Skip to content

Commit db1831c

Browse files
authored
Merge pull request #86 from fluttercommunity/null-safety
Null safety
2 parents a24774c + 031be10 commit db1831c

File tree

16 files changed

+129
-212
lines changed

16 files changed

+129
-212
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
This widget is in active development.
2323
___Any contribution, idea, criticism or feedback is welcomed.___
2424

25+
__NOTE: If using Flutter v1.x.x, use v0.5.x pub version.__
26+
2527
## Quick links
2628

2729
| | |

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:pedantic/analysis_options.1.8.0.yaml
1+
include: package:pedantic/analysis_options.yaml
22

33
analyzer:
44
exclude: [build/**]

demo/lib/data/theme_data.dart

Lines changed: 0 additions & 100 deletions
This file was deleted.

demo/lib/data/use_case.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import 'package:flutter/material.dart';
33
/// Abstract class for defining a use case that is presented within the demo app.
44
abstract class UseCase {
55
/// The name of the use case.
6-
String name;
6+
late String name;
77

88
/// Description of the use case.
9-
String description;
9+
late String description;
1010

1111
/// Path to the file containing the sample code of the use case.
12-
String codeFile;
12+
String? codeFile;
1313

1414
/// The `Widget` representing a preview of the given use case.
15-
Widget preview;
15+
Widget? preview;
1616
}

demo/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import 'package:demo/data/theme_data.dart';
21
import 'package:demo/data/use_case.dart';
32
import 'package:demo/use_cases/contextual_controls/contextual_controls_use_case.dart';
43
import 'package:demo/use_cases/contextual_info/contextual_info_use_case.dart';
54
import 'package:demo/use_cases/filter/filter_use_case.dart';
65
import 'package:demo/use_cases/navigation/navigation_use_case.dart';
76
import 'package:flutter/material.dart';
87
import 'package:gallerize/gallerize.dart';
8+
import 'package:gallerize/themes/gallerize_theme_data.dart';
99

1010
void main() => runApp(DemoApp());
1111

@@ -15,7 +15,7 @@ class DemoApp extends StatelessWidget {
1515
Widget build(BuildContext context) {
1616
return MaterialApp(
1717
title: "Backdrop Gallery",
18-
theme: GalleryThemeData.darkThemeData,
18+
theme: GallerizeThemeData.darkThemeData,
1919
home: HomePage(),
2020
);
2121
}

demo/lib/use_cases/contextual_controls/contextual_controls.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ class _ContextualControlsState extends State<ContextualControls> {
5353
items: _COLOR_MAP.keys.map<DropdownMenuItem<Color>>((Color c) {
5454
return DropdownMenuItem<Color>(
5555
value: c,
56-
child: Text(_COLOR_MAP[c]),
56+
child: Text(_COLOR_MAP[c]!),
5757
);
5858
}).toList(),
59-
onChanged: (Color newValue) {
59+
onChanged: (Color? newValue) {
6060
setState(() {
61-
_color = newValue;
61+
_color = newValue!;
6262
});
6363
},
6464
),
@@ -99,9 +99,9 @@ class _ContextualControlsState extends State<ContextualControls> {
9999
child: Text("${r.toString()} GB"),
100100
);
101101
}).toList(),
102-
onChanged: (int newValue) {
102+
onChanged: (int? newValue) {
103103
setState(() {
104-
_ram = newValue;
104+
_ram = newValue!;
105105
});
106106
},
107107
),
@@ -132,7 +132,7 @@ class _ContextualControlsState extends State<ContextualControls> {
132132
"Laptop",
133133
style: Theme.of(context)
134134
.textTheme
135-
.headline3
135+
.headline3!
136136
.apply(color: Colors.black),
137137
),
138138
],

demo/lib/use_cases/contextual_info/contextual_info.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ContextualInfo extends StatelessWidget {
9393
"Laptop",
9494
style: Theme.of(context)
9595
.textTheme
96-
.headline3
96+
.headline3!
9797
.apply(color: Colors.black),
9898
),
9999
],
@@ -156,7 +156,7 @@ class ContextualInfo extends StatelessWidget {
156156
title: Text("Reviews",
157157
style: Theme.of(context)
158158
.textTheme
159-
.headline6
159+
.headline6!
160160
.apply(color: Colors.black)),
161161
),
162162
ListTile(

demo/lib/use_cases/filter/filter.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class _FilterState extends State<Filter> {
2323
];
2424
Set<ItemCategory> _filteredCategories =
2525
Set.from([ItemCategory.Electronics, ItemCategory.Transportation]);
26-
List<Item> _shownItems;
26+
late List<Item> _shownItems;
2727

2828
@override
2929
void initState() {
@@ -70,8 +70,8 @@ class _FilterState extends State<Filter> {
7070
ListView.builder(
7171
itemCount: _CATEGORIES.length,
7272
itemBuilder: (context, index) => CheckboxListTile(
73-
onChanged: (bool checked) =>
74-
_addOrRemoveFilterCategory(checked, _CATEGORIES[index]),
73+
onChanged: (bool? checked) =>
74+
_addOrRemoveFilterCategory(checked!, _CATEGORIES[index]),
7575
value: _filteredCategories.contains(_CATEGORIES[index]),
7676
title: Text(describeEnum(_CATEGORIES[index].toString())),
7777
activeColor: Colors.white,

demo/pubspec.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,21 @@ 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
2626

27-
# The following adds the Cupertino Icons font to your application.
28-
# Use with the CupertinoIcons class for iOS style icons.
29-
cupertino_icons: ^0.1.3
30-
google_fonts: ^1.1.0
31-
flutter_highlight: ^0.6.0
32-
gallerize: ^0.0.4
27+
gallerize: ^0.1.0
3328
# Add backdrop dependency here
3429
backdrop:
3530
path: "../"
3631

3732
dev_dependencies:
3833
flutter_test:
3934
sdk: flutter
40-
flutter_launcher_icons: "^0.7.3"
35+
flutter_launcher_icons: ^0.9.0
4136

4237
flutter_icons:
4338
android: false

example/pubspec.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ name: example
22
description: A new Flutter project.
33

44
environment:
5-
sdk: '>=2.10.0 <3.0.0'
5+
sdk: '>=2.12.0 <3.0.0'
66

77
dependencies:
88
flutter:
99
sdk: flutter
1010

11-
# The following adds the Cupertino Icons font to your application.
12-
# Use with the CupertinoIcons class for iOS style icons.
13-
cupertino_icons: ^0.1.2
1411
# Add backdrop dependency here
1512
backdrop:
1613
path: "../"

0 commit comments

Comments
 (0)