Skip to content

Commit 967457f

Browse files
Merge pull request #2 from Sasikumar3595/master
FLUT-4313-Sample updated with null safety.
2 parents 436c338 + 96923da commit 967457f

File tree

3 files changed

+61
-149
lines changed

3 files changed

+61
-149
lines changed

lib/main.dart

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,8 @@ class MultiplePickerSample extends StatefulWidget {
2323
}
2424

2525
class _MultiplePickerSampleState extends State<MultiplePickerSample> {
26-
DateRangePickerController _controller;
27-
String _headerString;
28-
29-
@override
30-
void initState() {
31-
_controller = DateRangePickerController();
32-
super.initState();
33-
}
26+
final DateRangePickerController _controller = DateRangePickerController();
27+
String _headerString = '';
3428

3529
@override
3630
Widget build(BuildContext context) {
@@ -57,7 +51,7 @@ class _MultiplePickerSampleState extends State<MultiplePickerSample> {
5751
highlightColor: Colors.lightGreen,
5852
onPressed: () {
5953
setState(() {
60-
_controller.backward();
54+
_controller.backward!();
6155
});
6256
},
6357
)),
@@ -82,7 +76,7 @@ class _MultiplePickerSampleState extends State<MultiplePickerSample> {
8276
highlightColor: Colors.lightGreen,
8377
onPressed: () {
8478
setState(() {
85-
_controller.forward();
79+
_controller.forward!();
8680
});
8781
},
8882
)),
@@ -100,10 +94,9 @@ class _MultiplePickerSampleState extends State<MultiplePickerSample> {
10094
enableMultiView: true,
10195
onViewChanged: viewChanged,
10296
monthViewSettings: DateRangePickerMonthViewSettings(
103-
showTrailingAndLeadingDates: true,
10497
viewHeaderStyle: DateRangePickerViewHeaderStyle(
105-
backgroundColor: Color(0xFFfcc169),
106-
)),
98+
backgroundColor: Color(0xFFfcc169),
99+
)),
107100
),
108101
),
109102
)
@@ -112,16 +105,18 @@ class _MultiplePickerSampleState extends State<MultiplePickerSample> {
112105
}
113106

