diff --git a/lib/components/animation/gf_animation.dart b/lib/components/animation/gf_animation.dart index 15752758..9aef13bd 100644 --- a/lib/components/animation/gf_animation.dart +++ b/lib/components/animation/gf_animation.dart @@ -34,10 +34,10 @@ class GFAnimation extends StatefulWidget { this.reverseDuration, }) : super(key: key); - /// The duration for animations of the [Decoration]. + /// `The duration for animation to perform` final Duration duration; - /// The duration for animations of the type[Size]. + /// The duration for animation to perform final Duration reverseDuration; /// Defines how the animated widget is aligned within the Animation. @@ -49,7 +49,7 @@ class GFAnimation extends StatefulWidget { /// The child of type [Widget] to display animation effect. final Widget child; - /// Determines the animation curve physics. Defaults to [Curves.linear]. + /// 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] @@ -58,51 +58,66 @@ class GFAnimation extends StatefulWidget { /// [AnimatedContainer] initial width final double width; - /// [AnimatedContainer] changed width + /// defines the width of [AnimatedContainer] upto which it can extend during animation final double changedWidth; /// [AnimatedContainer] initial height final double height; - /// [AnimatedContainer] changed height + /// defines the height of [AnimatedContainer] upto which it can extend during animation final double changedHeight; - /// defines the color of items when onTap triggers + /// defines the color of [AnimatedContainer] when onTap triggers final Color activeColor; - /// defines the color of items + /// defines the color of [AnimatedContainer] final Color color; - /// The empty space that surrounds the animation. Defines the animation outer [Container.padding].. + /// defines [child]'s or [AnimatedContainer] padding final EdgeInsetsGeometry padding; - /// The empty space that surrounds the animation. Defines the animation outer [Container.margin]. + /// defines [child]'s or [AnimatedContainer] margin final EdgeInsetsGeometry margin; + + /// 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 [Tween] set to [animate]: + /// animated by a stuckValue set to animate final Animation turnsAnimation; /// Here's an illustration of the [ScaleTransition] widget, with it's [scaleAnimation] - /// animated by a [CurvedAnimation] set to [Curves.linear]: + /// animated by a [CurvedAnimation] set to [Curves.linear] final Animation scaleAnimation; + /// controls animation final AnimationController controller; ///direction of the [AnimatedDefaultTextStyle] TextDirection for [ltr,rtl] final TextDirection textDirection; - /// * [ScaleTransition], which animates the scale of a widget. + /// [ScaleTransition], which animates the scale of a widget. final Animation slidePosition; + + /// defines the [TextStyle] of [AnimatedDefaultTextStyle] final TextStyle style; + + /// defines the [TextAlign] of [AnimatedDefaultTextStyle] final TextAlign textAlign; + + /// defines the [TextOverflow] of [AnimatedDefaultTextStyle] final TextOverflow textOverflow; - /// [AnimatedDefaultTextStyle] maxlines + /// defines the [maxLines] of [AnimatedDefaultTextStyle] final int maxLines; + + /// defines the [TextWidthBasis] of [AnimatedDefaultTextStyle] final TextWidthBasis textWidthBasis; + + /// defines the [fontSize] of [AnimatedDefaultTextStyle] final double fontSize; + + /// defines the [fontWeight] of [AnimatedDefaultTextStyle] final FontWeight fontWeight; @override diff --git a/lib/components/border/gf_border.dart b/lib/components/border/gf_border.dart index 3f74b802..29f980bc 100644 --- a/lib/components/border/gf_border.dart +++ b/lib/components/border/gf_border.dart @@ -14,9 +14,9 @@ class GFBorder extends StatelessWidget { this.radius = const Radius.circular(0), this.customPath, }) : assert(child != null), - assert(_isValiddashedLine(dashedLine), 'Invalid dash pattern'); + assert(_isValidDashedLine(dashedLine), 'Invalid dash pattern'); - /// child of type [Widget] which can be any component or text , etc + /// child of type [Widget] which can be any component or text, etc final Widget child; /// padding of time [EdgeInsets] where in padding is given to the border types @@ -61,7 +61,7 @@ class GFBorder extends StatelessWidget { } /// the value of dashedLine cannot be 0 or null, it should have some definite and proper value -bool _isValiddashedLine(List dash) { +bool _isValidDashedLine(List dash) { final Set _dashSet = dash.toSet(); if (_dashSet == null) { return false; diff --git a/lib/components/button/gf_button_bar.dart b/lib/components/button/gf_button_bar.dart index eb370b50..3b579d8f 100644 --- a/lib/components/button/gf_button_bar.dart +++ b/lib/components/button/gf_button_bar.dart @@ -45,7 +45,7 @@ class GFButtonBar extends StatelessWidget { /// are placed relative to each other in the cross axis. final WrapAlignment alignment; - /// How much space to place between children in a run in the main axis. + /// How much space to place bestuckValue children in a run in the main axis. /// /// For example, if [spacing] is 10.0, the children will be spaced at least /// 10.0 logical pixels apart in the main axis. @@ -73,7 +73,7 @@ class GFButtonBar extends StatelessWidget { /// are placed relative to each other in the cross axis. final WrapAlignment runAlignment; - /// How much space to place between the runs themselves in the cross axis. + /// How much space to place bestuckValue the runs themselves in the cross axis. /// /// For example, if [runSpacing] is 10.0, the runs will be spaced at least /// 10.0 logical pixels apart in the cross axis. diff --git a/lib/components/carousel/gf_carousel.dart b/lib/components/carousel/gf_carousel.dart index e0248337..65f80b24 100644 --- a/lib/components/carousel/gf_carousel.dart +++ b/lib/components/carousel/gf_carousel.dart @@ -75,7 +75,7 @@ class GFCarousel extends StatefulWidget { /// Sets Duration to determent the frequency of slides when [autoPlay] is set to true. Defaults to 4 seconds. final Duration autoPlayInterval; - /// The animation duration between two transitioning pages while in auto playback. Defaults to 800 ms. + /// The animation duration bestuckValue two transitioning pages while in auto playback. Defaults to 800 ms. final Duration autoPlayAnimationDuration; /// Determines the animation curve physics. Defaults to [Curves.fastOutSlowIn]. @@ -344,7 +344,7 @@ class _GFCarouselState extends State with TickerProviderStateMixin { /// For example; We have a Carousel of 10000(simulating infinity) but only 6 images. /// We need to repeat the images to give the illusion of a never ending stream. /// By calling _getRealIndex with position and base we get an offset. -/// This offset modulo our length, 6, will return a number between 0 and 5, which represent the image +/// This offset modulo our length, 6, will return a number bestuckValue 0 and 5, which represent the image /// to be placed in the given position. int _getRealIndex(int position, int base, int length) { final int offset = position - base; diff --git a/lib/components/checkbox/gf_checkbox.dart b/lib/components/checkbox/gf_checkbox.dart index e19fa9ca..3a06baf8 100644 --- a/lib/components/checkbox/gf_checkbox.dart +++ b/lib/components/checkbox/gf_checkbox.dart @@ -25,13 +25,13 @@ class GFCheckbox extends StatefulWidget { : assert(autofocus != null), super(key: key); - /// type of [GFCheckboxType] which is of four type is basic, sqaure, circular and custom + /// type of [GFCheckboxType] which is of four type is basic, square, circular and custom final GFCheckboxType type; /// 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 + /// 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 @@ -49,22 +49,23 @@ class GFCheckbox extends StatefulWidget { /// Called when the user checks or unchecks the checkbox. final ValueChanged onChanged; - ///Used to set the current state of the checkbox + /// Used to set the current state of the checkbox final bool value; - ///type of Widget used to change the checkbox's active icon + /// type of [Widget] used to change the checkbox's active icon final Widget activeIcon; - ///type of [Widget] used to change the checkbox's inactive icon + /// type of [Widget] used to change the checkbox's inactive icon final Widget inactiveIcon; - /// type of [Color] used to change the background color of the custom active checkbox only + /// type of [Color] used to change the background color of the custom active checkbox only final Color custombgColor; - /// {@macro flutter.widgets.Focus.autofocus} + /// on true state this widget will be selected as the initial focus + /// when no other node in its scope is currently focused final bool autofocus; - /// {@macro flutter.widgets.Focus.focusNode} + /// an optional focus node to use as the focus node for this widget. final FocusNode focusNode; @override diff --git a/lib/components/image/gf_image_overlay.dart b/lib/components/image/gf_image_overlay.dart index 95da3a8f..bfef2145 100644 --- a/lib/components/image/gf_image_overlay.dart +++ b/lib/components/image/gf_image_overlay.dart @@ -67,9 +67,9 @@ class GFImageOverlay extends StatelessWidget { /// /// If this is [BoxShape.circle] then [borderRadius] is ignored. /// - /// The [shape] cannot be interpolated; animating between two [BoxDecoration]s + /// The [shape] cannot be interpolated; animating bestuckValue two [BoxDecoration]s /// with different [shape]s will result in a discontinuity in the rendering. - /// To interpolate between two shapes, consider using [ShapeDecoration] and + /// To interpolate bestuckValue two shapes, consider using [ShapeDecoration] and /// different [ShapeBorder]s; in particular, [CircleBorder] instead of /// [BoxShape.circle] and [RoundedRectangleBorder] instead of /// [BoxShape.rectangle]. diff --git a/lib/components/intro_screen/gf__intro_bottom_navigation.dart b/lib/components/intro_screen/gf__intro_bottom_navigation.dart deleted file mode 100644 index c2aa444b..00000000 --- a/lib/components/intro_screen/gf__intro_bottom_navigation.dart +++ /dev/null @@ -1,160 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -class GFIntroBottomNavigation extends StatelessWidget { - const GFIntroBottomNavigation({ - Key key, - this.rightText = 'NEXT', - this.pageNumber = 0, - this.onNext, - this.showDivider = true, - this.dividerColor = Colors.grey, - this.dividerHeight = 1, - this.dividerThickness = 0.0, - this.child, - this.padding = const EdgeInsets.all(8), - this.margin = const EdgeInsets.all(8), - this.pagesCount = 0, - this.skipText = 'SKIP', - this.onSkipTap, - this.skipWidget, - this.rightWidget, - this.dotShape = BoxShape.circle, - this.defaultColor, - this.activeColor, - this.dotHeight, - this.dotWidth, - this.dotMargin, - this.skipStyle, - this.rightStyle, - this.onDoneTap, - this.doneText = 'GO', - }) : super(key: key); - - final String rightText; - final int pageNumber; - final VoidCallback onNext; - final bool showDivider; - final double dividerHeight; - final double dividerThickness; - final Color dividerColor; - final Widget child; - final int pagesCount; - final String skipText; - final VoidCallback onSkipTap; - final VoidCallback onDoneTap; - final EdgeInsets padding; - final EdgeInsets margin; - final Widget skipWidget; - final Widget rightWidget; - final TextStyle skipStyle; - final TextStyle rightStyle; - final String doneText; - - ///dot - final BoxShape dotShape; - final Color defaultColor; - final Color activeColor; - final double dotHeight; - final double dotWidth; - final EdgeInsets dotMargin; - - @override - Widget build(BuildContext context) => Container( - child: DefaultTextStyle( - style: const TextStyle( - color: Colors.black, - fontSize: 16, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - showDivider - ? Divider( - height: dividerHeight, - thickness: dividerThickness, - color: dividerColor, - ) - : Container(), - Container( - padding: padding, - margin: margin, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - behavior: HitTestBehavior.translucent, - child: Padding( - padding: const EdgeInsets.only( - top: 8, - bottom: 8, - left: 24, - right: 32, - ), - child: skipWidget ?? - Text( - skipText, - style: skipStyle ?? - const TextStyle( - color: Colors.black, - fontSize: 16, - ), - )), - onTap: onSkipTap, - ), - Expanded( - child: Container( - child: Stack( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: getDotsList(), - ) - ], - ), - ), - ), - GestureDetector( - behavior: HitTestBehavior.translucent, - child: Padding( - padding: const EdgeInsets.only( - top: 8, bottom: 8, left: 32, right: 24), - child: rightWidget ?? - Text( - pageNumber == pagesCount - 1 - ? doneText - : rightText, - style: rightStyle ?? - const TextStyle( - color: Colors.black, - fontSize: 16, - )), - ), - onTap: pageNumber == pagesCount - 1 ? onDoneTap : onNext, - ), - ], - ), - ) - ], - ), - ), - ); - - List getDotsList() { - final List list = []; - for (int i = 0; i < pagesCount; i++) { - list.add(Container( - width: dotWidth ?? 12, - height: dotHeight ?? 12, - margin: dotMargin ?? const EdgeInsets.symmetric(horizontal: 4), - decoration: BoxDecoration( - shape: dotShape, - color: pageNumber == i - ? activeColor ?? Colors.blue - : defaultColor ?? Colors.grey.withOpacity(0.5), - ), - )); - } - return list; - } -} diff --git a/lib/components/intro_screen/gf_intro_screen.dart b/lib/components/intro_screen/gf_intro_screen.dart index a2bcb973..ecd3a2d8 100644 --- a/lib/components/intro_screen/gf_intro_screen.dart +++ b/lib/components/intro_screen/gf_intro_screen.dart @@ -1,51 +1,230 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:getwidget/components/intro_screen/gf__intro_bottom_navigation.dart'; -import 'package:getwidget/components/intro_screen/gf_intro_slide.dart'; -import 'package:getwidget/types/gf_intro_type.dart'; +import 'package:getwidget/getwidget.dart'; class GFIntroScreen extends StatefulWidget { - const GFIntroScreen( - {Key key, - this.slides, - this.pageController, - this.gfIntroBottomNavigation, - this.type, - this.color = Colors.white}) - : super(key: key); - - /// if the type as [GFIntroType.fullWidth],[GFIntroType.half],[GFIntroType.rounded] use [GFIntroSlide]'s or customWidgets - final List slides; + const GFIntroScreen({ + Key key, + @required this.pageController, + @required this.slides, + this.color, + this.width, + this.height, + this.borderRadius, + this.border, + this.introScreenBottomNavigationBar, + this.showIntroSCreenBottomNavigationBar = true, + this.currentIndex = 0, + this.pageCount = 0, + this.child, + this.navigationBarColor = GFColors.SUCCESS, + this.navigationBarHeight = 50, + this.navigationBarShape, + this.navigationBarWidth, + this.navigationBarPadding = const EdgeInsets.all(8), + this.navigationBarMargin = const EdgeInsets.all(8), + this.showDivider = true, + this.dividerColor = Colors.white, + this.dividerHeight = 1, + this.dividerThickness = 2, + this.dotShape, + this.inActiveColor = GFColors.LIGHT, + this.activeColor = GFColors.PRIMARY, + this.dotHeight = 12, + this.dotWidth = 12, + this.dotMargin = const EdgeInsets.symmetric(horizontal: 2), + this.backButton, + this.forwardButton, + this.doneButton, + this.skipButton, + this.onDoneTap, + this.onForwardButtonTap, + this.onBackButtonTap, + this.onSkipTap, + this.forwardButtonText = 'NEXT', + this.backButtonText = 'BACK', + this.doneButtonText = 'GO', + this.skipButtonText = 'SKIP', + this.skipButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.doneButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.backButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.forwardButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.showButton = true, + this.showPagination = true, + }) : super(key: key); - /// type of [GFIntroType] which takes the type ie, fullWidth, half,rounded and bubble for the [GFIntroScreen] - final GFIntroType type; + /// defines the list of slides + final List slides; /// default controller for the [GFIntroScreen] component final PageController pageController; - /// [GFIntroScreen] bottom navigation will be used as [GFIntroBottomNavigation] component - final GFIntroBottomNavigation gfIntroBottomNavigation; - /// background color of the [GFIntroScreen] component final Color color; + /// defines [GFIntroScreen] height + final double height; + + /// defines [GFIntroScreen] width + final double width; + + /// defines [GFIntroScreen] border radius to defines slide shape + final BorderRadius borderRadius; + + /// defines [GFIntroScreen] border + final Border border; + + /// defines [GFIntroScreen]'s bottom navigation bar + final GFIntroScreenBottomNavigationBar introScreenBottomNavigationBar; + + /// on true state, displays [GFIntroScreenBottomNavigationBar], defaults to true + final bool showIntroSCreenBottomNavigationBar; + + /// defines the currentIndex of [GFIntroScreen] slides, default value is 0 + final int currentIndex; + + /// defines the length of [GFIntroScreen] slides, default value is 0 + final int pageCount; + + /// defines [GFIntroScreenBottomNavigationBar], it takes any widget + final Widget child; + + /// defines [GFIntroScreenBottomNavigationBar] height + final double navigationBarHeight; + + /// defines [GFIntroScreenBottomNavigationBar] width + final double navigationBarWidth; + + /// defines [GFIntroScreenBottomNavigationBar] padding + final EdgeInsets navigationBarPadding; + + /// defines [GFIntroScreenBottomNavigationBar] margin + final EdgeInsets navigationBarMargin; + + /// defines [GFIntroScreenBottomNavigationBar] color + final dynamic navigationBarColor; + + /// defines the shape of [GFIntroScreenBottomNavigationBar] + final ShapeBorder navigationBarShape; + + /// Called when the forward button is tapped + final VoidCallback onForwardButtonTap; + + /// Called when the back button is tapped + final VoidCallback onBackButtonTap; + + /// Called when the done button is tapped + final VoidCallback onDoneTap; + + /// Called when the skip button is tapped + final VoidCallback onSkipTap; + + /// defines the backButton widget + final Widget backButton; + + /// defines the forwardButton widget + final Widget forwardButton; + + /// defines the doneButton widget + final Widget doneButton; + + /// defines the skipButton widget + final Widget skipButton; + + /// defines the backButton text + final String backButtonText; + + /// defines the forwardButton text + final String forwardButtonText; + + /// defines the doneButton text + final String doneButtonText; + + /// defines the skipButton text + final String skipButtonText; + + /// defines the skipButton textStyle + final TextStyle skipButtonTextStyle; + + /// defines the doneButton textStyle + final TextStyle doneButtonTextStyle; + + /// defines the backButton textStyle + final TextStyle backButtonTextStyle; + + /// defines the forwardButton textStyle + final TextStyle forwardButtonTextStyle; + + /// on true state, displays [Divider], defaults to true + final bool showDivider; + + /// on true state, displays buttons, defaults to true + final bool showButton; + + /// on true state, displays pagination, defaults to true + final bool showPagination; + + /// defines divider height + final double dividerHeight; + + /// defines divider thickness + final double dividerThickness; + + /// defines divider color + final dynamic dividerColor; + + /// defines pagination shape + final ShapeBorder dotShape; + + /// defines pagination inactive color + final Color inActiveColor; + + /// defines pagination active color + final Color activeColor; + + /// defines pagination height + final double dotHeight; + + /// defines pagination width + final double dotWidth; + + /// defines pagination in between space + final EdgeInsets dotMargin; + @override _GFIntroScreenState createState() => _GFIntroScreenState(); } class _GFIntroScreenState extends State { - PageController _pageController = PageController(initialPage: 0); - int page = 0; + PageController _pageController; + int currentIndex; List pages; @override void initState() { + _pageController = widget.pageController != null + ? widget.pageController + : PageController(initialPage: 0); + currentIndex = _pageController.initialPage; if (widget.pageController != null) { _pageController = widget.pageController; } _pageController.addListener(() { if (mounted) { setState(() { - page = _pageController.page.round(); + currentIndex = _pageController.page.round(); }); } }); @@ -55,52 +234,66 @@ class _GFIntroScreenState extends State { @override Widget build(BuildContext context) => Center( child: Container( - width: widget.type == GFIntroType.fullWidth - ? MediaQuery.of(context).size.width - : MediaQuery.of(context).size.width * 0.885, - height: widget.type != GFIntroType.fullWidth - ? MediaQuery.of(context).size.height / 2 - : MediaQuery.of(context).size.height, - margin: widget.type != GFIntroType.fullWidth - ? const EdgeInsets.only(left: 20, right: 20) - : const EdgeInsets.only(left: 0, right: 0), - padding: widget.type == GFIntroType.fullWidth - ? const EdgeInsets.all(0) - : const EdgeInsets.all(0), + width: widget.width, + height: widget.height, decoration: BoxDecoration( + borderRadius: widget.borderRadius ?? BorderRadius.circular(0), + border: widget.border ?? Border.all(width: 0), color: widget.color, - borderRadius: widget.type == GFIntroType.fullWidth - ? BorderRadius.circular(0) - : widget.type == GFIntroType.rounded - ? BorderRadius.circular(24) - : BorderRadius.zero, ), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( - child: ClipRRect( - borderRadius: widget.type == GFIntroType.rounded - ? const BorderRadius.only( - topLeft: Radius.circular(24), - topRight: Radius.circular(24)) - : BorderRadius.zero, child: PageView( controller: _pageController, children: widget.slides, ), - )), - widget.gfIntroBottomNavigation ?? - GFIntroBottomNavigation( - onNext: () { - _pageController.nextPage( - duration: const Duration(milliseconds: 500), - curve: Curves.linear); - }, - pagesCount: widget.slides.length, - pageNumber: page, - ) + ), + widget.showIntroSCreenBottomNavigationBar + ? widget.introScreenBottomNavigationBar ?? + GFIntroScreenBottomNavigationBar( + pageController: _pageController, + pageCount: widget.slides.length, + currentIndex: currentIndex, + child: widget.child, + navigationBarColor: widget.navigationBarColor, + navigationBarHeight: widget.navigationBarHeight, + navigationBarShape: widget.navigationBarShape, + navigationBarWidth: widget.navigationBarWidth, + navigationBarPadding: widget.navigationBarPadding, + navigationBarMargin: widget.navigationBarMargin, + showDivider: widget.showDivider, + dividerColor: widget.dividerColor, + dividerHeight: widget.dividerHeight, + dividerThickness: widget.dividerThickness, + dotShape: widget.dotShape, + inActiveColor: widget.inActiveColor, + activeColor: widget.activeColor, + dotHeight: widget.dotHeight, + dotWidth: widget.dotWidth, + dotMargin: widget.dotMargin, + backButton: widget.backButton, + forwardButton: widget.forwardButton, + doneButton: widget.doneButton, + skipButton: widget.skipButton, + onDoneTap: widget.onDoneTap, + onForwardButtonTap: widget.onForwardButtonTap, + onBackButtonTap: widget.onBackButtonTap, + onSkipTap: widget.onSkipTap, + forwardButtonText: widget.forwardButtonText, + backButtonText: widget.backButtonText, + doneButtonText: widget.doneButtonText, + skipButtonText: widget.skipButtonText, + skipButtonTextStyle: widget.skipButtonTextStyle, + doneButtonTextStyle: widget.doneButtonTextStyle, + backButtonTextStyle: widget.backButtonTextStyle, + forwardButtonTextStyle: widget.forwardButtonTextStyle, + showButton: widget.showButton, + showPagination: widget.showPagination, + ) + : Container(), ], ), ), 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 new file mode 100644 index 00000000..0ea9d32b --- /dev/null +++ b/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart @@ -0,0 +1,273 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:getwidget/getwidget.dart'; + +class GFIntroScreenBottomNavigationBar extends StatelessWidget { + const GFIntroScreenBottomNavigationBar({ + Key key, + this.pageController, + this.currentIndex = 0, + this.pageCount = 0, + this.child, + this.navigationBarColor = GFColors.SUCCESS, + this.navigationBarHeight = 50, + this.navigationBarShape, + this.navigationBarWidth, + this.navigationBarPadding = const EdgeInsets.all(8), + this.navigationBarMargin = const EdgeInsets.all(8), + this.showDivider = true, + this.dividerColor = Colors.white, + this.dividerHeight = 1, + this.dividerThickness = 2, + this.dotShape, + this.inActiveColor = GFColors.LIGHT, + this.activeColor = GFColors.PRIMARY, + this.dotHeight = 12, + this.dotWidth = 12, + this.dotMargin = const EdgeInsets.symmetric(horizontal: 2), + this.backButton, + this.forwardButton, + this.doneButton, + this.skipButton, + this.onDoneTap, + this.onForwardButtonTap, + this.onBackButtonTap, + this.onSkipTap, + this.forwardButtonText = 'NEXT', + this.backButtonText = 'BACK', + this.doneButtonText = 'GO', + this.skipButtonText = 'SKIP', + this.skipButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.doneButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.backButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.forwardButtonTextStyle = const TextStyle( + color: Colors.black, + fontSize: 16, + ), + this.showButton = true, + this.showPagination = true, + }) : super(key: key); + + /// default controller for the [GFIntroScreen] component + final PageController pageController; + + /// defines the currentIndex of [GFIntroScreen] slides, default value is 0 + final int currentIndex; + + /// defines the length of [GFIntroScreen] slides, default value is 0 + final int pageCount; + + /// defines [GFIntroScreenBottomNavigationBar], it takes any widget + final Widget child; + + /// defines [GFIntroScreenBottomNavigationBar] height + final double navigationBarHeight; + + /// defines [GFIntroScreenBottomNavigationBar] width + final double navigationBarWidth; + + /// defines [GFIntroScreenBottomNavigationBar] padding + final EdgeInsets navigationBarPadding; + + /// defines [GFIntroScreenBottomNavigationBar] margin + final EdgeInsets navigationBarMargin; + + /// defines [GFIntroScreenBottomNavigationBar] color + final dynamic navigationBarColor; + + /// defines the shape of [GFIntroScreenBottomNavigationBar] + final ShapeBorder navigationBarShape; + + /// Called when the forward button is tapped + final VoidCallback onForwardButtonTap; + + /// Called when the back button is tapped + final VoidCallback onBackButtonTap; + + /// Called when the done button is tapped + final VoidCallback onDoneTap; + + /// Called when the skip button is tapped + final VoidCallback onSkipTap; + + /// defines the backButton widget + final Widget backButton; + + /// defines the forwardButton widget + final Widget forwardButton; + + /// defines the doneButton widget + final Widget doneButton; + + /// defines the skipButton widget + final Widget skipButton; + + /// defines the backButton text + final String backButtonText; + + /// defines the forwardButton text + final String forwardButtonText; + + /// defines the doneButton text + final String doneButtonText; + + /// defines the skipButton text + final String skipButtonText; + + /// defines the skipButton textStyle + final TextStyle skipButtonTextStyle; + + /// defines the doneButton textStyle + final TextStyle doneButtonTextStyle; + + /// defines the backButton textStyle + final TextStyle backButtonTextStyle; + + /// defines the forwardButton textStyle + final TextStyle forwardButtonTextStyle; + + /// on true state, displays [Divider], defaults to true + final bool showDivider; + + /// on true state, displays buttons, defaults to true + final bool showButton; + + /// on true state, displays pagination, defaults to true + final bool showPagination; + + /// defines divider height + final double dividerHeight; + + /// defines divider thickness + final double dividerThickness; + + /// defines divider color + final dynamic dividerColor; + + /// defines pagination shape + final ShapeBorder dotShape; + + /// defines pagination inactive color + final Color inActiveColor; + + /// defines pagination active color + final Color activeColor; + + /// defines pagination height + final double dotHeight; + + /// defines pagination width + final double dotWidth; + + /// defines pagination in between space + final EdgeInsets dotMargin; + + void onForwardButton() { + pageController.nextPage( + duration: const Duration(milliseconds: 500), curve: Curves.linear); + } + + void onBackButton() { + pageController.previousPage( + duration: const Duration(milliseconds: 500), curve: Curves.linear); + } + + @override + Widget build(BuildContext context) => Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + showDivider + ? Divider( + height: dividerHeight, + thickness: dividerThickness, + color: dividerColor, + ) + : Container(), + Material( + child: Container( + height: navigationBarHeight, + width: navigationBarWidth, + child: Material( + shape: navigationBarShape, + color: navigationBarColor, + child: Container( + padding: navigationBarPadding, + margin: navigationBarMargin, + child: child != null + ? Row( + children: [child], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + showButton + ? InkWell( + child: currentIndex == 0 + ? skipButton ?? + Text(skipButtonText, + style: skipButtonTextStyle) + : backButton ?? + Text(backButtonText, + style: backButtonTextStyle), + onTap: currentIndex == 0 + ? onSkipTap + : onBackButtonTap ?? onBackButton, + ) + : Container(), + showPagination + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + children: getDotsList(), + ) + : Container(), + showButton + ? InkWell( + child: currentIndex == pageCount - 1 + ? doneButton ?? + Text(doneButtonText, + style: doneButtonTextStyle) + : forwardButton ?? + Text(forwardButtonText, + style: forwardButtonTextStyle), + onTap: currentIndex == pageCount - 1 + ? onDoneTap + : onForwardButtonTap ?? onForwardButton, + ) + : Container(), + ], + ), + ), + ), + ), + ) + ], + ); + + List getDotsList() { + final List list = []; + for (int i = 0; i < pageCount; i++) { + list.add(Container( + margin: dotMargin, + child: Material( + shape: dotShape ?? + RoundedRectangleBorder(borderRadius: BorderRadius.circular(50)), + color: currentIndex == i ? activeColor : inActiveColor, + child: Container( + width: dotWidth, + height: dotHeight, + ), + ), + )); + } + return list; + } +} diff --git a/lib/components/intro_screen/gf_intro_slide.dart b/lib/components/intro_screen/gf_intro_slide.dart deleted file mode 100644 index a084eb7d..00000000 --- a/lib/components/intro_screen/gf_intro_slide.dart +++ /dev/null @@ -1,55 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:getwidget/colors/gf_color.dart'; -import 'package:getwidget/components/image/gf_image_overlay.dart'; - -class GFIntroSlide extends StatelessWidget { - const GFIntroSlide({ - Key key, - @required this.image, - this.imageHeight = 100, - this.imageWidth = 100, - this.title, - this.subTitle, - this.titleStyle = const TextStyle(fontSize: 20, color: GFColors.DARK), - this.subTitleStyle = const TextStyle(fontSize: 16, color: GFColors.DARK), - this.backgroundColor = GFColors.PRIMARY, - }) : super(key: key); - final double imageHeight; - final double imageWidth; - final ImageProvider image; - final String title; - final TextStyle titleStyle; - final String subTitle; - final TextStyle subTitleStyle; - final Color backgroundColor; - - @override - Widget build(BuildContext context) => Container( - color: backgroundColor, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GFImageOverlay( - height: imageHeight, - colorFilter: const ColorFilter.mode(null, null), - width: imageWidth, - image: image), - const SizedBox( - height: 20, - ), - Text( - title ?? 'Title', - style: titleStyle, - ), - const SizedBox( - height: 40, - ), - Text( - subTitle ?? 'Sub Title', - style: subTitleStyle, - ) - ], - ), - ); -} diff --git a/lib/components/progress_bar/gf_progress_bar.dart b/lib/components/progress_bar/gf_progress_bar.dart index 5da517f8..dc6e55ad 100644 --- a/lib/components/progress_bar/gf_progress_bar.dart +++ b/lib/components/progress_bar/gf_progress_bar.dart @@ -36,7 +36,7 @@ class GFProgressBar extends StatefulWidget { assert(circleStartAngle >= 0.0); if (percentage < 0.0 || percentage > 1.0) { - throw Exception('Percentage value must be between 0.0 and 1.0'); + throw Exception('Percentage value must be be tween 0.0 and 1.0'); } } diff --git a/lib/components/radio/gf_radio.dart b/lib/components/radio/gf_radio.dart index f39dac92..5573c48d 100644 --- a/lib/components/radio/gf_radio.dart +++ b/lib/components/radio/gf_radio.dart @@ -41,39 +41,40 @@ class GFRadio extends StatefulWidget { /// 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 + /// type pf [Color] used to change the checkcolor when the radio button is active final Color radioColor; - /// type of [Color] used to change the backgroundColor of the active checkbox + /// type of [Color] used to change the backgroundColor of the active radio button final Color activebgColor; - /// type of [Color] used to change the backgroundColor of the inactive checkbox + /// type of [Color] used to change the backgroundColor of the inactive radio button final Color inactivebgColor; - /// type of [Color] used to change the border color of the active checkbox + /// type of [Color] used to change the border color of the active radio button final Color activeBorderColor; - /// type of [Color] used to change the border color of the inactive checkbox + /// type of [Color] used to change the border color of the inactive radio button final Color inactiveBorderColor; - /// Called when the user checks or unchecks the checkbox. + /// Called when the user checks or unchecks the radio button final ValueChanged onChanged; - ///type of Widget used to change the checkbox's active icon + ///type of Widget used to change the radio button's active icon final Widget activeIcon; - ///type of [Widget] used to change the checkbox's inactive icon + ///type of [Widget] used to change the radio button's inactive icon final Widget inactiveIcon; - /// type of [Color] used to change the background color of the custom active checkbox only + /// type of [Color] used to change the background color of the custom active radio button only final Color custombgColor; - /// {@macro flutter.widgets.Focus.focusNode} - final FocusNode focusNode; - - /// {@macro flutter.widgets.Focus.autofocus} + /// on true state this widget will be selected as the initial focus + /// when no other node in its scope is currently focused final bool autofocus; + /// an optional focus node to use as the focus node for this widget. + final FocusNode focusNode; + /// The value represented by this radio button. final T value; 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 6c5bade8..c6464d78 100644 --- a/lib/components/radio_list_tile/gf_radio_list_tile.dart +++ b/lib/components/radio_list_tile/gf_radio_list_tile.dart @@ -109,12 +109,13 @@ class GFRadioListTile extends StatelessWidget { /// The color for the tile's [Material] when a pointer is hovering over it. final Color hoverColor; - /// {@macro flutter.widgets.Focus.focusNode} - final FocusNode focusNode; - - /// {@macro flutter.widgets.Focus.autofocus} + /// on true state this widget will be selected as the initial focus + /// when no other node in its scope is currently focused final bool autofocus; + /// an optional focus node to use as the focus node for this widget. + final FocusNode focusNode; + /// type of [GFRadioType] which is of four type is basic, sqaure, circular and custom final GFRadioType type; diff --git a/lib/components/rating/gf_rating.dart b/lib/components/rating/gf_rating.dart index 2af1517b..d6de70cb 100644 --- a/lib/components/rating/gf_rating.dart +++ b/lib/components/rating/gf_rating.dart @@ -48,7 +48,7 @@ class GFRating extends StatefulWidget { /// defines the default items, when having filledIcon && halfFilledIcon final Widget defaultIcon; - /// defines the space between items + /// defines the space bestuckValue items final double spacing; /// defines the rating value diff --git a/lib/getwidget.dart b/lib/getwidget.dart index c73500d2..c53c9728 100644 --- a/lib/getwidget.dart +++ b/lib/getwidget.dart @@ -3,6 +3,7 @@ library getwidget; //exports components export 'package:getwidget/components/accordian/gf_accordian.dart'; export 'package:getwidget/components/alert/gf_alert.dart'; +export 'package:getwidget/components/animation/gf_animation.dart'; export 'package:getwidget/components/appbar/gf_appbar.dart'; export 'package:getwidget/components/avatar/gf_avatar.dart'; export 'package:getwidget/components/badge/gf_badge.dart'; @@ -23,6 +24,8 @@ export 'package:getwidget/components/drawer/gf_drawer.dart'; export 'package:getwidget/components/drawer/gf_drawer_header.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'; +export 'package:getwidget/components/intro_screen/gf_intro_screen.dart'; export 'package:getwidget/components/list_tile/gf_list_tile.dart'; export 'package:getwidget/components/loader/gf_loader.dart'; export 'package:getwidget/components/progress_bar/gf_progress_bar.dart'; @@ -52,9 +55,11 @@ export 'shape/gf_button_shape.dart'; export 'shape/gf_icon_button_shape.dart'; export 'size/gf_size.dart'; export 'types/gf_alert_type.dart'; +export 'types/gf_animation_type.dart'; export 'types/gf_border_type.dart'; export 'types/gf_button_type.dart'; export 'types/gf_checkbox_type.dart'; +export 'types/gf_intro_type.dart'; export 'types/gf_loader_type.dart'; export 'types/gf_progress_type.dart'; export 'types/gf_radio_type.dart';