|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:getwidget/components/loader/gf_loader.dart'; |
| 3 | +import 'package:getwidget/getwidget.dart'; |
| 4 | + |
| 5 | +class GFIntroBottomNavigation extends StatelessWidget { |
| 6 | + const GFIntroBottomNavigation( |
| 7 | + {Key key, |
| 8 | + this.rightText = 'NEXT', |
| 9 | + this.pageNumber = 0, |
| 10 | + this.onNext, |
| 11 | + this.showDivider = true, |
| 12 | + this.dividerColor = Colors.grey, |
| 13 | + this.dividerHeight = 1, |
| 14 | + this.dividerThickness = 0.0, |
| 15 | + this.child, |
| 16 | + this.padding = const EdgeInsets.all(8), |
| 17 | + this.margin = const EdgeInsets.all(8), |
| 18 | + this.pagesCount = 4, |
| 19 | + this.skipText = 'SKIP', |
| 20 | + this.onSkipTap, |
| 21 | + this.skipWidget, |
| 22 | + this.nextWidget, |
| 23 | + this.pageCount = 1}) |
| 24 | + : super(key: key); |
| 25 | + |
| 26 | + final String rightText; |
| 27 | + final int pageNumber; |
| 28 | + final VoidCallback onNext; |
| 29 | + final bool showDivider; |
| 30 | + final double dividerHeight; |
| 31 | + final double dividerThickness; |
| 32 | + final Color dividerColor; |
| 33 | + final Widget child; |
| 34 | + final int pagesCount; |
| 35 | + final String skipText; |
| 36 | + final VoidCallback onSkipTap; |
| 37 | + final EdgeInsets padding; |
| 38 | + final EdgeInsets margin; |
| 39 | + final Widget skipWidget; |
| 40 | + final Widget nextWidget; |
| 41 | + final int pageCount; |
| 42 | + |
| 43 | + @override |
| 44 | + Widget build(BuildContext context) => Container( |
| 45 | + child: Column( |
| 46 | + mainAxisAlignment: MainAxisAlignment.end, |
| 47 | + children: <Widget>[ |
| 48 | + showDivider |
| 49 | + ? Divider( |
| 50 | + height: dividerHeight, |
| 51 | + thickness: dividerThickness, |
| 52 | + color: dividerColor, |
| 53 | + ) |
| 54 | + : Container(), |
| 55 | + Container( |
| 56 | + padding: padding, |
| 57 | + margin: margin, |
| 58 | + child: Row( |
| 59 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 60 | + children: <Widget>[ |
| 61 | + GestureDetector( |
| 62 | + behavior: HitTestBehavior.translucent, |
| 63 | + child: Padding( |
| 64 | + padding: const EdgeInsets.only( |
| 65 | + top: 8, |
| 66 | + bottom: 8, |
| 67 | + left: 24, |
| 68 | + right: 32, |
| 69 | + ), |
| 70 | + child: skipWidget ?? Text(skipText)), |
| 71 | + onTap: onSkipTap, |
| 72 | + ), |
| 73 | + SizedBox( |
| 74 | + height: 40, |
| 75 | + width: 100, |
| 76 | + child: ListView.builder( |
| 77 | + scrollDirection: Axis.horizontal, |
| 78 | + itemCount: pageCount, |
| 79 | + itemBuilder: (context, index) => Container( |
| 80 | + width: 12, |
| 81 | + height: 12, |
| 82 | + decoration: BoxDecoration( |
| 83 | + shape: BoxShape.circle, |
| 84 | + color: pageCount == 0 |
| 85 | + ? const Color(0xff3adecb) |
| 86 | + : const Color(0xffd3d3d3), |
| 87 | + ), |
| 88 | + ), |
| 89 | + ), |
| 90 | + ), |
| 91 | + GestureDetector( |
| 92 | + behavior: HitTestBehavior.translucent, |
| 93 | + child: Padding( |
| 94 | + padding: const EdgeInsets.only( |
| 95 | + top: 8, bottom: 8, left: 32, right: 24), |
| 96 | + child: nextWidget ?? Text(rightText), |
| 97 | + ), |
| 98 | + onTap: onNext, |
| 99 | + ), |
| 100 | + ], |
| 101 | + ), |
| 102 | + ) |
| 103 | + ], |
| 104 | + ), |
| 105 | + ); |
| 106 | +} |
0 commit comments