Skip to content

null safety support and test on different platforms #2

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions tip_003_popup_card/lib/add_todo_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import 'hero_dialog_route.dart';
/// {@endtemplate}
class AddTodoButton extends StatelessWidget {
/// {@macro add_todo_button}
const AddTodoButton({Key key}) : super(key: key);
const AddTodoButton({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -57,7 +57,7 @@ const String _heroAddTodo = 'add-todo-hero';
/// {@endtemplate}
class _AddTodoPopupCard extends StatelessWidget {
/// {@macro add_todo_popup_card}
const _AddTodoPopupCard({Key key}) : super(key: key);
const _AddTodoPopupCard({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down
12 changes: 6 additions & 6 deletions tip_003_popup_card/lib/custom_rect_tween.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import 'package:flutter/widgets.dart';
class CustomRectTween extends RectTween {
/// {@macro custom_rect_tween}
CustomRectTween({
@required Rect begin,
@required Rect end,
required Rect? begin,
required Rect? end,
}) : super(begin: begin, end: end);

@override
Rect lerp(double t) {
final elasticCurveValue = Curves.easeOut.transform(t);
return Rect.fromLTRB(
lerpDouble(begin.left, end.left, elasticCurveValue),
lerpDouble(begin.top, end.top, elasticCurveValue),
lerpDouble(begin.right, end.right, elasticCurveValue),
lerpDouble(begin.bottom, end.bottom, elasticCurveValue),
lerpDouble(begin!.left, end!.left, elasticCurveValue)!,
lerpDouble(begin!.top, end!.top, elasticCurveValue)!,
lerpDouble(begin!.right, end!.right, elasticCurveValue)!,
lerpDouble(begin!.bottom, end!.bottom, elasticCurveValue)!,
);
}
}
4 changes: 2 additions & 2 deletions tip_003_popup_card/lib/hero_dialog_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import 'package:flutter/material.dart';
class HeroDialogRoute<T> extends PageRoute<T> {
/// {@macro hero_dialog_route}
HeroDialogRoute({
@required WidgetBuilder builder,
RouteSettings settings,
required WidgetBuilder builder,
RouteSettings? settings,
bool fullscreenDialog = false,
}) : _builder = builder,
super(settings: settings, fullscreenDialog: fullscreenDialog);
Expand Down
40 changes: 20 additions & 20 deletions tip_003_popup_card/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MyApp extends StatelessWidget {
class Home extends StatelessWidget {
/// {@macro home}
const Home({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -74,8 +74,8 @@ class Home extends StatelessWidget {
/// {@endtemplate}
class _TodoListContent extends StatelessWidget {
const _TodoListContent({
Key key,
@required this.todos,
Key? key,
required this.todos,
}) : super(key: key);

final List<Todo> todos;
Expand All @@ -101,8 +101,8 @@ class _TodoListContent extends StatelessWidget {
class _TodoCard extends StatelessWidget {
/// {@macro todo_card}
const _TodoCard({
Key key,
@required this.todo,
Key? key,
required this.todo,
}) : super(key: key);

final Todo todo;
Expand Down Expand Up @@ -157,8 +157,8 @@ class _TodoCard extends StatelessWidget {
class _TodoTitle extends StatelessWidget {
/// {@macro todo_title}
const _TodoTitle({
Key key,
@required this.title,
Key? key,
required this.title,
}) : super(key: key);

final String title;
Expand All @@ -178,13 +178,13 @@ class _TodoTitle extends StatelessWidget {
/// Activated from [_TodoCard].
/// {@endtemplate}
class _TodoPopupCard extends StatelessWidget {
const _TodoPopupCard({Key key, this.todo}) : super(key: key);
final Todo todo;
const _TodoPopupCard({Key? key, this.todo}) : super(key: key);
final Todo? todo;

@override
Widget build(BuildContext context) {
return Hero(
tag: todo.id,
tag: todo!.id,
createRectTween: (begin, end) {
return CustomRectTween(begin: begin, end: end);
},
Expand All @@ -200,13 +200,13 @@ class _TodoPopupCard extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_TodoTitle(title: todo.description),
_TodoTitle(title: todo!.description),
const SizedBox(
height: 8,
),
if (todo.items != null) ...[
if (todo!.items != null) ...[
const Divider(),
_TodoItemsBox(items: todo.items),
_TodoItemsBox(items: todo!.items),
],
Container(
margin: const EdgeInsets.all(8),
Expand Down Expand Up @@ -242,17 +242,17 @@ class _TodoPopupCard extends StatelessWidget {
class _TodoItemsBox extends StatelessWidget {
/// {@macro todo_items_box}
const _TodoItemsBox({
Key key,
@required this.items,
Key? key,
required this.items,
}) : super(key: key);

final List<Item> items;
final List<Item>? items;

@override
Widget build(BuildContext context) {
return Column(
children: [
for (final item in items) _TodoItemTile(item: item),
for (final item in items!) _TodoItemTile(item: item),
],
);
}
Expand All @@ -264,8 +264,8 @@ class _TodoItemsBox extends StatelessWidget {
class _TodoItemTile extends StatefulWidget {
/// {@macro todo_item_template}
const _TodoItemTile({
Key key,
@required this.item,
Key? key,
required this.item,
}) : super(key: key);

final Item item;
Expand All @@ -275,7 +275,7 @@ class _TodoItemTile extends StatefulWidget {
}

class _TodoItemTileState extends State<_TodoItemTile> {
void _onChanged(bool val) {
void _onChanged(bool? val) {
setState(() {
widget.item.completed = val;
});
Expand Down
10 changes: 5 additions & 5 deletions tip_003_popup_card/lib/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import 'package:meta/meta.dart';
class Todo {
/// {@macro todo}
const Todo({
@required this.id,
@required this.description,
required this.id,
required this.description,
this.items,
});

Expand All @@ -19,7 +19,7 @@ class Todo {
final String description;

/// A list of [Item]s for sub-todos.
final List<Item> items;
final List<Item>? items;
}

/// {@template item}
Expand All @@ -28,7 +28,7 @@ class Todo {
class Item {
/// {@macro item}
Item({
@required this.id,
required this.id,
this.description = '',
this.completed = false,
});
Expand All @@ -40,5 +40,5 @@ class Item {
final String description;

/// Indicates if this item has been completed or not.
bool completed;
bool? completed;
}
38 changes: 19 additions & 19 deletions tip_003_popup_card/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.5.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -80,21 +80,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.1"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.1"
version: "1.8.0"
pedantic:
dependency: transitive
description:
Expand All @@ -113,56 +113,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.1"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.2"
version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
very_good_analysis:
dependency: "direct dev"
description:
Expand All @@ -171,5 +171,5 @@ packages:
source: hosted
version: "1.0.4"
sdks:
dart: ">=2.10.0-110 <2.11.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.17.0"
2 changes: 1 addition & 1 deletion tip_003_popup_card/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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:
Expand Down
Loading