diff --git a/CHANGELOG.md b/CHANGELOG.md index b84bcdd..3f2fbcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ +## 4.6.3 + +- New - PlaceHolderWidget - Set nicely colored PlaceHolder while image is loading + +## 4.6.2 + +- New - Animated ListView +- New - Animated Wrap + ## 4.6.1 + - Get Package Info + ## 4.6.0 + - New - Blur Widget - New - Read More Text Widget - New - Rounded Check Box Widget @@ -45,8 +57,9 @@ - Added afterBuildCreated method get context after BuildContext created - AfterLayout mixin deprecated now ## 4.4.2 -- Added Gradient Border Widget -- Added Animation in Custom Dialog + +- New - Gradient Border Widget +- New - Animation in Custom Dialog ## 4.4.1 - Added highlight color in onTap extension - Added height property in all TextStyles @@ -58,38 +71,45 @@ ## 4.3.0 - Added Circular Progress with Gradient Widget ## 4.2.14 + - Help widget for FutureBuilder & StreamBuilder with loading and error handling inbuilt -- Added Overlay widget -- Added JWT Decoder +- New - Overlay widget +- New - JWT Decoder - Added builder in showInDialog method to fix context issue (Migrated from child to builder) ## 4.2.12 - Added page route animation - Added default input decoration ## 4.2.11 -- Added Theme Selection Dialog -- Added SnackBar function + +- New - Theme Selection Dialog +- New - SnackBar function - Dark Mode support for LanguageList DropDown ## 4.2.10 + - Updated ReadMe -- Added Language DropDown Widget +- New - Language DropDown Widget - Added onAccept in show confirm dialog - Added get selected language function - AppButton Scale animation ## 4.2.9 -- Added HoverWidget -- Added DottedBorderWidget + +- New - HoverWidget +- New - DottedBorderWidget - Make onTap optional in TextIcon - Added customAccentColor in Loader ## 4.2.8 -- Added Rating Item Widget, Common Model Class + +- New - Rating Item Widget, Common Model Class ## 4.2.5 -- Added Setting Section widget -- Added TextButton Widget + +- New - Setting Section widget +- New - TextButton Widget - Added DateTime Extensions - Added Default BoxDecoration - Added currency symbols ## 4.2.2 -- Added Persistent Tabs widget + +- New - Persistent Tabs widget ## 4.1.0 - Added new int extensions ## 4.0.0 @@ -97,7 +117,8 @@ ## 3.3.0+13 - Global AppButton background color, validate null widget, useful Color ext, automatic status bar color brightness, show toast only if string is not empty ## 3.3.0+8 -- Added DotsIndicator, Buttons, TextFields, Loader, Setting Item + +- New - DotsIndicator, Buttons, TextFields, Loader, Setting Item ## 3.2.11+4 - Update connectivity package version ## 3.2.9 diff --git a/README.md b/README.md index ba50cbc..2036bb1 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,36 @@ [![Pub Package](https://img.shields.io/pub/v/nb_utils.svg)](https://pub.dartlang.org/packages/nb_utils) - - - - + - + - GitHub: bhoominn +GitHub: bhoominn - + - + + + + + - GitHub: bhoominn + GitHub: bhoominn - + + - ## Show some love and like to support the project ## Documentation diff --git a/example/lib/main.dart b/example/lib/main.dart index 160bc8d..b449be8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -125,8 +125,7 @@ class _HomePageState extends State { onChange: (size) { log(size); }, - child: Container( - color: blueColor, + child: PlaceHolderWidget( height: 50.dynamicHeight, width: 100.dynamicWidth, ), diff --git a/lib/nb_utils.dart b/lib/nb_utils.dart index 9faa87c..051fb3e 100644 --- a/lib/nb_utils.dart +++ b/lib/nb_utils.dart @@ -17,7 +17,6 @@ export 'package:connectivity_plus/connectivity_plus.dart'; export 'package:fluttertoast/fluttertoast.dart'; export 'package:shared_preferences/shared_preferences.dart'; -export 'src/live_stream.dart'; export 'src/customPaints/google_logo_painter.dart'; export 'src/deprecated_widgets.dart'; export 'src/extensions/bool_extensions.dart'; @@ -32,12 +31,14 @@ export 'src/extensions/num_extensions.dart'; export 'src/extensions/scroll_extensions.dart'; export 'src/extensions/string_extensions.dart'; export 'src/extensions/widget_extensions.dart'; +export 'src/live_stream.dart'; export 'src/models/language_data_model.dart'; export 'src/models/package_info_model.dart'; export 'src/models/walkthrough_model.dart'; export 'src/utils/after_layout.dart'; export 'src/utils/colors.dart'; export 'src/utils/common.dart'; +export 'src/utils/confirmation_dialog.dart'; export 'src/utils/constants.dart'; export 'src/utils/date_time_utils.dart'; export 'src/utils/decorations.dart'; @@ -50,11 +51,14 @@ export 'src/utils/size_config.dart'; export 'src/utils/system_utils.dart'; export 'src/utils/text_styles.dart'; export 'src/utils/time_formatter.dart'; +export 'src/widgets/PersistentTabs.dart'; +export 'src/widgets/animatedList/animated_configurations.dart'; +export 'src/widgets/animatedList/animated_list_view.dart'; +export 'src/widgets/animatedList/animated_wrap.dart'; export 'src/widgets/app_button.dart'; export 'src/widgets/app_text_field.dart'; export 'src/widgets/blur_widget.dart'; export 'src/widgets/circular_progress_gradient.dart'; -export 'src/utils/confirmation_dialog.dart'; export 'src/widgets/dot_indicator.dart'; export 'src/widgets/dotted_border_widget.dart'; export 'src/widgets/gradient_border.dart'; @@ -64,7 +68,7 @@ export 'src/widgets/language_list_widget.dart'; export 'src/widgets/loader_widget.dart'; export 'src/widgets/marquee_widget.dart'; export 'src/widgets/overlay_custom_widget.dart'; -export 'src/widgets/PersistentTabs.dart'; +export 'src/widgets/placeholder_widget.dart'; export 'src/widgets/rating_bar_widget.dart'; export 'src/widgets/read_more_text.dart'; export 'src/widgets/responsive_widget.dart'; @@ -80,9 +84,6 @@ export 'src/widgets/timer_widget.dart'; export 'src/widgets/ul_widget.dart'; export 'src/widgets/version_info_widget.dart'; export 'src/widgets/widgets.dart'; -export 'src/widgets/animatedList/animated_configurations.dart'; -export 'src/widgets/animatedList/animated_list_view.dart'; -export 'src/widgets/animatedList/animated_wrap.dart'; //region Global variables - This variables can be changed. Color textPrimaryColorGlobal = textPrimaryColor; @@ -159,15 +160,13 @@ Future initialize({ }) async { sharedPreferences = await SharedPreferences.getInstance(); - defaultAppButtonShapeBorder = - RoundedRectangleBorder(borderRadius: radius(defaultAppButtonRadius)); + defaultAppButtonShapeBorder = RoundedRectangleBorder(borderRadius: radius(defaultAppButtonRadius)); defaultDialogShape = dialogShape(defaultDialogBorderRadius); localeLanguageList = aLocaleLanguageList ?? []; - selectedLanguageDataModel = - getSelectedLanguageModel(defaultLanguage: defaultLanguage); + selectedLanguageDataModel = getSelectedLanguageModel(defaultLanguage: defaultLanguage); } /// nb_utils class @@ -189,14 +188,12 @@ Future push( }) async { if (isNewTask) { return await Navigator.of(getContext).pushAndRemoveUntil( - buildPageRoute( - widget, pageRouteAnimation ?? pageRouteAnimationGlobal, duration), + buildPageRoute(widget, pageRouteAnimation ?? pageRouteAnimationGlobal, duration), (route) => false, ); } else { return await Navigator.of(getContext).push( - buildPageRoute( - widget, pageRouteAnimation ?? pageRouteAnimationGlobal, duration), + buildPageRoute(widget, pageRouteAnimation ?? pageRouteAnimationGlobal, duration), ); } } diff --git a/lib/src/widgets/animatedList/animated_configurations.dart b/lib/src/widgets/animatedList/animated_configurations.dart index cb5fa73..d6057c8 100644 --- a/lib/src/widgets/animatedList/animated_configurations.dart +++ b/lib/src/widgets/animatedList/animated_configurations.dart @@ -12,10 +12,10 @@ class AnimatedItemWidget extends StatelessWidget { final ListAnimationType listAnimationType; final Widget child; - final SlideConfiguration slideConfiguration; - final FadeInConfiguration fadeInConfiguration; - final ScaleConfiguration scaleConfiguration; - final FlipConfiguration flipConfiguration; + final SlideConfiguration? slideConfiguration; + final FadeInConfiguration? fadeInConfiguration; + final ScaleConfiguration? scaleConfiguration; + final FlipConfiguration? flipConfiguration; AnimatedItemWidget({ Key? key, @@ -25,26 +25,10 @@ class AnimatedItemWidget extends StatelessWidget { FadeInConfiguration? fadeInConfiguration, ScaleConfiguration? scaleConfiguration, FlipConfiguration? flipConfiguration, - }) : slideConfiguration = (listAnimationType == ListAnimationType.Slide && slideConfiguration == null) - ? SlideConfiguration.init() - : slideConfiguration != null - ? slideConfiguration - : SlideConfiguration(), - fadeInConfiguration = (listAnimationType == ListAnimationType.FadeIn && fadeInConfiguration == null) - ? FadeInConfiguration.init() - : fadeInConfiguration != null - ? fadeInConfiguration - : FadeInConfiguration(), - scaleConfiguration = (listAnimationType == ListAnimationType.Scale && scaleConfiguration == null) - ? ScaleConfiguration.init() - : scaleConfiguration != null - ? scaleConfiguration - : ScaleConfiguration(), - flipConfiguration = (listAnimationType == ListAnimationType.Flip && flipConfiguration == null) - ? FlipConfiguration.init() - : flipConfiguration != null - ? flipConfiguration - : FlipConfiguration(), + }) : slideConfiguration = (listAnimationType == ListAnimationType.Slide && slideConfiguration == null) ? SlideConfiguration.init() : slideConfiguration!, + fadeInConfiguration = (listAnimationType == ListAnimationType.FadeIn && fadeInConfiguration == null) ? FadeInConfiguration.init() : fadeInConfiguration!, + scaleConfiguration = (listAnimationType == ListAnimationType.Scale && scaleConfiguration == null) ? ScaleConfiguration.init() : scaleConfiguration!, + flipConfiguration = (listAnimationType == ListAnimationType.Flip && flipConfiguration == null) ? FlipConfiguration.init() : flipConfiguration!, super(key: key); @override @@ -52,34 +36,34 @@ class AnimatedItemWidget extends StatelessWidget { if (listAnimationType == ListAnimationType.FadeIn) { return FadeInAnimation( child: child, - duration: fadeInConfiguration.duration, - curve: fadeInConfiguration.curve, - delay: fadeInConfiguration.delay, + duration: fadeInConfiguration!.duration, + curve: fadeInConfiguration!.curve, + delay: fadeInConfiguration!.delay, ); } else if (listAnimationType == ListAnimationType.Flip) { return FlipAnimation( child: child, - delay: flipConfiguration.delay, - curve: flipConfiguration.curve, - duration: flipConfiguration.duration, - flipAxis: flipConfiguration.flipAxis, + delay: flipConfiguration!.delay, + curve: flipConfiguration!.curve, + duration: flipConfiguration!.duration, + flipAxis: flipConfiguration!.flipAxis, ); } else if (listAnimationType == ListAnimationType.Slide) { return SlideAnimation( child: child, - delay: slideConfiguration.delay, - curve: slideConfiguration.curve, - duration: slideConfiguration.duration, - horizontalOffset: slideConfiguration.horizontalOffset, - verticalOffset: slideConfiguration.verticalOffset, + delay: slideConfiguration!.delay, + curve: slideConfiguration!.curve, + duration: slideConfiguration!.duration, + horizontalOffset: slideConfiguration!.horizontalOffset, + verticalOffset: slideConfiguration!.verticalOffset, ); } else if (listAnimationType == ListAnimationType.Scale) { return ScaleAnimation( child: child, - delay: scaleConfiguration.delay, - curve: scaleConfiguration.curve, - duration: scaleConfiguration.duration, - scale: scaleConfiguration.scale, + delay: scaleConfiguration!.delay, + curve: scaleConfiguration!.curve, + duration: scaleConfiguration!.duration, + scale: scaleConfiguration!.scale, ); } else { return child; @@ -179,6 +163,7 @@ class FlipConfiguration { } } +//region flutter_staggered_animation library /// In the context of a scrollable view, your children's animations are only built /// as the user scrolls and they appear on the screen. /// @@ -770,3 +755,4 @@ class SlideAnimation extends StatelessWidget { ); } } +//endregion diff --git a/lib/src/widgets/blur_widget.dart b/lib/src/widgets/blur_widget.dart index acbb5b5..2a6ebfe 100644 --- a/lib/src/widgets/blur_widget.dart +++ b/lib/src/widgets/blur_widget.dart @@ -19,7 +19,7 @@ class Blur extends StatelessWidget { this.width, this.blur = 5, this.elevation = 0, - this.padding = const EdgeInsets.all(8), + this.padding = const EdgeInsets.only(), this.color = Colors.transparent, this.borderRadius = const BorderRadius.all(Radius.circular(20)), this.clipBehavior = Clip.antiAlias, diff --git a/lib/src/widgets/placeholder_widget.dart b/lib/src/widgets/placeholder_widget.dart new file mode 100644 index 0000000..29b27e6 --- /dev/null +++ b/lib/src/widgets/placeholder_widget.dart @@ -0,0 +1,71 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:nb_utils/nb_utils.dart'; + +/// Colors for PlaceHolderWidget +List _placeholderColors = [ + mistyRose, + whiteSmoke, + linen, + Color(0xFFb7efc5), + Color(0xFFf0efeb), + Color(0xFFcddafd), + Color(0xFFe3d5ca), + Color(0xFFffccd5), + Color(0xFFccdbdc), + Color(0xFFfbf8cc), + Color(0xFFcdeac0), + Color(0xFFefe5dc), +]; + +/// Set nicely colored PlaceHolder while image is loading +class PlaceHolderWidget extends StatelessWidget { + final double? height; + final double? width; + final AlignmentGeometry? alignment; + final EdgeInsetsGeometry? padding; + final EdgeInsetsGeometry? margin; + final Duration? animationDuration; + + final BoxShape? shape; + final BorderRadiusGeometry? borderRadius; + final BoxBorder? border; + final List? boxShadow; + final Gradient? gradient; + + PlaceHolderWidget({ + this.height, + this.width, + this.animationDuration, + this.padding, + this.margin, + this.alignment, + this.shape, + this.borderRadius, + this.border, + this.boxShadow, + this.gradient, + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return AnimatedContainer( + height: height, + duration: animationDuration ?? 1.seconds, + width: width, + decoration: BoxDecoration( + color: _placeholderColors[Random.secure().nextInt(_placeholderColors.length)], + shape: shape ?? BoxShape.rectangle, + borderRadius: borderRadius, + border: border, + boxShadow: boxShadow, + gradient: gradient, + ), + alignment: alignment, + padding: padding, + margin: margin, + ); + } +} diff --git a/lib/src/widgets/rounded_checkbox_widget.dart b/lib/src/widgets/rounded_checkbox_widget.dart index 05718db..a1e3255 100644 --- a/lib/src/widgets/rounded_checkbox_widget.dart +++ b/lib/src/widgets/rounded_checkbox_widget.dart @@ -20,7 +20,7 @@ class RoundedCheckBox extends StatefulWidget { this.textStyle, }) : super(key: key); - ///Define wether the checkbox is marked or not + ///Define weather the checkbox is marked or not final bool? isChecked; ///Define the widget that is shown when Widgets is checked @@ -51,7 +51,7 @@ class RoundedCheckBox extends StatefulWidget { final TextStyle? textStyle; ///Define Function that os executed when user tap on checkbox - ///If onTap is given a null callack, it will be disabled + ///If onTap is given a null callback, it will be disabled final Function(bool?)? onTap; ///Define the duration of the animation. If any @@ -91,8 +91,8 @@ class _RoundedCheckBoxState extends State { return GestureDetector( onTap: widget.onTap != null ? () { - setState(() => isChecked = !isChecked!); - widget.onTap!(isChecked); + setState(() => isChecked = !isChecked!); + widget.onTap?.call(isChecked); } : null, child: Row( diff --git a/pubspec.yaml b/pubspec.yaml index 71273c3..526ff0b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: nb_utils description: This package helps you daily usable function and ready made Widgets with ease. -version: 4.6.1 +version: 4.6.3 #homepage: https://bhoominn.github.io repository: https://github.com/bhoominn/nb_utils issue_tracker: https://github.com/bhoominn/nb_utils/issues @@ -15,7 +15,7 @@ dependencies: shared_preferences: ^2.0.15 fluttertoast: ^8.0.9 - connectivity_plus: ^2.3.3 + connectivity_plus: ^2.3.5 flutter: plugin: