From 7f81b3dad7f4301afd33cf24cf28a04b26e4a590 Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Sat, 29 Jul 2023 19:19:22 +0200 Subject: [PATCH] Ensure native settings / rate app / share app entries look the same (#4388) --- packages/smooth_app/lib/l10n/app_en.arb | 1 + .../user_preferences_settings.dart | 28 +++++-------------- .../preferences/user_preferences_widgets.dart | 16 ++++++++++- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/packages/smooth_app/lib/l10n/app_en.arb b/packages/smooth_app/lib/l10n/app_en.arb index 7bbc2c81782..c517a9db802 100644 --- a/packages/smooth_app/lib/l10n/app_en.arb +++ b/packages/smooth_app/lib/l10n/app_en.arb @@ -2071,6 +2071,7 @@ "@show_password": { "description": "Show hidden password in password field" }, + "rate_app": "Rate the app", "app_rating_dialog_title": "Great! Let others know what you think of this app!", "app_rating_dialog_positive_action": "Rate the app", "app_rating_dialog_negative_action": "Later", diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart index e77c0c779f8..19a52c7d80d 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart @@ -117,7 +117,7 @@ class _RateUs extends StatelessWidget { child: Image.asset(getImagePath()), ); - final String title = appLocalizations.app_rating_dialog_positive_action; + final String title = appLocalizations.rate_app; return UserPreferenceListTile( title: title, @@ -421,28 +421,14 @@ class _AdvancedSettings extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( - child: ListTile( - onTap: () async { + child: UserPreferenceListTile( + onTap: (_) async { await AppSettings.openAppSettings(); }, - title: Text( - appLocalizations.native_app_settings, - style: Theme.of(context).textTheme.headlineMedium, - ), - subtitle: Padding( - padding: const EdgeInsets.only(top: SMALL_SPACE), - child: Text( - appLocalizations.native_app_description, - style: Theme.of(context).textTheme.bodyMedium, - ), - ), - leading: const Padding( - padding: EdgeInsets.all(VERY_SMALL_SPACE), - child: Icon( - CupertinoIcons.settings_solid, - ), - ), - minVerticalPadding: MEDIUM_SPACE, + title: appLocalizations.native_app_settings, + subTitle: appLocalizations.native_app_description, + leading: const Icon(CupertinoIcons.settings_solid), + showDivider: true, ), ), ], diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart index abc0774860a..0998ec37244 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart @@ -379,16 +379,20 @@ class UserPreferenceListTile extends StatelessWidget { required this.leading, required this.onTap, required this.showDivider, + this.subTitle, super.key, }); final String title; + final String? subTitle; final Widget leading; final Future Function(BuildContext) onTap; final bool showDivider; @override Widget build(BuildContext context) { + final TextTheme textTheme = Theme.of(context).textTheme; + return Column( children: [ ListTile( @@ -398,9 +402,19 @@ class UserPreferenceListTile extends StatelessWidget { ), title: Text( title, - style: const TextStyle(fontWeight: FontWeight.bold), + style: textTheme.headlineMedium, ), + subtitle: subTitle != null + ? Text( + subTitle!, + style: textTheme.bodyMedium, + ) + : null, onTap: () => onTap(context), + contentPadding: const EdgeInsetsDirectional.symmetric( + horizontal: LARGE_SPACE, + vertical: SMALL_SPACE, + ), ), if (showDivider) const UserPreferencesListItemDivider(), ],