nb_utils library

Classes

LiveStream
LiveStream is a class which can be used to share data values among different modules in your application. It makes easy to provide communication among different parts of your application. It's a data holder class which can be created and used anywhere in application. By using it, You can emit values to any stream with data value from anywhere in the application. Observers will receive data events when the value of subscribed stream is updated.

Mixins

AfterLayoutMixin<T extends StatefulWidget>

Extensions

BooleanExtensions
ContextExtensions
DoubleExtensions
IntExtensions
ScrollExtension
StringExtension
TextExtension
WidgetExtension

Constants

blackColor → const Color
Colors.black
errorColor → const Color
const Color(0xFFFF6347)
textPrimaryColor → const Color
const Color(0xFF2E3033)
textSecondaryColor → const Color
const Color(0xFF757575)
transparentColor → const Color
const Color(0x00000000)
viewLineColor → const Color
const Color(0xFFEAEAEA)
whiteColor → const Color
Colors.white

Functions

boldTextStyle({int size: 16, Color color: textPrimaryColor, FontWeight weight: FontWeight.bold, String fontFamily}) TextStyle
boxDecorationRoundedWithShadow(int radiusAll, {Color backgroundColor: whiteColor, Color shadowColor: Colors.black12, dynamic blurRadius: 10.0, dynamic spreadRadius: 0.0, Offset offset: const Offset(0.0, 0.0)}) BoxDecoration
boxDecorationWithRoundedCorners({Color backgroundColor: whiteColor, BorderRadius borderRadius: const BorderRadius.all(Radius.circular(8.0)), LinearGradient gradient, BoxBorder border, List<BoxShadow> boxShadow, DecorationImage decorationImage, BoxShape boxShape: BoxShape.rectangle}) BoxDecoration
boxDecorationWithShadow({Color backgroundColor: whiteColor, Color shadowColor: Colors.black12, dynamic blurRadius: 10.0, dynamic spreadRadius: 0.0, Offset offset: const Offset(0.0, 0.0), LinearGradient gradient, BoxBorder border, List<BoxShadow> boxShadow, DecorationImage decorationImage, BoxShape boxShape: BoxShape.rectangle, BorderRadius borderRadius}) BoxDecoration
clearSharedPref() Future<bool>
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")
createRichText(List<TextSpan> list, {TextOverflow overflow: TextOverflow.ellipsis, int maxLines, TextAlign textAlign: TextAlign.left}) RichText
currentMillisecondsTimeStamp() → dynamic
currentTimeStamp() → dynamic
defaultBoxShadow({Color shadowColor: Colors.black12, dynamic blurRadius: 10.0, dynamic spreadRadius: 0.0, Offset offset: const Offset(0.0, 0.0)}) List<BoxShadow>
finish(dynamic context) → dynamic
Go back to previous screen.
formatTime(int timestamp) String
getBool(String key, {dynamic defaultValue: false}) Future<bool>
getColorFromHex(String hexColor) Color
Returns Color from hex String. [...]
getDouble(String key, {dynamic defaultValue: 0.0}) Future<double>
getInt(String key, {dynamic defaultValue: 0}) Future<int>
getSharedPref() Future<SharedPreferences>
getString(String key, {dynamic defaultValue: ''}) Future<String>
hideKeyboard(dynamic context) → dynamic
Hide soft keyboard
isNetworkAvailable() Future<bool>
launchNewScreen(dynamic context, dynamic tag) → dynamic
Go to new screen with provided screen tag. [...]
launchNewScreenWithNewTask(dynamic context, dynamic tag) → dynamic
Removes all previous screens from the back stack and redirect to new screen with provided screen tag [...]
log(dynamic value) → dynamic
primaryTextStyle({int size: 16, Color color: textPrimaryColor, FontWeight weight: FontWeight.normal, String fontFamily}) TextStyle
removeKey(String key) Future<bool>
secondaryTextStyle({int size: 14, Color color: textSecondaryColor, FontWeight weight: FontWeight.normal, String fontFamily}) TextStyle
setBool(String key, bool value) → Future
setDouble(String key, double value) → Future
setInt(String key, int value) → Future
setString(String key, String value) → Future
showConfirmDialog<bool>(dynamic context, String title, {dynamic positiveText: 'Yes', dynamic negativeText: 'No', Color buttonColor}) → Future
showInDialog(BuildContext context, {Widget title, Widget child, ShapeBorder shape, TextStyle titleTextStyle, EdgeInsetsGeometry contentPadding: const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0), Color backgroundColor, double elevation, List<Widget> actions, bool barrierDismissible: true}) Future
toast(String value, {ToastGravity gravity: ToastGravity.BOTTOM, dynamic length: Toast.LENGTH_SHORT, Color bgColor, Color textColor}) → dynamic
toastLong(String value, {ToastGravity gravity: ToastGravity.BOTTOM, dynamic length: Toast.LENGTH_LONG, Color bgColor, Color textColor}) → dynamic