From 71cceb0fdc801ba8b36726ffd41ffb92c9e31b55 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Thu, 18 Aug 2022 18:03:26 +0200 Subject: [PATCH] improvements & bugfixes --- ios/Runner/Info.plist | 3 +- lib/managers/authentication_manager.dart | 3 +- lib/screens/login_screen.dart | 7 +- .../main_screen/settings_button_overlay.dart | 7 +- lib/screens/server_loading_screen.dart | 8 +- lib/screens/settings_screen.dart | 174 +++++++++--------- lib/screens/timeline_screen/memory_sheet.dart | 21 ++- lib/screens/timeline_screen/memory_view.dart | 6 +- 8 files changed, 127 insertions(+), 102 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 9a35d38..c163fa0 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -70,6 +70,7 @@ - + NSPhotoLibraryUsageDescription + Accessing your gallery allows you to save your memories diff --git a/lib/managers/authentication_manager.dart b/lib/managers/authentication_manager.dart index 73f4b62..eb54c9a 100644 --- a/lib/managers/authentication_manager.dart +++ b/lib/managers/authentication_manager.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_platform_widgets/flutter_platform_widgets.dart'; import 'package:quid_faciam_hodie/extensions/snackbar.dart'; import 'package:quid_faciam_hodie/screens/main_screen.dart'; import 'package:quid_faciam_hodie/screens/welcome_screen.dart'; @@ -27,6 +28,6 @@ class AuthState extends SupabaseAuthState { @override void onErrorAuthenticating(String message) { - context.showErrorSnackBar(message: message); + if (isMaterial(context)) context.showErrorSnackBar(message: message); } } diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index 04d0261..040513e 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -69,9 +69,10 @@ class _LoginScreenState extends AuthState with Loadable { await _signUp(); } catch (error) { if (mounted) { - context.showLongErrorSnackBar( - message: localizations.loginScreenLoginFailed, - ); + if (isMaterial(context)) + context.showLongErrorSnackBar( + message: localizations.loginScreenLoginFailed, + ); passwordController.clear(); } diff --git a/lib/screens/main_screen/settings_button_overlay.dart b/lib/screens/main_screen/settings_button_overlay.dart index 2248acf..b5fec54 100644 --- a/lib/screens/main_screen/settings_button_overlay.dart +++ b/lib/screens/main_screen/settings_button_overlay.dart @@ -11,8 +11,11 @@ class SettingsButtonOverlay extends StatelessWidget { return Positioned( left: SMALL_SPACE, top: SMALL_SPACE, - child: IconButton( - icon: Icon(context.platformIcons.settings), + child: PlatformTextButton( + child: Icon( + context.platformIcons.settings, + color: Colors.white, + ), onPressed: () { Navigator.pushNamed(context, SettingsScreen.ID); }, diff --git a/lib/screens/server_loading_screen.dart b/lib/screens/server_loading_screen.dart index 753b7b2..6cdfecb 100644 --- a/lib/screens/server_loading_screen.dart +++ b/lib/screens/server_loading_screen.dart @@ -120,8 +120,12 @@ class _ServerLoadingScreenState extends State { localizations.serverLoadingScreenDescription, style: platformThemeData( context, - material: (data) => data.textTheme.bodyText1, - cupertino: (data) => data.textTheme.textStyle, + material: (data) => data.textTheme.bodyText1!.copyWith( + color: Colors.white, + ), + cupertino: (data) => data.textTheme.textStyle.copyWith( + color: Colors.white, + ), ), ), ], diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index b299e0c..32e6e41 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -85,97 +85,103 @@ class _SettingsScreenState extends AuthRequiredState ], ), ) - : SettingsList( - sections: [ - SettingsSection( - title: Text(localizations.settingsScreenAccountSectionTitle), - tiles: [ - SettingsTile( - leading: Icon(context.platformIcons.mail), - title: Text(user!.email!), - ), - SettingsTile( - leading: Icon(context.platformIcons.time), - title: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - DateFormat('d. MMMM y, HH:mm:ss') - .format(DateTime.parse(user!.createdAt)), - ), - const SizedBox(height: SMALL_SPACE), - Text( - localizations - .settingsScreenAccountSectionCreationDateLabel, - style: platformThemeData( - context, - material: (data) => data.textTheme.bodySmall, - cupertino: (data) => data.textTheme.textStyle, - ), - ) - ], + : Padding( + padding: + EdgeInsets.only(top: isCupertino(context) ? LARGE_SPACE : 0), + child: SettingsList( + sections: [ + SettingsSection( + title: + Text(localizations.settingsScreenAccountSectionTitle), + tiles: [ + SettingsTile( + leading: Icon(context.platformIcons.mail), + title: Text(user!.email!), ), - ), - SettingsTile( - leading: const Icon(Icons.logout_rounded), - title: Text(localizations - .settingsScreenAccountSectionLogoutLabel), - onPressed: (_) async { - await callWithLoading(supabase.auth.signOut); - - if (!mounted) { - return; - } - - Navigator.pushNamedAndRemoveUntil( - context, - WelcomeScreen.ID, - (route) => false, - ); - }, - ) - ], - ), - SettingsSection( - title: Text(localizations.settingsScreenDangerSectionTitle), - tiles: [ - SettingsTile( - leading: Icon(context.platformIcons.delete), - title: Text(localizations - .settingsScreenDangerSectionDeleteAccountLabel), - onPressed: (_) => showPlatformDialog( - context: context, - builder: (platformContext) => PlatformAlertDialog( - title: Text( - localizations - .settingsScreenDangerSectionDeleteAccountLabel, - ), - content: Text( - localizations - .settingsScreenDeleteAccountDescription, - style: getBodyTextTextStyle(platformContext), - ), - actions: [ - PlatformDialogAction( - child: Text( - localizations.generalCancelButtonLabel, - ), - onPressed: () => Navigator.pop(context), + SettingsTile( + leading: Icon(context.platformIcons.time), + title: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + DateFormat('d. MMMM y, HH:mm:ss') + .format(DateTime.parse(user!.createdAt)), ), - PlatformDialogAction( - child: Text( - localizations - .settingsScreenDeleteAccountConfirmLabel, + const SizedBox(height: SMALL_SPACE), + Text( + localizations + .settingsScreenAccountSectionCreationDateLabel, + style: platformThemeData( + context, + material: (data) => data.textTheme.bodySmall, + cupertino: (data) => + data.textTheme.tabLabelTextStyle, ), - onPressed: () => callWithLoading(deleteUser), ) ], ), ), - ), - ], - ), - ], + SettingsTile( + leading: const Icon(Icons.logout_rounded), + title: Text(localizations + .settingsScreenAccountSectionLogoutLabel), + onPressed: (_) async { + await callWithLoading(supabase.auth.signOut); + + if (!mounted) { + return; + } + + Navigator.pushNamedAndRemoveUntil( + context, + WelcomeScreen.ID, + (route) => false, + ); + }, + ) + ], + ), + SettingsSection( + title: Text(localizations.settingsScreenDangerSectionTitle), + tiles: [ + SettingsTile( + leading: Icon(context.platformIcons.delete), + title: Text(localizations + .settingsScreenDangerSectionDeleteAccountLabel), + onPressed: (_) => showPlatformDialog( + context: context, + builder: (platformContext) => PlatformAlertDialog( + title: Text( + localizations + .settingsScreenDangerSectionDeleteAccountLabel, + ), + content: Text( + localizations + .settingsScreenDeleteAccountDescription, + style: getBodyTextTextStyle(platformContext), + ), + actions: [ + PlatformDialogAction( + child: Text( + localizations.generalCancelButtonLabel, + ), + onPressed: () => Navigator.pop(context), + ), + PlatformDialogAction( + child: Text( + localizations + .settingsScreenDeleteAccountConfirmLabel, + ), + onPressed: () => callWithLoading(deleteUser), + ) + ], + ), + ), + ), + ], + ), + ], + ), ), ); } diff --git a/lib/screens/timeline_screen/memory_sheet.dart b/lib/screens/timeline_screen/memory_sheet.dart index 6238542..683b1b3 100644 --- a/lib/screens/timeline_screen/memory_sheet.dart +++ b/lib/screens/timeline_screen/memory_sheet.dart @@ -60,10 +60,12 @@ class _MemorySheetState extends State with Loadable { Navigator.pop(context); - context.showSuccessSnackBar( - message: localizations.memorySheetSavedToGallery); + if (isMaterial(context)) + context.showSuccessSnackBar( + message: localizations.memorySheetSavedToGallery); } catch (error) { - context.showErrorSnackBar(message: localizations.generalError); + if (isMaterial(context)) + context.showErrorSnackBar(message: localizations.generalError); } } @@ -86,14 +88,17 @@ class _MemorySheetState extends State with Loadable { Navigator.pop(context); if (isNowPublic) { - context.showSuccessSnackBar( - message: localizations.memorySheetMemoryUpdatedToPublic); + if (isMaterial(context)) + context.showSuccessSnackBar( + message: localizations.memorySheetMemoryUpdatedToPublic); } else { - context.showSuccessSnackBar( - message: localizations.memorySheetMemoryUpdatedToPrivate); + if (isMaterial(context)) + context.showSuccessSnackBar( + message: localizations.memorySheetMemoryUpdatedToPrivate); } } catch (error) { - context.showErrorSnackBar(message: localizations.generalError); + if (isMaterial(context)) + context.showErrorSnackBar(message: localizations.generalError); } } diff --git a/lib/screens/timeline_screen/memory_view.dart b/lib/screens/timeline_screen/memory_view.dart index 22844d7..efc53ed 100644 --- a/lib/screens/timeline_screen/memory_view.dart +++ b/lib/screens/timeline_screen/memory_view.dart @@ -132,7 +132,11 @@ class _MemoryViewState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - PlatformCircularProgressIndicator(), + PlatformCircularProgressIndicator( + cupertino: (_, __) => CupertinoProgressIndicatorData( + color: Colors.white, + ), + ), const SizedBox(height: SMALL_SPACE), () { switch (status) {