mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Beta (#1234)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user