114107
void viewChanged(DateRangePickerViewChangedArgs args) {
115-
final int count = (args.visibleDateRange.endDate
116-
.difference(args.visibleDateRange.startDate)
117-
.inDays);
118-
/// For updating proper custom header string if showLeadingAndTrailingDates value as true/false.
108+
final DateTime startDate = args.visibleDateRange.startDate!;
109+
final DateTime endDate = args.visibleDateRange.endDate!;
110+
final int count = endDate.difference(startDate).inDays;
111+
119112
_headerString = DateFormat('MMMM yyyy')
120-
.format(args.visibleDateRange.startDate.add(Duration(days: (count * 0.25).toInt())))
121-
.toString() + ' - ' +DateFormat('MMMM yyyy')
122-
.format(args.visibleDateRange.startDate.add(Duration(days: (count * 0.75).toInt())))
123-
.toString();
124-
SchedulerBinding.instance.addPostFrameCallback((duration) {
113+
.format(startDate.add(Duration(days: (count * 0.25).toInt())))
114+
.toString() +
115+
' - ' +
116+
DateFormat('MMMM yyyy')
117+
.format(startDate.add(Duration(days: (count * 0.75).toInt())))
118+
.toString();
119+
SchedulerBinding.instance!.addPostFrameCallback((duration) {
125120
setState(() {});
126121
});
127122
}

pubspec.lock

Lines changed: 39 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,62 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4-
archive:
5-
dependency: transitive
6-
description:
7-
name: archive
8-
url: "https://pub.dartlang.org"
9-
source: hosted
10-
version: "2.0.13"
11-
args:
12-
dependency: transitive
13-
description:
14-
name: args
15-
url: "https://pub.dartlang.org"
16-
source: hosted
17-
version: "1.6.0"
184
async:
195
dependency: transitive
206
description:
217
name: async
228
url: "https://pub.dartlang.org"
239
source: hosted
24-
version: "2.4.1"
10+
version: "2.5.0"
2511
boolean_selector:
2612
dependency: transitive
2713
description:
2814
name: boolean_selector
2915
url: "https://pub.dartlang.org"
3016
source: hosted
31-
version: "2.0.0"
32-
charcode:
17+
version: "2.1.0"
18+
characters:
3319
dependency: transitive
3420
description:
35-
name: charcode
21+
name: characters
3622
url: "https://pub.dartlang.org"
3723
source: hosted
38-
version: "1.1.3"
39-
collection:
24+
version: "1.1.0"
25+
charcode:
4026
dependency: transitive
4127
description:
42-
name: collection
28+
name: charcode
4329
url: "https://pub.dartlang.org"
4430
source: hosted
45-
version: "1.14.12"
46-
convert:
31+
version: "1.2.0"
32+
clock:
4733
dependency: transitive
4834
description:
49-
name: convert
35+
name: clock
5036
url: "https://pub.dartlang.org"
5137
source: hosted
52-
version: "2.1.1"
53-
crypto:
38+
version: "1.1.0"
39+
collection:
5440
dependency: transitive
5541
description:
56-
name: crypto
42+
name: collection
5743
url: "https://pub.dartlang.org"
5844
source: hosted
59-
version: "2.1.4"
45+
version: "1.15.0"
6046
cupertino_icons:
6147
dependency: "direct main"
6248
description:
6349
name: cupertino_icons
6450
url: "https://pub.dartlang.org"
6551
source: hosted
66-
version: "0.1.3"
52+
version: "1.0.2"
53+
fake_async:
54+
dependency: transitive
55+
description:
56+
name: fake_async
57+
url: "https://pub.dartlang.org"
58+
source: hosted
59+
version: "1.2.0"
6760
flutter:
6861
dependency: "direct main"
6962
description: flutter
@@ -74,67 +67,34 @@ packages:
7467
description: flutter
7568
source: sdk
7669
version: "0.0.0"
77-
flutter_web_plugins:
78-
dependency: transitive
79-
description: flutter
80-
source: sdk
81-
version: "0.0.0"
82-
image:
83-
dependency: transitive
84-
description:
85-
name: image
86-
url: "https://pub.dartlang.org"
87-
source: hosted
88-
version: "2.1.12"
8970
intl:
90-
dependency: "direct dev"
71+
dependency: "direct main"
9172
description:
9273
name: intl
9374
url: "https://pub.dartlang.org"
9475
source: hosted
95-
version: "0.16.1"
76+
version: "0.17.0"
9677
matcher:
9778
dependency: transitive
9879
description:
9980
name: matcher
10081
url: "https://pub.dartlang.org"
10182
source: hosted
102-
version: "0.12.6"
83+
version: "0.12.10"
10384
meta:
10485
dependency: transitive
10586
description:
10687
name: meta
10788
url: "https://pub.dartlang.org"
10889
source: hosted
109-
version: "1.1.8"
90+
version: "1.3.0"
11091
path:
11192
dependency: transitive
11293
description:
11394
name: path
11495
url: "https://pub.dartlang.org"
11596
source: hosted
116-
version: "1.6.4"
117-
petitparser:
118-
dependency: transitive
119-
description:
120-
name: petitparser
121-
url: "https://pub.dartlang.org"
122-
source: hosted
123-
version: "2.4.0"
124-
plugin_platform_interface:
125-
dependency: transitive
126-
description:
127-
name: plugin_platform_interface
128-
url: "https://pub.dartlang.org"
129-
source: hosted
130-
version: "1.0.2"
131-
quiver:
132-
dependency: transitive
133-
description:
134-
name: quiver
135-
url: "https://pub.dartlang.org"
136-
source: hosted
137-
version: "2.1.3"
97+
version: "1.8.0"
13898
sky_engine:
13999
dependency: transitive
140100
description: flutter
@@ -146,112 +106,69 @@ packages:
146106
name: source_span
147107
url: "https://pub.dartlang.org"
148108
source: hosted
149-
version: "1.7.0"
109+
version: "1.8.1"
150110
stack_trace:
151111
dependency: transitive
152112
description:
153113
name: stack_trace
154114
url: "https://pub.dartlang.org"
155115
source: hosted
156-
version: "1.9.3"
116+
version: "1.10.0"
157117
stream_channel:
158118
dependency: transitive
159119
description:
160120
name: stream_channel
161121
url: "https://pub.dartlang.org"
162122
source: hosted
163-
version: "2.0.0"
123+
version: "2.1.0"
164124
string_scanner:
165125
dependency: transitive
166126
description:
167127
name: string_scanner
168128
url: "https://pub.dartlang.org"
169129
source: hosted
170-
version: "1.0.5"
130+
version: "1.1.0"
171131
syncfusion_flutter_core:
172132
dependency: transitive
173133
description:
174134
name: syncfusion_flutter_core
175135
url: "https://pub.dartlang.org"
176136
source: hosted
177-
version: "18.2.44"
137+
version: "19.1.55"
178138
syncfusion_flutter_datepicker:
179-
dependency: "direct dev"
139+
dependency: "direct main"
180140
description:
181141
name: syncfusion_flutter_datepicker
182142
url: "https://pub.dartlang.org"
183143
source: hosted
184-
version: "18.2.44-beta"
144+
version: "19.1.55-beta"
185145
term_glyph:
186146
dependency: transitive
187147
description:
188148
name: term_glyph
189149
url: "https://pub.dartlang.org"
190150
source: hosted
191-
version: "1.1.0"
151+
version: "1.2.0"
192152
test_api:
193153
dependency: transitive
194154
description:
195155
name: test_api
196156
url: "https://pub.dartlang.org"
197157
source: hosted
198-
version: "0.2.15"
158+
version: "0.2.19"
199159
typed_data:
200160
dependency: transitive
201161
description:
202162
name: typed_data
203163
url: "https://pub.dartlang.org"
204164
source: hosted
205-
version: "1.1.6"
206-
url_launcher:
207-
dependency: transitive
208-
description:
209-
name: url_launcher
210-
url: "https://pub.dartlang.org"
211-
source: hosted
212-
version: "5.4.2"
213-
url_launcher_macos:
214-
dependency: transitive
215-
description:
216-
name: url_launcher_macos
217-
url: "https://pub.dartlang.org"
218-
source: hosted
219-
version: "0.0.1+4"
220-
url_launcher_platform_interface:
221-
dependency: transitive
222-
description:
223-
name: url_launcher_platform_interface
224-
url: "https://pub.dartlang.org"
225-
source: hosted
226-
version: "1.0.6"
227-
url_launcher_web:
228-
dependency: transitive
229-
description:
230-
name: url_launcher_web
231-
url: "https://pub.dartlang.org"
232-
source: hosted
233-
version: "0.1.1+1"
234-
utf:
235-
dependency: transitive
236-
description:
237-
name: utf
238-
url: "https://pub.dartlang.org"
239-
source: hosted
240-
version: "0.9.0+5"
165+
version: "1.3.0"
241166
vector_math:
242167
dependency: transitive
243168
description:
244169
name: vector_math
245170
url: "https://pub.dartlang.org"
246171
source: hosted
247-
version: "2.0.8"
248-
xml:
249-
dependency: transitive
250-
description:
251-
name: xml
252-
url: "https://pub.dartlang.org"
253-
source: hosted
254-
version: "3.6.1"
172+
version: "2.1.0"
255173
sdks:
256-
dart: ">=2.6.0 <3.0.0"
257-
flutter: ">=1.12.8 <2.0.0"
174+
dart: ">=2.12.0 <3.0.0"

pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ description: A new Flutter application.
1414
version: 1.0.0+1
1515

1616
environment:
17-
sdk: ">=2.1.0 <3.0.0"
17+
sdk: '>=2.12.0 <3.0.0'
1818

1919
dependencies:
2020
flutter:
2121
sdk: flutter
2222

23+
24+
syncfusion_flutter_datepicker: ^19.1.55-beta
25+
intl: ^0.17.0
2326
# The following adds the Cupertino Icons font to your application.
2427
# Use with the CupertinoIcons class for iOS style icons.
25-
cupertino_icons: ^0.1.2
28+
cupertino_icons: ^1.0.2
2629

2730
dev_dependencies:
2831
flutter_test:
2932
sdk: flutter
30-
syncfusion_flutter_datepicker: 18.2.44-beta
31-
intl: ">=0.15.0 <0.17.0"
32-
3333

3434
# For information on the generic Dart part of this file, see the
3535
# following page: https://dart.dev/tools/pub/pubspec

0 commit comments

Comments
 (0)