moved texts to locale files

This commit is contained in:
Myzel394 2022-08-17 12:18:57 +02:00
parent 08c7436bb3
commit 5670de4b68
11 changed files with 233 additions and 74 deletions

View File

@ -1,3 +1,54 @@
{ {
"helloWorld": "Hallo Welt" "appTitleQuestion": "Quid faciam hodie?",
"generalError": "Ein Fehler ist aufgetreten",
"welcomeScreenDescription": "Finde heraus was du den ganzen Tag gemacht hast und erlebe Erinnerungen wieder, die du komplett vergessen hast!",
"welcomeScreenSubtitle": "Was hab ich heute gemacht?",
"welcomeScreenStartButtonTitle": "Loslegen",
"serverLoadingScreenDescription": "Wir laden deine Daten",
"mainScreenLoadingCamera": "Kamera wird geladen",
"mainScreenActionsTorchButton": "Taschenlampe",
"mainScreenUploadSuccess": "Erfolgreich hochgeladen",
"mainScreenTakePhotoActionTakingPhoto": "Foto wird aufgenommen, halte still...",
"mainScreenTakePhotoActionUploadingPhoto": "Foto wird hochgeladen...",
"mainScreenTakeVideoActionSaveVideo": "Video wird aufgenommen, halte still...",
"mainScreenTakeVideoActionUploadingVideo": "Video wird hochgeladen...",
"loginScreenTitle": "Anmelden",
"loginScreenLoginError": "E-Mail oder Passwort inkorrekt",
"loginScreenHelpText": "Melde dich an. Wenn du noch keinen Account besitzt, erstellen wir automatisch einen für dich.",
"loginScreenFormEmailLabel": "E-Mail",
"loginScreenFormPasswordLabel": "Passwort",
"loginScreenFormSubmitButton": "Anmelden",
"grantPermissionScreenTitle": "Berechtigungen erteilen",
"permissionsRequiredPageTitle": "Berechtigungen benötigt",
"permissionsRequiredPageDescription": "Bitte erteile die folgenden Berechtigungen, um die App zu verwenden.",
"permissionsRequiredPagePermanentlyDenied": "Du hast Berechtigungen permanent abgelehnt, welche für die App benötigt werden. Bitte erteile sie in den Einstellungen.",
"permissionsRequiredPageOpenSettings": "Einstellungen öffnen",
"permissionsRequiredPageGrantCameraPermission": "Kamera-Berechtigung erteilen",
"permissionsRequiredPageGrantMicrophonePermission": "Mikrofon-Berechtigung erteilen",
"memoryViewIsDownloading": "Erinnerung wird heruntergeladen",
"memorySheetSavedToGallery": "In Gallerie gespeichert!",
"memorySheetMemoryUpdatedToPublic": "Deine Erinnerung wurde veröffentlicht!",
"memorySheetMemoryUpdatedToPrivate": "Deine Erinnerung wurde auf privat gestellt.",
"memorySheetTitle": "Erinnerung bearbeiten",
"memorySheetDownloadMemory": "In Gallerie speichern",
"memorySheetUpdateMemoryMakePublic": "Veröffentlichen",
"memorySheetUpdateMemoryMakePrivate": "Privat machen",
"memorySheetDeleteMemory": "Erinnerung löschen"
} }

View File

