diff --git a/lib/components/carousel/gf_carousel.dart b/lib/components/carousel/gf_carousel.dart index 4718e4ca..e30e31c8 100644 --- a/lib/components/carousel/gf_carousel.dart +++ b/lib/components/carousel/gf_carousel.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; class GFCarousel extends StatefulWidget { /// Creates slide show of Images and [Widget] with animation for sliding. - GFCarousel({ + const GFCarousel({ @required this.items, this.pagerSize, this.passiveIndicator, @@ -13,7 +13,6 @@ class GFCarousel extends StatefulWidget { this.aspectRatio = 16 / 9, this.viewportFraction = 0.8, this.initialPage = 0, - int realPage = 10000, this.enableInfiniteScroll = true, this.reverse = false, this.autoPlay = false, @@ -25,12 +24,7 @@ class GFCarousel extends StatefulWidget { this.onPageChanged, this.scrollPhysics, this.scrollDirection = Axis.horizontal, - }) : realPage = enableInfiniteScroll ? realPage + initialPage : initialPage, - pageController = PageController( - viewportFraction: viewportFraction, - initialPage: - enableInfiniteScroll ? realPage + initialPage : initialPage, - ); + }); /// The pagination dots size can be defined using [double]. final double pagerSize; @@ -59,9 +53,6 @@ class GFCarousel extends StatefulWidget { /// The initial page to show when first creating the [GFCarousel]. Defaults to 0. final num initialPage; - /// The actual index of the [PageView]. - final num realPage; - /// Determines if slides should loop infinitely or be limited to item length. Defaults to true, i.e. infinite loop. final bool enableInfiniteScroll; @@ -107,48 +98,44 @@ class GFCarousel extends StatefulWidget { /// Defaults to matching platform conventions. final ScrollPhysics scrollPhysics; - /// [pageController] is created using the properties passed to the constructor - /// and can be used to control the [PageView] it is passed to. - final PageController pageController; - /// Animates the controlled [GFCarousel] to the next page. /// /// The animation lasts for the given duration and follows the given curve. /// The returned [Future] resolves when the animation completes. - Future nextPage({Duration duration, Curve curve}) => - pageController.nextPage(duration: duration, curve: curve); - - /// Animates the controlled [GFCarousel] to the previous page. - /// - /// The animation lasts for the given duration and follows the given curve. - /// The returned [Future] resolves when the animation completes. - Future previousPage({Duration duration, Curve curve}) => - pageController.previousPage(duration: duration, curve: curve); - - /// Changes which page is displayed in the controlled [GFCarousel]. - /// - /// Jumps the page position from its current value to the given value, - /// without animation, and without checking if the new value is in range. - void jumpToPage(int page) { - final index = - _getRealIndex(pageController.page.toInt(), realPage, items.length); - return pageController - .jumpToPage(pageController.page.toInt() + page - index); - } - - /// Animates the controlled [GFCarousel] from the current page to the given page. - /// - /// The animation lasts for the given duration and follows the given curve. - /// The returned [Future] resolves when the animation completes. - Future animateToPage(int page, {Duration duration, Curve curve}) { - final index = - _getRealIndex(pageController.page.toInt(), realPage, items.length); - return pageController.animateToPage( - pageController.page.toInt() + page - index, - duration: duration, - curve: curve, - ); - } + // Future nextPage({Duration duration, Curve curve}) => + // pageController.nextPage(duration: duration, curve: curve); + // + // /// Animates the controlled [GFCarousel] to the previous page. + // /// + // /// The animation lasts for the given duration and follows the given curve. + // /// The returned [Future] resolves when the animation completes. + // Future previousPage({Duration duration, Curve curve}) => + // pageController.previousPage(duration: duration, curve: curve); + // + // /// Changes which page is displayed in the controlled [GFCarousel]. + // /// + // /// Jumps the page position from its current value to the given value, + // /// without animation, and without checking if the new value is in range. + // void jumpToPage(int page) { + // final index = + // _getRealIndex(pageController.page.toInt(), realPage, items.length); + // return pageController + // .jumpToPage(pageController.page.toInt() + page - index); + // } + // + // /// Animates the controlled [GFCarousel] from the current page to the given page. + // /// + // /// The animation lasts for the given duration and follows the given curve. + // /// The returned [Future] resolves when the animation completes. + // Future animateToPage(int page, {Duration duration, Curve curve}) { + // final index = + // _getRealIndex(pageController.page.toInt(), realPage, items.length); + // return pageController.animateToPage( + // pageController.page.toInt() + page - index, + // duration: duration, + // curve: curve, + // ); + // } List map(List list, Function handler) { List result; @@ -173,15 +160,31 @@ class _GFCarouselState extends State with TickerProviderStateMixin { /// Width of cells container double width = 0; + /// [pageController] is created using the properties passed to the constructor + /// and can be used to control the [PageView] it is passed to. + PageController pageController; + + /// The actual index of the [PageView]. + int realPage = 10000; + @override void initState() { super.initState(); + realPage = widget.enableInfiniteScroll + ? realPage + widget.initialPage + : widget.initialPage; + pageController = PageController( + viewportFraction: widget.viewportFraction, + initialPage: widget.enableInfiniteScroll + ? realPage + widget.initialPage + : widget.initialPage, + ); timer = getPlayTimer(); } Timer getPlayTimer() => Timer.periodic(widget.autoPlayInterval, (_) { if (widget.autoPlay && widget.items.length > 1) { - widget.pageController.nextPage( + pageController.nextPage( duration: widget.autoPlayAnimationDuration, curve: widget.autoPlayCurve); } @@ -230,7 +233,7 @@ class _GFCarouselState extends State with TickerProviderStateMixin { getPageWrapper(PageView.builder( physics: widget.scrollPhysics, scrollDirection: widget.scrollDirection, - controller: widget.pageController, + controller: pageController, reverse: widget.reverse, itemCount: widget.items.length == 1 ? widget.items.length @@ -239,8 +242,8 @@ class _GFCarouselState extends State with TickerProviderStateMixin { : widget.items.length, onPageChanged: (int index) { int currentPage; - currentPage = _getRealIndex(index + widget.initialPage, - widget.realPage, widget.items.length); + currentPage = _getRealIndex( + index + widget.initialPage, realPage, widget.items.length); if (widget.onPageChanged != null) { widget.onPageChanged(currentPage); } @@ -253,29 +256,47 @@ class _GFCarouselState extends State with TickerProviderStateMixin { itemBuilder: (BuildContext context, int i) { final int index = _getRealIndex( i + widget.initialPage, - widget.realPage, + realPage, widget.items.length, ); + currentSlide = index; return AnimatedBuilder( - animation: widget.pageController, + animation: pageController, child: widget.items[index], builder: (BuildContext context, child) { // on the first render, the pageController.page is null, // this is a dirty hack - if (widget.pageController.position.minScrollExtent == null || - widget.pageController.position.maxScrollExtent == null) { - Future.delayed(const Duration(microseconds: 1), () { - setState(() {}); - }); - return Container(); + + // if (pageController.position.minScrollExtent == null || + // pageController.position.maxScrollExtent == null) { + // Future.delayed(const Duration(microseconds: 1), () {}); + // return Container(); + // } + + double value; + try { + value = pageController.page - i; + // ignore: avoid_catches_without_on_clauses + } catch (e) { + // value = 1; + final BuildContext storageContext = + pageController.position.context.storageContext; + final double previousSavedPosition = + PageStorage.of(storageContext) + ?.readState(storageContext); + if (previousSavedPosition != null) { + value = previousSavedPosition - i.toDouble(); + } else { + value = realPage.toDouble() - i.toDouble(); + } } - double value = widget.pageController.page - i; value = (1 - (value.abs() * 0.3)).clamp(0.0, 1.0); final double height = widget.height ?? MediaQuery.of(context).size.width * (1 / widget.aspectRatio); + final double distortionValue = widget.enlargeMainPage ? Curves.easeOut.transform(value) : 1.0; diff --git a/lib/components/checkbox/gf_checkbox.dart b/lib/components/checkbox/gf_checkbox.dart index 8fe7709c..e1188619 100644 --- a/lib/components/checkbox/gf_checkbox.dart +++ b/lib/components/checkbox/gf_checkbox.dart @@ -7,9 +7,8 @@ class GFCheckbox extends StatefulWidget { {Key key, this.size = GFSize.MEDIUM, this.type = GFCheckboxType.basic, - this.checkColor = GFColors.WHITE, - this.activebgColor = GFColors.PRIMARY, - this.inactivebgColor = GFColors.WHITE, + this.activeBgColor = GFColors.PRIMARY, + this.inactiveBgColor = GFColors.WHITE, this.activeBorderColor = GFColors.WHITE, this.inactiveBorderColor = GFColors.DARK, this.onChanged, @@ -20,7 +19,7 @@ class GFCheckbox extends StatefulWidget { color: GFColors.WHITE, ), this.inactiveIcon, - this.custombgColor = GFColors.SUCCESS, + this.customBgColor = GFColors.SUCCESS, this.autofocus = false, this.focusNode}) : assert(autofocus != null), @@ -32,14 +31,11 @@ class GFCheckbox extends StatefulWidget { /// type of [double] which is GFSize ie, small, medium and large and can use any double value final double size; - /// type of [Color] used to change the checkcolor when the checkbox is active - final Color checkColor; - /// type of [Color] used to change the backgroundColor of the active checkbox - final Color activebgColor; + final Color activeBgColor; /// type of [Color] used to change the backgroundColor of the inactive checkbox - final Color inactivebgColor; + final Color inactiveBgColor; /// type of [Color] used to change the border color of the active checkbox final Color activeBorderColor; @@ -60,7 +56,7 @@ class GFCheckbox extends StatefulWidget { final Widget inactiveIcon; /// type of [Color] used to change the background color of the custom active checkbox only - final Color custombgColor; + final Color customBgColor; /// on true state this widget will be selected as the initial focus /// when no other node in its scope is currently focused @@ -101,8 +97,8 @@ class _GFCheckboxState extends State { ? widget.value ? widget.type == GFCheckboxType.custom ? Colors.white - : widget.activebgColor - : widget.inactivebgColor + : widget.activeBgColor + : widget.inactiveBgColor : Colors.grey, borderRadius: widget.type == GFCheckboxType.basic ? BorderRadius.circular(3) @@ -129,7 +125,7 @@ class _GFCheckboxState extends State { height: widget.size * 0.8, decoration: BoxDecoration( shape: BoxShape.rectangle, - color: widget.custombgColor), + color: widget.customBgColor), ) ], ) diff --git a/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart b/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart index 35142631..ba31a401 100644 --- a/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart +++ b/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFCheckboxListTile extends StatelessWidget { - /// [GFCheckboxListTile] is a tile with small box at right (as in a checklist) in which to place a check mark to make a selection with various customization options. + /// [GFCheckboxListTile] is a tile with small box at right (as in a checklist) + /// in which to place a check mark to make a selection with various customization options. const GFCheckboxListTile({ Key key, @required this.value, @@ -12,16 +13,15 @@ class GFCheckboxListTile extends StatelessWidget { this.color, this.avatar, this.title, - this.subTitle, + this.subtitle, this.icon, this.description, this.padding = const EdgeInsets.all(8), this.margin = const EdgeInsets.symmetric(vertical: 8, horizontal: 16), this.size = GFSize.MEDIUM, this.type = GFCheckboxType.basic, - this.checkColor = GFColors.WHITE, - this.activebgColor = GFColors.PRIMARY, - this.inactivebgColor = GFColors.WHITE, + this.activeBgColor = GFColors.PRIMARY, + this.inactiveBgColor = GFColors.WHITE, this.activeBorderColor = GFColors.WHITE, this.inactiveBorderColor = GFColors.DARK, this.activeIcon = const Icon( @@ -30,7 +30,7 @@ class GFCheckboxListTile extends StatelessWidget { color: GFColors.WHITE, ), this.inactiveIcon, - this.custombgColor = GFColors.SUCCESS, + this.customBgColor = GFColors.SUCCESS, this.position = GFPosition.end, this.selected = false, this.autofocus = false, @@ -48,14 +48,15 @@ class GFCheckboxListTile extends StatelessWidget { /// The GFListTile's background color. Can be given [Color] or [GFColors] final Color color; - /// If position is start Checkbox will come instead of avatar, type of [Widget] or [GFAvatar] used to create rounded user profile + /// If position is start Checkbox will come instead of avatar, + /// type of [Widget] or [GFAvatar] used to create rounded user profile final Widget avatar; /// The title to display inside the [GFListTile]. see [Text] final Widget title; - /// The subTitle to display inside the [GFListTile]. see [Text] - final Widget subTitle; + /// The subtitle to display inside the [GFListTile]. see [Text] + final Widget subtitle; /// The description to display inside the [GFListTile]. see [Text] final Widget description; @@ -72,14 +73,11 @@ class GFCheckboxListTile extends StatelessWidget { /// type of [double] which is GFSize ie, small, medium and large and can use any double value final double size; - /// type pf [Color] used to change the checkcolor when the checkbox is active - final Color checkColor; - /// type of [Color] used to change the backgroundColor of the active checkbox - final Color activebgColor; + final Color activeBgColor; /// type of [Color] used to change the backgroundColor of the inactive checkbox - final Color inactivebgColor; + final Color inactiveBgColor; /// type of [Color] used to change the border color of the active checkbox final Color activeBorderColor; @@ -103,13 +101,14 @@ class GFCheckboxListTile extends StatelessWidget { final Widget inactiveIcon; /// type of [Color] used to change the background color of the custom active checkbox only - final Color custombgColor; + final Color customBgColor; /// To have the list tile appear selected when the checkbox is checked, pass the same value to both. /// Normally, this property is left to its default value, false. final bool selected; - /// {@macro flutter.widgets.Focus.autofocus} + /// On true state it should focus itself if nothing else is already focused. + /// Defaults to false final bool autofocus; /// If position is end Checkbox will come instead of icon, The icon to display inside the [GFListTile]. see [Icon] @@ -122,14 +121,14 @@ class GFCheckboxListTile extends StatelessWidget { onChanged: onChanged, value: value, size: size, - activebgColor: activebgColor, + activeBgColor: activeBgColor, inactiveIcon: inactiveIcon, activeBorderColor: activeBorderColor, - inactivebgColor: inactivebgColor, + inactiveBgColor: inactiveBgColor, activeIcon: activeIcon, inactiveBorderColor: inactiveBorderColor, - custombgColor: custombgColor, - checkColor: checkColor, + customBgColor: customBgColor, + // checkColor: checkColor, type: type); return MergeSemantics( child: GFListTile( @@ -143,7 +142,7 @@ class GFCheckboxListTile extends StatelessWidget { selected: selected, avatar: position == GFPosition.start ? checkbox : avatar, titleText: titleText, - subTitle: subTitle, + subtitle: subtitle, subtitleText: subtitleText, description: description, color: color, diff --git a/lib/components/dropdown/gf_dropdown.dart b/lib/components/dropdown/gf_dropdown.dart index bc56ff3f..8d8caa90 100644 --- a/lib/components/dropdown/gf_dropdown.dart +++ b/lib/components/dropdown/gf_dropdown.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFDropdown extends StatefulWidget { - /// + /// GF Dropdown let user to select from the number of items and display selected + /// item in the button. It displays list of items in the overlay dropdown fashion. const GFDropdown( {Key key, @required this.items, @@ -21,7 +22,7 @@ class GFDropdown extends StatefulWidget { this.iconSize = 24.0, this.isDense = true, this.isExpanded = false, - this.itemHeight = kMinInteractiveDimension, + this.itemHeight = 40, this.focusColor, this.focusNode, this.autofocus = false, @@ -29,7 +30,7 @@ class GFDropdown extends StatefulWidget { this.padding = const EdgeInsets.all(5), this.borderRadius = const BorderRadius.all(Radius.circular(4)), this.border = const BorderSide( - color: Colors.white, width: 1, style: BorderStyle.solid), + color: Colors.transparent, width: 1, style: BorderStyle.solid), this.dropdownButtonColor = GFColors.WHITE}) : super(key: key); @@ -124,7 +125,8 @@ class _GFDropdownState extends State { side: widget.border, borderRadius: widget.borderRadius, ), - child: Padding( + child: Container( + height: widget.itemHeight, padding: widget.padding, child: DropdownButton( items: widget.items, @@ -142,7 +144,7 @@ class _GFDropdownState extends State { iconSize: widget.iconSize, isDense: widget.isDense, isExpanded: widget.isExpanded, - itemHeight: widget.itemHeight, + // itemHeight: widget.itemHeight, focusColor: widget.focusColor, focusNode: widget.focusNode, autofocus: widget.autofocus, diff --git a/lib/components/dropdown/gf_multiselect.dart b/lib/components/dropdown/gf_multiselect.dart index 9ebcf00d..be98ec28 100644 --- a/lib/components/dropdown/gf_multiselect.dart +++ b/lib/components/dropdown/gf_multiselect.dart @@ -2,12 +2,14 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFMultiSelect extends StatefulWidget { - /// + /// GF Multiselect let user to select multiple items from the number of + /// Checkbox ListTile items and display selected items in the TitleTile box. + /// It displays list of items in the overlay dropdown fashion. const GFMultiSelect({ @required this.items, @required this.onSelect, - this.dropDownTitleTileText = 'Select : ', - this.dropDownTitleTileTextStyle = + this.dropdownTitleTileText = 'Select : ', + this.dropdownTitleTileTextStyle = const TextStyle(fontSize: 16, fontWeight: FontWeight.w500), this.color, this.avatar, @@ -15,12 +17,12 @@ class GFMultiSelect extends StatefulWidget { this.margin = const EdgeInsets.all(5), this.size = GFSize.SMALL, this.type = GFCheckboxType.basic, - this.checkColor = GFColors.WHITE, - this.activebgColor = GFColors.WHITE, - this.inactivebgColor = GFColors.WHITE, + this.activeBgColor = GFColors.WHITE, + this.inactiveBgColor = GFColors.WHITE, this.activeBorderColor = GFColors.WHITE, this.inactiveBorderColor = GFColors.WHITE, this.submitButton, + this.cancelButton, this.expandedIcon = const Icon( Icons.keyboard_arrow_down, color: Colors.black87, @@ -31,14 +33,14 @@ class GFMultiSelect extends StatefulWidget { color: Colors.black87, size: 30, ), - this.dropdownbgColor = Colors.white, + this.dropdownBgColor = Colors.white, this.activeIcon = const Icon( Icons.check, size: 20, color: GFColors.DARK, ), this.inactiveIcon, - this.custombgColor = GFColors.SUCCESS, + this.customBgColor = GFColors.SUCCESS, this.selected = false, this.dropdownTitleTileBorder, this.dropdownTitleTileBorderRadius = @@ -46,12 +48,13 @@ class GFMultiSelect extends StatefulWidget { this.dropdownTitleTileColor = GFColors.WHITE, this.hideDropdownUnderline = false, this.dropdownUnderlineBorder = - const BorderSide(color: Colors.black12, width: 1), + const BorderSide(color: Colors.black45, width: 1), this.dropdownTitleTileMargin = const EdgeInsets.all(16), this.dropdownTitleTilePadding = const EdgeInsets.all(12), - this.dropDownTitleTileHintText, - this.dropDownTitleTileHintTextStyle = + this.dropdownTitleTileHintText, + this.dropdownTitleTileHintTextStyle = const TextStyle(fontSize: 12, fontWeight: FontWeight.w400), + this.dropdownButton, Key key, }) : assert(selected != null), super(key: key); @@ -64,16 +67,16 @@ class GFMultiSelect extends StatefulWidget { final ValueChanged> onSelect; /// type of [String] to define the dropdownTitleTile title - final String dropDownTitleTileText; + final String dropdownTitleTileText; - /// type of [TextStyle] to define the textStyle of [dropDownTitleTileText] - final TextStyle dropDownTitleTileTextStyle; + /// type of [TextStyle] to define the textStyle of [dropdownTitleTileText] + final TextStyle dropdownTitleTileTextStyle; /// type of [String] to define the dropdownTitleTile hint text - final String dropDownTitleTileHintText; + final String dropdownTitleTileHintText; - /// type of [TextStyle] to define the textStyle of [dropDownTitleTileHintTextStyle] - final TextStyle dropDownTitleTileHintTextStyle; + /// type of [TextStyle] to define the textStyle of [dropdownTitleTileHintTextStyle] + final TextStyle dropdownTitleTileHintTextStyle; /// defines the border radius of the dropdownTitleTile final BorderRadius dropdownTitleTileBorderRadius; @@ -103,9 +106,12 @@ class GFMultiSelect extends StatefulWidget { /// defines the dropdownTitleTile's trailing icon when dropdown is not visible final Widget collapsedIcon; - /// defines the button in the dropdown + /// defines the submit button in the dropdown final Widget submitButton; + /// defines the cancel button in the dropdown + final Widget cancelButton; + /// defines dropdown checkbox ListTile's background color. Can be given [Color] or [GFColors] final dynamic color; @@ -126,17 +132,13 @@ class GFMultiSelect extends StatefulWidget { /// type of [double] which is GFSize ie, small, medium and large and can use any double value final double size; - /// defines dropdown ListTile's checkbox color when its active - /// type of [Color] used to change the checkcolor when the checkbox is active - final Color checkColor; - /// defines dropdown ListTile's checkbox background color when its active /// type of [Color] used to change the backgroundColor of the active checkbox - final Color activebgColor; + final Color activeBgColor; /// defines dropdown ListTile's checkbox background color when its inactive /// type of [Color] used to change the backgroundColor of the inactive checkbox - final Color inactivebgColor; + final Color inactiveBgColor; /// defines dropdown ListTile's checkbox border color when its active /// type of [Color] used to change the border color of the active checkbox @@ -155,15 +157,16 @@ class GFMultiSelect extends StatefulWidget { final Widget inactiveIcon; /// type of [Color] used to change the background color of the custom active checkbox only - final Color custombgColor; + final Color customBgColor; /// To have the list tile appear selected when the checkbox is checked, pass the same value to both. /// Normally, this property is left to its default value, false. final bool selected; /// defines the background color of the dropdown. Can be given [Color] or [GFColors] - final Color dropdownbgColor; + final Color dropdownBgColor; + final Widget dropdownButton; @override _GFMultiSelectState createState() => _GFMultiSelectState(); @@ -205,11 +208,11 @@ class _GFMultiSelectState extends State> { children: [ _selectedTitles.isEmpty ? Expanded( - child: Text(widget.dropDownTitleTileText, - style: widget.dropDownTitleTileTextStyle)) + child: Text(widget.dropdownTitleTileText, + style: widget.dropdownTitleTileTextStyle)) : Expanded( child: Text(_selectedTitles.join(', ').toString(), - style: widget.dropDownTitleTileTextStyle)), + style: widget.dropdownTitleTileTextStyle)), !showDropdown ? widget.expandedIcon : widget.collapsedIcon, ], ); @@ -232,17 +235,18 @@ class _GFMultiSelectState extends State> { child: Container( decoration: BoxDecoration( border: widget.hideDropdownUnderline - ? const Border(bottom: BorderSide(color: Colors.white)) + ? const Border( + bottom: BorderSide(color: Colors.transparent)) : Border(bottom: widget.dropdownUnderlineBorder), ), - child: widget.dropDownTitleTileHintText == null + child: widget.dropdownTitleTileHintText == null ? dropdownTile() : Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - '${widget.dropDownTitleTileHintText}', - style: widget.dropDownTitleTileHintTextStyle, + '${widget.dropdownTitleTileHintText}', + style: widget.dropdownTitleTileHintTextStyle, ), dropdownTile(), const SizedBox( @@ -255,7 +259,7 @@ class _GFMultiSelectState extends State> { ? Container( padding: const EdgeInsets.symmetric(vertical: 6), decoration: BoxDecoration( - color: widget.dropdownbgColor, + color: widget.dropdownBgColor, boxShadow: const [ BoxShadow( color: Colors.black12, @@ -288,25 +292,42 @@ class _GFMultiSelectState extends State> { padding: widget.padding, margin: widget.margin, size: widget.size, - activebgColor: widget.activebgColor, + activeBgColor: widget.activeBgColor, inactiveIcon: widget.inactiveIcon, activeBorderColor: widget.activeBorderColor, - inactivebgColor: widget.inactivebgColor, + inactiveBgColor: widget.inactiveBgColor, activeIcon: widget.activeIcon, inactiveBorderColor: widget.inactiveBorderColor, - custombgColor: widget.custombgColor, - checkColor: widget.checkColor, + customBgColor: widget.customBgColor, + // checkColor: widget.checkColor, type: widget.type, ))), - GFButton( - onPressed: () { - setState(() { - showDropdown = !showDropdown; - }); - }, - child: widget.submitButton ?? const Text('OK'), - ) + widget.dropdownButton ?? + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + GFButton( + onPressed: () { + setState(() { + showDropdown = !showDropdown; + _selectedTitles.clear(); + _selectedTitlesIndex.clear(); + }); + }, + child: + widget.cancelButton ?? const Text('CANCEL'), + ), + GFButton( + onPressed: () { + setState(() { + showDropdown = !showDropdown; + }); + }, + child: widget.submitButton ?? const Text('OK'), + ) + ], + ) ], ), ), diff --git a/lib/components/intro_screen/gf_intro_screen.dart b/lib/components/intro_screen/gf_intro_screen.dart index 1d3f8ba9..b80606eb 100644 --- a/lib/components/intro_screen/gf_intro_screen.dart +++ b/lib/components/intro_screen/gf_intro_screen.dart @@ -3,7 +3,9 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFIntroScreen extends StatefulWidget { - /// Presents informative screens to users with various posibilities in customization. + /// GF Intro Screen is virtual unique interactive Slider that helps users get started with an app. + /// It has many features that helps to build custom-made introduction screen sliders. + /// Presents informative screens to users with various possibilities in customization. const GFIntroScreen({ Key key, @required this.pageController, @@ -29,7 +31,7 @@ class GFIntroScreen extends StatefulWidget { this.dividerHeight = 1, this.dividerThickness = 2, this.dotShape, - this.inActiveColor = GFColors.LIGHT, + this.inactiveColor = GFColors.LIGHT, this.activeColor = GFColors.PRIMARY, this.dotHeight = 12, this.dotWidth = 12, @@ -190,7 +192,7 @@ class GFIntroScreen extends StatefulWidget { final ShapeBorder dotShape; /// defines pagination inactive color - final Color inActiveColor; + final Color inactiveColor; /// defines pagination active color final Color activeColor; @@ -247,7 +249,7 @@ class _GFIntroScreenState extends State { dividerHeight: widget.dividerHeight, dividerThickness: widget.dividerThickness, dotShape: widget.dotShape, - inActiveColor: widget.inActiveColor, + inactiveColor: widget.inactiveColor, activeColor: widget.activeColor, dotHeight: widget.dotHeight, dotWidth: widget.dotWidth, diff --git a/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart b/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart index 6361c960..4f2a23e2 100644 --- a/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart +++ b/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart @@ -20,7 +20,7 @@ class GFIntroScreenBottomNavigationBar extends StatefulWidget { this.dividerHeight = 1, this.dividerThickness = 2, this.dotShape, - this.inActiveColor = GFColors.DANGER, + this.inactiveColor = GFColors.DANGER, this.activeColor = GFColors.PRIMARY, this.dotHeight = 12, this.dotWidth = 12, @@ -157,7 +157,7 @@ class GFIntroScreenBottomNavigationBar extends StatefulWidget { final ShapeBorder dotShape; /// defines pagination inactive color - final Color inActiveColor; + final Color inactiveColor; /// defines pagination active color final Color activeColor; @@ -297,7 +297,7 @@ class _GFIntroScreenBottomNavigationBarState child: Material( shape: widget.dotShape ?? RoundedRectangleBorder(borderRadius: BorderRadius.circular(50)), - color: currentIndex == i ? widget.activeColor : widget.inActiveColor, + color: currentIndex == i ? widget.activeColor : widget.inactiveColor, child: Container( width: widget.dotWidth, height: widget.dotHeight, diff --git a/lib/components/list_tile/gf_list_tile.dart b/lib/components/list_tile/gf_list_tile.dart index 68fdf7ad..eed7744d 100644 --- a/lib/components/list_tile/gf_list_tile.dart +++ b/lib/components/list_tile/gf_list_tile.dart @@ -11,7 +11,7 @@ class GFListTile extends StatelessWidget { this.color, this.avatar, this.title, - this.subTitle, + this.subtitle, this.description, this.icon, this.padding = const EdgeInsets.all(8), @@ -29,10 +29,10 @@ class GFListTile extends StatelessWidget { assert(autofocus != null), super(key: key); - ///type of [String] used to pass text, alternative to title property and gets higher priority than title + /// type of [String] used to pass text, alternative to title property and gets higher priority than title final String titleText; - ///type of [String] used to pass text, alternative to subtitle property and gets higher priority than subtitle + /// type of [String] used to pass text, alternative to subtitle property and gets higher priority than subtitle final String subtitleText; /// The GFListTile's background color. Can be given [Color] or [GFColors] @@ -44,8 +44,8 @@ class GFListTile extends StatelessWidget { /// The title to display inside the [GFListTile]. see [Text] final Widget title; - /// The subTitle to display inside the [GFListTile]. see [Text] - final Widget subTitle; + /// The subtitle to display inside the [GFListTile]. see [Text] + final Widget subtitle; /// The description to display inside the [GFListTile]. see [Text] final Widget description; @@ -88,10 +88,11 @@ class GFListTile extends StatelessWidget { /// The color for the tile's [Material] when a pointer is hovering over it. final Color hoverColor; - /// {@macro flutter.widgets.Focus.focusNode} + /// Defines the keyboard focus for this widget. final FocusNode focusNode; - /// {@macro flutter.widgets.Focus.autofocus} + /// On true state it should focus itself if nothing else is already focused. + /// Defaults to false final bool autofocus; @override @@ -141,7 +142,7 @@ class GFListTile extends StatelessWidget { color: Colors.black54, ), ) - : subTitle ?? Container(), + : subtitle ?? Container(), description ?? Container() ], ), diff --git a/lib/components/radio/gf_radio.dart b/lib/components/radio/gf_radio.dart index 6bd558d5..4ff86546 100644 --- a/lib/components/radio/gf_radio.dart +++ b/lib/components/radio/gf_radio.dart @@ -14,8 +14,8 @@ class GFRadio extends StatefulWidget { this.size = GFSize.SMALL, this.type = GFRadioType.basic, this.radioColor = GFColors.SUCCESS, - this.activebgColor = GFColors.WHITE, - this.inactivebgColor = GFColors.WHITE, + this.activeBgColor = GFColors.WHITE, + this.inactiveBgColor = GFColors.WHITE, this.activeBorderColor = GFColors.DARK, this.inactiveBorderColor = GFColors.DARK, this.activeIcon = const Icon( @@ -24,7 +24,7 @@ class GFRadio extends StatefulWidget { color: GFColors.DARK, ), this.inactiveIcon, - this.custombgColor = GFColors.SUCCESS, + this.customBgColor = GFColors.SUCCESS, this.autofocus = false, this.focusNode, this.toggleable = false}) @@ -42,10 +42,10 @@ class GFRadio extends StatefulWidget { final Color radioColor; /// type of [Color] used to change the backgroundColor of the active radio button - final Color activebgColor; + final Color activeBgColor; /// type of [Color] used to change the backgroundColor of the inactive radio button - final Color inactivebgColor; + final Color inactiveBgColor; /// type of [Color] used to change the border color of the active radio button final Color activeBorderColor; @@ -63,7 +63,7 @@ class GFRadio extends StatefulWidget { final Widget inactiveIcon; /// type of [Color] used to change the background color of the custom active radio button only - final Color custombgColor; + final Color customBgColor; /// on true state this widget will be selected as the initial focus /// when no other node in its scope is currently focused @@ -116,7 +116,7 @@ class _GFRadioState extends State> with TickerProviderStateMixin { height: widget.size, width: widget.size, decoration: BoxDecoration( - color: selected ? widget.activebgColor : widget.inactivebgColor, + color: selected ? widget.activeBgColor : widget.inactiveBgColor, borderRadius: widget.type == GFRadioType.basic ? BorderRadius.circular(50) : widget.type == GFRadioType.square @@ -159,7 +159,7 @@ class _GFRadioState extends State> with TickerProviderStateMixin { decoration: BoxDecoration( borderRadius: const BorderRadius.all( Radius.circular(50)), - color: widget.custombgColor), + color: widget.customBgColor), ) ], ) diff --git a/lib/components/radio_list_tile/gf_radio_list_tile.dart b/lib/components/radio_list_tile/gf_radio_list_tile.dart index 4b712258..86c738d0 100644 --- a/lib/components/radio_list_tile/gf_radio_list_tile.dart +++ b/lib/components/radio_list_tile/gf_radio_list_tile.dart @@ -11,8 +11,8 @@ class GFRadioListTile extends StatelessWidget { this.size = GFSize.SMALL, this.type = GFRadioType.basic, this.radioColor = GFColors.SUCCESS, - this.activebgColor = GFColors.WHITE, - this.inactivebgColor = GFColors.WHITE, + this.activeBgColor = GFColors.WHITE, + this.inactiveBgColor = GFColors.WHITE, this.activeBorderColor = GFColors.DARK, this.inactiveBorderColor = GFColors.DARK, this.position = GFPosition.end, @@ -22,7 +22,7 @@ class GFRadioListTile extends StatelessWidget { color: GFColors.DARK, ), this.inactiveIcon, - this.custombgColor = GFColors.SUCCESS, + this.customBgColor = GFColors.SUCCESS, this.autofocus = false, this.focusNode, this.toggleable = false, @@ -31,7 +31,7 @@ class GFRadioListTile extends StatelessWidget { this.color, this.avatar, this.title, - this.subTitle, + this.subtitle, this.description, this.icon, this.padding = const EdgeInsets.all(8), @@ -63,8 +63,8 @@ class GFRadioListTile extends StatelessWidget { /// The title to display inside the [GFListTile]. see [Text] final Widget title; - /// The subTitle to display inside the [GFListTile]. see [Text] - final Widget subTitle; + /// The subtitle to display inside the [GFListTile]. see [Text] + final Widget subtitle; /// The description to display inside the [GFListTile]. see [Text] final Widget description; @@ -127,10 +127,10 @@ class GFRadioListTile extends StatelessWidget { final Color radioColor; /// type of [Color] used to change the backgroundColor of the active checkbox - final Color activebgColor; + final Color activeBgColor; /// type of [Color] used to change the backgroundColor of the inactive checkbox - final Color inactivebgColor; + final Color inactiveBgColor; /// type of [Color] used to change the border color of the active checkbox final Color activeBorderColor; @@ -148,7 +148,7 @@ class GFRadioListTile extends StatelessWidget { final Widget inactiveIcon; /// type of [Color] used to change the background color of the custom active checkbox only - final Color custombgColor; + final Color customBgColor; /// The value represented by this radio button. final T value; @@ -171,13 +171,13 @@ class GFRadioListTile extends StatelessWidget { size: size, type: type, radioColor: radioColor, - activebgColor: activebgColor, + activeBgColor: activeBgColor, inactiveIcon: inactiveIcon, activeBorderColor: activeBorderColor, - inactivebgColor: inactivebgColor, + inactiveBgColor: inactiveBgColor, activeIcon: activeIcon, inactiveBorderColor: inactiveBorderColor, - custombgColor: custombgColor, + customBgColor: customBgColor, toggleable: toggleable, ); return MergeSemantics( @@ -199,7 +199,7 @@ class GFRadioListTile extends StatelessWidget { selected: selected, avatar: position == GFPosition.start ? radio : avatar, titleText: titleText, - subTitle: subTitle, + subtitle: subtitle, subtitleText: subtitleText, description: description, color: color, diff --git a/lib/components/sticky_header/gf_sticky_header.dart b/lib/components/sticky_header/gf_sticky_header.dart index e0bbb6ad..c28a3b59 100644 --- a/lib/components/sticky_header/gf_sticky_header.dart +++ b/lib/components/sticky_header/gf_sticky_header.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; import 'package:getwidget/getwidget.dart'; class GFStickyHeader extends MultiChildRenderObjectWidget { + /// GF Sticky Header will the stick header at top when content is being scrolled. /// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar. GFStickyHeader( {Key key, diff --git a/pubspec.lock b/pubspec.lock index b308ac32..65991e82 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,7 +73,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.3" + version: "1.3.0-nullsafety.4" path: dependency: transitive description: @@ -99,7 +99,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.1" + version: "1.10.0-nullsafety.2" stream_channel: dependency: transitive description: @@ -143,4 +143,4 @@ packages: source: hosted version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.10.0-110 <2.11.0" + dart: ">=2.10.0-110 <=2.11.0-213.1.beta"