From a594d1c9623bab836c95e9772ef73e3ae9ee1936 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:52:38 +0530 Subject: [PATCH] Show support dev banner in offline mode --- lib/ui/settings/support_dev_widget.dart | 75 +++++++++++++------------ 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/lib/ui/settings/support_dev_widget.dart b/lib/ui/settings/support_dev_widget.dart index 20429b2f4..bd9082068 100644 --- a/lib/ui/settings/support_dev_widget.dart +++ b/lib/ui/settings/support_dev_widget.dart @@ -26,46 +26,51 @@ class SupportDevWidget extends StatelessWidget { if (snapshot.hasData) { final subscription = snapshot.data; if (subscription != null && subscription.productID == "free") { - return GestureDetector( - onTap: () { - launchUrl(Uri.parse("https://ente.io")); - }, - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 12.0, horizontal: 6), - child: Column( - children: [ - StyledText( - text: l10n.supportDevs, - tags: { - 'bold-green': StyledTextTag( - style: TextStyle( - fontWeight: FontWeight.bold, - color: getEnteColorScheme(context).primaryGreen, - ), - ), - }, - ), - const Padding(padding: EdgeInsets.all(6)), - Platform.isAndroid - ? Text( - l10n.supportDiscount, - textAlign: TextAlign.center, - style: const TextStyle( - color: Colors.grey, - ), - ) - : const SizedBox.shrink(), - ], - ), - ), - ); + return buildWidget(l10n, context); } } return const SizedBox.shrink(); }, ); + } else { + return buildWidget(l10n, context); } - return const SizedBox.shrink(); + } + + GestureDetector buildWidget(AppLocalizations l10n, BuildContext context) { + return GestureDetector( + onTap: () { + launchUrl(Uri.parse("https://ente.io")); + }, + child: Padding( + padding: + const EdgeInsets.symmetric(vertical: 12.0, horizontal: 6), + child: Column( + children: [ + StyledText( + text: l10n.supportDevs, + tags: { + 'bold-green': StyledTextTag( + style: TextStyle( + fontWeight: FontWeight.bold, + color: getEnteColorScheme(context).primaryGreen, + ), + ), + }, + ), + const Padding(padding: EdgeInsets.all(6)), + Platform.isAndroid + ? Text( + l10n.supportDiscount, + textAlign: TextAlign.center, + style: const TextStyle( + color: Colors.grey, + ), + ) + : const SizedBox.shrink(), + ], + ), + ), + ); } }