Skip to content

Commit 63517ed

Browse files
committed
* Add default behavior the onSkip parameter of the IntroScreens
* Add `containerBg` parameter to the `IntroScreens` class to set the color for the wrapper container
1 parent d132577 commit 63517ed

File tree

6 files changed

+71
-37
lines changed

6 files changed

+71
-37
lines changed

Diff for: CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@
3131
## [0.1.6] - [2022-13-02]
3232

3333
* Minor update: make intro screen texts use default body text theme style
34+
35+
## [0.1.7] - [2022-05-18]
36+
37+
* Minor update: migrate to Flutter 3.0
38+
39+
40+
## [0.2.0] - [2022-05-18]
41+
42+
* Add default behavior the `onSkip` parameter of the `IntroScreens`
43+
* Add `containerBg` parameter to the `IntroScreens` class to set the color for the wrapper container

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Add the following to pubspec.yaml:
2525

2626
```yaml
2727
dependencies:
28-
nice_intro: ^0.1.6
28+
nice_intro: ^0.2.0
2929
```
3030
3131
## Usage Example
@@ -95,6 +95,7 @@ And pass it to your scaffold widget.
9595
| textStyle |`TextStyle` | null | Set the style of the title and description of your slide|
9696
| headerBgColor | `Color` | `Colors.white` | Set the background color of the slide |
9797
| headerPadding | `EdgeInsets` | `EdgeInsets.all(12)` | Set the padding of the header part of your slide screen |
98+
| containerBg | `Color` | `Colors.white` | Set the wrapper container's background color |
9899

99100
#### IntroScreens widget's properties
100101

Diff for: example/pubspec.lock

+20-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.8.1"
10+
version: "2.8.2"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,7 +21,7 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0"
24+
version: "1.2.0"
2525
charcode:
2626
dependency: transitive
2727
description:
@@ -42,7 +42,7 @@ packages:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.15.0"
45+
version: "1.16.0"
4646
crypto:
4747
dependency: transitive
4848
description:
@@ -63,7 +63,7 @@ packages:
6363
name: fake_async
6464
url: "https://pub.dartlang.org"
6565
source: hosted
66-
version: "1.2.0"
66+
version: "1.3.0"
6767
ffi:
6868
dependency: transitive
6969
description:
@@ -94,7 +94,7 @@ packages:
9494
name: google_fonts
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "2.1.0"
97+
version: "2.3.2"
9898
http:
9999
dependency: transitive
100100
description:
@@ -115,7 +115,14 @@ packages:
115115
name: matcher
116116
url: "https://pub.dartlang.org"
117117
source: hosted
118-
version: "0.12.10"
118+
version: "0.12.11"
119+
material_color_utilities:
120+
dependency: transitive
121+
description:
122+
name: material_color_utilities
123+
url: "https://pub.dartlang.org"
124+
source: hosted
125+
version: "0.1.4"
119126
meta:
120127
dependency: transitive
121128
description:
@@ -129,14 +136,14 @@ packages:
129136
path: ".."
130137
relative: true
131138
source: path
132-
version: "0.1.5"
139+
version: "0.2.0"
133140
path:
134141
dependency: transitive
135142
description:
136143
name: path
137144
url: "https://pub.dartlang.org"
138145
source: hosted
139-
version: "1.8.0"
146+
version: "1.8.1"
140147
path_provider:
141148
dependency: transitive
142149
description:
@@ -218,7 +225,7 @@ packages:
218225
name: source_span
219226
url: "https://pub.dartlang.org"
220227
source: hosted
221-
version: "1.8.1"
228+
version: "1.8.2"
222229
stack_trace:
223230
dependency: transitive
224231
description:
@@ -253,7 +260,7 @@ packages:
253260
name: test_api
254261
url: "https://pub.dartlang.org"
255262
source: hosted
256-
version: "0.4.2"
263+
version: "0.4.9"
257264
typed_data:
258265
dependency: transitive
259266
description:
@@ -267,7 +274,7 @@ packages:
267274
name: vector_math
268275
url: "https://pub.dartlang.org"
269276
source: hosted
270-
version: "2.1.0"
277+
version: "2.1.2"
271278
win32:
272279
dependency: transitive
273280
description:
@@ -283,5 +290,5 @@ packages:
283290
source: hosted
284291
version: "0.2.0"
285292
sdks:
286-
dart: ">=2.14.0 <3.0.0"
287-
flutter: ">=2.5.0"
293+
dart: ">=2.17.0-0 <3.0.0"
294+
flutter: ">=2.10.0-0"

