diff --git a/lib/components/animation/gf_animation.dart b/lib/components/animation/gf_animation.dart index f0849a86..9c6c07ab 100644 --- a/lib/components/animation/gf_animation.dart +++ b/lib/components/animation/gf_animation.dart @@ -38,13 +38,13 @@ class GFAnimation extends StatefulWidget { /// The duration for animation to perform final Duration duration; - /// The duration for animation to perform + /// The duration for reverse animation to perform final Duration reverseDuration; - /// Defines how the animated widget is aligned within the Animation. + /// Defines how the animated widget is aligned during Animation. final Alignment alignment; - /// Defines how the animated widget is aligned(after the onTap) within the Animation. + /// Defines how the animated widget is aligned(after the onTap) during Animation. final Alignment activeAlignment; /// The child of type [Widget] to display animation effect. @@ -53,19 +53,20 @@ class GFAnimation extends StatefulWidget { /// Determines the animation curve. Defaults to [Curves.linear]. final Curve curve; - ///type of [GFAnimation] which takes the type ie, align, size, container, rotateTransition, scaleTransition, slideTransition, and textStyle for the [GFAnimation] + ///type of [GFAnimation] which takes the type ie, align, size, container, + /// rotateTransition, scaleTransition, slideTransition, and textStyle for the [GFAnimation] final GFAnimationType type; /// defines [AnimatedContainer] initial width final double width; - /// defines the width of [AnimatedContainer] upto which it can extend during animation + /// defines the width of [AnimatedContainer] upto which it can expand during animation final double changedWidth; /// defines [AnimatedContainer] initial height final double height; - /// defines the height of [AnimatedContainer] upto which it can extend during animation + /// defines the height of [AnimatedContainer] upto which it can expand during animation final double changedHeight; /// defines the color of [AnimatedContainer] when onTap triggers @@ -83,42 +84,40 @@ class GFAnimation extends StatefulWidget { /// Called when the user taps the [child] final Function onTap; - /// Here's an illustration of the [RotationTransition] widget, with it's [turnsAnimation] - /// animated by a stuckValue set to animate + /// For GFAnimationType.rotateTransition, customized turns animation can be added to [RotationTransition] widget final Animation turnsAnimation; - /// Here's an illustration of the [ScaleTransition] widget, with it's [scaleAnimation] - /// animated by a [CurvedAnimation] set to [Curves.linear] + /// For GFAnimationType.scaleTransition, customized scale animation can be added to [ScaleTransition] widget final Animation scaleAnimation; - /// controls animation + /// Type of [AnimationController], its a controller of an animation. final AnimationController controller; - ///direction of the [AnimatedDefaultTextStyle] TextDirection for [ltr,rtl] + /// Defines direction of the [AnimatedDefaultTextStyle] TextDirection i.e [ltr,rtl] final TextDirection textDirection; - /// [ScaleTransition], which animates the scale of a widget. + /// For GFAnimationType.slideTransition, which animates the position of a widget. final Animation slidePosition; - /// defines the [TextStyle] of [AnimatedDefaultTextStyle] + /// Defines the [TextStyle] of [AnimatedDefaultTextStyle] final TextStyle style; - /// defines the [TextAlign] of [AnimatedDefaultTextStyle] + /// Defines the [TextAlign] of [AnimatedDefaultTextStyle] final TextAlign textAlign; - /// defines the [TextOverflow] of [AnimatedDefaultTextStyle] + /// Defines the [TextOverflow] of [AnimatedDefaultTextStyle] final TextOverflow textOverflow; - /// defines the [maxLines] of [AnimatedDefaultTextStyle] + /// Defines the [maxLines] of [AnimatedDefaultTextStyle] final int maxLines; - /// defines the [TextWidthBasis] of [AnimatedDefaultTextStyle] + /// Defines the [TextWidthBasis] of [AnimatedDefaultTextStyle] final TextWidthBasis textWidthBasis; - /// defines the [fontSize] of [AnimatedDefaultTextStyle] + /// Defines the [fontSize] of [AnimatedDefaultTextStyle] final double fontSize; - /// defines the [fontWeight] of [AnimatedDefaultTextStyle] + /// Defines the [fontWeight] of [AnimatedDefaultTextStyle] final FontWeight fontWeight; @override diff --git a/lib/components/bottom_sheet/gf_bottom_sheet.dart b/lib/components/bottom_sheet/gf_bottom_sheet.dart index ad9ddf60..0772f64d 100644 --- a/lib/components/bottom_sheet/gf_bottom_sheet.dart +++ b/lib/components/bottom_sheet/gf_bottom_sheet.dart @@ -14,7 +14,7 @@ class GFBottomSheet extends StatefulWidget { this.elevation = 0.0, this.stickyFooterHeight = 0.0, this.stickyHeaderHeight = 0.0, - this.animationDuration = 300, + this.animationDuration = 1200, this.enableExpandableContent = false, }) : assert(elevation >= 0.0), assert(minContentHeight >= 0.0), @@ -71,7 +71,8 @@ class GFBottomSheet extends StatefulWidget { class _GFBottomSheetState extends State with TickerProviderStateMixin { - final StreamController controller = StreamController.broadcast(); + final StreamController _streamController = + StreamController.broadcast(); bool isDragDirectionUp; bool showBottomSheet = false; Function _controllerListener; @@ -152,11 +153,20 @@ class _GFBottomSheetState extends State child: widget.contentBody), ), ) - : showContent - ? StreamBuilder( - stream: controller.stream, + : widget.controller.height == widget.minContentHeight + ? Container() + : StreamBuilder( + stream: _streamController.stream, initialData: widget.controller.height, - builder: (context, snapshot) => GestureDetector( + builder: (BuildContext context, AsyncSnapshot snapshot) => + AnimatedContainer( + curve: Curves.easeOut, + duration: Duration( + milliseconds: widget.controller.animationDuration), + height: snapshot.hasData == null + ? widget.minContentHeight + : snapshot.data, + child: GestureDetector( onVerticalDragUpdate: (DragUpdateDetails details) { if (((widget.controller.height - details.delta.dy) > widget.minContentHeight) && @@ -167,19 +177,15 @@ class _GFBottomSheetState extends State isDragDirectionUp = details.delta.dy <= 0; widget.controller.height -= details.delta.dy; } - controller.add(widget.controller.height); + _streamController.add(widget.controller.height); }, onVerticalDragEnd: _onVerticalDragEnd, onTap: _onTap, behavior: HitTestBehavior.translucent, - child: Container( - height: snapshot.hasData == null - ? widget.minContentHeight - : snapshot.data, - child: widget.contentBody, - )), - ) - : Container(), + child: widget.contentBody, + ), + ), + ), widget.stickyFooter == null ? Container() : AnimatedBuilder( diff --git a/lib/components/button/gf_icon_button.dart b/lib/components/button/gf_icon_button.dart index 93acc6fa..a228c390 100644 --- a/lib/components/button/gf_icon_button.dart +++ b/lib/components/button/gf_icon_button.dart @@ -111,7 +111,7 @@ class _GFIconButtonState extends State { BoxShadow boxShadow; double height; double width; - double iconPixel; + double iconPixel = 18; @override void initState() { @@ -230,31 +230,34 @@ class _GFIconButtonState extends State { } else if (widget.size == GFSize.MEDIUM) { height = 35.0; width = 35.0; - iconPixel = 18.0; + iconPixel = 28.0; } else if (widget.size == GFSize.LARGE) { height = 40.0; width = 40.0; - iconPixel = 18.0; - } else { - height = 35.0; - width = 35.0; - iconPixel = 18.0; + iconPixel = 38.0; } Widget result = Container( - height: widget.shape == GFIconButtonShape.circle ? height + 6.0 : height, - width: widget.shape == GFIconButtonShape.pills - ? width + 10 - : widget.shape == GFIconButtonShape.circle - ? height + 6 - : width, + // height: widget.shape == GFIconButtonShape.circle ? height + 6.0 : height, + // width: widget.shape == GFIconButtonShape.pills + // ? width + 10 + // : widget.shape == GFIconButtonShape.circle + // ? height + 6 + // : width, padding: widget.padding, - child: IconTheme.merge( - data: IconThemeData( - size: widget.iconSize > 0.0 ? widget.iconSize : iconPixel, - color: getIconColor(), + child: SizedBox( + height: widget.iconSize != 0 ? widget.iconSize : iconPixel, + width: widget.iconSize != 0 ? widget.iconSize : iconPixel, + child: Align( + alignment: Alignment.center, + child: IconTheme.merge( + data: IconThemeData( + size: widget.iconSize > 0.0 ? widget.iconSize : iconPixel, + color: getIconColor(), + ), + child: widget.icon, + ), ), - child: widget.icon, ), ); @@ -308,46 +311,42 @@ class _GFIconButtonState extends State { child: Focus( focusNode: widget.focusNode, autofocus: widget.autofocus, - child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 60, maxHeight: 60), - child: Container( - height: - widget.shape == GFIconButtonShape.circle ? height + 6 : height, - width: widget.shape == GFIconButtonShape.pills - ? width + 10 - : widget.shape == GFIconButtonShape.circle - ? height + 6 - : width, - decoration: - widget.type == GFButtonType.solid ? getBoxShadow() : null, - child: Material( - shape: widget.type == GFButtonType.transparent - ? null - : widget.borderShape ?? shapeBorderType, - color: widget.onPressed != null - ? getColor() - : getDisabledFillColor(), - type: widget.type == GFButtonType.transparent - ? MaterialType.transparency - : MaterialType.button, - child: InkResponse( - onTap: widget.onPressed, - child: result, - focusColor: widget.focusColor ?? Theme.of(context).focusColor, - hoverColor: widget.hoverColor ?? Theme.of(context).hoverColor, - highlightColor: - widget.highlightColor ?? Theme.of(context).highlightColor, - splashColor: - widget.splashColor ?? Theme.of(context).splashColor, - radius: math.max( - Material.defaultSplashRadius, - (widget.iconSize + - math.min( - widget.padding.horizontal, - widget.padding.vertical, - )) * - 0.7), - ), + child: Container( + // height: + // widget.shape == GFIconButtonShape.circle ? height + 6 : height, + // width: widget.shape == GFIconButtonShape.pills + // ? width + 10 + // : widget.shape == GFIconButtonShape.circle + // ? height + 6 + // : width, + decoration: widget.type == GFButtonType.solid ? getBoxShadow() : null, + child: Material( + shape: widget.type == GFButtonType.transparent + ? null + : widget.borderShape ?? shapeBorderType, + color: + widget.onPressed != null ? getColor() : getDisabledFillColor(), + type: widget.type == GFButtonType.transparent + ? MaterialType.transparency + : MaterialType.button, + child: InkResponse( + onTap: widget.onPressed, + child: result, + focusColor: widget.focusColor ?? Theme.of(context).focusColor, + hoverColor: widget.hoverColor ?? Theme.of(context).hoverColor, + highlightColor: + widget.highlightColor ?? Theme.of(context).highlightColor, + splashColor: widget.splashColor ?? Theme.of(context).splashColor, + radius: math.max( + Material.defaultSplashRadius, + (widget.iconSize > 0.0 + ? widget.iconSize + : iconPixel + + math.min( + widget.padding.horizontal, + widget.padding.vertical, + )) * + 0.7), ), ), ), 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 fda47044..35142631 100644 --- a/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart +++ b/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart @@ -16,7 +16,7 @@ class GFCheckboxListTile extends StatelessWidget { this.icon, this.description, this.padding = const EdgeInsets.all(8), - this.margin = const EdgeInsets.all(16), + this.margin = const EdgeInsets.symmetric(vertical: 8, horizontal: 16), this.size = GFSize.MEDIUM, this.type = GFCheckboxType.basic, this.checkColor = GFColors.WHITE, diff --git a/lib/components/dropdown/gf_dropdown.dart b/lib/components/dropdown/gf_dropdown.dart index a8b4f137..bc56ff3f 100644 --- a/lib/components/dropdown/gf_dropdown.dart +++ b/lib/components/dropdown/gf_dropdown.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:getwidget/getwidget.dart'; class GFDropdown extends StatefulWidget { /// @@ -18,7 +19,7 @@ class GFDropdown extends StatefulWidget { this.iconDisabledColor, this.iconEnabledColor, this.iconSize = 24.0, - this.isDense = false, + this.isDense = true, this.isExpanded = false, this.itemHeight = kMinInteractiveDimension, this.focusColor, @@ -27,7 +28,9 @@ class GFDropdown extends StatefulWidget { this.dropdownColor, this.padding = const EdgeInsets.all(5), this.borderRadius = const BorderRadius.all(Radius.circular(4)), - this.borderColor}) + this.border = const BorderSide( + color: Colors.white, width: 1, style: BorderStyle.solid), + this.dropdownButtonColor = GFColors.WHITE}) : super(key: key); final DropdownButtonBuilder selectedItemBuilder; @@ -43,10 +46,10 @@ class GFDropdown extends StatefulWidget { /// The value of the currently selected [DropdownMenuItem]. final T value; - /// the color of the border of the dropdown button - final Color borderColor; + /// Defines the border of dropdown button + final BorderSide border; - ///The padding given inside the dropdown + /// Defines the padding given inside the dropdown final EdgeInsets padding; /// A placeholder widget that is displayed by the dropdown button. @@ -87,39 +90,42 @@ class GFDropdown extends StatefulWidget { /// Set the dropdown's inner contents to horizontally fill its parent. final bool isExpanded; - /// The default value is [kMinInteractiveDimension], which is also the minimum - /// height for menu items. - /// - /// If this value is null and there isn't enough vertical room for the menu, + /// Defines the height of the menu items final double itemHeight; /// The color for the button's [Material] when it has the input focus. final Color focusColor; - /// {@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; - /// The background color of the dropdown. + /// Defines the background color of the dropdown. final Color dropdownColor; - /// The border radius of the dropdown. + /// Defines the border radius of the dropdown. final BorderRadius borderRadius; + /// Defines the background color of the dropdownButton. + final dynamic dropdownButtonColor; + @override _GFDropdownState createState() => _GFDropdownState(); } class _GFDropdownState extends State { @override - Widget build(BuildContext context) => Card( - child: Container( + Widget build(BuildContext context) => Material( + color: widget.dropdownButtonColor, + shape: RoundedRectangleBorder( + side: widget.border, + borderRadius: widget.borderRadius, + ), + child: Padding( padding: widget.padding, - decoration: BoxDecoration( - borderRadius: widget.borderRadius, - border: Border.all(color: widget.borderColor ?? Colors.white)), child: DropdownButton( items: widget.items, selectedItemBuilder: widget.selectedItemBuilder, diff --git a/lib/components/dropdown/gf_multiselect.dart b/lib/components/dropdown/gf_multiselect.dart index 57ee6b80..9ebcf00d 100644 --- a/lib/components/dropdown/gf_multiselect.dart +++ b/lib/components/dropdown/gf_multiselect.dart @@ -1,27 +1,36 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; -class GFMultiSelect extends StatefulWidget { +class GFMultiSelect extends StatefulWidget { /// const GFMultiSelect({ - this.titleText, - this.selectedTextStyle = + @required this.items, + @required this.onSelect, + this.dropDownTitleTileText = 'Select : ', + this.dropDownTitleTileTextStyle = const TextStyle(fontSize: 16, fontWeight: FontWeight.w500), this.color, this.avatar, - this.padding = const EdgeInsets.all(0), + this.padding = const EdgeInsets.all(5), this.margin = const EdgeInsets.all(5), - this.size = GFSize.MEDIUM, + this.size = GFSize.SMALL, this.type = GFCheckboxType.basic, this.checkColor = GFColors.WHITE, this.activebgColor = GFColors.WHITE, this.inactivebgColor = GFColors.WHITE, this.activeBorderColor = GFColors.WHITE, this.inactiveBorderColor = GFColors.WHITE, - this.items, - this.submitbutton, - this.expandedicon = Icons.keyboard_arrow_down, - this.collapsedicon = Icons.keyboard_arrow_up, + this.submitButton, + this.expandedIcon = const Icon( + Icons.keyboard_arrow_down, + color: Colors.black87, + size: 30, + ), + this.collapsedIcon = const Icon( + Icons.keyboard_arrow_up, + color: Colors.black87, + size: 30, + ), this.dropdownbgColor = Colors.white, this.activeIcon = const Icon( Icons.check, @@ -31,55 +40,117 @@ class GFMultiSelect extends StatefulWidget { this.inactiveIcon, this.custombgColor = GFColors.SUCCESS, this.selected = false, + this.dropdownTitleTileBorder, + this.dropdownTitleTileBorderRadius = + const BorderRadius.all(Radius.circular(4)), + this.dropdownTitleTileColor = GFColors.WHITE, + this.hideDropdownUnderline = false, + this.dropdownUnderlineBorder = + const BorderSide(color: Colors.black12, width: 1), + this.dropdownTitleTileMargin = const EdgeInsets.all(16), + this.dropdownTitleTilePadding = const EdgeInsets.all(12), + this.dropDownTitleTileHintText, + this.dropDownTitleTileHintTextStyle = + const TextStyle(fontSize: 12, fontWeight: FontWeight.w400), Key key, }) : assert(selected != null), super(key: key); - ///type of [String] used to pass text, alternative to title property and gets higher priority than title - final String titleText; + /// defines the list of items the user can select + final List items; + + /// callback when user select item from the dropdown, + /// in callback we get list of selected items index + final ValueChanged> onSelect; + + /// type of [String] to define the dropdownTitleTile title + final String dropDownTitleTileText; + + /// type of [TextStyle] to define the textStyle of [dropDownTitleTileText] + final TextStyle dropDownTitleTileTextStyle; + + /// type of [String] to define the dropdownTitleTile hint text + final String dropDownTitleTileHintText; + + /// type of [TextStyle] to define the textStyle of [dropDownTitleTileHintTextStyle] + final TextStyle dropDownTitleTileHintTextStyle; + + /// defines the border radius of the dropdownTitleTile + final BorderRadius dropdownTitleTileBorderRadius; + + /// defines the border of the dropdownTitleTile. + final Border dropdownTitleTileBorder; + + /// defines the background color of dropdownButton + final dynamic dropdownTitleTileColor; + + /// on true state, it hides the Dropdown Underline border + /// defaults value is false + final bool hideDropdownUnderline; + + /// defines the border of the Dropdown Underline border + final BorderSide dropdownUnderlineBorder; + + /// defines the dropdownTitleTile margin + final EdgeInsets dropdownTitleTileMargin; + + /// defines the dropdownTitleTile padding + final EdgeInsets dropdownTitleTilePadding; + + /// defines the dropdownTitleTile's trailing icon when dropdown is visible + final Widget expandedIcon; - /// The GFListTile's background color. Can be given [Color] or [GFColors] - final Color color; + /// defines the dropdownTitleTile's trailing icon when dropdown is not visible + final Widget collapsedIcon; - /// type of [Widget] or [GFAvatar] used to create rounded user profile + /// defines the button in the dropdown + final Widget submitButton; + + /// defines dropdown checkbox ListTile's background color. Can be given [Color] or [GFColors] + final dynamic color; + + /// type of [Widget] or [GFAvatar] used to defines dropdown checkbox ListTile's leading final Widget avatar; - /// defines the margin of GFListTile + /// defines the margin of dropdown checkbox ListTile final EdgeInsets margin; - /// defines the padding of GFListTile + /// defines the padding of dropdown checkbox ListTile final EdgeInsets padding; + /// defines dropdown ListTile's checkbox type /// type of [GFCheckboxType] which is of four type is basic, sqaure, circular and custom final GFCheckboxType type; + /// defines dropdown ListTile's checkbox size /// 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 + /// 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; + /// 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; + /// defines dropdown ListTile's checkbox border color when its active /// type of [Color] used to change the border color of the active checkbox final Color activeBorderColor; + /// defines dropdown ListTile's checkbox border color when its inactive /// type of [Color] used to change the border color of the inactive checkbox final Color inactiveBorderColor; - /// Called when the user checks or unchecks the checkbox. - // final ValueChanged onChanged; - - ///Used to set the current state of the checkbox - // final bool value; - - ///type of Widget used to change the checkbox's active icon + /// defines dropdown ListTile's checkbox's active icon + /// type of [Widget] used to change the checkbox's active icon final Widget activeIcon; + /// defines dropdown ListTile's checkbox's inactive icon ///type of [Widget] used to change the checkbox's inactive icon final Widget inactiveIcon; @@ -90,39 +161,30 @@ class GFMultiSelect extends StatefulWidget { /// Normally, this property is left to its default value, false. final bool selected; - final List items; - - final Widget submitbutton; - + /// defines the background color of the dropdown. Can be given [Color] or [GFColors] final Color dropdownbgColor; - final TextStyle selectedTextStyle; - - final IconData expandedicon; - - final IconData collapsedicon; @override _GFMultiSelectState createState() => _GFMultiSelectState(); } -class _GFMultiSelectState extends State { - bool check = true; - bool isdrop = false; - bool check1 = false; - +class _GFMultiSelectState extends State> { + bool showDropdown = false; final _controller = TextEditingController(); - final List _selectedTitles = []; + final List _selectedTitlesIndex = []; - void _onItemSelect(bool selected, String title) { + void _onItemSelect(bool selected, int index) { if (selected == true) { setState(() { - _selectedTitles.add(title); + _selectedTitles.add(widget.items[index]); + _selectedTitlesIndex.add(index); }); } else { setState(() { - _selectedTitles.remove(title); + _selectedTitles.remove(widget.items[index]); + _selectedTitlesIndex.remove(index); }); } } @@ -136,99 +198,121 @@ class _GFMultiSelectState extends State { } @override - Widget build(BuildContext context) => Column( - children: [ - InkWell( - onTap: () { - setState(() { - isdrop = !isdrop; - }); - }, - child: Container( - - // height: 40, - width: MediaQuery.of(context).size.width, - decoration: const BoxDecoration( - border: - Border(bottom: BorderSide(color: Colors.black12))), - child: Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: Container( - padding: const EdgeInsets.only(bottom: 10), - child: Text(_selectedTitles.join(' , ').toString(), - style: widget.selectedTextStyle), - )), - Icon( - !isdrop ? widget.expandedicon : widget.collapsedicon, - color: Colors.black87, - size: 30, - ), - ], - ), - ))), - isdrop - ? Container( + Widget build(BuildContext context) { + Widget dropdownTile() => Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _selectedTitles.isEmpty + ? Expanded( + child: Text(widget.dropDownTitleTileText, + style: widget.dropDownTitleTileTextStyle)) + : Expanded( + child: Text(_selectedTitles.join(', ').toString(), + style: widget.dropDownTitleTileTextStyle)), + !showDropdown ? widget.expandedIcon : widget.collapsedIcon, + ], + ); + + return Column( + children: [ + InkWell( + onTap: () { + setState(() { + showDropdown = !showDropdown; + }); + }, + child: Container( + margin: widget.dropdownTitleTileMargin, + padding: widget.dropdownTitleTilePadding, + decoration: BoxDecoration( + color: widget.dropdownTitleTileColor, + border: widget.dropdownTitleTileBorder, + borderRadius: widget.dropdownTitleTileBorderRadius), + child: Container( decoration: BoxDecoration( - color: widget.dropdownbgColor, - boxShadow: const [ - BoxShadow( - color: Colors.black12, - blurRadius: 3, + border: widget.hideDropdownUnderline + ? const Border(bottom: BorderSide(color: Colors.white)) + : Border(bottom: widget.dropdownUnderlineBorder), + ), + child: widget.dropDownTitleTileHintText == null + ? dropdownTile() + : Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${widget.dropDownTitleTileHintText}', + style: widget.dropDownTitleTileHintTextStyle, + ), + dropdownTile(), + const SizedBox( + height: 2, + ) + ], + ), + ))), + showDropdown + ? Container( + padding: const EdgeInsets.symmetric(vertical: 6), + decoration: BoxDecoration( + color: widget.dropdownbgColor, + boxShadow: const [ + BoxShadow( + color: Colors.black12, + blurRadius: 3, + ) + ], + ), + child: SingleChildScrollView( + child: Column( + children: [ + Column( + children: List.generate( + widget.items.length, + (index) => GFCheckboxListTile( + value: _selectedTitles + .contains(widget.items[index]), + onChanged: (bool selected) { + _controller.text; + _onItemSelect(selected, index); + if (selected == null) { + widget.onSelect(null); + return; + } + widget.onSelect(_selectedTitlesIndex); + }, + selected: widget.selected, + avatar: widget.avatar, + titleText: widget.items[index], + color: widget.color, + padding: widget.padding, + margin: widget.margin, + size: widget.size, + activebgColor: widget.activebgColor, + inactiveIcon: widget.inactiveIcon, + activeBorderColor: widget.activeBorderColor, + inactivebgColor: widget.inactivebgColor, + activeIcon: widget.activeIcon, + inactiveBorderColor: + widget.inactiveBorderColor, + custombgColor: widget.custombgColor, + checkColor: widget.checkColor, + type: widget.type, + ))), + GFButton( + onPressed: () { + setState(() { + showDropdown = !showDropdown; + }); + }, + child: widget.submitButton ?? const Text('OK'), ) ], ), - height: 300, - child: SingleChildScrollView( - child: Column( - children: [ - Column( - children: List.generate( - widget.items.length, - (index) => GFCheckboxListTile( - value: _selectedTitles - .contains(widget.items[index]), - onChanged: (bool selected) { - _controller.text; - print(selected); - _onItemSelect( - selected, widget.items[index]); - }, - selected: widget.selected, - avatar: widget.avatar, - titleText: widget.items[index], - color: widget.color, - padding: widget.padding, - margin: widget.margin, - size: widget.size, - activebgColor: widget.activebgColor, - inactiveIcon: widget.inactiveIcon, - activeBorderColor: - widget.activeBorderColor, - inactivebgColor: widget.inactivebgColor, - activeIcon: widget.activeIcon, - inactiveBorderColor: - widget.inactiveBorderColor, - custombgColor: widget.custombgColor, - checkColor: widget.checkColor, - type: widget.type, - ))), - GFButton( - onPressed: () { - setState(() { - isdrop = !isdrop; - }); - }, - child: widget.submitbutton, - ) - ], - ), - ), - ) - : Container(), - ], - ); + ), + ) + : Container(), + ], + ); + } } diff --git a/lib/components/floating_widget/gf_floating_widget.dart b/lib/components/floating_widget/gf_floating_widget.dart index 9d0d55b6..1be9abc8 100644 --- a/lib/components/floating_widget/gf_floating_widget.dart +++ b/lib/components/floating_widget/gf_floating_widget.dart @@ -10,7 +10,7 @@ class GFFloatingWidget extends StatefulWidget { this.horizontalPosition, this.verticalPosition, this.blurnessColor, - this.showblurness = false, + this.showBlurness = false, this.body}) : super(key: key); @@ -30,7 +30,7 @@ class GFFloatingWidget extends StatefulWidget { final Color blurnessColor; ///type of bool which allows to show or hide the blurness of the backgroundColor whenever the [child] is used in [GFFloatingWidget] - final bool showblurness; + final bool showBlurness; @override _GFFloatingWidgetState createState() => _GFFloatingWidgetState(); @@ -64,7 +64,7 @@ class _GFFloatingWidgetState extends State { child: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, - color: widget.showblurness + color: widget.showBlurness ? widget.blurnessColor ?? Colors.black54 : null, child: Stack( diff --git a/lib/components/list_tile/gf_list_tile.dart b/lib/components/list_tile/gf_list_tile.dart index 5b08e13e..68fdf7ad 100644 --- a/lib/components/list_tile/gf_list_tile.dart +++ b/lib/components/list_tile/gf_list_tile.dart @@ -15,7 +15,7 @@ class GFListTile extends StatelessWidget { this.description, this.icon, this.padding = const EdgeInsets.all(8), - this.margin = const EdgeInsets.all(16), + this.margin = const EdgeInsets.symmetric(vertical: 8, horizontal: 16), this.enabled = true, this.onTap, this.onLongPress, diff --git a/lib/components/progress_bar/gf_progress_bar.dart b/lib/components/progress_bar/gf_progress_bar.dart index 3b2c09fd..2b4e2456 100644 --- a/lib/components/progress_bar/gf_progress_bar.dart +++ b/lib/components/progress_bar/gf_progress_bar.dart @@ -132,8 +132,8 @@ class _GFProgressBarState extends State _animationController = AnimationController( duration: Duration(milliseconds: widget.animationDuration), vsync: this); - _animation = - Tween(begin: 0, end: widget.percentage).animate(_animationController) + _animation = Tween(begin: _progressPercent, end: widget.percentage) + .animate(_animationController) ..addListener(() { setState(() { _progressPercent = _animation.value; @@ -148,7 +148,7 @@ class _GFProgressBarState extends State circularAnimationController = AnimationController( duration: Duration(milliseconds: widget.animationDuration), vsync: this); - circularAnimation = Tween(begin: 0, end: widget.percentage) + circularAnimation = Tween(begin: _percentage, end: widget.percentage) .animate(circularAnimationController) ..addListener(() { setState(() { 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 f4f09fb8..4b712258 100644 --- a/lib/components/radio_list_tile/gf_radio_list_tile.dart +++ b/lib/components/radio_list_tile/gf_radio_list_tile.dart @@ -35,7 +35,7 @@ class GFRadioListTile extends StatelessWidget { this.description, this.icon, this.padding = const EdgeInsets.all(8), - this.margin = const EdgeInsets.all(16), + this.margin = const EdgeInsets.symmetric(vertical: 8, horizontal: 16), this.enabled = true, this.onTap, this.onLongPress, diff --git a/lib/components/toast/gf_toast.dart b/lib/components/toast/gf_toast.dart index 94a3db0c..030444b5 100644 --- a/lib/components/toast/gf_toast.dart +++ b/lib/components/toast/gf_toast.dart @@ -63,8 +63,8 @@ class GFToast extends StatefulWidget { } class _GFToastState extends State with TickerProviderStateMixin { - AnimationController animationController, fadeanimationController; - Animation animation, fadeanimation; + AnimationController animationController, fadeAnimationController; + Animation animation, fadeAnimation; bool hideToast = false; @override @@ -78,24 +78,24 @@ class _GFToastState extends State with TickerProviderStateMixin { if (mounted) { animationController.forward(); - fadeanimationController = + fadeAnimationController = AnimationController(duration: widget.animationDuration, vsync: this) ..addListener(() => setState(() {})); - fadeanimation = Tween( + fadeAnimation = Tween( begin: 0, end: 1, - ).animate(fadeanimationController); + ).animate(fadeAnimationController); Timer(widget.duration, () { if (mounted) { - fadeanimationController.forward(); + fadeAnimationController.forward(); } }); - fadeanimation = Tween( + fadeAnimation = Tween( begin: 1, end: 0, - ).animate(fadeanimationController); - fadeanimation.addStatusListener((AnimationStatus state) { - if (fadeanimation.isCompleted && widget.autoDismiss) { + ).animate(fadeAnimationController); + fadeAnimation.addStatusListener((AnimationStatus state) { + if (fadeAnimation.isCompleted && widget.autoDismiss) { setState(() { hideToast = true; }); @@ -109,7 +109,7 @@ class _GFToastState extends State with TickerProviderStateMixin { @override void dispose() { animationController.dispose(); - fadeanimationController.dispose(); + fadeAnimationController.dispose(); super.dispose(); } @@ -117,7 +117,7 @@ class _GFToastState extends State with TickerProviderStateMixin { Widget build(BuildContext context) => hideToast ? Container() : FadeTransition( - opacity: widget.autoDismiss ? fadeanimation : animation, + opacity: widget.autoDismiss ? fadeAnimation : animation, child: Column( children: [ Container( diff --git a/lib/getwidget.dart b/lib/getwidget.dart index bd0a7242..c6c38e86 100644 --- a/lib/getwidget.dart +++ b/lib/getwidget.dart @@ -22,8 +22,8 @@ export 'package:getwidget/components/checkbox/gf_checkbox.dart'; export 'package:getwidget/components/checkbox_list_tile/gf_checkbox_list_tile.dart'; export 'package:getwidget/components/drawer/gf_drawer.dart'; export 'package:getwidget/components/drawer/gf_drawer_header.dart'; -// export 'package:getwidget/components/dropdown/gf_dropdown.dart'; -// export 'package:getwidget/components/dropdown/gf_multiselect.dart'; +export 'package:getwidget/components/dropdown/gf_dropdown.dart'; +export 'package:getwidget/components/dropdown/gf_multiselect.dart'; export 'package:getwidget/components/floating_widget/gf_floating_widget.dart'; export 'package:getwidget/components/image/gf_image_overlay.dart'; export 'package:getwidget/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart';