Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 59 additions & 55 deletions google_api_availability/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,64 +129,68 @@ class _MyAppState extends State<MyApp> {
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: ListView(
children: <Widget>[
MaterialButton(
onPressed: () => checkPlayServices(),
child: const Text('Get PlayServices availability'),
color: Colors.red,
appBar: AppBar(title: const Text('Plugin example app')),
body: ListView(
children: <Widget>[
MaterialButton(
onPressed: () => checkPlayServices(),
child: const Text('Get PlayServices availability'),
color: Colors.red,
),
Center(
child: Text(
'Google Play Store status: ${_playStoreAvailability.toString().split('.').last}\n',
),
Center(
child: Text(
'Google Play Store status: ${_playStoreAvailability.toString().split('.').last}\n')),
MaterialButton(
onPressed: () => checkPlayServices(true),
child:
const Text('Get PlayServices availability with fix dialog'),
color: Colors.redAccent,
),
MaterialButton(
onPressed: () => checkPlayServices(true),
child: const Text(
'Get PlayServices availability with fix dialog',
),
Center(
child: Text(
'Google Play Store status: ${_playStoreAvailability.toString().split('.').last}\n')),
MaterialButton(
onPressed: () => makeGooglePlayServicesAvailable(),
child: const Text('Make Google Play Service available'),
color: Colors.red,
color: Colors.redAccent,
),
Center(
child: Text(
'Google Play Store status: ${_playStoreAvailability.toString().split('.').last}\n',
),
const SizedBox(height: 30),
MaterialButton(
onPressed: () => getErrorString(),
child: const Text('Get string of the error code'),
color: Colors.red,
),
Center(child: Text('Error string: $_errorString\n')),
MaterialButton(
onPressed: () => isUserResolvable(),
child: const Text('Error resolvable by user'),
color: Colors.red,
),
Center(
child:
Text('Error resolvable by user: $_isUserResolvable\n')),
MaterialButton(
onPressed: () => showErrorNotification(),
child: const Text('Show error notification'),
color: Colors.red,
),
const SizedBox(height: 30),
MaterialButton(
onPressed: () => showErrorDialogFragment(),
child: const Text('Show error dialog fragment'),
color: Colors.red,
),
Center(
child:
Text('Error dialog shown: $_errorDialogFragmentShown\n')),
],
)),
),
MaterialButton(
onPressed: () => makeGooglePlayServicesAvailable(),
child: const Text('Make Google Play Service available'),
color: Colors.red,
),
const SizedBox(height: 30),
MaterialButton(
onPressed: () => getErrorString(),
child: const Text('Get string of the error code'),
color: Colors.red,
),
Center(child: Text('Error string: $_errorString\n')),
MaterialButton(
onPressed: () => isUserResolvable(),
child: const Text('Error resolvable by user'),
color: Colors.red,
),
Center(
child: Text('Error resolvable by user: $_isUserResolvable\n'),
),
MaterialButton(
onPressed: () => showErrorNotification(),
child: const Text('Show error notification'),
color: Colors.red,
),
const SizedBox(height: 30),
MaterialButton(
onPressed: () => showErrorDialogFragment(),
child: const Text('Show error dialog fragment'),
color: Colors.red,
),
Center(
child: Text('Error dialog shown: $_errorDialogFragmentShown\n'),
),
],
),
),
);
}
}
5 changes: 3 additions & 2 deletions google_api_availability/lib/src/google_api_availability.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class GoogleApiAvailability {
///
/// Optionally, you can also show an error dialog if the connection status is
/// not [SUCCESS].
Future<GooglePlayServicesAvailability> checkGooglePlayServicesAvailability(
[bool showDialogIfNecessary = false]) async {
Future<GooglePlayServicesAvailability> checkGooglePlayServicesAvailability([
bool showDialogIfNecessary = false,
]) async {
if (GoogleApiAvailabilityPlatform.instance == null) {
throw UnsupportedError('This platform is not supported.');
}
Expand Down
Loading