1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00
This commit is contained in:
Brett Morgan
2022-05-11 12:48:11 -07:00
committed by GitHub
parent fb00d0a102
commit ccd68f34e2
242 changed files with 1719 additions and 1430 deletions

View File

@@ -12,7 +12,7 @@ void main() {
}
class PlatformView extends StatelessWidget {
const PlatformView({Key key}) : super(key: key);
const PlatformView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -27,12 +27,10 @@ class PlatformView extends StatelessWidget {
}
class HomePage extends StatefulWidget {
const HomePage({
Key key,
}) : super(key: key);
const HomePage({Key? key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@@ -44,7 +42,7 @@ class _HomePageState extends State<HomePage> {
Future<void> _launchPlatformCount() async {
final platformCounter =
await _methodChannel.invokeMethod<int>('switchView', _counter);
setState(() => _counter = platformCounter);
setState(() => _counter = platformCounter ?? 0);
}
@override
@@ -67,8 +65,8 @@ class _HomePageState extends State<HomePage> {
),
const SizedBox(height: 18),
ElevatedButton(
child: const Text('Continue in iOS view'),
onPressed: _launchPlatformCount,
child: const Text('Continue in iOS view'),
),
],
),