simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -17,6 +17,8 @@ class Overhang extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _OverhangState extends State<Overhang> {
|
||||
late final Future<bool> _reviewAvailable = InAppReview.instance.isAvailable();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -48,7 +50,7 @@ class _OverhangState extends State<Overhang> {
|
||||
onTap: () => AppRoutes.openQrShare(context),
|
||||
),
|
||||
FutureBuilder(
|
||||
future: InAppReview.instance.isAvailable(),
|
||||
future: _reviewAvailable,
|
||||
builder: (context, snapshot) {
|
||||
String? getPlatformStoreName() {
|
||||
if (Platform.isAndroid) return 'Play store';
|
||||
@@ -60,19 +62,19 @@ class _OverhangState extends State<Overhang> {
|
||||
.openStoreListing(appStoreId: '6458789560')
|
||||
.then(
|
||||
(value) {
|
||||
if (!context.mounted) return;
|
||||
InfoDialog.show(context, 'Vielen Dank!');
|
||||
},
|
||||
onError: (error) {
|
||||
if (!context.mounted) return;
|
||||
InfoDialog.show(
|
||||
context,
|
||||
error.toString(),
|
||||
copyable: true,
|
||||
title: 'Fehler',
|
||||
if (!context.mounted) return;
|
||||
InfoDialog.show(context, 'Vielen Dank!');
|
||||
},
|
||||
onError: (error) {
|
||||
if (!context.mounted) return;
|
||||
InfoDialog.show(
|
||||
context,
|
||||
error.toString(),
|
||||
copyable: true,
|
||||
title: 'Fehler',
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
final ready = snapshot.connectionState == ConnectionState.done;
|
||||
return ListTile(
|
||||
@@ -83,7 +85,7 @@ class _OverhangState extends State<Overhang> {
|
||||
(data) => Text('Im $data'),
|
||||
),
|
||||
trailing: const Icon(Icons.arrow_right),
|
||||
onTap: !ready ? null : rate
|
||||
onTap: !ready ? null : rate,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user