diff --git a/CHANGELOG.md b/CHANGELOG.md index 20676d1a..4f840b0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 1.1.3 - 2020-07-30 + +### Fixed +* [GFAppBar] clear button does not fire onChanged #149 +* [GFCarousel] initialPage Not Honored if Page Indicators Enabled. #144 +* [GFCarousel] timer of the autoPlay is not disposed #143 +* [GFCarousel] active page indicator is not being updated without "onPageChanged" #139 +* [GFTabBar] Docs say about isScrollable which is not supported #132 + +### Update +* couple of compoenents (WIP) + - GFCheckboxTile + - GFRadioTile + + + ## 1.1.1 - 2020-06-26 ### Added diff --git a/README.md b/README.md index 868d7f35..2b365a03 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ we have launched the library with the following components : * Write and improve some **documentation**. Documentation is very critical to us. We would appreciate help in adding multiple languages to our docs. * If you are a developer, feel free to check out the source and submit pull requests. * Dig into [**CONTRIBUTING.MD**](CONTRIBUTING.md), which covers submitting bugs, requesting new features, preparing your code for a pull request, etc. - * Please don't forget to **like**, **follow**, and **star our repo**! Join our growing [community](http://forum.getwidget.dev) to keep up to date with the latest GetWidget development. + * Please don't forget to **like**, **follow**, and **star our repo**! Join our growing [community](https://forum.getwidget.dev) to keep up to date with the latest GetWidget development. diff --git a/analysis_options.yaml b/analysis_options.yaml index 070fe4ce..3c87f40e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -13,7 +13,7 @@ linter: # conflicts with the Flutter convention of putting {Key key} first and {Widget child} last # - always_put_required_named_parameters_first - always_require_non_null_named_parameters - # - annotate_overrides + - annotate_overrides - avoid_annotating_with_dynamic - avoid_as - avoid_bool_literals_in_conditional_expressions @@ -33,7 +33,7 @@ linter: - avoid_relative_lib_imports - avoid_renaming_method_parameters - avoid_return_types_on_setters - # - avoid_returning_null + - avoid_returning_null - avoid_returning_null_for_void - avoid_returning_this - avoid_setters_without_getters @@ -49,6 +49,7 @@ linter: # - cascade_invocations - close_sinks - comment_references + # required for couple of GetWidget pattern # - constant_identifier_names - control_flow_in_finally - curly_braces_in_flow_control_structures @@ -75,7 +76,7 @@ linter: # - omit_local_variable_types - one_member_abstracts - only_throw_errors - # in some places it is required to override fileds + # in some places it is required to override fields # - overridden_fields - package_api_docs - package_names diff --git a/example/lib/main_temp.dart b/example/lib/main_temp.dart index 4f9c2780..c756d5cb 100644 --- a/example/lib/main_temp.dart +++ b/example/lib/main_temp.dart @@ -40,6 +40,7 @@ class _MyHomePageState extends State with SingleTickerProviderStateMixin { TabController tabController; final _ratingController = TextEditingController(); + bool check = false; @override void initState() { @@ -1146,55 +1147,110 @@ class _MyHomePageState extends State // .toList(), // ), -// Container( -// alignment: Alignment.center, -// child: GFCheckbox( -// size: GFSize.SMALL, -// onChanged: (val) { -// print('on change val $val'); -// }, -// value: true, -// type: GFCheckboxType.circle, -//// checkColor: GFColors.DANGER, -////activebgColor: Colors.green, -////inactivebgColor: Colors.white, -////activeBorderColor: Colors.red, -//// backgroundColor: Colors.green, -// ), -// ), + CheckboxListTile( + title: Text("title text"), + value: check, + onChanged: (newValue) { + setState(() { + check = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + ), - GFCheckbox( - size: GFSize.SMALL, - activebgColor: GFColors.DANGER, + GFCheckboxListTile( + color: Colors.blueGrey.withOpacity(0.3), + title: const Text('title'), + subTitle: const Text('subtitle'), +// avatar: const GFAvatar( +// backgroundColor: GFColors.SUCCESS, +// ), + description: const Text('description'), +// padding: const EdgeInsets.all(16), +// margin: const EdgeInsets.all(16), +// size: 24, +// type: GFCheckboxType.basic, +// checkColor: Colors.white, +// activebgColor: Colors.red, +// inactivebgColor: Colors.red.withOpacity(0.3), +// activeBorderColor: Colors.red, +// inactiveBorderColor: Colors.red.withOpacity(0.3), +// custombgColor: GFColors.SUCCESS, + value: check, onChanged: (val) { - print('on change val $val'); + setState(() { + check = val; + }); }, - value: true, - inactiveIcon: null, +// inactiveIcon: const Icon( +// Icons.close, +// color: GFColors.DARK, +// size: 16, +// ), +// activeIcon: const Icon( +// Icons.check, +// size: 20, +// color: GFColors.WHITE, +// ), + ), + + Checkbox( + value: check, + onChanged: null, +// (val){ +// print('on change val $val'); +// } ), - GFRadioButton( + GFCheckbox( size: GFSize.SMALL, - value: true, - type: GFRadioButtonType.basic, - radioColor: GFColors.SUCCESS, -// activebgColor: GFColors.ALT, -// inactivebgColor: GFColors.PRIMARY, -// activeBorderColor: GFColors.DANGER, -// inactiveBorderColor: GFColors.DARK, - onChanged: (val) { - print('on change val $val'); + activebgColor: GFColors.DANGER, + onChanged: +// null, + (val) { + setState(() { + check = val; + }); }, - activeIcon: const Icon( - Icons.check, - size: 20, - color: GFColors.DARK, - ), -// inactiveIcon: const Icon(Icons.close, size: 20, color: GFColors.DARK,), -// custombgColor: GFColors.SUCCESS, -// groupValue: + value: check, + inactiveIcon: null, ), +// GFCheckbox( +// size: GFSize.SMALL, +// onChanged: (val) { +// print('on change val $val'); +// }, +// value: true, +// type: GFCheckboxType.circle, +// checkColor: GFColors.DANGER, +//// activebgColor: Colors.green, +//// inactivebgColor: Colors.white, +//// activeBorderColor: Colors.red, +// ), +// +// GFRadioButton( +// size: GFSize.SMALL, +// value: true, +// type: GFRadioButtonType.basic, +// radioColor: GFColors.SUCCESS, +//// activebgColor: GFColors.ALT, +//// inactivebgColor: GFColors.PRIMARY, +//// activeBorderColor: GFColors.DANGER, +//// inactiveBorderColor: GFColors.DARK, +// onChanged: (val) { +// print('on change val $val'); +// }, +// activeIcon: const Icon( +// Icons.check, +// size: 20, +// color: GFColors.DARK, +// ), +//// inactiveIcon: const Icon(Icons.close, size: 20, color: GFColors.DARK,), +//// custombgColor: GFColors.SUCCESS, +//// groupValue: +// ), + // const Padding( // padding: EdgeInsets.only(left: 15, top: 30), // child: GFTypography( @@ -1371,70 +1427,38 @@ class _MyHomePageState extends State // ], // ), // ), + // - GFCheckboxListTile( - color: GFColors.ALT, - title: const Text('title'), - subTitle: const Text('subtitle'), -// titleText: 'sdfg', -// subtitleText: 'sdfg', - avatar: const GFAvatar( - backgroundColor: GFColors.SUCCESS, - ), - description: const Text('description'), - padding: const EdgeInsets.all(16), - margin: const EdgeInsets.all(16), - size: 24, - type: GFCheckboxType.basic, - checkColor: GFColors.WHITE, - activebgColor: GFColors.PRIMARY, - inactivebgColor: GFColors.WHITE, - activeBorderColor: GFColors.WHITE, - inactiveBorderColor: GFColors.DARK, - activeIcon: const Icon( - Icons.check, - size: 20, - color: GFColors.WHITE, - ), - custombgColor: GFColors.SUCCESS, - onChanged: (val) {}, - value: true, - inactiveIcon: const Icon( - Icons.close, - color: GFColors.DARK, - size: 16, - ), - ), // - GFCarousel( -// initialPage: 1, - pagerSize: 12, - activeIndicator: Colors.pink, - passiveIndicator: Colors.pink.withOpacity(0.4), - viewportFraction: 1.0, -// aspectRatio: 1, - autoPlay: true, - enlargeMainPage: true, - pagination: true, - items: imageList - .map((url) => Container( - padding: const EdgeInsets.only(bottom: 16), - margin: const EdgeInsets.all(12), - child: ClipRRect( - borderRadius: - const BorderRadius.all(Radius.circular(5)), - child: Image.network(url, - fit: BoxFit.cover, width: 1000), - ), - )) - .toList(), -// onPageChanged: (int index) { -// setState(() { -// index; -// }); -// }, - ), +// GFCarousel( +//// initialPage: 1, +// pagerSize: 12, +// activeIndicator: Colors.pink, +// passiveIndicator: Colors.pink.withOpacity(0.4), +// viewportFraction: 1.0, +//// aspectRatio: 1, +// autoPlay: true, +// enlargeMainPage: true, +// pagination: true, +// items: imageList +// .map((url) => Container( +// padding: const EdgeInsets.only(bottom: 16), +// margin: const EdgeInsets.all(12), +// child: ClipRRect( +// borderRadius: +// const BorderRadius.all(Radius.circular(5)), +// child: Image.network(url, +// fit: BoxFit.cover, width: 1000), +// ), +// )) +// .toList(), +//// onPageChanged: (int index) { +//// setState(() { +//// index; +//// }); +//// }, +// ), // // GFCarousel( @@ -1674,14 +1698,14 @@ class _MyHomePageState extends State // borderRadius: BorderRadius.circular(10.0), // ), - const GFIconBadge( - child: GFAvatar( - backgroundColor: GFColors.SUCCESS, - ), - counterChild: GFBadge( - text: '12', - ), - ), +// const GFIconBadge( +// child: GFAvatar( +// backgroundColor: GFColors.SUCCESS, +// ), +// counterChild: GFBadge( +// text: '12', +// ), +// ), // GFIconButton( // onPressed: () {}, diff --git a/example/pubspec.lock b/example/pubspec.lock index 079bd9a7..ebc1d1bd 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -92,7 +92,7 @@ packages: path: ".." relative: true source: path - version: "1.1.1" + version: "1.1.3" image: dependency: transitive description: diff --git a/lib/components/appbar/gf_appbar.dart b/lib/components/appbar/gf_appbar.dart index d8c6e335..d8905d0e 100644 --- a/lib/components/appbar/gf_appbar.dart +++ b/lib/components/appbar/gf_appbar.dart @@ -321,9 +321,9 @@ class _GFAppBarState extends State { IconThemeData actionsIconTheme = widget.actionsIconTheme ?? appBarTheme.actionsIconTheme ?? overallIconTheme; - TextStyle centerStyle = widget.textTheme?.headline1 ?? - appBarTheme.textTheme?.headline1 ?? - theme.primaryTextTheme.headline1; + TextStyle centerStyle = widget.textTheme?.headline5 ?? + appBarTheme.textTheme?.headline5 ?? + theme.primaryTextTheme.headline5; TextStyle sideStyle = widget.textTheme?.bodyText1 ?? appBarTheme.textTheme?.bodyText1 ?? theme.primaryTextTheme.bodyText1; diff --git a/lib/components/button/gf_button.dart b/lib/components/button/gf_button.dart index 7a986ef6..80501483 100644 --- a/lib/components/button/gf_button.dart +++ b/lib/components/button/gf_button.dart @@ -1019,7 +1019,7 @@ class _GFButtonState extends State { } else if (widget.fullWidthButton == true) { return MediaQuery.of(context).size.width; } else { - return null; + return MediaQuery.of(context).size.width * 0.88; } } diff --git a/lib/components/button/gf_social_button.dart b/lib/components/button/gf_social_button.dart index fe077f9d..54249394 100644 --- a/lib/components/button/gf_social_button.dart +++ b/lib/components/button/gf_social_button.dart @@ -65,84 +65,111 @@ class GFSocialButton extends GFButton { ); /// Called when the button is tapped or otherwise activated. + @override final VoidCallback onPressed; /// Called by the underlying [InkWell] widget's InkWell.onHighlightChanged callback. + @override final ValueChanged onHighlightChanged; /// Defines the default text style, with [Material.textStyle], for the button's [child]. + @override final TextStyle textStyle; /// The border side for the button's [Material]. + @override final BorderSide borderSide; /// The box shadow for the button's [Material], if GFButtonType is solid + @override final BoxShadow boxShadow; /// Pass [GFColors] or [Color]. The color for the button's [Material] when it has the input focus. + @override final Color focusColor; /// Pass [GFColors] or [Color]. The color for the button's [Material] when a pointer is hovering over it. + @override final Color hoverColor; /// Pass [GFColors] or [Color]. The highlight color for the button's [InkWell]. + @override final Color highlightColor; /// Pass [GFColors] or [Color]. The splash color for the button's [InkWell]. + @override final Color splashColor; /// The elevation for the button's [Material] when the button is [enabled] but not pressed. + @override final double elevation; /// The elevation for the button's [Material] when the button is [enabled] and a pointer is hovering over it. + @override final double hoverElevation; /// The elevation for the button's [Material] when the button is [enabled] and has the input focus. + @override final double focusElevation; /// The elevation for the button's [Material] when the button is [enabled] and pressed. + @override final double highlightElevation; /// The elevation for the button's [Material] when the button is not [enabled]. + @override final double disabledElevation; /// The internal padding for the button's [child]. + @override final EdgeInsetsGeometry padding; /// Defines the button's size. + @override final BoxConstraints constraints; /// The shape of the button's [Material]. + @override final ShapeBorder borderShape; /// Defines the duration of animated changes for [shape] and [elevation]. + @override final Duration animationDuration; /// Typically the button's label. + @override final Widget child; /// Whether the button is enabled or disabled. + @override bool get enabled => onPressed != null; /// Configures the minimum size of the tap target. + @override final MaterialTapTargetSize materialTapTargetSize; /// {@macro flutter.widgets.Focus.focusNode} + @override final FocusNode focusNode; /// {@macro flutter.widgets.Focus.autofocus} + @override final bool autofocus; /// {@macro flutter.widgets.Clip} + @override final Clip clipBehavior; /// Button type of [GFButtonType] i.e, solid, outline, outline2x, transparent + @override final GFButtonType type; /// Button type of GFSocialButtonShape i.e, standard, pills, square, shadow, icons + @override final GFButtonShape shape; /// Pass [GFColors] or [Color] + @override final Color color; /// The fill color of the button when the button is disabled. @@ -153,9 +180,12 @@ class GFSocialButton extends GFButton { /// See also: /// /// * [color] - the fill color of the button when the button is [enabled]. + + @override final Color disabledColor; /// Pass [GFColors] or [Color] + @override final Color textColor; /// The color to use for this button's text when the button is disabled. @@ -172,27 +202,35 @@ class GFSocialButton extends GFButton { /// See also: /// /// * [textColor] - The color to use for this button's text when the button is [enabled]. + @override final Color disabledTextColor; /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc. + @override final double size; /// text of type [String] is alternative to child. text will get priority over child + @override final String text; /// icon of type [Widget] + @override final Widget icon; /// icon type of [GFPosition] i.e, start, end + @override final GFPosition position; /// on true state blockButton gives block size button + @override final bool blockButton; /// on true state full width Button gives full width button + @override final bool fullWidthButton; /// on true state default box shadow appears around button, if GFButtonType is solid + @override final bool buttonBoxShadow; /// A set of thirteen colors that can be used to derive the button theme's @@ -205,6 +243,7 @@ class GFSocialButton extends GFButton { /// The colors for new button classes can be defined exclusively in terms /// of [colorScheme]. When it's possible, the existing buttons will /// (continue to) gradually migrate to it. + @override final ColorScheme colorScheme; /// Whether detected gestures should provide acoustic and/or haptic feedback. @@ -215,6 +254,7 @@ class GFSocialButton extends GFButton { /// See also: /// /// * [Feedback] for providing platform-specific feedback to certain actions. + @override final bool enableFeedback; /// Called when the button is long-pressed. @@ -224,6 +264,7 @@ class GFSocialButton extends GFButton { /// See also: /// /// * [enabled], which is true if the button is enabled. + @override final VoidCallback onLongPress; Widget build(BuildContext context) => GFButton( diff --git a/lib/components/checkbox/gf_checkbox.dart b/lib/components/checkbox/gf_checkbox.dart index ada0aa6b..737a3c9a 100644 --- a/lib/components/checkbox/gf_checkbox.dart +++ b/lib/components/checkbox/gf_checkbox.dart @@ -63,6 +63,7 @@ class GFCheckbox extends StatefulWidget { } class _GFCheckboxState extends State { + bool get enabled => widget.onChanged != null; bool isSelected = false; @override @@ -81,48 +82,53 @@ class _GFCheckboxState extends State { } @override - Widget build(BuildContext context) => InkWell( - onTap: onStatusChange, - child: Container( - height: widget.size, - width: widget.size, - decoration: BoxDecoration( - color: isSelected - ? widget.type == GFCheckboxType.custom - ? Colors.white - : widget.activebgColor - : widget.inactivebgColor, - borderRadius: widget.type == GFCheckboxType.basic - ? BorderRadius.circular(3) - : widget.type == GFCheckboxType.circle - ? BorderRadius.circular(50) - : BorderRadius.zero, - border: Border.all( - color: isSelected - ? widget.type == GFCheckboxType.custom - ? Colors.black87 - : widget.activeBorderColor - : widget.inactiveBorderColor)), - child: isSelected - ? widget.type == GFCheckboxType.custom - ? Stack( - children: [ - Container( - alignment: Alignment.center, - ), - Container( - margin: const EdgeInsets.all(5), - alignment: Alignment.center, - width: widget.size * 0.8, - height: widget.size * 0.8, - decoration: BoxDecoration( - shape: BoxShape.rectangle, - color: widget.custombgColor), - ) - ], - ) - : widget.activeIcon - : widget.inactiveIcon, + Widget build(BuildContext context) => FocusableActionDetector( + enabled: enabled, + child: InkWell( + onTap: onStatusChange, + child: Container( + height: widget.size, + width: widget.size, + decoration: BoxDecoration( + color: enabled + ? isSelected + ? widget.type == GFCheckboxType.custom + ? Colors.white + : widget.activebgColor + : widget.inactivebgColor + : Colors.grey, + borderRadius: widget.type == GFCheckboxType.basic + ? BorderRadius.circular(3) + : widget.type == GFCheckboxType.circle + ? BorderRadius.circular(50) + : BorderRadius.zero, + border: Border.all( + color: isSelected + ? widget.type == GFCheckboxType.custom + ? Colors.black87 + : widget.activeBorderColor + : widget.inactiveBorderColor)), + child: isSelected + ? widget.type == GFCheckboxType.custom + ? Stack( + children: [ + Container( + alignment: Alignment.center, + ), + Container( + margin: const EdgeInsets.all(5), + alignment: Alignment.center, + width: widget.size * 0.8, + height: widget.size * 0.8, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: widget.custombgColor), + ) + ], + ) + : widget.activeIcon + : widget.inactiveIcon, + ), ), ); } diff --git a/lib/components/list_tile/gf_list_tile.dart b/lib/components/list_tile/gf_list_tile.dart index d3bcd523..2c503ae7 100644 --- a/lib/components/list_tile/gf_list_tile.dart +++ b/lib/components/list_tile/gf_list_tile.dart @@ -79,7 +79,7 @@ class GFListTile extends StatelessWidget { subtitleText != null ? Text( subtitleText, - style: TextStyle( + style: const TextStyle( fontSize: 14.5, color: Colors.black54, ), diff --git a/lib/components/search_bar/gf_search_bar.dart b/lib/components/search_bar/gf_search_bar.dart index 78b84281..5e9aafe2 100644 --- a/lib/components/search_bar/gf_search_bar.dart +++ b/lib/components/search_bar/gf_search_bar.dart @@ -161,7 +161,7 @@ class MySingleChoiceSearchState extends State> { color: Theme.of(context).primaryColor, ), ), - suffixIcon: Icon(Icons.search), + suffixIcon: const Icon(Icons.search), border: InputBorder.none, hintText: 'Search here...', contentPadding: const EdgeInsets.only( diff --git a/lib/components/typography/gf_typography.dart b/lib/components/typography/gf_typography.dart index 9c005587..d1eac57b 100644 --- a/lib/components/typography/gf_typography.dart +++ b/lib/components/typography/gf_typography.dart @@ -83,7 +83,7 @@ class GFTypography extends StatelessWidget { image: backgroundImage, fit: BoxFit.cover, colorFilter: backgroundImagecolorFilter ?? - ColorFilter.mode(Colors.black54, BlendMode.darken), + const ColorFilter.mode(Colors.black54, BlendMode.darken), ) : null, ), diff --git a/pubspec.yaml b/pubspec.yaml index 8c778268..a0a56314 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: getwidget description: GetWidget is open source libraries that come with pre-build 1000+ UI components. It makes development faster & more enjoyable. You can customize the component as per your need. -version: 1.1.1 +version: 1.1.3 homepage: https://github.com/ionicfirebaseapp/getwidget environment: