nb_utils
library
Classes
AnimatedItemWidget
AnimatedListView
A customizable animated ListView widget with various animation configurations.
AnimatedScrollView
AnimatedText
Abstract base class for text animations.
AnimatedTextKit
Base class for Animated Text widgets.
AnimatedWrap
AnimationConfigurationClass
AnimationConfigurationClass provides the configuration used as a base for every children Animation.
Configuration made in AnimationConfigurationClass can be overridden in Animation children if needed.
AnimationConfiguratorClass
AnimationExecutorClass
AnimationLimiterWidget
In the context of a scrollable view, your children's animations are only built
as the user scrolls and they appear on the screen.
AppButton
Default App Button
AppTextField
Default Text Form Field
Blur
Blur any widget
ChatGPTAnswerResponseModel
ChatGPTChoiceModel
ChatGPTConfig
ChatGPTErrorModel
ChatGPTModuleStrings
ChatGPTSheetComponent
ChatGPTUsageModel
ChatGPTWidget
Parameters:
CircularProgressGradient
A circular progress indicator with gradient effect.
Connectivity
Discover network connectivity configurations: Distinguish between WI-FI and cellular, check WI-FI status and more.
ConnectivityPlusLinuxPlugin
The Linux implementation of ConnectivityPlatform.
Debouncer
DotIndicator <T >
DotIndicatorState
DottedBorderWidget
DoublePressBackWidget
A widget that handles double press back navigation.
FadeInAnimationWidget
An animation that fades its child.
FadeInConfiguration
FlipAnimationWidget
An animation that flips its child either vertically or horizontally.
FlipConfiguration
Fluttertoast
Plugin to show a toast message on screen
Only for android, ios and Web platforms
FToast
Runs on dart side this has no interaction with the Native Side
Works with all platforms just in two lines of code
final fToast = FToast().init(context)
fToast.showToast(child)
GoogleLogoPainter
Google logo CustomPaint
GoogleLogoWidget
Google logo created using CustomPaint
GradientBorder
GradientPainter
GradientPainter
HorizontalList
HoverWidget
Hover Widget is useful is web platform
HyperLinkWidget
HyperLinkWidget
JwtDecoder
LanguageDataModel
Model class for Locales
LanguageListWidget
Use SELECTED_LANGUAGE_CODE Pref key to get selected language code
LanguageListWidgetState
LineIcons
This font was generated by FlutterIcon.com, which is derived from Fontello.
LiveStream
CREDITS
https://pub.dev/packages/livestream
Loader
Circular Loader Widget
LoaderState
Marquee
Marquee Text
NBUtils
nb_utils class
NoDataWidget
A widget used to display a message when there is no data available.
OTPLengthModel
Model class to hold the text editing controller and focus node for each OTP input field.
OTPTextField
A widget for entering and managing OTP (One Time Password) input.
OTPTextFieldState
OverlayBuilder
OverlayBuilder widget
OverlayCustomWidget
Show custom widget on a widget click
OverlayOffsetWidget
OverlayOffsetWidget
PackageInfoData
Model class for package info
Patterns
Predefined Patterns for different validation
PlaceHolderWidget
Set nicely colored PlaceHolder while image is loading
RatingBarWidget
A widget for displaying and interacting with a rating bar.
ReadMoreText
Add read more button to a long text
ReadMoreTextState
ResponseMessage
Responsive
set different layout based on current screen size (mobile, web, desktop)
RestartAppWidget
RestartAppWidget helps you to restart your Flutter app
RichTextWidget
RoundedCheckBox
Widget that draw a beautiful checkbox rounded. Provided with animation if wanted
SBehavior
Custom scroll behaviour widget
ScaleAnimationWidget
An animation that scales its child.
ScaleConfiguration
SettingItemWidget
SettingItemWidget
SettingSection
SharedPreferences
Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android), providing
a persistent store for simple data.
SharedPreferencesAsync
Provides a persistent store for simple data.
SharedPreferencesWithCache
Provides a persistent store for simple data.
SharedPreferencesWithCacheOptions
Options necessary to create a SharedPreferencesWithCache .
SizeConfig
Model class for Size Configurations
SizeListener
SizeListener Listen to your child widget's size
SlideAnimationWidget
An animation that slides its child.
SlideConfiguration
SnapHelperWidget <T >
TextIcon
ThemeWidget
TimerWidget
TimerWidget - Use this widget if you want to do something every X seconds or any duration.
ToastStateFulState
State for _ToastStateFul
TypewriterAnimatedText
Animated Text that displays a Text element as if it is being typed one
character at a time. Similar to TyperAnimatedText
, but shows a cursor.
TypewriterAnimatedTextKit
Animation that displays text
elements, as if they are being typed one
character at a time. Similar to TyperAnimatedTextKit
, but shows a cursor.
UL
Add UL to its children
VersionInfoWidget
VersionInfoWidget
WalkThroughModelClass
Model class for walkthrough
Functions
afterBuildCreated (dynamic onCreated ()? )
→ void
Executes a function after the build is created.
appBarWidget (String title , {Widget ? child , Widget ? titleWidget , List <Widget > ? actions , Color ? color , bool center = false , Color ? textColor , int textSize = 20 , bool showBack = true , Color ? shadowColor , double ? elevation , Widget ? backWidget , Brightness ? brightness , SystemUiOverlayStyle ? systemUiOverlayStyle , TextStyle ? titleTextStyle , PreferredSizeWidget ? bottom , Widget ? flexibleSpace })
→ AppBar
Default AppBar
boldTextStyle ({int ? size , Color ? color , FontWeight ? weight , String ? fontFamily , double ? letterSpacing , FontStyle ? fontStyle , double ? wordSpacing , TextDecoration ? decoration , TextDecorationStyle ? textDecorationStyle , TextBaseline ? textBaseline , Color ? decorationColor , Color ? backgroundColor , double ? height })
→ TextStyle
Text Styles
Returns a TextStyle with bold weight.
boxDecorationDefault ({BorderRadiusGeometry ? borderRadius , Color ? color , Gradient ? gradient , BoxBorder ? border , BoxShape ? shape , BlendMode ? backgroundBlendMode , List <BoxShadow > ? boxShadow , DecorationImage ? image })
→ Decoration
default box decoration for container
boxDecorationRoundedWithShadow (int radiusAll , {Color backgroundColor = whiteColor , Color ? shadowColor , double ? blurRadius , double ? spreadRadius , Offset offset = const Offset(0.0, 0.0) , LinearGradient ? gradient })
→ Decoration
rounded box decoration with shadow
boxDecorationWithRoundedCorners ({Color backgroundColor = whiteColor , BorderRadius ? borderRadius , LinearGradient ? gradient , BoxBorder ? border , List <BoxShadow > ? boxShadow , DecorationImage ? decorationImage , BoxShape boxShape = BoxShape.rectangle })
→ Decoration
rounded box decoration
boxDecorationWithShadow ({Color backgroundColor = whiteColor , Color ? shadowColor , double ? blurRadius , double ? spreadRadius , Offset offset = const Offset(0.0, 0.0) , LinearGradient ? gradient , BoxBorder ? border , List <BoxShadow > ? boxShadow , DecorationImage ? decorationImage , BoxShape boxShape = BoxShape.rectangle , BorderRadius ? borderRadius })
→ Decoration
box decoration with shadow
Builds a page route with the specified animation.
buildTitleWidget (BuildContext context , DialogType dialogType , Color ? primaryColor , Widget ? customCenterWidget , double height , double width , String ? centerImage , ShapeBorder ? shape )
→ Widget
title for dialog
checkConnectivityResult ()
→ Future <ConnectivityResult >
returns true if network is available
clearSharedPref ()
→ Future <bool >
clear SharedPref
countDays (int difference )
→ String
Converts the time difference to a number of days.
This function truncates to the lowest day.
returns ("1 day" OR "X days")
countHours (int difference )
→ String
Converts the time difference to a number of hours.
This function truncates to the lowest hour.
returns ("1 hour" OR "X hours")
countMinutes (int difference )
→ String
Converts the time difference to a number of minutes.
This function truncates to the lowest minute.
returns ("1 minute" OR "X minutes")
countMonths (int difference )
→ String
Converts the time difference to a number of months.
This function rounds to the nearest month.
returns ("1 month" OR "X months" OR "1 year")
countSeconds (int difference )
→ String
Converts the time difference to a number of seconds.
This function truncates to the lowest second.
returns ("Just now" OR "X seconds")
countWeeks (int difference )
→ String
Converts the time difference to a number of weeks.
This function truncates to the lowest week.
returns ("1 week" OR "X weeks" OR "1 month")
countYears (int difference )
→ String
Converts the time difference to a number of years.
This function truncates to the lowest year.
returns ("1 year" OR "X years")
createMaterialColor (Color color )
→ MaterialColor
Returns MaterialColor from Color
createRichText ({required List <TextSpan > list , TextOverflow overflow = TextOverflow.clip , int ? maxLines , TextAlign textAlign = TextAlign.left , TextDirection ? textDirection , StrutStyle ? strutStyle })
→ RichText
currentMillisecondsTimeStamp ()
→ int
return current time in milliseconds
currentTimeStamp ()
→ int
return current timestamp
daysInMonth (int monthNum , int year )
→ int
returns number of days in given month
defaultBoxShadow ({Color ? shadowColor , double ? blurRadius , double ? spreadRadius , Offset offset = const Offset(0.0, 0.0) })
→ List <BoxShadow >
default box shadow
defaultInputDecoration ({String ? hint , String ? label , TextStyle ? textStyle })
→ InputDecoration
returns default InputDecoration for AppTextField widget
defaultPlaceHolder (BuildContext context , DialogType dialogType , double ? height , double ? width , Color ? primaryColor , {Widget ? child , ShapeBorder ? shape })
→ Widget
placeholder for dialog
dialogAnimatedWrapperWidget ({required Animation <double > animation , required Widget child , required DialogAnimation dialogAnimation , required Curve curve })
→ Widget
Widget wrapper for animated dialog transitions.
dialogShape ([double ? borderRadius ])
→ ShapeBorder
dynamicAppButtonPadding (BuildContext context )
→ EdgeInsets
Provides dynamic padding for app buttons based on the context.
enterFullScreen ()
→ void
exitFullScreen ()
→ void
finish (BuildContext context , [Object ? result ])
→ void
Go back to previous screen.
formatTime (int timestamp )
→ String
returns how much time ago from timestamp
FToastBuilder ()
→ TransitionBuilder
Simple builder method to create a TransitionBuilder
and for the use in MaterialApp builder method
generateWithChatGPT ({required String prompt , String promptPrefix = 'Tune this' , bool shortReply = false , bool testWithoutKey = false , required ChatGPTModuleStrings gptModuleStrings })
→ Future <String >
Generates a response using the ChatGPT API based on the provided prompt.
getBool (String key , {dynamic defaultValue = false })
→ Future <bool >
Returns a Bool if exists in SharedPref
getBoolAsync (String key , {bool defaultValue = false })
→ bool
Returns a Bool if exists in SharedPref
getCenteredImage (BuildContext context , DialogType dialogType , Color ? primaryColor )
→ Widget ?
Build center image for dialog
getColorFromHex (String hexColor , {Color ? defaultColor })
→ Color
Returns Color from hex String.
getColorFromImage (Image image , [int quality = 10 ])
→ Future <List <int > ? >
get colors used in image
getDialogPrimaryColor (BuildContext context , DialogType dialogType , Color ? primaryColor )
→ Color
dialog primary color
getDouble (String key , {dynamic defaultValue = 0.0 })
→ Future <double >
Returns a Double if exists in SharedPref
getDoubleAsync (String key , {double defaultValue = 0.0 })
→ double
Returns a Double if exists in SharedPref
getIcon (DialogType dialogType , {double ? size })
→ Widget
get icon for dialog
getInt (String key , {dynamic defaultValue = 0 })
→ Future <int >
Returns a Int if exists in SharedPref
getIntAsync (String key , {int defaultValue = 0 })
→ int
Returns a Int if exists in SharedPref
getIPAddress ({IPAddressFormat ipAddressFormat = IPAddressFormat.string , String defaultErrorMessage = 'Not able to find the IP Address.' , IPAddressVersion ipAddressVersion = IPAddressVersion.v64 })
→ Future
Retrieves the public IP address using the ipify API.
getJSONAsync (String key , {Map <String , dynamic > ? defaultValue })
→ Map <String , dynamic >
Returns a JSON if exists in SharedPref
getMatchingSharedPrefKeys (String key )
→ List <String >
Returns List of Keys that matches with given Key
getMaterialYouColors ()
→ Future
Returns material you colors from Android
getMaterialYouPrimaryColor ()
→ Future <Color >
Returns primary color for material you theme
getMaterialYouTheme ()
→ Future <ThemeData >
Returns material you ThemeData
getPackageInfo ()
→ Future <PackageInfoData >
Retrieves package information asynchronously.
getPackageName ()
→ Future <String >
Get Package Name
getPositiveText (DialogType dialogType )
→ String
build positive text for dialog
getSelectedLanguageModel ({String ? defaultLanguage })
→ LanguageDataModel ?
getSharedPref ()
→ Future <SharedPreferences >
Returns SharedPref Instance
getSocialMediaLink (LinkProvider linkProvider , {String url = '' })
→ String
Use getSocialMediaLink function to build social media links
getString (String key , {dynamic defaultValue = '' })
→ Future <String >
Returns a String if exists in SharedPref
getStringAsync (String key , {String defaultValue = '' })
→ String
Returns a String if exists in SharedPref
getStringListAsync (String key )
→ List <String > ?
Returns a StringList if exists in SharedPref
getTitle (DialogType dialogType )
→ String
Build title
handleJSONResponse ({bool status = false , String value = '' })
→ Map <String , dynamic >
Handles the JSON response for IP address retrieval.
hasMatch (String ? s , String p )
→ bool
has match return bool for pattern matching
hideKeyboard (dynamic context )
→ void
Hide soft keyboard
hideStatusBar ()
→ Future <void >
This function will hide status bar
initialize ({double ? defaultDialogBorderRadius , List <LanguageDataModel > ? aLocaleLanguageList , String ? defaultLanguage })
→ Future <void >
invokeNativeMethod <T > (String channel , String method , [dynamic arguments ])
→ Future <T? >
Invoke Native method and get result
isAndroid12Above ()
→ Future <bool >
Return true if Android OS version is above 12
isConnectedToBluetooth ()
→ Future <bool >
returns true if connected to bluetooth
isConnectedToEthernet ()
→ Future <bool >
returns true if connected to ethernet
isConnectedToMobile ()
→ Future <bool >
returns true if connected to mobile
isConnectedToOther ()
→ Future <bool >
returns true if connected to other
isConnectedToVPN ()
→ Future <bool >
returns true if connected to vpn
isConnectedToWiFi ()
→ Future <bool >
returns true if connected to wifi
isNetworkAvailable ()
→ Future <bool >
returns true if network is available
isSnapshotLoading (AsyncSnapshot snap , {bool checkHasData = false })
→ bool
Returns true is snapshot is loading
launchNewScreen <T > (BuildContext context , String tag )
→ Future <T? >
Go to new screen with provided screen tag.
launchNewScreenWithNewTask <T > (BuildContext context , String tag )
→ Future <T? >
Removes all previous screens from the back stack and redirect to new screen with provided screen tag
leapYear (int year )
→ bool
return true if given year is an leap year
log (Object ? value )
→ void
Prints only if in debug or profile mode
mailTo ({required List <String > to , String subject = '' , String body = '' , List <String > cc = const [] , List <String > bcc = const [] })
→ Uri
mailto: function to open native email app
makeNullable <T > (T? value )
→ T?
Make any variable nullable
onError (Object o )
→ Future <Null >
use this for catchError in Future functions
paste ()
→ Future <String >
Returns a string from Clipboard
pasteObject ()
→ Future
Returns a string from Clipboard
platformName ()
→ String
Returns current PlatformName
pop ([Object ? object ])
→ void
Dispose current screen or close current dialog
primaryTextStyle ({int ? size , Color ? color , FontWeight ? weight , String ? fontFamily , double ? letterSpacing , FontStyle ? fontStyle , double ? wordSpacing , TextDecoration ? decoration , TextDecorationStyle ? textDecorationStyle , TextBaseline ? textBaseline , Color ? decorationColor , Color ? backgroundColor , double ? height })
→ TextStyle
Returns a TextStyle with primary color and default settings.
push <T > (Widget widget , {bool isNewTask = false , Duration ? duration })
→ Future <T? >
Redirect to given widget without context
radians (double degrees )
→ double
Converts degrees to radians.
radius ([double ? radius ])
→ BorderRadius
returns Radius
radiusCircular ([double ? radius ])
→ Radius
returns Radius
radiusOnly ({double ? topRight , double ? topLeft , double ? bottomRight , double ? bottomLeft })
→ BorderRadius
returns custom Radius on each side
removeKey (String key )
→ Future <bool >
remove key from SharedPref
scrollBehaviour ()
→ Widget Function(BuildContext , Widget ? ) ?
Custom scroll behaviour
secondaryTextStyle ({int ? size , Color ? color , FontWeight ? weight , String ? fontFamily , double ? letterSpacing , FontStyle ? fontStyle , double ? wordSpacing , TextDecoration ? decoration , TextDecorationStyle ? textDecorationStyle , TextBaseline ? textBaseline , Color ? decorationColor , Color ? backgroundColor , double ? height })
→ TextStyle
Returns a TextStyle with secondary color and default settings.
setBool (String key , bool value )
→ Future <bool >
add a Bool in SharedPref
setBoolAsync (String key , bool value )
→ Future <bool >
add a Bool in SharedPref
setDarkStatusBar ()
→ void
Dark Status Bar
setDouble (String key , double value )
→ Future <bool >
add a Double in SharedPref
setDoubleAsync (String key , double value )
→ Future <bool >
//////////////////////////////////////////////////////////////////// DEPRECATED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
add a Double in SharedPref
setInt (String key , int value )
→ Future <bool >
add a Int in SharedPref
setIntAsync (String key , int value )
→ Future <bool >
add a Int in SharedPref
setJSONAsync (String key , String value )
→ Future <bool >
add a JSON in SharedPref
setLightStatusBar ()
→ void
Light Status Bar
setOrientationLandscape ()
→ void
Set orientation to landscape
setOrientationPortrait ()
→ void
Set orientation to portrait
setStatusBarColor (Color statusBarColor , {Color ? systemNavigationBarColor , Brightness ? statusBarBrightness , Brightness ? statusBarIconBrightness , int delayInMilliSeconds = 200 })
→ Future <void >
Change status bar Color and Brightness
setString (String key , String value )
→ Future <bool >
add a String in SharedPref
setStringAsync (String key , String value )
→ Future <bool >
add a String in SharedPref
setValue (String key , dynamic value , {bool print = true })
→ Future <bool >
Add a value in SharedPref based on their type - Must be a String, int, bool, double, Map<String, dynamic> or StringList
showBottomSheetOrDialog ({required BuildContext context , required Widget child , BottomSheetDialog bottomSheetDialog = BottomSheetDialog.Dialog })
→ Future
Shows a bottom sheet or a dialog based on the specified type.
showConfirmDialog <bool > (dynamic context , String title , {String positiveText = 'Yes' , String negativeText = 'No' , Color ? buttonColor , Color ? barrierColor , bool? barrierDismissible , Function ? onAccept })
→ Future <bool? >
show confirm dialog box
showConfirmDialogCustom (BuildContext context , {required dynamic onAccept (BuildContext ), String ? title , String ? subTitle , String ? positiveText , String ? negativeText , String ? centerImage , Widget ? customCenterWidget , Color ? primaryColor , Color ? positiveTextColor , Color ? negativeTextColor , ShapeBorder ? shape , dynamic onCancel (BuildContext )?, bool barrierDismissible = true , double ? height , double ? width , bool cancelable = true , Color ? barrierColor , DialogType dialogType = DialogType.CONFIRMATION , DialogAnimation dialogAnimation = DialogAnimation.DEFAULT , Duration ? transitionDuration , Curve curve = Curves.easeInBack })
→ Future <bool ? >
show confirm dialog box
showInDialog <T > (BuildContext context , {Widget ? title , Widget ? child , Widget ? builder (BuildContext )?, ShapeBorder ? shape , TextStyle ? titleTextStyle , EdgeInsetsGeometry ? contentPadding , Color ? backgroundColor , DialogAnimation dialogAnimation = DialogAnimation.DEFAULT , double ? elevation , Color ? barrierColor , List <Widget > ? actions , bool barrierDismissible = true , bool hideSoftKeyboard = true , Duration ? transitionDuration , Curve curve = Curves.easeInBack })
→ Future <T? >
show child widget in dialog
showStatusBar ()
→ Future <void >
This function will show status bar
snackBar (BuildContext context , {String title = '' , Widget ? content , SnackBarAction ? snackBarAction , Function ? onVisible , Color ? textColor , Color ? backgroundColor , EdgeInsets ? margin , EdgeInsets ? padding , Animation <double > ? animation , double ? width , ShapeBorder ? shape , Duration ? duration , SnackBarBehavior ? behavior , double ? elevation })
→ void
Show SnackBar
snapWidgetHelper <T > (AsyncSnapshot <T > snap , {Widget ? errorWidget , Widget ? loadingWidget , String ? defaultErrorMessage , bool checkHasData = false , Widget errorBuilder (String )?, bool showErrorLog = false })
→ Widget
Handle error and loading widget when using FutureBuilder or StreamBuilder
splashDelay ({int second = 2 })
→ Future <void >
Use this if you want to skip splash delay above Android 12
toast (String ? value , {ToastGravity ? gravity , dynamic length = Toast.LENGTH_SHORT , Color ? bgColor , Color ? textColor , bool print = false })
→ void
Toast for default time
toastLong (String ? value , {BuildContext ? context , ToastGravity gravity = ToastGravity.BOTTOM , dynamic length = Toast.LENGTH_LONG , Color ? bgColor , Color ? textColor , bool print = false })
→ void
Toast for long period of time
toasty (BuildContext context , String ? text , {ToastGravity ? gravity , dynamic length = Toast.LENGTH_SHORT , Color ? bgColor , Color ? textColor , bool print = false , bool removeQueue = false , Duration duration = const Duration(seconds: 2) , BorderRadius ? borderRadius , EdgeInsets ? padding })
→ void
Toast with Context