From 4c04d00323daf5b0f690f7c1a0010824db950ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Wed, 13 May 2026 20:39:05 +0200 Subject: [PATCH] improved app rating UI logic by showing a disabled state during availability check instead of hiding the component --- lib/view/pages/overhang.dart | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/view/pages/overhang.dart b/lib/view/pages/overhang.dart index fbdf8a4..5966ca4 100644 --- a/lib/view/pages/overhang.dart +++ b/lib/view/pages/overhang.dart @@ -49,40 +49,40 @@ class _OverhangState extends State { FutureBuilder( future: InAppReview.instance.isAvailable(), builder: (context, snapshot) { - if (!snapshot.hasData) return const SizedBox.shrink(); - String? getPlatformStoreName() { if (Platform.isAndroid) return 'Play store'; if (Platform.isIOS) return 'App store'; return null; } + Future rate() => InAppReview.instance + .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', + ); + }, + ); + + final ready = snapshot.connectionState == ConnectionState.done; return ListTile( + enabled: ready, leading: const CenteredLeading(Icon(Icons.star_rate_outlined)), title: const Text('App bewerten'), subtitle: getPlatformStoreName().wrapNullable( (data) => Text('Im $data'), ), trailing: const Icon(Icons.arrow_right), - onTap: () { - InAppReview.instance - .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', - ); - }, - ); - }, + onTap: !ready ? null : rate ); }, ),