Skip to content

Commit 0b2498f

Browse files
authored
Merge pull request #1 from Sasikumar3595/main
FLUT-4313-Sample updated with null safety.
2 parents e020cee + 47f8640 commit 0b2498f

File tree

4 files changed

+41
-53
lines changed

4 files changed

+41
-53
lines changed

lib/main.dart

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,16 @@ import 'package:flutter/scheduler.dart';
44
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
55

66
void main() {
7-
return runApp(BlackoutDates_Updation());
7+
return runApp(BlackoutDatesUpdation());
88
}
99

10-
class BlackoutDates_Updation extends StatefulWidget {
10+
class BlackoutDatesUpdation extends StatefulWidget {
1111
@override
1212
BlackoutDates createState() => BlackoutDates();
1313
}
1414

15-
class BlackoutDates extends State<BlackoutDates_Updation> {
16-
List<DateTime> _blackoutDates;
17-
18-
@override
19-
void initState() {
20-
_blackoutDates = <DateTime>[];
21-
super.initState();
22-
}
15+
class BlackoutDates extends State<BlackoutDatesUpdation> {
16+
List<DateTime> _blackoutDates = <DateTime>[];
2317

2418
@override
2519
Widget build(BuildContext context) {
@@ -31,10 +25,9 @@ class BlackoutDates extends State<BlackoutDates_Updation> {
3125
selectionMode: DateRangePickerSelectionMode.single,
3226
monthViewSettings: DateRangePickerMonthViewSettings(
3327
blackoutDates: _blackoutDates),
34-
monthCellStyle: DateRangePickerMonthCellStyle(blackoutDateTextStyle:
35-
TextStyle(
36-
color: Colors.red,
37-
decoration: TextDecoration.lineThrough),
28+
monthCellStyle: DateRangePickerMonthCellStyle(
29+
blackoutDateTextStyle: TextStyle(
30+
color: Colors.red, decoration: TextDecoration.lineThrough),
3831
),
3932
onViewChanged: viewChanged,
4033
)),
@@ -44,16 +37,13 @@ class BlackoutDates extends State<BlackoutDates_Updation> {
4437

4538
void viewChanged(DateRangePickerViewChangedArgs args) {
4639
List<DateTime> _blackoutDateCollection = <DateTime>[];
47-
_blackoutDateCollection.add(args.visibleDateRange.startDate);
48-
_blackoutDateCollection
49-
.add(args.visibleDateRange.startDate.add(Duration(days: 1)));
50-
_blackoutDateCollection
51-
.add(args.visibleDateRange.startDate.add(Duration(days: 2)));
52-
_blackoutDateCollection
53-
.add(args.visibleDateRange.startDate.add(Duration(days: 3)));
54-
_blackoutDateCollection
55-
.add(args.visibleDateRange.startDate.add(Duration(days: 4)));
56-
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
40+
final DateTime visibleStartDate = args.visibleDateRange.startDate!;
41+
_blackoutDateCollection.add(visibleStartDate);
42+
_blackoutDateCollection.add(visibleStartDate.add(Duration(days: 1)));
43+
_blackoutDateCollection.add(visibleStartDate.add(Duration(days: 2)));
44+
_blackoutDateCollection.add(visibleStartDate.add(Duration(days: 3)));
45+
_blackoutDateCollection.add(visibleStartDate.add(Duration(days: 4)));
46+
SchedulerBinding.instance!.addPostFrameCallback((timeStamp) {
5747
setState(() {
5848
_blackoutDates = _blackoutDateCollection;
5949
});

pubspec.lock

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.5.0-nullsafety.3"
10+
version: "2.5.0"
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.3"
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.5"
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.3"
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.3"
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.5"
45+
version: "1.15.0"
4646
cupertino_icons:
4747
dependency: "direct main"
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-nullsafety.3"
59+
version: "1.2.0"
6060
flutter:
6161
dependency: "direct main"
6262
description: flutter
@@ -73,28 +73,28 @@ packages:
7373
name: intl
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "0.16.1"
76+
version: "0.17.0"
7777
matcher:
7878
dependency: transitive
7979
description:
8080
name: matcher
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "0.12.10-nullsafety.3"
83+
version: "0.12.10"
8484
meta:
8585
dependency: transitive
8686
description:
8787
name: meta
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "1.3.0-nullsafety.6"
90+
version: "1.3.0"
9191
path:
9292
dependency: transitive
9393
description:
9494
name: path
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "1.8.0-nullsafety.3"
97+
version: "1.8.0"
9898
sky_engine:
9999
dependency: transitive
100100
description: flutter
@@ -106,69 +106,69 @@ packages:
106106
name: source_span
107107
url: "https://pub.dartlang.org"
108108
source: hosted
109-
version: "1.8.0-nullsafety.4"
109+
version: "1.8.1"
110110
stack_trace:
111111
dependency: transitive
112112
description:
113113
name: stack_trace
114114
url: "https://pub.dartlang.org"
115115
source: hosted
116-
version: "1.10.0-nullsafety.6"
116+
version: "1.10.0"
117117
stream_channel:
118118
dependency: transitive
119119
description:
120120
name: stream_channel
121121
url: "https://pub.dartlang.org"
122122
source: hosted
123-
version: "2.1.0-nullsafety.3"
123+
version: "2.1.0"
124124
string_scanner:
125125
dependency: transitive
126126
description:
127127
name: string_scanner
128128
url: "https://pub.dartlang.org"
129129
source: hosted
130-
version: "1.1.0-nullsafety.3"
130+
version: "1.1.0"
131131
syncfusion_flutter_core:
132132
dependency: transitive
133133
description:
134134
name: syncfusion_flutter_core
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "18.4.43"
137+
version: "19.1.55"
138138
syncfusion_flutter_datepicker:
139139
dependency: "direct main"
140140
description:
141141
name: syncfusion_flutter_datepicker
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "18.4.43-beta"
144+
version: "19.1.55-beta"
145145
term_glyph:
146146
dependency: transitive
147147
description:
148148
name: term_glyph
149149
url: "https://pub.dartlang.org"
150150
source: hosted
151-
version: "1.2.0-nullsafety.3"
151+
version: "1.2.0"
152152
test_api:
153153
dependency: transitive
154154
description:
155155
name: test_api
156156
url: "https://pub.dartlang.org"
157157
source: hosted
158-
version: "0.2.19-nullsafety.6"
158+
version: "0.2.19"
159159
typed_data:
160160
dependency: transitive
161161
description:
162162
name: typed_data
163163
url: "https://pub.dartlang.org"
164164
source: hosted
165-
version: "1.3.0-nullsafety.5"
165+
version: "1.3.0"
166166
vector_math:
167167
dependency: transitive
168168
description:
169169
name: vector_math
170170
url: "https://pub.dartlang.org"
171171
source: hosted
172-
version: "2.1.0-nullsafety.5"
172+
version: "2.1.0"
173173
sdks:
174-
dart: ">=2.12.0-0.0 <3.0.0"
174+
dart: ">=2.12.0 <3.0.0"

pubspec.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1818
version: 1.0.0+1
1919

2020
environment:
21-
sdk: ">=2.7.0 <3.0.0"
21+
sdk: '>=2.12.0 <3.0.0'
2222

2323
dependencies:
2424
flutter:
2525
sdk: flutter
26-
# syncfusion_flutter_calendar:
27-
# path: E:\jan 20\flutter-calendar\flutter_calendar\syncfusion_flutter_calendar
28-
syncfusion_flutter_datepicker: 18.4.43-beta
29-
intl: ^0.16.1
26+
syncfusion_flutter_datepicker: ^19.1.55-beta
27+
intl: ^0.17.0
3028

3129
# The following adds the Cupertino Icons font to your application.
3230
# Use with the CupertinoIcons class for iOS style icons.
33-
cupertino_icons: ^1.0.1
31+
cupertino_icons: ^1.0.2
3432

3533
dev_dependencies:
3634
flutter_test:

test/widget_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import 'package:flutter_visibledates_calendar/main.dart';
1212
void main() {
1313
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
1414
// Build our app and trigger a frame.
15-
await tester.pumpWidget(BlackoutDates_Updation());
15+
await tester.pumpWidget(BlackoutDatesUpdation());
1616

1717
// Verify that our counter starts at 0.
1818
expect(find.text('0'), findsOneWidget);

0 commit comments

Comments
 (0)