Diff for: lib/intro_screens.dart

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import 'dart:ui';
2-
3-
import 'package:flutter/cupertino.dart';
41
import 'package:flutter/material.dart';
52
import 'package:flutter/services.dart';
63
import 'package:google_fonts/google_fonts.dart';
@@ -50,7 +47,7 @@ class IntroScreens extends StatefulWidget {
5047

5148
///defines what to do when the skip button is tapped
5249
///[Function]
53-
final Function onSkip;
50+
final Function? onSkip;
5451

5552
///defines what to do when the last slide is reached
5653
///[Function]
@@ -84,15 +81,20 @@ class IntroScreens extends StatefulWidget {
8481
///sets the physics for the page view
8582
final ScrollPhysics physics;
8683

84+
///[Color]
85+
///sets the wrapper container's background color, defaults to white
86+
final Color containerBg;
87+
8788
const IntroScreens({
8889
required this.slides,
8990
this.footerRadius = 12.0,
9091
this.footerGradients = const [],
92+
this.containerBg = Colors.white,
9193
required this.onDone,
9294
this.indicatorType = IndicatorType.CIRCLE,
9395
this.appTitle = '',
9496
this.physics = const BouncingScrollPhysics(),
95-
required this.onSkip,
97+
this.onSkip,
9698
this.nextWidget,
9799
this.doneWidget,
98100
this.activeDotColor = Colors.white,
@@ -129,6 +131,14 @@ class _IntroScreensState extends State<IntroScreens>
129131
AnimationController(duration: Duration(milliseconds: 500), vsync: this);
130132
}
131133

134+
get onSkip => this.widget.onSkip != null ? this.widget.onSkip : defaultOnSkip;
135+
136+
defaultOnSkip() => animationController.animateTo(
137+
widget.slides.length - 1,
138+
duration: Duration(milliseconds: 400),
139+
curve: Curves.fastOutSlowIn,
140+
);
141+
132142
TextStyle get textStyle =>
133143
currentScreen!.textStyle ??
134144
Theme.of(context).textTheme.bodyText1 ??
@@ -188,12 +198,11 @@ class _IntroScreensState extends State<IntroScreens>
188198
currentScreen?.headerBgColor ?? Colors.transparent,
189199
),
190200
child: Container(
191-
color: Colors.white,
201+
color: this.widget.containerBg,
192202
// height: MediaQuery.of(context).size.height,
193203
width: double.infinity,
194204
child: Stack(
195-
overflow: Overflow.visible,
196-
fit: StackFit.expand,
205+
clipBehavior: Clip.none,
197206
children: <Widget>[
198207
PageView.builder(
199208
itemCount: widget.slides.length,
@@ -315,7 +324,7 @@ class _IntroScreensState extends State<IntroScreens>
315324
widget.skipText.toUpperCase(),
316325
style: textStyle,
317326
),
318-
onTap: widget.onSkip as void Function()?,
327+
onTap: onSkip,
319328
),
320329
),
321330
),

Diff for: pubspec.lock

+19-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.8.1"
10+
version: "2.8.2"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,7 +21,7 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0"
24+
version: "1.2.0"
2525
charcode:
2626
dependency: transitive
2727
description:
@@ -42,7 +42,7 @@ packages:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.15.0"
45+
version: "1.16.0"
4646
crypto:
4747
dependency: transitive
4848
description:
@@ -56,7 +56,7 @@ packages:
5656
name: fake_async
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "1.2.0"
59+
version: "1.3.0"
6060
ffi:
6161
dependency: transitive
6262
description:
@@ -87,7 +87,7 @@ packages:
8787
name: google_fonts
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "2.1.0"
90+
version: "2.3.2"
9191
http:
9292
dependency: transitive
9393
description:
@@ -108,7 +108,14 @@ packages:
108108
name: matcher
109109
url: "https://pub.dartlang.org"
110110
source: hosted
111-
version: "0.12.10"
111+
version: "0.12.11"
112+
material_color_utilities:
113+
dependency: transitive
114+
description:
115+
name: material_color_utilities
116+
url: "https://pub.dartlang.org"
117+
source: hosted
118+
version: "0.1.4"
112119
meta:
113120
dependency: transitive
114121
description:
@@ -122,7 +129,7 @@ packages:
122129
name: path
123130
url: "https://pub.dartlang.org"
124131
source: hosted
125-
version: "1.8.0"
132+
version: "1.8.1"
126133
path_provider:
127134
dependency: transitive
128135
description:
@@ -204,7 +211,7 @@ packages:
204211
name: source_span
205212
url: "https://pub.dartlang.org"
206213
source: hosted
207-
version: "1.8.1"
214+
version: "1.8.2"
208215
stack_trace:
209216
dependency: transitive
210217
description:
@@ -239,7 +246,7 @@ packages:
239246
name: test_api
240247
url: "https://pub.dartlang.org"
241248
source: hosted
242-
version: "0.4.2"
249+
version: "0.4.9"
243250
typed_data:
244251
dependency: transitive
245252
description:
@@ -253,7 +260,7 @@ packages:
253260
name: vector_math
254261
url: "https://pub.dartlang.org"
255262
source: hosted
256-
version: "2.1.0"
263+
version: "2.1.2"
257264
win32:
258265
dependency: transitive
259266
description:
@@ -269,5 +276,5 @@ packages:
269276
source: hosted
270277
version: "0.2.0"
271278
sdks:
272-
dart: ">=2.14.0 <3.0.0"
273-
flutter: ">=2.5.0"
279+
dart: ">=2.17.0-0 <3.0.0"
280+
flutter: ">=2.10.0-0"

Diff for: pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nice_intro
22
description: Get your users to know your app with ease! This package will help you build beautiful intro sides for your app.
3-
version: 0.1.6
3+
version: 0.2.0
44
homepage: https://github.com/Ethiel97/nice_intro
55

66
environment:
@@ -9,7 +9,7 @@ environment:
99
dependencies:
1010
flutter:
1111
sdk: flutter
12-
google_fonts: ^2.3.1
12+
google_fonts: ^2.3.2
1313

1414
dev_dependencies:
1515
flutter_test:

0 commit comments

Comments
 (0)