mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
dart migrate add_to_app/android_view/flutter_module_using_plugin (#833)
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() {
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -117,9 +117,9 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
// Figure out the phone's orientation relative
|
||||
// to gravity's direction. Ignore the z vector.
|
||||
transform: Matrix4.rotationX(
|
||||
snapshot.data.y / gravity * pi / 2)
|
||||
snapshot.data!.y / gravity * pi / 2)
|
||||
..multiply(Matrix4.rotationY(
|
||||
snapshot.data.x / gravity * pi / 2)),
|
||||
snapshot.data!.x / gravity * pi / 2)),
|
||||
alignment: Alignment.center,
|
||||
child: const FlutterLogo(size: 72));
|
||||
},
|
||||
|
||||
@@ -70,7 +70,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) {
|
||||
@@ -87,7 +87,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) {
|
||||
@@ -109,7 +109,7 @@ class FullScreenView extends StatelessWidget {
|
||||
class Contents extends StatelessWidget {
|
||||
final bool showExit;
|
||||
|
||||
const Contents({this.showExit = false, Key key}) : super(key: key);
|
||||
const Contents({this.showExit = false, Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -120,21 +120,21 @@ packages:
|
||||
name: plugin_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
version: "2.0.0"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.3.3"
|
||||
version: "5.0.0"
|
||||
sensors:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: sensors
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.2+6"
|
||||
version: "2.0.3"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -195,42 +195,42 @@ packages:
|
||||
name: url_launcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.7.10"
|
||||
version: "6.0.6"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+4"
|
||||
version: "2.0.0"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+9"
|
||||
version: "2.0.0"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.9"
|
||||
version: "2.0.3"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.5+3"
|
||||
version: "2.0.1"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+3"
|
||||
version: "2.0.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -240,4 +240,4 @@ packages:
|
||||
version: "2.1.0"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
flutter: ">=1.22.0"
|
||||
flutter: ">=2.0.0"
|
||||
|
||||
@@ -4,19 +4,19 @@ 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.12.0 <3.0.0'
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
provider: ^4.1.0
|
||||
url_launcher: ^5.2.5
|
||||
sensors: ^0.4.2
|
||||
provider: ^5.0.0
|
||||
url_launcher: ^6.0.6
|
||||
sensors: ^2.0.3
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.0
|
||||
flutter_lints: ^1.0.3
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
Reference in New Issue
Block a user