Skip to content

Commit bdf0434

Browse files
committed
add doneButtonPersist & rename
doneButtonPersist keeps the done button on screen throughout the pages ignore opacity transition when enabled. rename to doneText, skip Text to keep inline with onPressedSkipButton & onPressedDoneButton update readme
1 parent aad66c3 commit bdf0434

File tree

4 files changed

+42
-30
lines changed

4 files changed

+42
-30
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ You should then run `flutter packages get` in your terminal so as to get the pac
113113
| showSkipButton | Bool | Show the skip button at the bottom of page. | true |
114114
| pageButtonTextSize | Double | Set the button text size. | 18.0 |
115115
| pageButtonFontFamily | String | Set the font of button text. | Default |
116-
| skip | Text | Override SkipButton Text and styles. | null |
117-
| done | Text | Override DoneButton Text and styles. | null |
118116
| onTapSkipButton | VoidCallback | Method executes on tapping skip button. | null |
119117
| pageButtonTextStyles | TextStyle | Configure TextStyle for skip, done buttons, overrides pageButtonFontFamily, pageButtonsColor, pageButtonTextSize. | fontSize: `18.0`, color: `Colors.white` |
118+
| skipText | Text | Override SkipButton Text and styles. | Text('SKIP') |
119+
| doneText | Text | Override DoneButton Text and styles. | Text('DONE') |
120+
| doneButtonPersist | Bool | show done Button throughout pages | false |
120121

121122
For help on editing package code, view the [flutter documentation](https://flutter.io/developing-packages/).
122123

lib/UI/page.dart

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ class Page extends StatelessWidget {
6363
pageViewModel: pageViewModel), //Transform
6464

6565
new Flexible(
66-
child: new Column(
67-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
68-
children: <Widget>[
69-
new _TitlePageTransform(
70-
percentVisible: percentVisible,
71-
pageViewModel: pageViewModel), //Transform
72-
new _BodyPageTransform(
73-
percentVisible: percentVisible,
74-
pageViewModel: pageViewModel), //Transform
75-
],
76-
) // Column
77-
),
66+
child: new Column(
67+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
68+
mainAxisSize: MainAxisSize.max,
69+
children: <Widget>[
70+
new _TitlePageTransform(
71+
percentVisible: percentVisible,
72+
pageViewModel: pageViewModel), //Transform
73+
new _BodyPageTransform(
74+
percentVisible: percentVisible,
75+
pageViewModel: pageViewModel), //Transform
76+
],
77+
), // Column
78+
),
7879
],
7980
);
8081
}

lib/UI/page_indicator_buttons.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ class PageIndicatorButtons extends StatelessWidget {
9494
final double slidePercent;
9595
final bool showSkipButton;
9696

97-
final Text endText;
98-
final Text startText;
97+
final Text doneText;
98+
final Text skipText;
9999
final TextStyle textStyle;
100+
101+
final bool doneButtonPersist;
102+
100103
//Constructor
101104
PageIndicatorButtons({
102105
@required this.acitvePageIndex,
@@ -106,9 +109,10 @@ class PageIndicatorButtons extends StatelessWidget {
106109
this.slidePercent,
107110
this.onPressedSkipButton,
108111
this.showSkipButton = true,
109-
this.startText,
110-
this.endText,
112+
this.skipText,
113+
this.doneText,
111114
this.textStyle,
115+
this.doneButtonPersist,
112116
});
113117

114118
@override
@@ -131,7 +135,7 @@ class PageIndicatorButtons extends StatelessWidget {
131135
slideDirection == SlideDirection.leftToRight)) &&
132136
showSkipButton)
133137
? new SkipButton(
134-
child: startText,
138+
child: skipText,
135139
onTap: onPressedSkipButton,
136140
pageButtonViewModel: new PageButtonViewModel(
137141
//View Model
@@ -148,15 +152,16 @@ class PageIndicatorButtons extends StatelessWidget {
148152
padding: const EdgeInsets.only(bottom: 10.0),
149153
child: (acitvePageIndex == totalPages - 1 ||
150154
(acitvePageIndex == totalPages - 2 &&
151-
slideDirection == SlideDirection.rightToLeft))
155+
slideDirection == SlideDirection.rightToLeft ||
156+
doneButtonPersist))
152157
? new DoneButton(
153-
child: endText,
158+
child: doneText,
154159
onTap: onPressedDoneButton,
155160
pageButtonViewModel: new PageButtonViewModel(
156161
//view Model
157162
activePageIndex: acitvePageIndex,
158163
totalPages: totalPages,
159-
slidePercent: slidePercent,
164+
slidePercent: doneButtonPersist ? 0.0 : slidePercent,
160165
slideDirection: slideDirection,
161166
),
162167
)

lib/intro_views_flutter.dart

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,14 @@ class IntroViewsFlutter extends StatefulWidget {
4848
/// gets overridden by [pageButtonTextStyles]
4949
final String pageButtonFontFamily;
5050

51-
/// Override 'DONE' Text with Your Own Text, its TextStyle will be copied and override [pageButtonTextSize] [PageButtonFontFamily] [PageButtonsColor]
52-
final Text endText;
51+
/// Override 'DONE' Text with Your Own Text,
52+
final Text doneText;
5353

54-
/// Override 'Skip' Text with Your Own Text, its TextStyle will be copied and override [pageButtonTextSize] [PageButtonFontFamily] [PageButtonsColor]
55-
final Text startText;
54+
/// Override 'Skip' Text with Your Own Text,
55+
final Text skipText;
56+
57+
/// always Show DoneButton
58+
final bool doneButtonPersist;
5659
IntroViewsFlutter(
5760
this.pages, {
5861
Key key,
@@ -63,8 +66,9 @@ class IntroViewsFlutter extends StatefulWidget {
6366
this.pageButtonFontFamily,
6467
this.onTapSkipButton,
6568
this.pageButtonsColor,
66-
this.endText = const Text("DONE"),
67-
this.startText = const Text("SKIP"),
69+
this.doneText = const Text("DONE"),
70+
this.skipText = const Text("SKIP"),
71+
this.doneButtonPersist = false,
6872
}) : super(key: key);
6973

7074
@override
@@ -218,8 +222,9 @@ class _IntroViewsFlutterState extends State<IntroViewsFlutter>
218222
});
219223
},
220224
showSkipButton: widget.showSkipButton,
221-
endText: widget.endText,
222-
startText: widget.startText,
225+
doneText: widget.doneText,
226+
skipText: widget.skipText,
227+
doneButtonPersist: widget.doneButtonPersist,
223228
),
224229

225230
new PageDragger(

0 commit comments

Comments
 (0)