@@ -20,7 +20,7 @@ class SkipButton extends StatelessWidget {
2020 Widget build (BuildContext context) {
2121 //Calculating opacity to create a fade in effect
2222 double opacity = 1.0 ;
23-
23+ final TextStyle style = DefaultTextStyle . of (context).style;
2424 if (pageButtonViewModel.activePageIndex ==
2525 pageButtonViewModel.totalPages - 2 &&
2626 pageButtonViewModel.slideDirection == SlideDirection .rightToLeft) {
@@ -37,11 +37,7 @@ class SkipButton extends StatelessWidget {
3737 opacity: opacity,
3838 child: new Text (
3939 "SKIP" ,
40- style: new TextStyle (
41- color: pageButtonViewModel.pageButtonColor,
42- fontSize: pageButtonViewModel.pageButtonTextSize,
43- fontFamily: pageButtonViewModel.fontFamily,
44- ), //TextStyle
40+ style: style, //TextStyle
4541 ), //Text
4642 ), //Opacity
4743 ); //FlatButton
@@ -66,7 +62,7 @@ class DoneButton extends StatelessWidget {
6662 Widget build (BuildContext context) {
6763 //Calculating opacity so as to create a fade in effect
6864 double opacity = 1.0 ;
69-
65+ final TextStyle style = DefaultTextStyle . of (context).style;
7066 if (pageButtonViewModel.activePageIndex ==
7167 pageButtonViewModel.totalPages - 1 &&
7268 pageButtonViewModel.slideDirection == SlideDirection .leftToRight) {
@@ -79,11 +75,7 @@ class DoneButton extends StatelessWidget {
7975 opacity: opacity,
8076 child: new Text (
8177 "DONE" ,
82- style: new TextStyle (
83- color: pageButtonViewModel.pageButtonColor,
84- fontSize: pageButtonViewModel.pageButtonTextSize,
85- fontFamily: pageButtonViewModel.fontFamily,
86- ), //TextStyle
78+ style: style, //TextStyle
8779 ), //Text
8880 ), //Opacity
8981 ); //FlatButton
@@ -98,10 +90,7 @@ class PageIndicatorButtons extends StatelessWidget {
9890 final VoidCallback onPressedSkipButton; //Callback for Skip Button
9991 final SlideDirection slideDirection;
10092 final double slidePercent;
101- final Color pageButtonsColor;
10293 final bool showSkipButton;
103- final String fontFamily;
104- final double pageButtonTextSize;
10594
10695 //Constructor
10796 PageIndicatorButtons ({
@@ -111,81 +100,58 @@ class PageIndicatorButtons extends StatelessWidget {
111100 this .slideDirection,
112101 this .slidePercent,
113102 this .onPressedSkipButton,
114- this .pageButtonsColor = const Color (0x88FFFFFF ),
115103 this .showSkipButton = true ,
116- this .fontFamily,
117- this .pageButtonTextSize = 18.0 ,
118104 });
119105
120106 @override
121107 Widget build (BuildContext context) {
122- return new Stack (
123- children: < Widget > [
124- new Column (
125- mainAxisAlignment: MainAxisAlignment .start,
126- children: < Widget > [
127- new Expanded (child: new Container ()),
128- new Padding (
129- padding: const EdgeInsets .only (bottom: 10.0 ),
130- child: new Row (
131- mainAxisAlignment: MainAxisAlignment .start,
132- children: < Widget > [
133- ((acitvePageIndex < totalPages - 1 ||
134- (acitvePageIndex == totalPages - 1 &&
135- slideDirection ==
136- SlideDirection .leftToRight)) &&
137- showSkipButton)
138- ? new SkipButton (
139- onTap: onPressedSkipButton,
140- pageButtonViewModel: new PageButtonViewModel (
141- //View Model
142- activePageIndex: acitvePageIndex,
143- totalPages: totalPages,
144- slidePercent: slidePercent,
145- slideDirection: slideDirection,
146- fontFamily: fontFamily,
147- pageButtonColor: pageButtonsColor,
148- pageButtonTextSize: pageButtonTextSize,
149- ),
150- )
151- : new Container (),
152- ],
153- ), //Row
154- ), //Padding
155- ],
156- ), //Column
157- new Column (
158- mainAxisAlignment: MainAxisAlignment .end,
159- children: < Widget > [
160- new Expanded (child: new Container ()),
161- new Padding (
162- padding: const EdgeInsets .only (bottom: 10.0 ),
163- child: new Row (
164- mainAxisAlignment: MainAxisAlignment .end,
165- children: < Widget > [
166- (acitvePageIndex == totalPages - 1 ||
167- (acitvePageIndex == totalPages - 2 &&
168- slideDirection == SlideDirection .rightToLeft))
169- ? new DoneButton (
170- onTap: onPressedDoneButton,
171- pageButtonViewModel: new PageButtonViewModel (
172- //view Model
173- activePageIndex: acitvePageIndex,
174- totalPages: totalPages,
175- slidePercent: slidePercent,
176- slideDirection: slideDirection,
177- fontFamily: fontFamily,
178- pageButtonColor: pageButtonsColor,
179- pageButtonTextSize: pageButtonTextSize,
180- ),
181- )
182- : new Container (),
183- ],
184- ), //Row
185- ), //Padding
186- ],
187- ), //Column
188- ],
189- ); //Stack
108+ return Positioned (
109+ left: 0.0 ,
110+ right: 0.0 ,
111+ bottom: 0.0 ,
112+ child: new Row (
113+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
114+ crossAxisAlignment: CrossAxisAlignment .center,
115+ mainAxisSize: MainAxisSize .max,
116+ children: < Widget > [
117+ new Padding (
118+ padding: const EdgeInsets .only (bottom: 10.0 ),
119+ child: ((acitvePageIndex < totalPages - 1 ||
120+ (acitvePageIndex == totalPages - 1 &&
121+ slideDirection == SlideDirection .leftToRight)) &&
122+ showSkipButton)
123+ ? new SkipButton (
124+ onTap: onPressedSkipButton,
125+ pageButtonViewModel: new PageButtonViewModel (
126+ //View Model
127+ activePageIndex: acitvePageIndex,
128+ totalPages: totalPages,
129+ slidePercent: slidePercent,
130+ slideDirection: slideDirection,
131+ ),
132+ )
133+ : new Container (), //Row
134+ ), //Padding
135+
136+ new Padding (
137+ padding: const EdgeInsets .only (bottom: 10.0 ),
138+ child: (acitvePageIndex == totalPages - 1 ||
139+ (acitvePageIndex == totalPages - 2 &&
140+ slideDirection == SlideDirection .rightToLeft))
141+ ? new DoneButton (
142+ onTap: onPressedDoneButton,
143+ pageButtonViewModel: new PageButtonViewModel (
144+ //view Model
145+ activePageIndex: acitvePageIndex,
146+ totalPages: totalPages,
147+ slidePercent: slidePercent,
148+ slideDirection: slideDirection,
149+ ),
150+ )
151+ : new Container (), //Row
152+ ),
153+ ],
154+ ),
155+ );
190156 }
191157}
0 commit comments