Skip to content

Commit 549e56a

Browse files
committed
structure changes done in GFIntro bottom navigation
1 parent 4ada99f commit 549e56a

File tree

2 files changed

+54
-54
lines changed

2 files changed

+54
-54
lines changed

lib/components/intro_screen/gf_intro_bottom_navigation.dart

Lines changed: 48 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,76 @@ import 'package:flutter/material.dart';
44
class GFIntroBottomNavigation extends StatelessWidget {
55
const GFIntroBottomNavigation({
66
Key key,
7-
this.forwardButtonText = 'NEXT',
87
this.pageNumber = 0,
9-
this.onNext,
10-
this.showDivider = true,
11-
this.dividerColor = Colors.grey,
12-
this.dividerHeight = 1,
13-
this.dividerThickness = 0.0,
14-
this.child,
8+
this.pagesCount = 0,
159
this.padding = const EdgeInsets.all(8),
1610
this.margin = const EdgeInsets.all(8),
17-
this.pagesCount = 0,
18-
this.backButtonText = 'BACK',
19-
this.onBackButtonTap,
20-
this.backButton,
21-
this.forwardButton,
11+
this.child,
12+
13+
this.showDivider = true,
14+
this.dividerColor = Colors.white,
15+
this.dividerHeight = 1,
16+
this.dividerThickness = 2,
17+
2218
this.dotShape = BoxShape.circle,
23-
this.defaultColor,
19+
this.inActiveColor,
2420
this.activeColor,
2521
this.dotHeight,
2622
this.dotWidth,
2723
this.dotMargin,
28-
this.backButtonTextStyle,
29-
this.forwardButtonTextStyle,
24+
25+
this.backButton,
26+
this.forwardButton,
27+
this.doneButton,
28+
this.skipButton,
3029
this.onDoneTap,
31-
this.doneText = 'GO',
30+
this.onForwardButtonTap,
31+
this.onBackButtonTap,
32+
this.onSkipTap,
33+
this.forwardButtonText = 'NEXT',
34+
this.backButtonText = 'BACK',
35+
this.doneButtonText = 'GO',
36+
this.skipButtonText = 'SKIP',
37+
this.skipButtonTextStyle = const TextStyle(color: Colors.black, fontSize: 16,),
38+
this.doneButtonTextStyle = const TextStyle(color: Colors.black, fontSize: 16,),
39+
this.backButtonTextStyle = const TextStyle(color: Colors.black, fontSize: 16,),
40+
this.forwardButtonTextStyle = const TextStyle(color: Colors.black, fontSize: 16,),
3241
}) : super(key: key);
3342

34-
final String forwardButtonText;
35-
final int pageNumber;
36-
final VoidCallback onNext;
3743

44+
final int pageNumber;
3845
final Widget child;
3946
final int pagesCount;
40-
final String backButtonText;
41-
final VoidCallback onBackButtonTap;
42-
final VoidCallback onDoneTap;
4347
final EdgeInsets padding;
4448
final EdgeInsets margin;
49+
final VoidCallback onForwardButtonTap;
50+
final VoidCallback onBackButtonTap;
51+
final VoidCallback onDoneTap;
52+
final VoidCallback onSkipTap;
4553
final Widget backButton;
4654
final Widget forwardButton;
55+
final Widget doneButton;
56+
final Widget skipButton;
57+
final String backButtonText;
58+
final String forwardButtonText;
59+
final String doneButtonText;
60+
final String skipButtonText;
61+
final TextStyle skipButtonTextStyle;
62+
final TextStyle doneButtonTextStyle;
4763
final TextStyle backButtonTextStyle;
4864
final TextStyle forwardButtonTextStyle;
49-
final String doneText;
50-
5165
final bool showDivider;
5266
final double dividerHeight;
5367
final double dividerThickness;
5468
final Color dividerColor;
55-
56-
///dot
5769
final BoxShape dotShape;
58-
final Color defaultColor;
70+
final Color inActiveColor;
5971
final Color activeColor;
6072
final double dotHeight;
6173
final double dotWidth;
6274
final EdgeInsets dotMargin;
6375

76+
6477
@override
6578
Widget build(BuildContext context) => Column(
6679
mainAxisAlignment: MainAxisAlignment.end,
@@ -78,37 +91,19 @@ class GFIntroBottomNavigation extends StatelessWidget {
7891
child: Row(
7992
mainAxisAlignment: MainAxisAlignment.spaceBetween,
8093
children: <Widget>[
81-
GestureDetector(
82-
behavior: HitTestBehavior.translucent,
83-
child: backButton ??
84-
Text(
85-
backButtonText,
86-
style: backButtonTextStyle ??
87-
const TextStyle(
88-
color: Colors.black,
89-
fontSize: 16,
90-
),
91-
),
94+
InkWell(
95+
child: pageNumber == 0 ? skipButton ?? Text(skipButtonText, style: skipButtonTextStyle) :
96+
backButton ?? Text(backButtonText, style: backButtonTextStyle),
9297
onTap: onBackButtonTap,
9398
),
9499
Row(
95100
mainAxisAlignment: MainAxisAlignment.center,
96101
children: getDotsList(),
97102
),
98-
GestureDetector(
99-
behavior: HitTestBehavior.translucent,
100-
child: forwardButton ??
101-
Text(
102-
pageNumber == pagesCount - 1
103-
? doneText
104-
: forwardButtonText,
105-
style: forwardButtonTextStyle ??
106-
const TextStyle(
107-
color: Colors.black,
108-
fontSize: 16,
109-
)
110-
),
111-
onTap: pageNumber == pagesCount - 1 ? onDoneTap : onNext,
103+
InkWell(
104+
child: pageNumber == pagesCount - 1 ? doneButton ?? Text(doneButtonText, style: doneButtonTextStyle) :
105+
forwardButton ?? Text(forwardButtonText, style: forwardButtonTextStyle),
106+
onTap: pageNumber == pagesCount - 1 ? onDoneTap : onForwardButtonTap,
112107
),
113108
],
114109
),
@@ -127,7 +122,7 @@ class GFIntroBottomNavigation extends StatelessWidget {
127122
shape: dotShape,
128123
color: pageNumber == i
129124
? activeColor ?? Colors.blue
130-
: defaultColor ?? Colors.grey.withOpacity(0.5),
125+
: inActiveColor ?? Colors.grey.withOpacity(0.5),
131126
),
132127
));
133128
}

lib/components/intro_screen/gf_intro_screen.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,16 @@ class _GFIntroScreenState extends State<GFIntroScreen> {
8989
)),
9090
widget.gfIntroBottomNavigation ??
9191
GFIntroBottomNavigation(
92-
onNext: () {
92+
onForwardButtonTap: () {
9393
_pageController.nextPage(
9494
duration: const Duration(milliseconds: 500),
9595
curve: Curves.linear);
9696
},
97+
onBackButtonTap: () {
98+
_pageController.previousPage(
99+
duration: const Duration(milliseconds: 500),
100+
curve: Curves.linear);
101+
},
97102
pagesCount: widget.slides.length,
98103
pageNumber: page,
99104
),

0 commit comments

Comments
 (0)