Skip to content

Commit 5999685

Browse files
committed
Bug fix: now the next button overrides doneButtonPersist
1 parent e686581 commit 5999685

File tree

5 files changed

+27
-20
lines changed

5 files changed

+27
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.5.0
2+
* Added Next Button to move to the next screen. Overriding doneButtonPersist.
3+
14
## 2.4.0
25
**Feature Enhancement**
36
* Exposed the way to change the distance a user needs to drag for a full transition to occur using `fullTransition` and its default value is set to `300.0`.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,16 @@ You should then run `flutter packages get` in your terminal so as to get the pac
139139
| :---------------------- | :------------------ | :---------------------------------------------------------------------------------------------------------------- | :-------------------------------------: |
140140
| pages | List<PageViewModel> | Set the pages of the intro screen. | Null |
141141
| onTapDoneButton | VoidCallback | Method executes on tapping done button. | Null |
142+
| onTapNextButton | VoidCallback | Method executes on tapping next button. | Null |
142143
| showSkipButton | Bool | Show the skip button at the bottom of page. | true |
144+
| showNextButton | Bool | Show the Next button at the bottom of page. Overrides doneButtonPersist. | true |
143145
| pageButtonTextSize | Double | Set the button text size. | 18.0 |
144146
| pageButtonFontFamily | String | Set the font of button text. | Default |
145147
| onTapSkipButton | VoidCallback | Method executes on tapping skip button. | null |
146148
| pageButtonTextStyles | TextStyle | Configure TextStyle for skip, done buttons, overrides pageButtonFontFamily, pageButtonsColor, pageButtonTextSize. | fontSize: `18.0`, color: `Colors.white` |
147149
| skipText | Text / Widget | Override Skip Button Text and styles. | Text('SKIP') |
148150
| doneText | Text / Widget | Override Done Button Text and styles. | Text('DONE') |
151+
| nextText | Text / Widget | Override Next Button Text and styles. | Text('NEXT') |
149152
| doneButtonPersist | Bool | Show done Button throughout pages | false |
150153
| columnMainAxisAlignment | MainAxisAlignment | Control [MainAxisAlignment] for column | MainAxisAlignment.spaceAround |
151154
| fullTransition | double | Adjust scroll distance for full transition | 300.0 |

example/lib/main.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class App extends StatelessWidget {
6868
primarySwatch: Colors.blue,
6969
), //ThemeData
7070
home: Builder(
71-
builder: (context) => IntroViewsFlutter(
71+
builder: (context) =>
72+
IntroViewsFlutter(
7273
pages,
7374
onTapDoneButton: () {
7475
Navigator.push(
@@ -79,7 +80,7 @@ class App extends StatelessWidget {
7980
);
8081
},
8182
showSkipButton:
82-
true, //Whether you want to show the skip button or not.
83+
true, //Whether you want to show the skip button or not.
8384
pageButtonTextStyles: TextStyle(
8485
color: Colors.white,
8586
fontSize: 18.0,

lib/UI/page_indicator_buttons.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,22 +153,7 @@ class PageIndicatorButtons extends StatelessWidget {
153153
final bool doneButtonPersist;
154154

155155
Widget _getDoneORNextButton(){
156-
if (acitvePageIndex == totalPages - 1 ||
157-
(acitvePageIndex == totalPages - 2 &&
158-
slideDirection == SlideDirection.rightToLeft ||
159-
doneButtonPersist)){
160-
return DoneButton(
161-
child: doneText,
162-
onTap: onPressedDoneButton,
163-
pageButtonViewModel: PageButtonViewModel(
164-
//view Model
165-
activePageIndex: acitvePageIndex,
166-
totalPages: totalPages,
167-
slidePercent: doneButtonPersist ? 0.0 : slidePercent,
168-
slideDirection: slideDirection,
169-
),
170-
);
171-
}else if ((acitvePageIndex < totalPages - 1 ||
156+
if ((acitvePageIndex < totalPages - 1 ||
172157
(acitvePageIndex == totalPages - 1 &&
173158
slideDirection == SlideDirection.leftToRight)) &&
174159
showNextButton){
@@ -183,7 +168,22 @@ class PageIndicatorButtons extends StatelessWidget {
183168
slideDirection: slideDirection,
184169
),
185170
);
186-
}else{
171+
}else if (acitvePageIndex == totalPages - 1 ||
172+
(acitvePageIndex == totalPages - 2 &&
173+
slideDirection == SlideDirection.rightToLeft ||
174+
doneButtonPersist)){
175+
return DoneButton(
176+
child: doneText,
177+
onTap: onPressedDoneButton,
178+
pageButtonViewModel: PageButtonViewModel(
179+
//view Model
180+
activePageIndex: acitvePageIndex,
181+
totalPages: totalPages,
182+
slidePercent: doneButtonPersist ? 0.0 : slidePercent,
183+
slideDirection: slideDirection,
184+
),
185+
);
186+
}else {
187187
return Container();
188188
}
189189
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: intro_views_flutter
22
description: A Flutter package for simple material design app intro screens with some cool animations.
3-
version: 2.4.0
3+
version: 2.5.0
44
author: Ayush Agarwal <[email protected]>
55
homepage: https://github.com/aagarwal1012/IntroViews-Flutter
66

0 commit comments

Comments
 (0)