@@ -6,6 +6,8 @@ class GFIntroScreen extends StatefulWidget {
66 const GFIntroScreen ({
77 Key key,
88 @required this .pageController,
9+ @required this .currentIndex,
10+ @required this .pageCount,
911 @required this .slides,
1012 this .color,
1113 this .width,
@@ -14,8 +16,6 @@ class GFIntroScreen extends StatefulWidget {
1416 this .border,
1517 this .introScreenBottomNavigationBar,
1618 this .showIntroScreenBottomNavigationBar = true ,
17- this .currentIndex = 0 ,
18- this .pageCount = 0 ,
1919 this .child,
2020 this .navigationBarColor = GFColors .SUCCESS ,
2121 this .navigationBarHeight = 50 ,
@@ -68,23 +68,22 @@ class GFIntroScreen extends StatefulWidget {
6868 /// defines the list of slides
6969 final List <Widget > slides;
7070
71- /// default controller for the [GFIntroScreen] component
71+ /// allows one to control [GFIntroScreen] slides
7272 final PageController pageController;
7373
74- /// background color of the [GFIntroScreen] component
74+ /// defines background color of the [GFIntroScreen] slides
7575 final Color color;
7676
77- /// defines [GFIntroScreen] height
77+ /// defines [GFIntroScreen] slides height
7878 final double height;
7979
80-
81- /// defines [GFIntroScreen] width
80+ /// defines [GFIntroScreen] slides width
8281 final double width;
8382
84- /// defines [GFIntroScreen] border radius to defines slide shape
83+ /// defines [GFIntroScreen] border radius to defines slides shape
8584 final BorderRadius borderRadius;
8685
87- /// defines [GFIntroScreen] border
86+ /// defines [GFIntroScreen] slides border
8887 final Border border;
8988
9089 /// defines [GFIntroScreen] 's bottom navigation bar
@@ -99,7 +98,7 @@ class GFIntroScreen extends StatefulWidget {
9998 /// defines the length of [GFIntroScreen] slides, default value is 0
10099 final int pageCount;
101100
102- /// defines [GFIntroScreenBottomNavigationBar] , it takes any widget
101+ /// defines [GFIntroScreenBottomNavigationBar] 's child , it takes any widget
103102 final Widget child;
104103
105104 /// defines [GFIntroScreenBottomNavigationBar] height
@@ -132,28 +131,28 @@ class GFIntroScreen extends StatefulWidget {
132131 /// Called when the skip button is tapped
133132 final VoidCallback onSkipTap;
134133
135- /// defines the backButton widget
134+ /// takes any Widget to define the backButton widget,
136135 final Widget backButton;
137136
138- /// defines the forwardButton widget
137+ /// takes any Widget to define the forwardButton widget
139138 final Widget forwardButton;
140139
141- /// defines the doneButton widget
140+ /// takes any Widget to define the doneButton widget
142141 final Widget doneButton;
143142
144- /// defines the skipButton widget
143+ /// takes any Widget to define the skipButton widget
145144 final Widget skipButton;
146145
147- /// defines the backButton text
146+ /// takes String to define backButton text
148147 final String backButtonText;
149148
150- /// defines the forwardButton text
149+ /// takes String to define forwardButton text
151150 final String forwardButtonText;
152151
153- /// defines the doneButton text
152+ /// takes String to define doneButton text
154153 final String doneButtonText;
155154
156- /// defines the skipButton text
155+ /// takes String to define skipButton text
157156 final String skipButtonText;
158157
159158 /// defines the skipButton textStyle
@@ -209,28 +208,6 @@ class GFIntroScreen extends StatefulWidget {
209208}
210209
211210class _GFIntroScreenState extends State <GFIntroScreen > {
212- PageController _pageController;
213- int currentIndex;
214- List <Widget > pages;
215-
216- @override
217- void initState () {
218- _pageController = widget.pageController != null
219- ? widget.pageController
220- : PageController (initialPage: 0 );
221- currentIndex = _pageController.initialPage;
222- if (widget.pageController != null ) {
223- _pageController = widget.pageController;
224- }
225- _pageController.addListener (() {
226- if (mounted) {
227- setState (() {
228- currentIndex = _pageController.page.round ();
229- });
230- }
231- });
232- super .initState ();
233- }
234211
235212 @override
236213 Widget build (BuildContext context) => Center (
@@ -248,16 +225,16 @@ class _GFIntroScreenState extends State<GFIntroScreen> {
248225 children: < Widget > [
249226 Expanded (
250227 child: PageView (
251- controller: _pageController ,
228+ controller: widget.pageController ,
252229 children: widget.slides,
253230 ),
254231 ),
255232 widget.showIntroScreenBottomNavigationBar
256233 ? widget.introScreenBottomNavigationBar ??
257234 GFIntroScreenBottomNavigationBar (
258- pageController: _pageController ,
235+ pageController: widget.pageController ,
259236 pageCount: widget.slides.length,
260- currentIndex: currentIndex,
237+ currentIndex: widget. currentIndex,
261238 child: widget.child,
262239 navigationBarColor: widget.navigationBarColor,
263240 navigationBarHeight: widget.navigationBarHeight,
0 commit comments