Skip to content

Commit 4accd45

Browse files
committed
Upgrade to null safe flutter 2.0+
1 parent e99b504 commit 4accd45

File tree

5 files changed

+135
-93
lines changed

5 files changed

+135
-93
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
## [0.0.2] - Release
66

77
* A customizable flutter walkthrough screen library written in dart .
8+
9+
## [2.0.1] - Release
10+
11+
* A customizable flutter walkthrough screen library written in dart with a flutter null safe support.

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,8 @@ Selected dot Color | Unselected dot Color
122122

123123
### Created & Maintained By
124124

125-
[Tushar Nikam](https://github.com/champ96k)
125+
[Tushar Nikam](http://tusharnikam.ml/)
126126

127127

128-
[linkedin](https://www.linkedin.com/in/tushar-nikam-a29a97131/)
129-
130-
131-
## Getting Started
132-
133-
For help getting started with Flutter, view our online [documentation](https://flutter.io/).
134-
135-
For help on editing package code, view the [documentation](https://flutter.io/developing-packages/).
136128

129+
<p><a href="https://www.twitter.com/champ_96k"><img src="https://img.shields.io/badge/twitter-%231DA1F2.svg?&style=for-the-badge&logo=twitter&logoColor=white" height=25></a> <a href="https://www.linkedin.com/in/tushar-nikam-a29a97131/"><img src="https://img.shields.io/badge/linkedin-%230077B5.svg?&style=for-the-badge&logo=linkedin&logoColor=white" height=25></a> <a href="https://medium.com/@champ96k"><img src="https://img.shields.io/badge/medium-%2312100E.svg?&style=for-the-badge&logo=medium&logoColor=white" height=25></a> <a href="https://champ96k.github.io"><img src="https://img.shields.io/badge/tusharnikam.ml-portfolio-orange" height=25></a> <a href="https://stackoverflow.com/users/11157840/tushar-nikam" target="_blank"><img src="https://logos-download.com/wp-content/uploads/2019/01/Stack_Overflow_Logo-700x283.png" alt="Stackoverflow" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;"height=25 ></a> <a href="https://www.buymeacoffee.com/champ96k" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;"height=25 ></a></p>

lib/flutter_walkthrough_screen.dart

Lines changed: 104 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
1+
// Copyright 2013 Tushar Nikam. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
library walkthrough_screen;
26
import 'package:flutter/material.dart';
37

48
class OnbordingData extends StatelessWidget {
9+
10+
///Contain the list of ImageProvider such as Network Asset,SVG etc Images
511
final ImageProvider<Object> image;
12+
13+
///Title text
614
final Widget titleText;
15+
16+
///Description of the `walkthrough`
717
final Widget descText;
8-
final double imageHeight;
9-
final double imageWidth;
10-
final BoxFit fit;
11-
final EdgeInsetsGeometry titlePadding;
12-
final EdgeInsetsGeometry descPadding;
18+
19+
/// Height of the image Default is `MediaQuery.of(context).size.height * 0.5`
20+
final double? imageHeight;
21+
22+
///Width of the image default is `MediaQuery.of(context).size.width`
23+
final double? imageWidth;
24+
25+
///Default is BoxFit.cover
26+
final BoxFit? fit;
27+
28+
///Default padding is `EdgeInsets.symmetric(horizontal: 8.0)`,
29+
final EdgeInsetsGeometry? titlePadding;
30+
31+
///Default padding is `EdgeInsets.symmetric(horizontal: 8.0)`,
32+
final EdgeInsetsGeometry? descPadding;
1333

1434
const OnbordingData({
15-
Key key,
16-
@required this.image,
17-
@required this.titleText,
18-
@required this.descText,
35+
Key? key,
36+
required this.image,
37+
required this.titleText,
38+
required this.descText,
1939
this.imageHeight,
2040
this.imageWidth,
2141
this.fit,
@@ -32,13 +52,13 @@ class OnbordingData extends StatelessWidget {
3252
children: <Widget>[
3353

3454
SizedBox(
35-
height: 18.0,
55+
height: 18.0
3656
),
3757

3858
Padding(
3959
padding: titlePadding == null
4060
? EdgeInsets.symmetric(horizontal: 8.0)
41-
: titlePadding,
61+
: titlePadding!,
4262
child: Wrap(
4363
children: [
4464
titleText,
@@ -56,7 +76,7 @@ class OnbordingData extends StatelessWidget {
5676
Padding(
5777
padding: descPadding == null
5878
? EdgeInsets.symmetric(horizontal: 8.0)
59-
: descPadding,
79+
: descPadding!,
6080
child: Wrap(
6181
children: [
6282
descText,
@@ -71,28 +91,88 @@ class OnbordingData extends StatelessWidget {
7191

7292
/// A IntroScreen Class.
7393
class IntroScreen extends StatefulWidget {
94+
95+
///contain list of Onbording screen data such as
96+
///OnbordingData(
97+
// image: AssetImage("images/pic3.png"),
98+
// fit: BoxFit.cover,
99+
// imageHeight: 250,
100+
// titleText: RichText(
101+
// textAlign: TextAlign.center,
102+
// text: TextSpan(
103+
// children: [
104+
// TextSpan(
105+
// text: "Pickup delivery at \nyour ",
106+
// style: TextStyle(
107+
// color: Colors.black,
108+
// fontSize: 20.0,
109+
// )),
110+
// TextSpan(
111+
// text: "door ! ",
112+
// style: TextStyle(
113+
// color: Colors.orange,
114+
// fontSize: 22.0,
115+
// fontWeight: FontWeight.w500),
116+
// ),
117+
// ],
118+
// ),
119+
// ),
120+
// descText: RichText(
121+
// textAlign: TextAlign.center,
122+
// text: TextSpan(
123+
// children: [
124+
// TextSpan(
125+
// text:
126+
// "Even to space with us! Together, pickup delivery at your home ",
127+
// style: TextStyle(
128+
// color: Colors.grey,
129+
// fontSize: 17.0,
130+
// ),
131+
// ),
132+
// ],
133+
// ),
134+
// ),
135+
// descPadding: EdgeInsets.symmetric(horizontal: 22.0),
136+
// ),
74137
final List<OnbordingData> onbordingDataList;
75-
final MaterialPageRoute pageRoute;
138+
139+
///
140+
final MaterialPageRoute? pageRoute;
141+
142+
///
76143
final List<Color> colors;
144+
145+
///
77146
final Widget nextButton;
147+
148+
///
78149
final Widget lastButton;
150+
151+
///
79152
final Widget skipButton;
80-
final Color selectedDotColor;
81-
final Color unSelectdDotColor;
82-
final Gradient gradient;
153+
154+
///
155+
final Color? selectedDotColor;
156+
157+
///
158+
final Color? unSelectdDotColor;
159+
160+
///
161+
final Gradient? gradient;
162+
83163
IntroScreen(
84-
{@required this.onbordingDataList,
164+
{required this.onbordingDataList,
85165
this.pageRoute,
86-
@required this.colors,
166+
required this.colors,
87167
this.selectedDotColor,
88168
this.unSelectdDotColor,
89169
this.gradient,
90-
@required this.nextButton,
91-
@required this.lastButton,
92-
@required this.skipButton});
170+
required this.nextButton,
171+
required this.lastButton,
172+
required this.skipButton});
93173

94174
void skipPage(BuildContext context) {
95-
Navigator.push(context, pageRoute);
175+
Navigator.push(context, pageRoute!);
96176
}
97177

98178
@override
@@ -168,7 +248,7 @@ class IntroScreenState extends State<IntroScreen> {
168248
mainAxisAlignment: MainAxisAlignment.spaceBetween,
169249
crossAxisAlignment: CrossAxisAlignment.end,
170250
children: <Widget>[
171-
FlatButton(
251+
TextButton(
172252
child: lastPage ? Text("") : widget.skipButton,
173253
onPressed: () => lastPage
174254
? null
@@ -185,7 +265,7 @@ class IntroScreenState extends State<IntroScreen> {
185265
(index) => _buildPageIndicator(index))),
186266
),
187267
),
188-
FlatButton(
268+
TextButton(
189269
child: lastPage ? widget.lastButton : widget.nextButton,
190270
onPressed: () => lastPage
191271
? widget.skipPage(context)

pubspec.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,49 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.5.0-nullsafety.1"
10+
version: "2.6.1"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.1.0-nullsafety.1"
17+
version: "2.1.0"
1818
characters:
1919
dependency: transitive
2020
description:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0-nullsafety.3"
24+
version: "1.1.0"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.2.0-nullsafety.1"
31+
version: "1.2.0"
3232
clock:
3333
dependency: transitive
3434
description:
3535
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.1.0-nullsafety.1"
38+
version: "1.1.0"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.15.0-nullsafety.3"
45+
version: "1.15.0"
4646
fake_async:
4747
dependency: transitive
4848
description:
4949
name: fake_async
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.2.0-nullsafety.1"
52+
version: "1.2.0"
5353
flutter:
5454
dependency: "direct main"
5555
description: flutter
@@ -66,21 +66,21 @@ packages:
6666
name: matcher
6767
url: "https://pub.dartlang.org"
6868
source: hosted
69-
version: "0.12.10-nullsafety.1"
69+
version: "0.12.10"
7070
meta:
7171
dependency: transitive
7272
description:
7373
name: meta
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "1.3.0-nullsafety.3"
76+
version: "1.3.0"
7777
path:
7878
dependency: transitive
7979
description:
8080
name: path
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "1.8.0-nullsafety.1"
83+
version: "1.8.0"
8484
sky_engine:
8585
dependency: transitive
8686
description: flutter
@@ -92,56 +92,56 @@ packages:
9292
name: source_span
9393
url: "https://pub.dartlang.org"
9494
source: hosted
95-
version: "1.8.0-nullsafety.2"
95+
version: "1.8.1"
9696
stack_trace:
9797
dependency: transitive
9898
description:
9999
name: stack_trace
100100
url: "https://pub.dartlang.org"
101101
source: hosted
102-
version: "1.10.0-nullsafety.1"
102+
version: "1.10.0"
103103
stream_channel:
104104
dependency: transitive
105105
description:
106106
name: stream_channel
107107
url: "https://pub.dartlang.org"
108108
source: hosted
109-
version: "2.1.0-nullsafety.1"
109+
version: "2.1.0"
110110
string_scanner:
111111
dependency: transitive
112112
description:
113113
name: string_scanner
114114
url: "https://pub.dartlang.org"
115115
source: hosted
116-
version: "1.1.0-nullsafety.1"
116+
version: "1.1.0"
117117
term_glyph:
118118
dependency: transitive
119119
description:
120120
name: term_glyph
121121
url: "https://pub.dartlang.org"
122122
source: hosted
123-
version: "1.2.0-nullsafety.1"
123+
version: "1.2.0"
124124
test_api:
125125
dependency: transitive
126126
description:
127127
name: test_api
128128
url: "https://pub.dartlang.org"
129129
source: hosted
130-
version: "0.2.19-nullsafety.2"
130+
version: "0.3.0"
131131
typed_data:
132132
dependency: transitive
133133
description:
134134
name: typed_data
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "1.3.0-nullsafety.3"
137+
version: "1.3.0"
138138
vector_math:
139139
dependency: transitive
140140
description:
141141
name: vector_math
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "2.1.0-nullsafety.3"
144+
version: "2.1.0"
145145
sdks:
146-
dart: ">=2.10.0-110 <2.11.0"
147-
flutter: ">=1.17.0"
146+
dart: ">=2.12.0 <3.0.0"
147+
flutter: ">=2.0.0"

0 commit comments

Comments
 (0)