@@ -3,32 +3,74 @@ import 'package:flutter/material.dart';
33import 'package:getwidget/getwidget.dart' ;
44
55class GFIntroScreen extends StatefulWidget {
6- const GFIntroScreen (
7- {Key key,
8- @required this .slides,
9- // this.type = GFIntroType.fullWidth,
10- this .color = Colors .white,
11- this .width,
12- this .height,
13- this .border,
14- this .borderRadius,
15- this .pageController,
16- this .gfIntroBottomNavigation,
17- })
18- : super (key: key);
19-
20- /// if the type as [GFIntroType.fullWidth] ,[GFIntroType.half] ,[GFIntroType.rounded] use [GFIntroSlide] 's or customWidgets
6+ const GFIntroScreen ({
7+ Key key,
8+ @required this .pageController,
9+ @required this .slides,
10+ this .color,
11+ this .width,
12+ this .height,
13+ this .borderRadius,
14+ this .border,
15+ this .gfIntroBottomNavigation,
16+ this .showIntroBottomNavigation = true ,
17+ this .currentIndex = 0 ,
18+ this .pageCount = 0 ,
19+ this .child,
20+ this .navigationBarColor = GFColors .SUCCESS ,
21+ this .navigationBarHeight = 50 ,
22+ this .navigationBarShape,
23+ this .navigationBarWidth,
24+ this .navigationBarPadding = const EdgeInsets .all (8 ),
25+ this .navigationBarMargin = const EdgeInsets .all (8 ),
26+ this .showDivider = true ,
27+ this .dividerColor = Colors .white,
28+ this .dividerHeight = 1 ,
29+ this .dividerThickness = 2 ,
30+ this .dotShape,
31+ this .inActiveColor = GFColors .LIGHT ,
32+ this .activeColor = GFColors .PRIMARY ,
33+ this .dotHeight = 12 ,
34+ this .dotWidth = 12 ,
35+ this .dotMargin = const EdgeInsets .symmetric (horizontal: 2 ),
36+ this .backButton,
37+ this .forwardButton,
38+ this .doneButton,
39+ this .skipButton,
40+ this .onDoneTap,
41+ this .onForwardButtonTap,
42+ this .onBackButtonTap,
43+ this .onSkipTap,
44+ this .forwardButtonText = 'NEXT' ,
45+ this .backButtonText = 'BACK' ,
46+ this .doneButtonText = 'GO' ,
47+ this .skipButtonText = 'SKIP' ,
48+ this .skipButtonTextStyle = const TextStyle (
49+ color: Colors .black,
50+ fontSize: 16 ,
51+ ),
52+ this .doneButtonTextStyle = const TextStyle (
53+ color: Colors .black,
54+ fontSize: 16 ,
55+ ),
56+ this .backButtonTextStyle = const TextStyle (
57+ color: Colors .black,
58+ fontSize: 16 ,
59+ ),
60+ this .forwardButtonTextStyle = const TextStyle (
61+ color: Colors .black,
62+ fontSize: 16 ,
63+ ),
64+ this .showButton = true ,
65+ this .showPagination = true ,
66+ }) : super (key: key);
67+
68+ ///
2169 final List <Widget > slides;
2270
23- // /// type of [GFIntroType] which takes the type ie, fullWidth, half,rounded and bubble for the [GFIntroScreen]
24- // final GFIntroType type;
25-
2671 /// default controller for the [GFIntroScreen] component
2772 final PageController pageController;
2873
29- /// [GFIntroScreen] bottom navigation will be used as [GFIntroBottomNavigation] component
30- final GFIntroBottomNavigation gfIntroBottomNavigation;
31-
3274 /// background color of the [GFIntroScreen] component
3375 final Color color;
3476
@@ -40,26 +82,84 @@ class GFIntroScreen extends StatefulWidget {
4082
4183 final Border border;
4284
85+ /// [GFIntroScreen] bottom navigation will be used as [GFIntroBottomNavigation] component
86+ final GFIntroBottomNavigation gfIntroBottomNavigation;
87+
88+ final bool showIntroBottomNavigation;
89+
90+
91+
92+
93+ final int currentIndex;
94+ final int pageCount;
95+ final Widget child;
96+
97+ final double navigationBarHeight;
98+ final double navigationBarWidth;
99+ final EdgeInsets navigationBarPadding;
100+ final EdgeInsets navigationBarMargin;
101+ final dynamic navigationBarColor;
102+
103+ /// defines the shape of [GFIntroBottomNavigation]
104+ final ShapeBorder navigationBarShape;
105+
106+ final VoidCallback onForwardButtonTap;
107+ final VoidCallback onBackButtonTap;
108+ final VoidCallback onDoneTap;
109+ final VoidCallback onSkipTap;
110+
111+ final Widget backButton;
112+ final Widget forwardButton;
113+ final Widget doneButton;
114+ final Widget skipButton;
115+
116+ final String backButtonText;
117+ final String forwardButtonText;
118+ final String doneButtonText;
119+ final String skipButtonText;
120+
121+ final TextStyle skipButtonTextStyle;
122+ final TextStyle doneButtonTextStyle;
123+ final TextStyle backButtonTextStyle;
124+ final TextStyle forwardButtonTextStyle;
125+
126+ final bool showDivider;
127+ final bool showButton;
128+ final bool showPagination;
129+
130+ final double dividerHeight;
131+ final double dividerThickness;
132+ final dynamic dividerColor;
133+
134+ final ShapeBorder dotShape;
135+ final Color inActiveColor;
136+ final Color activeColor;
137+ final double dotHeight;
138+ final double dotWidth;
139+ final EdgeInsets dotMargin;
140+
43141 @override
44142 _GFIntroScreenState createState () => _GFIntroScreenState ();
45143}
46144
47145class _GFIntroScreenState extends State <GFIntroScreen > {
48146 PageController _pageController;
49- int page ;
147+ int currentIndex ;
50148 List <Widget > pages;
51149
52150 @override
53151 void initState () {
54- _pageController = widget.pageController != null ? widget.pageController : PageController (initialPage: 0 );
55- page = _pageController.initialPage;
152+ _pageController = widget.pageController != null
153+ ? widget.pageController
154+ : PageController (initialPage: 0 );
155+ currentIndex = _pageController.initialPage;
56156 if (widget.pageController != null ) {
57157 _pageController = widget.pageController;
58158 }
59159 _pageController.addListener (() {
60160 if (mounted) {
61161 setState (() {
62- page = _pageController.page.round ();
162+ currentIndex = _pageController.page.round ();
63163 });
64164 }
65165 });
@@ -68,95 +168,79 @@ class _GFIntroScreenState extends State<GFIntroScreen> {
68168
69169 @override
70170 Widget build (BuildContext context) => Center (
71- child: Container (
72- width: widget.width,
73- height: widget.height,
74- decoration: BoxDecoration (
75- color: widget.color,
76- borderRadius: widget.borderRadius,
77- border: widget.border
171+ child: Container (
172+ width: widget.width,
173+ height: widget.height,
174+ decoration: BoxDecoration (
175+ borderRadius: widget.borderRadius ?? BorderRadius .circular (0 ),
176+ border: widget.border ?? Border .all (width: 0 ),
177+ color: widget.color,
178+ ),
179+ child: Column (
180+ mainAxisAlignment: MainAxisAlignment .center,
181+ crossAxisAlignment: CrossAxisAlignment .center,
182+ children: < Widget > [
183+ Expanded (
184+ child: PageView (
185+ controller: _pageController,
186+ children: widget.slides,
187+ ),
78188 ),
79- child: Column (
80- mainAxisAlignment: MainAxisAlignment .center,
81- crossAxisAlignment: CrossAxisAlignment .center,
82- children: < Widget > [
83- Expanded (
84- child: ClipRRect (
85- borderRadius: widget.borderRadius == null ? BorderRadius .circular (0 ) : widget.borderRadius,
86- child: PageView (
87- controller: _pageController,
88- children: widget.slides,
189+ widget.showIntroBottomNavigation ? widget.gfIntroBottomNavigation ??
190+ GFIntroBottomNavigation (
191+ pageController: _pageController,
192+ pageCount: widget.slides.length,
193+ currentIndex: currentIndex,
194+ child: widget.child,
195+ navigationBarColor: widget.navigationBarColor,
196+ navigationBarHeight: widget.navigationBarHeight,
197+ navigationBarShape: widget.navigationBarWidth,
198+ navigationBarWidth,
199+ navigationBarPadding = const EdgeInsets .all (8 ),
200+ navigationBarMargin = const EdgeInsets .all (8 ),
201+ showDivider = true ,
202+ dividerColor = Colors .white,
203+ dividerHeight = 1 ,
204+ dividerThickness = 2 ,
205+ dotShape,
206+ inActiveColor = GFColors .LIGHT ,
207+ activeColor = GFColors .PRIMARY ,
208+ dotHeight = 12 ,
209+ dotWidth = 12 ,
210+ dotMargin = const EdgeInsets .symmetric (horizontal: 2 ),
211+ backButton,
212+ forwardButton,
213+ doneButton,
214+ skipButton,
215+ onDoneTap,
216+ onForwardButtonTap,
217+ onBackButtonTap,
218+ onSkipTap,
219+ forwardButtonText = 'NEXT' ,
220+ backButtonText = 'BACK' ,
221+ doneButtonText = 'GO' ,
222+ skipButtonText = 'SKIP' ,
223+ skipButtonTextStyle = const TextStyle (
224+ color: Colors .black,
225+ fontSize: 16 ,
89226 ),
90- )),
91- widget.gfIntroBottomNavigation ??
92- GFIntroBottomNavigation (
93- pageController: _pageController,
94- pageCount: widget.slides.length,
95- currentIndex: page,
96- // child: Text('dfghj'),
97-
98- // onForwardButtonTap: () {
99- // print('fffffff');
100- // // _pageController.nextPage(
101- // // duration: const Duration(milliseconds: 500),
102- // // curve: Curves.linear);
103- // },
104- // onBackButtonTap: () {
105- // print('kkkkkkkkk');
106- // // _pageController.previousPage(
107- // // duration: const Duration(milliseconds: 500),
108- // // curve: Curves.linear);
109- // },
110- // onDoneTap: (){
111- // print('done');
112- // },
113- // onSkipTap: (){
114- // print('skip');
115- // },
116- // backButtonTextStyle: TextStyle(
117- // fontSize: 12
118- // ),
119-
120- // backButton: GFButton(onPressed: null, child: Text('back'),),
121- // forwardButton: GFButton(onPressed: null, child: Text('next'),),
122- // skipButton: GFButton(onPressed: null, child: Text('skip'),),
123- // doneButton: GFButton(onPressed: null, child: Text('done'),),
124-
125- // backButtonText: 'bbbb',
126- // forwardButtonText: 'ffffff',
127- // skipButtonText: 'ssssss',
128- // doneButtonText: 'ddddddd',
129-
130- // navigationBarHeight: 100,
131- // navigationBarWidth: 300,
132- // navigationBarMargin: EdgeInsets.all(20),
133- // navigationBarPadding: EdgeInsets.all(20),
134- // navigationBarShape: RoundedRectangleBorder(
135- // side: const BorderSide(color: Colors.blue, width: 4),
136- // borderRadius: BorderRadius.circular(50),
137- // ),
138- // navigationBarColor: GFColors.SECONDARY,
139- //
140- // showDivider: true,
141- // dividerHeight: 2,
142- // dividerThickness: 13,
143- // dividerColor: GFColors.ALT,
144- //
145- // dotHeight: 10,
146- // dotWidth: 16,
147- // dotShape: RoundedRectangleBorder(
148- // side: BorderSide(color: Colors.red, width: 2),
149- // borderRadius: BorderRadius.circular(5)
150- // ),
151- // inActiveColor: GFColors.DARK,
152- // activeColor: GFColors.DANGER,
153- // dotMargin: EdgeInsets.symmetric(horizontal: 6),
154- //
155- // showButton: false,
156- // showPagination: true,
157- ),
158- ],
159- ),
160- ),
161- );
227+ doneButtonTextStyle = const TextStyle (
228+ color: Colors .black,
229+ fontSize: 16 ,
230+ ),
231+ backButtonTextStyle = const TextStyle (
232+ color: Colors .black,
233+ fontSize: 16 ,
234+ ),
235+ forwardButtonTextStyle = const TextStyle (
236+ color: Colors .black,
237+ fontSize: 16 ,
238+ ),
239+ showButton = true ,
240+ showPagination = true ,
241+ ) : Container (),
242+ ],
243+ ),
244+ ),
245+ );
162246}
0 commit comments