dart migrate add_to_app/android_view/flutter_module_using_plugin (#833)

pull/841/head
Brett Morgan 3 years ago committed by GitHub
parent 9153fdb6fc
commit 5280720df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,7 +15,7 @@ void main() {
} }
class Cell extends StatefulWidget { class Cell extends StatefulWidget {
const Cell({Key key}) : super(key: key); const Cell({Key? key}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _CellState(); State<StatefulWidget> createState() => _CellState();
@ -26,8 +26,8 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0); static final AccelerometerEvent defaultPosition = AccelerometerEvent(0, 0, 0);
int cellNumber = 0; int cellNumber = 0;
Random _random; Random? _random;
AppLifecycleState appLifecycleState; AppLifecycleState? appLifecycleState;
@override @override
void initState() { void initState() {
@ -41,13 +41,13 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
} }
}); });
// Keep track of what the current platform lifecycle state is. // Keep track of what the current platform lifecycle state is.
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance!.addObserver(this);
super.initState(); super.initState();
} }
@override @override
void dispose() { void dispose() {
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance!.removeObserver(this);
super.dispose(); super.dispose();
} }
@ -62,8 +62,8 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
Color randomLightColor() { Color randomLightColor() {
_random ??= Random(cellNumber); _random ??= Random(cellNumber);
return Color.fromARGB(255, _random.nextInt(50) + 205, return Color.fromARGB(255, _random!.nextInt(50) + 205,
_random.nextInt(50) + 205, _random.nextInt(50) + 205); _random!.nextInt(50) + 205, _random!.nextInt(50) + 205);
} }
@override @override
@ -117,9 +117,9 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
// Figure out the phone's orientation relative // Figure out the phone's orientation relative
// to gravity's direction. Ignore the z vector. // to gravity's direction. Ignore the z vector.
transform: Matrix4.rotationX( transform: Matrix4.rotationX(
snapshot.data.y / gravity * pi / 2) snapshot.data!.y / gravity * pi / 2)
..multiply(Matrix4.rotationY( ..multiply(Matrix4.rotationY(
snapshot.data.x / gravity * pi / 2)), snapshot.data!.x / gravity * pi / 2)),
alignment: Alignment.center, alignment: Alignment.center,
child: const FlutterLogo(size: 72)); 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 /// It offers two routes, one suitable for displaying as a full screen and
/// another designed to be part of a larger UI. /// 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -87,7 +87,7 @@ class MyApp extends StatelessWidget {
/// Wraps [Contents] in a Material [Scaffold] so it looks correct when displayed /// Wraps [Contents] in a Material [Scaffold] so it looks correct when displayed
/// full-screen. /// full-screen.
class FullScreenView extends StatelessWidget { class FullScreenView extends StatelessWidget {
const FullScreenView({Key key}) : super(key: key); const FullScreenView({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -109,7 +109,7 @@ class FullScreenView extends StatelessWidget {
class Contents extends StatelessWidget { class Contents extends StatelessWidget {
final bool showExit; final bool showExit;
const Contents({this.showExit = false, Key key}) : super(key: key); const Contents({this.showExit = false, Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -120,21 +120,21 @@ packages:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "2.0.0"
provider: provider:
dependency: "direct main" dependency: "direct main"
description: description:
name: provider name: provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.3.3" version: "5.0.0"
sensors: sensors:
dependency: "direct main" dependency: "direct main"
description: description:
name: sensors name: sensors
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.2+6" version: "2.0.3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -195,42 +195,42 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.7.10" version: "6.0.6"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_linux name: url_launcher_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+4" version: "2.0.0"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+9" version: "2.0.0"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.9" version: "2.0.3"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.5+3" version: "2.0.1"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_windows name: url_launcher_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+3" version: "2.0.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -240,4 +240,4 @@ packages:
version: "2.1.0" version: "2.1.0"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" 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 version: 1.0.0+1
environment: environment:
sdk: ">=2.6.0-dev <3.0.0" sdk: '>=2.12.0 <3.0.0'
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
provider: ^4.1.0 provider: ^5.0.0
url_launcher: ^5.2.5 url_launcher: ^6.0.6
sensors: ^0.4.2 sensors: ^2.0.3
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^1.0.0 flutter_lints: ^1.0.3
flutter: flutter:
uses-material-design: true uses-material-design: true

Loading…
Cancel
Save