mirror of
https://github.com/flutter/samples.git
synced 2026-03-22 04:17:50 +00:00
Beta (#1234)
This commit is contained in:
@@ -41,13 +41,13 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
}
|
||||
});
|
||||
// Keep track of what the current platform lifecycle state is.
|
||||
WidgetsBinding.instance!.addObserver(this);
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance!.removeObserver(this);
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ packages:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -78,7 +78,7 @@ packages:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
version: "0.6.4"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -99,7 +99,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -120,7 +120,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -153,7 +153,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -188,14 +188,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "0.4.9"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -209,7 +202,7 @@ packages:
|
||||
name: url_launcher_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.15"
|
||||
version: "6.0.16"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -258,7 +251,7 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-0 <3.0.0"
|
||||
flutter: ">=2.10.0"
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'package:flutter_module_books/api.dart';
|
||||
void main() => runApp(const MyApp());
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key key}) : super(key: key);
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -30,30 +30,28 @@ class FlutterBookApiHandler extends FlutterBookApi {
|
||||
|
||||
@override
|
||||
void displayBookDetails(Book book) {
|
||||
assert(
|
||||
book != null,
|
||||
'Non-null book expected from FlutterBookApi.displayBookDetails call.',
|
||||
);
|
||||
callback(book);
|
||||
}
|
||||
}
|
||||
|
||||
class BookDetail extends StatefulWidget {
|
||||
const BookDetail({this.hostApi, this.flutterApi, Key key}) : super(key: key);
|
||||
const BookDetail({Key? key, this.hostApi, this.flutterApi, this.book})
|
||||
: super(key: key);
|
||||
|
||||
// These are the outgoing and incoming APIs that are here for injection for
|
||||
// tests.
|
||||
final HostBookApi hostApi;
|
||||
final FlutterBookApi flutterApi;
|
||||
final HostBookApi? hostApi;
|
||||
final FlutterBookApi? flutterApi;
|
||||
final Book? book;
|
||||
|
||||
@override
|
||||
_BookDetailState createState() => _BookDetailState();
|
||||
State<BookDetail> createState() => _BookDetailState();
|
||||
}
|
||||
|
||||
class _BookDetailState extends State<BookDetail> {
|
||||
Book book;
|
||||
Book? book;
|
||||
|
||||
HostBookApi hostApi;
|
||||
late HostBookApi hostApi;
|
||||
|
||||
FocusNode textFocusNode = FocusNode();
|
||||
TextEditingController titleTextController = TextEditingController();
|
||||
@@ -63,6 +61,7 @@ class _BookDetailState extends State<BookDetail> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
book = widget.book;
|
||||
|
||||
// This `HostBookApi` class instance lets us make outgoing calls to the
|
||||
// platform.
|
||||
@@ -80,19 +79,19 @@ class _BookDetailState extends State<BookDetail> {
|
||||
// This book model is what we're going to return to Kotlin eventually.
|
||||
// Keep it bound to the UI.
|
||||
this.book = book;
|
||||
titleTextController.text = book.title;
|
||||
titleTextController.text = book.title ?? '';
|
||||
titleTextController.addListener(() {
|
||||
this.book?.title = titleTextController.text;
|
||||
this.book!.title = titleTextController.text;
|
||||
});
|
||||
// Subtitle could be null.
|
||||
// TODO(gaaclarke): https://github.com/flutter/flutter/issues/59118.
|
||||
subtitleTextController.text = book.subtitle ?? '';
|
||||
subtitleTextController.addListener(() {
|
||||
this.book?.subtitle = subtitleTextController.text;
|
||||
this.book!.subtitle = subtitleTextController.text;
|
||||
});
|
||||
authorTextController.text = book.author;
|
||||
authorTextController.text = book.author ?? '';
|
||||
authorTextController.addListener(() {
|
||||
this.book?.author = authorTextController.text;
|
||||
this.book!.author = authorTextController.text;
|
||||
});
|
||||
});
|
||||
}));
|
||||
@@ -123,10 +122,12 @@ class _BookDetailState extends State<BookDetail> {
|
||||
IconButton(
|
||||
icon: const Icon(Icons.check),
|
||||
// Pressing save sends the updated book to the platform.
|
||||
onPressed: () {
|
||||
hostApi.finishEditingBook(book);
|
||||
clear();
|
||||
},
|
||||
onPressed: book != null
|
||||
? () {
|
||||
hostApi.finishEditingBook(book!);
|
||||
clear();
|
||||
}
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -134,70 +135,98 @@ class _BookDetailState extends State<BookDetail> {
|
||||
// Draw a spinner until the platform gives us the book to show details
|
||||
// for.
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: Focus(
|
||||
: BookForm(
|
||||
book: book!,
|
||||
focusNode: textFocusNode,
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
children: [
|
||||
TextField(
|
||||
controller: titleTextController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
filled: true,
|
||||
hintText: "Title",
|
||||
labelText: "Title",
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextField(
|
||||
controller: subtitleTextController,
|
||||
maxLines: 2,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
filled: true,
|
||||
hintText: "Subtitle",
|
||||
labelText: "Subtitle",
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextField(
|
||||
controller: authorTextController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
filled: true,
|
||||
hintText: "Author",
|
||||
labelText: "Author",
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
const Divider(),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'${book.pageCount} pages ~ published ${book.publishDate}'),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(height: 32),
|
||||
const Center(
|
||||
child: Text(
|
||||
'BOOK DESCRIPTION',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
book.summary,
|
||||
style: TextStyle(color: Colors.grey.shade600, height: 1.24),
|
||||
),
|
||||
],
|
||||
),
|
||||
authorTextController: authorTextController,
|
||||
subtitleTextController: subtitleTextController,
|
||||
titleTextController: titleTextController,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BookForm extends StatelessWidget {
|
||||
const BookForm({
|
||||
Key? key,
|
||||
required this.book,
|
||||
required this.focusNode,
|
||||
required this.authorTextController,
|
||||
required this.subtitleTextController,
|
||||
required this.titleTextController,
|
||||
}) : super(key: key);
|
||||
|
||||
final Book book;
|
||||
final FocusNode focusNode;
|
||||
final TextEditingController titleTextController;
|
||||
final TextEditingController subtitleTextController;
|
||||
final TextEditingController authorTextController;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Focus(
|
||||
focusNode: focusNode,
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
children: [
|
||||
TextField(
|
||||
controller: titleTextController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
filled: true,
|
||||
hintText: "Title",
|
||||
labelText: "Title",
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextField(
|
||||
controller: subtitleTextController,
|
||||
maxLines: 2,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
filled: true,
|
||||
hintText: "Subtitle",
|
||||
labelText: "Subtitle",
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextField(
|
||||
controller: authorTextController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
filled: true,
|
||||
hintText: "Author",
|
||||
labelText: "Author",
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
const Divider(),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'${book.pageCount} pages ~ published ${book.publishDate}'),
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(height: 32),
|
||||
const Center(
|
||||
child: Text(
|
||||
'BOOK DESCRIPTION',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
book.summary ?? '',
|
||||
style: TextStyle(color: Colors.grey.shade600, height: 1.24),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_module_books/api.dart';
|
||||
import 'package:pigeon/pigeon.dart';
|
||||
|
||||
class Book {
|
||||
String title;
|
||||
String subtitle;
|
||||
String author;
|
||||
String summary;
|
||||
String publishDate;
|
||||
int pageCount;
|
||||
Thumbnail thumbnail;
|
||||
}
|
||||
|
||||
class Thumbnail {
|
||||
String url;
|
||||
}
|
||||
|
||||
@FlutterApi()
|
||||
abstract class FlutterBookApi {
|
||||
void displayBookDetails(Book book);
|
||||
|
||||
@@ -70,7 +70,7 @@ packages:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -84,14 +84,14 @@ packages:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -110,7 +110,7 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -129,7 +129,7 @@ packages:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -143,7 +143,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -164,7 +164,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
pigeon:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -190,7 +190,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -225,7 +225,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
version: "0.4.9"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -239,7 +239,7 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -255,4 +255,4 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
|
||||
@@ -6,7 +6,7 @@ description: A Flutter module using the Pigeon package to demonstrate
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -16,7 +16,7 @@ dev_dependencies:
|
||||
pigeon: ">=2.0.2 <4.0.0"
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.4
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -27,7 +27,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: BookDetail(hostApi: mockHostApi),
|
||||
home: BookDetail(book: Book(), hostApi: mockHostApi),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ packages:
|
||||
name: archive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
version: "3.1.11"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -49,7 +49,7 @@ packages:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -70,7 +70,7 @@ packages:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -94,7 +94,7 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -111,7 +111,7 @@ packages:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -125,7 +125,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -146,7 +146,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -179,7 +179,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -221,7 +221,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
version: "0.4.9"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -235,14 +235,14 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "7.5.0"
|
||||
version: "8.2.2"
|
||||
webdriver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -251,5 +251,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
flutter: ">=2.0.0"
|
||||
|
||||
@@ -4,7 +4,7 @@ description: An example Flutter module.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -17,7 +17,7 @@ dev_dependencies:
|
||||
flutter_driver:
|
||||
sdk: flutter
|
||||
espresso: ^0.2.0
|
||||
flutter_lints: ^1.0.3
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -36,7 +36,7 @@ class MyHomePage extends StatefulWidget {
|
||||
final String title;
|
||||
|
||||
@override
|
||||
_MyHomePageState createState() => _MyHomePageState();
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
|
||||
@@ -42,7 +42,7 @@ packages:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -56,7 +56,7 @@ packages:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -68,7 +68,7 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -85,14 +85,14 @@ packages:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
version: "0.6.4"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -106,7 +106,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -120,7 +120,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -139,7 +139,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -174,14 +174,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "0.4.9"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -195,7 +188,7 @@ packages:
|
||||
name: url_launcher_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.15"
|
||||
version: "6.0.16"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -244,7 +237,7 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
flutter: ">=2.10.0"
|
||||
|
||||
@@ -4,7 +4,7 @@ description: A module that is embedded in the multiple_flutters_ios and multiple
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -16,7 +16,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.0
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -15,7 +15,7 @@ void main() {
|
||||
}
|
||||
|
||||
class Cell extends StatefulWidget {
|
||||
const Cell({Key key}) : super(key: key);
|
||||
const Cell({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _CellState();
|
||||
@@ -26,8 +26,8 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0);
|
||||
|
||||
int cellNumber = 0;
|
||||
Random _random;
|
||||
AppLifecycleState appLifecycleState;
|
||||
Random? _random;
|
||||
AppLifecycleState? appLifecycleState;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -62,8 +62,8 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
Color randomLightColor() {
|
||||
_random ??= Random(cellNumber);
|
||||
|
||||
return Color.fromARGB(255, _random.nextInt(50) + 205,
|
||||
_random.nextInt(50) + 205, _random.nextInt(50) + 205);
|
||||
return Color.fromARGB(255, _random!.nextInt(50) + 205,
|
||||
_random!.nextInt(50) + 205, _random!.nextInt(50) + 205);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -113,15 +113,20 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
: Stream.value(defaultPosition),
|
||||
initialData: defaultPosition,
|
||||
builder: (context, snapshot) {
|
||||
final data = snapshot.data;
|
||||
if (data == null) {
|
||||
return const CircularProgressIndicator.adaptive();
|
||||
}
|
||||
return Transform(
|
||||
// Figure out the phone's orientation relative
|
||||
// to gravity's direction. Ignore the z vector.
|
||||
transform: Matrix4.rotationX(
|
||||
snapshot.data.y / gravity * pi / 2)
|
||||
..multiply(Matrix4.rotationY(
|
||||
snapshot.data.x / gravity * pi / 2)),
|
||||
alignment: Alignment.center,
|
||||
child: const FlutterLogo(size: 72));
|
||||
// Figure out the phone's orientation relative
|
||||
// to gravity's direction. Ignore the z vector.
|
||||
transform: Matrix4.rotationX(
|
||||
data.y / gravity * pi / 2,
|
||||
)..multiply(
|
||||
Matrix4.rotationY(data.x / gravity * pi / 2)),
|
||||
alignment: Alignment.center,
|
||||
child: const FlutterLogo(size: 72),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -69,7 +69,7 @@ class CounterModel extends ChangeNotifier {
|
||||
/// It offers two routes, one suitable for displaying as a full screen and
|
||||
/// another designed to be part of a larger UI.
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key key}) : super(key: key);
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -86,7 +86,7 @@ class MyApp extends StatelessWidget {
|
||||
/// Wraps [Contents] in a Material [Scaffold] so it looks correct when displayed
|
||||
/// full-screen.
|
||||
class FullScreenView extends StatelessWidget {
|
||||
const FullScreenView({Key key}) : super(key: key);
|
||||
const FullScreenView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -108,7 +108,7 @@ class FullScreenView extends StatelessWidget {
|
||||
class Contents extends StatelessWidget {
|
||||
final bool showExit;
|
||||
|
||||
const Contents({this.showExit = false, Key key}) : super(key: key);
|
||||
const Contents({Key? key, this.showExit = false}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -42,14 +42,14 @@ packages:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -61,7 +61,7 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -78,14 +78,14 @@ packages:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.3"
|
||||
version: "0.6.4"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -99,7 +99,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -120,7 +120,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -153,7 +153,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -188,14 +188,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "0.4.9"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -209,7 +202,7 @@ packages:
|
||||
name: url_launcher_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.15"
|
||||
version: "6.0.16"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -258,7 +251,7 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
flutter: ">=2.10.0"
|
||||
|
||||
@@ -4,7 +4,7 @@ description: An example Flutter module that uses a plugin.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.6.0-dev <3.0.0"
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -16,7 +16,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.0
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -58,7 +58,7 @@ class CounterModel extends ChangeNotifier {
|
||||
/// It offers two routes, one suitable for displaying as a full screen and
|
||||
/// another designed to be part of a larger UI.class MyApp extends StatelessWidget {
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key key}) : super(key: key);
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -75,7 +75,7 @@ class MyApp extends StatelessWidget {
|
||||
/// Wraps [Contents] in a Material [Scaffold] so it looks correct when displayed
|
||||
/// full-screen.
|
||||
class FullScreenView extends StatelessWidget {
|
||||
const FullScreenView({Key key}) : super(key: key);
|
||||
const FullScreenView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -96,7 +96,7 @@ class FullScreenView extends StatelessWidget {
|
||||
class Contents extends StatelessWidget {
|
||||
final bool showExit;
|
||||
|
||||
const Contents({this.showExit = false, Key key}) : super(key: key);
|
||||
const Contents({Key? key, this.showExit = false}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -7,7 +7,7 @@ packages:
|
||||
name: archive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.6"
|
||||
version: "3.1.11"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -49,7 +49,7 @@ packages:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
version: "1.16.0"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -70,7 +70,7 @@ packages:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.3.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -94,7 +94,7 @@ packages:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -111,7 +111,7 @@ packages:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
version: "2.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -125,7 +125,7 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -146,7 +146,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -179,7 +179,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -221,7 +221,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.8"
|
||||
version: "0.4.9"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -235,14 +235,14 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.1.2"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "7.5.0"
|
||||
version: "8.2.2"
|
||||
webdriver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -251,5 +251,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
sdks:
|
||||
dart: ">=2.14.0 <3.0.0"
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
flutter: ">=2.0.0"
|
||||
|
||||
@@ -4,7 +4,7 @@ description: An example Flutter module.
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.6.0-dev <3.0.0"
|
||||
sdk: ">=2.17.0-0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -17,7 +17,7 @@ dev_dependencies:
|
||||
flutter_driver:
|
||||
sdk: flutter
|
||||
espresso: ^0.2.0
|
||||
flutter_lints: ^1.0.0
|
||||
flutter_lints: ^2.0.1
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
Reference in New Issue
Block a user