mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

1. The platform code to show the keyboard wasn't working on certain devices. From my testing it appears to be related to when the code was firing. IMM won't show the soft input (or shows and then immediately hides it, it's hard to tell) if it's called before the Flutter UI is loaded. Change this to instead show the soft keyboard after a message from Flutter that main() has been started. 2. A text field was visible in the UI, and the test was run under a fuzzer that random tapped portions of the screen. Remove the text field so that the fuzzer can't accidentally open the keyboard on its own at a random time. 3. The keyboard was left open even after the app was closed. Also toggle the input off when the app was closed, so that this test can be ran multiple times in succession relatively hermetically.
67 lines
1.5 KiB
Dart
67 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
const MethodChannel channel = MethodChannel('com.example.abstract_method_smoke_test');
|
|
await channel.invokeMethod<void>('show_keyboard');
|
|
runApp(MyApp());
|
|
print('Test suceeded');
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Flutter Demo',
|
|
theme: ThemeData(
|
|
primarySwatch: Colors.blue,
|
|
),
|
|
home: HomePage(),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HomePage extends StatefulWidget {
|
|
@override
|
|
_HomePage createState() => _HomePage();
|
|
}
|
|
|
|
class _HomePage extends State<HomePage> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
// Trigger the second route.
|
|
// https://github.com/flutter/flutter/issues/40126
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
Navigator.of(context).push(
|
|
MaterialPageRoute<void>(builder: (_) => SecondPage()));
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return const Scaffold();
|
|
}
|
|
}
|
|
|
|
class SecondPage extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Column(
|
|
children: const <Widget>[
|
|
Expanded(
|
|
child: GoogleMap(
|
|
initialCameraPosition: CameraPosition(
|
|
target: LatLng(0, 0)
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |