Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null safety #86

Merged
merged 15 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
This widget is in active development.
___Any contribution, idea, criticism or feedback is welcomed.___

__NOTE: If using Flutter v1.x.x, use v0.5.x pub version.__

## Quick links

| | |
Expand Down
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.8.0.yaml
include: package:pedantic/analysis_options.yaml

analyzer:
exclude: [build/**]
Expand Down
100 changes: 0 additions & 100 deletions demo/lib/data/theme_data.dart

This file was deleted.

8 changes: 4 additions & 4 deletions demo/lib/data/use_case.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import 'package:flutter/material.dart';
/// Abstract class for defining a use case that is presented within the demo app.
abstract class UseCase {
/// The name of the use case.
String name;
late String name;

/// Description of the use case.
String description;
late String description;

/// Path to the file containing the sample code of the use case.
String codeFile;
String? codeFile;

/// The `Widget` representing a preview of the given use case.
Widget preview;
Widget? preview;
}
4 changes: 2 additions & 2 deletions demo/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:demo/data/theme_data.dart';
import 'package:demo/data/use_case.dart';
import 'package:demo/use_cases/contextual_controls/contextual_controls_use_case.dart';
import 'package:demo/use_cases/contextual_info/contextual_info_use_case.dart';
import 'package:demo/use_cases/filter/filter_use_case.dart';
import 'package:demo/use_cases/navigation/navigation_use_case.dart';
import 'package:flutter/material.dart';
import 'package:gallerize/gallerize.dart';
import 'package:gallerize/themes/gallerize_theme_data.dart';

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

Expand All @@ -15,7 +15,7 @@ class DemoApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: "Backdrop Gallery",
theme: GalleryThemeData.darkThemeData,
theme: GallerizeThemeData.darkThemeData,
home: HomePage(),
);
}
Expand Down
12 changes: 6 additions & 6 deletions demo/lib/use_cases/contextual_controls/contextual_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ class _ContextualControlsState extends State<ContextualControls> {
items: _COLOR_MAP.keys.map<DropdownMenuItem<Color>>((Color c) {
return DropdownMenuItem<Color>(
value: c,
child: Text(_COLOR_MAP[c]),
child: Text(_COLOR_MAP[c]!),
);
}).toList(),
onChanged: (Color newValue) {
onChanged: (Color? newValue) {
setState(() {
_color = newValue;
_color = newValue!;
});
},
),
Expand Down Expand Up @@ -99,9 +99,9 @@ class _ContextualControlsState extends State<ContextualControls> {
child: Text("${r.toString()} GB"),
);
}).toList(),
onChanged: (int newValue) {
onChanged: (int? newValue) {
setState(() {
_ram = newValue;
_ram = newValue!;
});
},
),
Expand Down Expand Up @@ -132,7 +132,7 @@ class _ContextualControlsState extends State<ContextualControls> {
"Laptop",
style: Theme.of(context)
.textTheme
.headline3
.headline3!
.apply(color: Colors.black),
),
],
Expand Down
4 changes: 2 additions & 2 deletions demo/lib/use_cases/contextual_info/contextual_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ContextualInfo extends StatelessWidget {
"Laptop",
style: Theme.of(context)
.textTheme
.headline3
.headline3!
.apply(color: Colors.black),
),
],
Expand Down Expand Up @@ -156,7 +156,7 @@ class ContextualInfo extends StatelessWidget {
title: Text("Reviews",
style: Theme.of(context)
.textTheme
.headline6
.headline6!
.apply(color: Colors.black)),
),
ListTile(
Expand Down
6 changes: 3 additions & 3 deletions demo/lib/use_cases/filter/filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class _FilterState extends State<Filter> {
];
Set<ItemCategory> _filteredCategories =
Set.from([ItemCategory.Electronics, ItemCategory.Transportation]);
List<Item> _shownItems;
late List<Item> _shownItems;

@override
void initState() {
Expand Down Expand Up @@ -70,8 +70,8 @@ class _FilterState extends State<Filter> {
ListView.builder(
itemCount: _CATEGORIES.length,
itemBuilder: (context, index) => CheckboxListTile(
onChanged: (bool checked) =>
_addOrRemoveFilterCategory(checked, _CATEGORIES[index]),
onChanged: (bool? checked) =>
_addOrRemoveFilterCategory(checked!, _CATEGORIES[index]),
value: _filteredCategories.contains(_CATEGORIES[index]),
title: Text(describeEnum(_CATEGORIES[index].toString())),
activeColor: Colors.white,
Expand Down
11 changes: 3 additions & 8 deletions demo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,21 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
google_fonts: ^1.1.0
flutter_highlight: ^0.6.0
gallerize: ^0.0.4
gallerize: ^0.1.0
# Add backdrop dependency here
backdrop:
path: "../"

dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.7.3"
flutter_launcher_icons: ^0.9.0

flutter_icons:
android: false
Expand Down
5 changes: 1 addition & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ name: example
description: A new Flutter project.

environment:
sdk: '>=2.10.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
# Add backdrop dependency here
backdrop:
path: "../"
Expand Down
28 changes: 14 additions & 14 deletions lib/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class BackdropAppBar extends StatelessWidget implements PreferredSizeWidget {
/// If this is `null` and if [BackdropAppBar.automaticallyImplyLeading] is
/// set to `true`, [BackdropAppBar] sets the underlying [AppBar.leading] to
/// [BackdropToggleButton].
final Widget leading;
final Widget? leading;

/// See [AppBar.automaticallyImplyLeading].
///
Expand All @@ -67,45 +67,45 @@ class BackdropAppBar extends StatelessWidget implements PreferredSizeWidget {
final bool automaticallyImplyLeading;

/// The widget that should be displayed as the [AppBar] title.
final Widget title;
final Widget? title;

/// See [AppBar.actions].
final List<Widget> actions;
final List<Widget>? actions;

/// See [AppBar.flexibleSpace].
final Widget flexibleSpace;
final Widget? flexibleSpace;

/// See [AppBar.bottom].
final PreferredSizeWidget bottom;
final PreferredSizeWidget? bottom;

/// See [AppBar.elevation].
///
/// Defaults to 0.0. This differs from [AppBar.elevation].
final double elevation;

/// See [AppBar.shape]
final ShapeBorder shape;
final ShapeBorder? shape;

/// See [AppBar.backgroundColor].
final Color backgroundColor;
final Color? backgroundColor;

/// See [AppBar.brightness].
final Brightness brightness;
final Brightness? brightness;

/// See [AppBar.iconTheme].
final IconThemeData iconTheme;
final IconThemeData? iconTheme;

/// See [AppBar.actionsIconTheme].
final IconThemeData actionsIconTheme;
final IconThemeData? actionsIconTheme;

/// See [AppBar.textTheme].
final TextTheme textTheme;
final TextTheme? textTheme;

/// See [AppBar.primary].
final bool primary;

/// See [AppBar.centerTitle].
final bool centerTitle;
final bool? centerTitle;

/// See [AppBar.excludeHeaderSemantics].
final bool excludeHeaderSemantics;
Expand All @@ -127,7 +127,7 @@ class BackdropAppBar extends StatelessWidget implements PreferredSizeWidget {
///
/// For more information see [AppBar].
BackdropAppBar({
Key key,
Key? key,
this.leading,
this.automaticallyImplyLeading = true,
this.title,
Expand All @@ -154,7 +154,7 @@ class BackdropAppBar extends StatelessWidget implements PreferredSizeWidget {
assert(toolbarOpacity != null),
assert(bottomOpacity != null),
preferredSize = Size.fromHeight(
kToolbarHeight + (bottom?.preferredSize?.height ?? 0.0)),
kToolbarHeight + (bottom?.preferredSize.height ?? 0.0)),
super(key: key);

@override
Expand Down
Loading