@ -1,6 +1,54 @@
{ {
"helloWorld": "Hello World!", "appTitleQuestion": "Quid faciam hodie?",
"@helloWorld": {
"description": "The conventional newborn programmer greeting" "generalError": "There was an error",
}
"welcomeScreenDescription": "Find out what you did all the days and unlock moments you completely forgot!",
"welcomeScreenSubtitle": "What did I do today?",
"welcomeScreenStartButtonTitle": "Start",
"serverLoadingScreenDescription": "We are loading your data",
"mainScreenLoadingCamera": "Loading camera",
"mainScreenActionsTorchButton": "Torch",
"mainScreenUploadSuccess": "Uploaded successfully!",
"mainScreenTakePhotoActionTakingPhoto": "Taking photo, please hold still...",
"mainScreenTakePhotoActionUploadingPhoto": "Uploading photo...",
"mainScreenTakeVideoActionSaveVideo": "Taking video, please hold still...",
"mainScreenTakeVideoActionUploadingVideo": "Uploading video...",
"loginScreenTitle": "Login",
"loginScreenLoginError": "Invalid password or email",
"loginScreenHelpText": "Sign in to your account. If you do not have one already, we will automatically set up one for you.",
"loginScreenFormEmailLabel": "Email",
"loginScreenFormPasswordLabel": "Password",
"loginScreenFormSubmitButton": "Login",
"grantPermissionScreenTitle": "Grant Permissions",
"permissionsRequiredPageTitle": "Permissions Required",
"permissionsRequiredPageDescription": "Please grant the following permissions to use this app.",
"permissionsRequiredPagePermanentlyDenied": "You have permanently denied permissions required to use this app. Please enable them in the settings.",
"permissionsRequiredPageOpenSettings": "Open Settings",
"permissionsRequiredPageGrantCameraPermission": "Grant camera permission",
"permissionsRequiredPageGrantMicrophonePermission": "Grant microphone permission",
"memoryViewIsDownloading": "Downloading memory",
"memorySheetSavedToGallery": "Saved to Gallery!",
"memorySheetMemoryUpdatedToPublic": "Your Memory is public now!",
"memorySheetMemoryUpdatedToPrivate": "Your Memory is private now.",
"memorySheetTitle": "Edit Memory",
"memorySheetDownloadMemory": "Download to Gallery",
"memorySheetUpdateMemoryMakePublic": "Make Public",
"memorySheetUpdateMemoryMakePrivate": "Make Private",
"memorySheetDeleteMemory": "Delete Memory"
} }

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:quid_faciam_hodie/screens/main_screen.dart'; import 'package:quid_faciam_hodie/screens/main_screen.dart';
import 'main_screen/permissions_required_page.dart'; import 'main_screen/permissions_required_page.dart';
@ -10,9 +11,11 @@ class GrantPermissionScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Grant Permission'), title: Text(localizations.grantPermissionScreenTitle),
), ),
body: Center( body: Center(
child: PermissionsRequiredPage( child: PermissionsRequiredPage(

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:quid_faciam_hodie/constants/spacing.dart'; import 'package:quid_faciam_hodie/constants/spacing.dart';
import 'package:quid_faciam_hodie/extensions/snackbar.dart'; import 'package:quid_faciam_hodie/extensions/snackbar.dart';
import 'package:quid_faciam_hodie/managers/authentication_manager.dart'; import 'package:quid_faciam_hodie/managers/authentication_manager.dart';
@ -56,6 +57,8 @@ class _LoginScreenState extends AuthState<LoginScreen> with Loadable {
} }
Future<void> signIn() async { Future<void> signIn() async {
final localizations = AppLocalizations.of(context)!;
try { try {
await _signUp(); await _signUp();
} catch (error) { } catch (error) {
@ -63,7 +66,9 @@ class _LoginScreenState extends AuthState<LoginScreen> with Loadable {
await _signIn(); await _signIn();
} catch (error) { } catch (error) {
if (mounted) { if (mounted) {
context.showLongErrorSnackBar(message: 'Invalid password or email'); context.showLongErrorSnackBar(
message: localizations.loginScreenLoginError,
);
emailController.clear(); emailController.clear();
passwordController.clear(); passwordController.clear();
@ -79,11 +84,12 @@ class _LoginScreenState extends AuthState<LoginScreen> with Loadable {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: const Text('Login'), title: Text(localizations.loginScreenTitle),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(MEDIUM_SPACE), padding: const EdgeInsets.all(MEDIUM_SPACE),
@ -96,9 +102,7 @@ class _LoginScreenState extends AuthState<LoginScreen> with Loadable {
style: theme.textTheme.headline1, style: theme.textTheme.headline1,
), ),
const SizedBox(height: LARGE_SPACE), const SizedBox(height: LARGE_SPACE),
const Text( Text(localizations.loginScreenHelpText),
'Sign in to your account. If you do not have one already, we will automatically set up one for you.',
),
const SizedBox(height: MEDIUM_SPACE), const SizedBox(height: MEDIUM_SPACE),
TextField( TextField(
controller: emailController, controller: emailController,
@ -106,25 +110,25 @@ class _LoginScreenState extends AuthState<LoginScreen> with Loadable {
autofillHints: const [AutofillHints.email], autofillHints: const [AutofillHints.email],
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.next, textInputAction: TextInputAction.next,
decoration: const InputDecoration( decoration: InputDecoration(
labelText: 'Email', labelText: localizations.loginScreenFormEmailLabel,
prefixIcon: Icon(Icons.email), prefixIcon: const Icon(Icons.email),
), ),
), ),
const SizedBox(height: SMALL_SPACE), const SizedBox(height: SMALL_SPACE),
TextField( TextField(
obscureText: true, obscureText: true,
controller: passwordController, controller: passwordController,
decoration: const InputDecoration( decoration: InputDecoration(
labelText: 'Password', labelText: localizations.loginScreenFormPasswordLabel,
prefixIcon: Icon(Icons.lock), prefixIcon: const Icon(Icons.lock),
), ),
onSubmitted: (value) => callWithLoading(signIn), onSubmitted: (value) => callWithLoading(signIn),
), ),
const SizedBox(height: MEDIUM_SPACE), const SizedBox(height: MEDIUM_SPACE),
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.arrow_right), icon: const Icon(Icons.arrow_right),
label: const Text('Login'), label: Text(localizations.loginScreenFormSubmitButton),
onPressed: isLoading ? null : () => callWithLoading(signIn), onPressed: isLoading ? null : () => callWithLoading(signIn),
) )
], ],

View File

@ -4,6 +4,7 @@ import 'dart:typed_data';
import 'package:camera/camera.dart'; import 'package:camera/camera.dart';
import 'package:expandable_bottom_sheet/expandable_bottom_sheet.dart'; import 'package:expandable_bottom_sheet/expandable_bottom_sheet.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:quid_faciam_hodie/constants/spacing.dart'; import 'package:quid_faciam_hodie/constants/spacing.dart';
import 'package:quid_faciam_hodie/constants/values.dart'; import 'package:quid_faciam_hodie/constants/values.dart';
import 'package:quid_faciam_hodie/extensions/snackbar.dart'; import 'package:quid_faciam_hodie/extensions/snackbar.dart';
@ -152,6 +153,8 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
} }
Future<void> takePhoto() async { Future<void> takePhoto() async {
final localizations = AppLocalizations.of(context)!;
if (controller!.value.isTakingPicture) { if (controller!.value.isTakingPicture) {
return; return;
} }
@ -162,7 +165,7 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
try { try {
context.showPendingSnackBar( context.showPendingSnackBar(
message: 'Taking photo, please hold still...', message: localizations.mainScreenTakePhotoActionTakingPhoto,
); );
controller!.setFlashMode(FlashMode.off); controller!.setFlashMode(FlashMode.off);
@ -172,7 +175,9 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
uploadingPhotoAnimation = file.readAsBytesSync(); uploadingPhotoAnimation = file.readAsBytesSync();
}); });
context.showPendingSnackBar(message: 'Uploading photo...'); context.showPendingSnackBar(
message: localizations.mainScreenTakePhotoActionUploadingPhoto,
);
try { try {
await FileManager.uploadFile(_user, file); await FileManager.uploadFile(_user, file);
@ -181,7 +186,9 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
return; return;
} }
context.showSuccessSnackBar(message: 'Photo uploaded!'); context.showSuccessSnackBar(
message: localizations.mainScreenUploadSuccess,
);
} finally { } finally {
setState(() { setState(() {
lockCamera = false; lockCamera = false;
@ -191,6 +198,8 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
} }
Future<void> takeVideo() async { Future<void> takeVideo() async {
final localizations = AppLocalizations.of(context)!;
setState(() { setState(() {
isRecording = false; isRecording = false;
}); });
@ -205,11 +214,15 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
}); });
try { try {
context.showPendingSnackBar(message: 'Saving video...'); context.showPendingSnackBar(
message: localizations.mainScreenTakeVideoActionSaveVideo,
);
final file = File((await controller!.stopVideoRecording()).path); final file = File((await controller!.stopVideoRecording()).path);
context.showPendingSnackBar(message: 'Uploading video...'); context.showPendingSnackBar(
message: localizations.mainScreenTakeVideoActionUploadingVideo,
);
try { try {
await FileManager.uploadFile(_user, file); await FileManager.uploadFile(_user, file);
@ -220,7 +233,9 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
return; return;
} }
context.showSuccessSnackBar(message: 'Video uploaded!'); context.showSuccessSnackBar(
message: localizations.mainScreenUploadSuccess,
);
} finally { } finally {
setState(() { setState(() {
lockCamera = false; lockCamera = false;
@ -230,6 +245,8 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
return Scaffold( return Scaffold(
backgroundColor: Colors.black, backgroundColor: Colors.black,
bottomSheet: () { bottomSheet: () {
@ -238,10 +255,10 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[ children: <Widget>[
CircularProgressIndicator(), const CircularProgressIndicator(),
SizedBox(height: MEDIUM_SPACE), const SizedBox(height: MEDIUM_SPACE),
Text('Loading camera'), Text(localizations.mainScreenLoadingCamera),
], ],
), ),
); );
@ -371,7 +388,8 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
children: <Widget>[ children: <Widget>[
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.flashlight_on_rounded), icon: const Icon(Icons.flashlight_on_rounded),
label: const Text('Torch'), label: Text(AppLocalizations.of(context)!
.mainScreenActionsTorchButton),
style: ButtonStyle( style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith<Color>( backgroundColor: MaterialStateProperty.resolveWith<Color>(
(_) => isTorchEnabled ? Colors.white : Colors.black, (_) => isTorchEnabled ? Colors.white : Colors.black,

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:quid_faciam_hodie/constants/spacing.dart'; import 'package:quid_faciam_hodie/constants/spacing.dart';
@ -52,28 +53,26 @@ class _PermissionsRequiredPageState extends State<PermissionsRequiredPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Text( Text(
'Permissions Required', localizations.permissionsRequiredPageTitle,
style: Theme.of(context).textTheme.headline1, style: Theme.of(context).textTheme.headline1,
), ),
const SizedBox(height: MEDIUM_SPACE), const SizedBox(height: MEDIUM_SPACE),
const Text( Text(localizations.permissionsRequiredPageDescription),
'Please grant the following permissions to use this app',
),
const SizedBox(height: LARGE_SPACE), const SizedBox(height: LARGE_SPACE),
if (hasDeniedForever) ...[ if (hasDeniedForever) ...[
const Text( Text(localizations.permissionsRequiredPagePermanentlyDenied),
'You have permanently denied permissions required to use this app. Please enable them in the settings.',
),
const SizedBox(height: LARGE_SPACE), const SizedBox(height: LARGE_SPACE),
TextButton.icon( TextButton.icon(
onPressed: () => openAppSettings(), onPressed: () => openAppSettings(),
icon: const Icon(Icons.settings), icon: const Icon(Icons.settings),
label: const Text('Open Settings'), label: Text(localizations.permissionsRequiredPageOpenSettings),
), ),
] else ...[ ] else ...[
TextButton.icon( TextButton.icon(
@ -84,8 +83,15 @@ class _PermissionsRequiredPageState extends State<PermissionsRequiredPage> {
await checkPermissions(); await checkPermissions();
}, },
icon: const Icon(Icons.camera_alt), icon: const Icon(Icons.camera_alt),
label: Text( label: Row(
'Grant camera permission${hasGrantedCameraPermission ? ' - Granted!' : ''}', mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
localizations.permissionsRequiredPageGrantCameraPermission,
),
if (hasGrantedCameraPermission) const Icon(Icons.check),
if (!hasGrantedCameraPermission) const SizedBox(),
],
), ),
), ),
const SizedBox(height: MEDIUM_SPACE), const SizedBox(height: MEDIUM_SPACE),
@ -97,8 +103,16 @@ class _PermissionsRequiredPageState extends State<PermissionsRequiredPage> {
await checkPermissions(); await checkPermissions();
}, },
icon: const Icon(Icons.mic), icon: const Icon(Icons.mic),
label: Text( label: Row(
'Grant microphone permission ${hasGrantedMicrophonePermission ? ' - Granted!' : ''}', mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
localizations
.permissionsRequiredPageGrantMicrophonePermission,
),
if (hasGrantedMicrophonePermission) const Icon(Icons.check),
if (!hasGrantedMicrophonePermission) const SizedBox(),
],
), ),
), ),
], ],

View File

@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:quid_faciam_hodie/constants/spacing.dart'; import 'package:quid_faciam_hodie/constants/spacing.dart';
import 'package:quid_faciam_hodie/managers/global_values_manager.dart'; import 'package:quid_faciam_hodie/managers/global_values_manager.dart';
@ -54,42 +55,42 @@ class _ServerLoadingScreenState extends State<ServerLoadingScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
return Scaffold( return Scaffold(
backgroundColor: Colors.black, backgroundColor: Colors.black,
body: Center( body: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: const <Widget>[ children: <Widget>[
Icon(Icons.cloud, size: 60), const Icon(Icons.cloud, size: 60),
SizedBox(height: SMALL_SPACE), const SizedBox(height: SMALL_SPACE),
DotAnimation( const DotAnimation(
initialFadeInDelay: Duration.zero, initialFadeInDelay: Duration.zero,
fadeInDuration: Duration(seconds: 1), fadeInDuration: Duration(seconds: 1),
fadeOutDuration: Duration(seconds: 1), fadeOutDuration: Duration(seconds: 1),
fadeInDelay: Duration(seconds: 4), fadeInDelay: Duration(seconds: 4),
fadeOutDelay: Duration.zero, fadeOutDelay: Duration.zero,
), ),
DotAnimation( const DotAnimation(
initialFadeInDelay: Duration(seconds: 2), initialFadeInDelay: Duration(seconds: 2),
fadeInDuration: Duration(seconds: 1), fadeInDuration: Duration(seconds: 1),
fadeOutDuration: Duration(seconds: 1), fadeOutDuration: Duration(seconds: 1),
fadeInDelay: Duration(seconds: 4), fadeInDelay: Duration(seconds: 4),
fadeOutDelay: Duration.zero, fadeOutDelay: Duration.zero,
), ),
DotAnimation( const DotAnimation(
initialFadeInDelay: Duration(seconds: 4), initialFadeInDelay: Duration(seconds: 4),
fadeInDuration: Duration(seconds: 1), fadeInDuration: Duration(seconds: 1),
fadeOutDuration: Duration(seconds: 1), fadeOutDuration: Duration(seconds: 1),
fadeInDelay: Duration(seconds: 4), fadeInDelay: Duration(seconds: 4),
fadeOutDelay: Duration.zero, fadeOutDelay: Duration.zero,
), ),
SizedBox(height: SMALL_SPACE), const SizedBox(height: SMALL_SPACE),
Icon(Icons.smartphone, size: 60), const Icon(Icons.smartphone, size: 60),
SizedBox(height: LARGE_SPACE), const SizedBox(height: LARGE_SPACE),
Text( Text(localizations.serverLoadingScreenDescription),
'We are loading your data',
),
], ],
), ),
), ),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:quid_faciam_hodie/constants/spacing.dart'; import 'package:quid_faciam_hodie/constants/spacing.dart';
import 'package:quid_faciam_hodie/widgets/logo.dart'; import 'package:quid_faciam_hodie/widgets/logo.dart';
@ -11,6 +12,7 @@ class WelcomeScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
final theme = Theme.of(context); final theme = Theme.of(context);
return Scaffold( return Scaffold(
@ -23,25 +25,25 @@ class WelcomeScreen extends StatelessWidget {
const Logo(), const Logo(),
const SizedBox(height: LARGE_SPACE), const SizedBox(height: LARGE_SPACE),
Text( Text(
'Quid faciam hodie?', localizations.appTitleQuestion,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: theme.textTheme.headline1, style: theme.textTheme.headline1,
), ),
const SizedBox(height: SMALL_SPACE), const SizedBox(height: SMALL_SPACE),
Text( Text(
'What did I do today?', localizations.welcomeScreenSubtitle,
style: theme.textTheme.bodySmall, style: theme.textTheme.bodySmall,
), ),
const SizedBox(height: LARGE_SPACE), const SizedBox(height: LARGE_SPACE),
Text( Text(
'Find out what you did all the days and unlock moments you completely forgot!', localizations.welcomeScreenDescription,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: theme.textTheme.bodyText2, style: theme.textTheme.bodyText2,
), ),
const SizedBox(height: LARGE_SPACE), const SizedBox(height: LARGE_SPACE),
ElevatedButton.icon( ElevatedButton.icon(
icon: const Icon(Icons.arrow_right), icon: const Icon(Icons.arrow_right),
label: const Text('Start'), label: Text(localizations.welcomeScreenStartButtonTitle),
onPressed: () { onPressed: () {
Navigator.pushReplacementNamed( Navigator.pushReplacementNamed(
context, context,

View File

@ -2,6 +2,7 @@ import 'dart:typed_data';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:quid_faciam_hodie/constants/spacing.dart'; import 'package:quid_faciam_hodie/constants/spacing.dart';
import 'package:quid_faciam_hodie/enums.dart'; import 'package:quid_faciam_hodie/enums.dart';
import 'package:quid_faciam_hodie/foreign_types/memory.dart'; import 'package:quid_faciam_hodie/foreign_types/memory.dart';
@ -79,6 +80,7 @@ class _MemoryViewState extends State<MemoryView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
final theme = Theme.of(context); final theme = Theme.of(context);
if (status == MemoryFetchStatus.error) { if (status == MemoryFetchStatus.error) {
@ -130,7 +132,7 @@ class _MemoryViewState extends State<MemoryView> {
switch (status) { switch (status) {
case MemoryFetchStatus.downloading: case MemoryFetchStatus.downloading:
return Text( return Text(
'Downloading memory', localizations.memoryViewIsDownloading,
style: theme.textTheme.bodyText2!.copyWith( style: theme.textTheme.bodyText2!.copyWith(
color: Colors.white, color: Colors.white,
), ),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:gallery_saver/gallery_saver.dart'; import 'package:gallery_saver/gallery_saver.dart';
import 'package:quid_faciam_hodie/constants/spacing.dart'; import 'package:quid_faciam_hodie/constants/spacing.dart';
import 'package:quid_faciam_hodie/enums.dart'; import 'package:quid_faciam_hodie/enums.dart';
@ -35,13 +36,11 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
} }
Future<void> downloadFile() async { Future<void> downloadFile() async {
final localizations = AppLocalizations.of(context)!;
try { try {
final file = await widget.memory.downloadToFile(); final file = await widget.memory.downloadToFile();
if (!mounted) {
return;
}
switch (widget.memory.type) { switch (widget.memory.type) {
case MemoryType.photo: case MemoryType.photo:
await GallerySaver.saveImage(file.path); await GallerySaver.saveImage(file.path);
@ -51,15 +50,22 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
break; break;
} }
if (!mounted) {
return;
}
Navigator.pop(context); Navigator.pop(context);
context.showSuccessSnackBar(message: 'File saved to Gallery!'); context.showSuccessSnackBar(
message: localizations.memorySheetSavedToGallery);
} catch (error) { } catch (error) {
context.showErrorSnackBar(message: 'There was an error.'); context.showErrorSnackBar(message: localizations.generalError);
} }
} }
Future<void> changeVisibility() async { Future<void> changeVisibility() async {
final localizations = AppLocalizations.of(context)!;
final isNowPublic = !widget.memory.isPublic == true; final isNowPublic = !widget.memory.isPublic == true;
try { try {
@ -69,15 +75,21 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
'id': widget.memory.id, 'id': widget.memory.id,
}).execute(); }).execute();
if (!mounted) {
return;
}
Navigator.pop(context); Navigator.pop(context);
if (isNowPublic) { if (isNowPublic) {
context.showSuccessSnackBar(message: 'Your Memory is public now!'); context.showSuccessSnackBar(
message: localizations.memorySheetMemoryUpdatedToPublic);
} else { } else {
context.showSuccessSnackBar(message: 'Your Memory is private now.'); context.showSuccessSnackBar(
message: localizations.memorySheetMemoryUpdatedToPrivate);
} }
} catch (error) { } catch (error) {
context.showErrorSnackBar(message: 'There was an error.'); context.showErrorSnackBar(message: localizations.generalError);
} }
} }
@ -96,19 +108,20 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final localizations = AppLocalizations.of(context)!;
final theme = Theme.of(context); final theme = Theme.of(context);
return ModalSheet( return ModalSheet(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Text( Text(
'Edit Memory', localizations.memorySheetTitle,
style: theme.textTheme.headline1, style: theme.textTheme.headline1,
), ),
const SizedBox(height: MEDIUM_SPACE), const SizedBox(height: MEDIUM_SPACE),
ListTile( ListTile(
leading: const Icon(Icons.download), leading: const Icon(Icons.download),
title: const Text('Download to Gallery'), title: Text(localizations.memorySheetDownloadMemory),
enabled: !getIsLoadingSpecificID('download'), enabled: !getIsLoadingSpecificID('download'),
onTap: getIsLoadingSpecificID('download') onTap: getIsLoadingSpecificID('download')
? null ? null
@ -121,8 +134,11 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
leading: Icon(widget.memory.isPublic leading: Icon(widget.memory.isPublic
? Icons.public_off_rounded ? Icons.public_off_rounded
: Icons.public_rounded), : Icons.public_rounded),
title: title: Text(
Text(widget.memory.isPublic ? 'Make private' : 'Make public'), widget.memory.isPublic
? localizations.memorySheetUpdateMemoryMakePrivate
: localizations.memorySheetUpdateMemoryMakePublic,
),
enabled: !getIsLoadingSpecificID('public'), enabled: !getIsLoadingSpecificID('public'),
onTap: getIsLoadingSpecificID('public') onTap: getIsLoadingSpecificID('public')
? null ? null
@ -133,7 +149,7 @@ class _MemorySheetState extends State<MemorySheet> with Loadable {
), ),
ListTile( ListTile(
leading: const Icon(Icons.delete_forever_sharp), leading: const Icon(Icons.delete_forever_sharp),
title: const Text('Delete Memory'), title: Text(localizations.memorySheetDeleteMemory),
enabled: !getIsLoadingSpecificID('delete'), enabled: !getIsLoadingSpecificID('delete'),
onTap: getIsLoadingSpecificID('delete') onTap: getIsLoadingSpecificID('delete')
? null ? null

View File

@ -34,7 +34,7 @@ class TimelineOverlay extends StatelessWidget {
curve: Curves.linearToEaseOut, curve: Curves.linearToEaseOut,
opacity: timeline.showOverlay ? 1.0 : 0.0, opacity: timeline.showOverlay ? 1.0 : 0.0,
child: Text( child: Text(
DateFormat('dd. MMMM yyyy').format(date), DateFormat.yMMMd().format(date),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline1!.copyWith( style: Theme.of(context).textTheme.headline1!.copyWith(
color: Colors.white, color: Colors.white,