From 4ff650781fcc4244977a6f0eb7bda2e57faf31a5 Mon Sep 17 00:00:00 2001 From: otsmr Date: Sun, 1 Jun 2025 23:27:13 +0200 Subject: [PATCH] added text for empty memories --- lib/src/localization/app_de.arb | 3 +- lib/src/localization/app_en.arb | 3 +- .../generated/app_localizations.dart | 6 ++ .../generated/app_localizations_de.dart | 4 ++ .../generated/app_localizations_en.dart | 4 ++ lib/src/views/memories/memories.view.dart | 67 ++++++++++--------- 6 files changed, 55 insertions(+), 32 deletions(-) diff --git a/lib/src/localization/app_de.arb b/lib/src/localization/app_de.arb index dc793eb..bf320c8 100644 --- a/lib/src/localization/app_de.arb +++ b/lib/src/localization/app_de.arb @@ -253,5 +253,6 @@ "tutorialChatMessagesVerifyShieldTitle": "Verifiziere deine Kontakte!", "tutorialChatMessagesVerifyShieldDesc": "twonly nutzt das Signal-Protokoll für eine sichere Ende-zu-Ende Verschlüsselung. Bei der ersten Kontaktaufnahme wird dafür der öffentliche Identitätsschlüssel von deinem Kontakt heruntergeladen. Um sicherzustellen, dass dieser Schlüssel nicht von Dritten ausgetauscht wurde, solltest du ihn mit deinem Freund vergleichen, wenn ihr euch persönlich trefft. Sobald du den Benutzer verifiziert hast, kannst du auch beim verschicken von Bildern und Videos den twonly-Modus aktivieren.", "tutorialChatMessagesReopenMessageTitle": "Bilder und Videos erneut öffnen", - "tutorialChatMessagesReopenMessageDesc": "Wenn dein Freund dir ein Bild oder Video mit unendlicher Anzeigezeit gesendet hat, kannst du es bis zum Neustart der App jederzeit erneut öffnen. Um dies zu tun, musst du einfach doppelt auf die Nachricht klicken. Dein Freund erhält dann eine Benachrichtigung, dass du das Bild erneut angesehen hast." + "tutorialChatMessagesReopenMessageDesc": "Wenn dein Freund dir ein Bild oder Video mit unendlicher Anzeigezeit gesendet hat, kannst du es bis zum Neustart der App jederzeit erneut öffnen. Um dies zu tun, musst du einfach doppelt auf die Nachricht klicken. Dein Freund erhält dann eine Benachrichtigung, dass du das Bild erneut angesehen hast.", + "memoriesEmpty": "Sobald du Bilder oder Videos speicherst, landen sie hier in deinen Erinnerungen." } \ No newline at end of file diff --git a/lib/src/localization/app_en.arb b/lib/src/localization/app_en.arb index 68ad803..4100040 100644 --- a/lib/src/localization/app_en.arb +++ b/lib/src/localization/app_en.arb @@ -412,5 +412,6 @@ "tutorialChatMessagesVerifyShieldTitle": "Verify your contacts!", "tutorialChatMessagesVerifyShieldDesc": "twonly uses the Signal protocol for secure end-to-end encryption. When you first contact someone, their public identity key is downloaded. To ensure that this key has not been tampered with by third parties, you should compare it with your friend when you meet in person. Once you have verified the user, you can also enable the twonly mode when sending images and videos.", "tutorialChatMessagesReopenMessageTitle": "Reopen Images and Videos", - "tutorialChatMessagesReopenMessageDesc": "If your friend has sent you a picture or video with infinite display time, you can open it again at any time until you restart the app. To do this, simply double-click on the message. Your friend will then receive a notification that you have viewed the picture again." + "tutorialChatMessagesReopenMessageDesc": "If your friend has sent you a picture or video with infinite display time, you can open it again at any time until you restart the app. To do this, simply double-click on the message. Your friend will then receive a notification that you have viewed the picture again.", + "memoriesEmpty": "As soon as you save pictures or videos, they end up here in your memories." } \ No newline at end of file diff --git a/lib/src/localization/generated/app_localizations.dart b/lib/src/localization/generated/app_localizations.dart index 2d07ef8..8685b2e 100644 --- a/lib/src/localization/generated/app_localizations.dart +++ b/lib/src/localization/generated/app_localizations.dart @@ -1537,6 +1537,12 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'If your friend has sent you a picture or video with infinite display time, you can open it again at any time until you restart the app. To do this, simply double-click on the message. Your friend will then receive a notification that you have viewed the picture again.'** String get tutorialChatMessagesReopenMessageDesc; + + /// No description provided for @memoriesEmpty. + /// + /// In en, this message translates to: + /// **'As soon as you save pictures or videos, they end up here in your memories.'** + String get memoriesEmpty; } class _AppLocalizationsDelegate diff --git a/lib/src/localization/generated/app_localizations_de.dart b/lib/src/localization/generated/app_localizations_de.dart index 0088995..2b3ed4e 100644 --- a/lib/src/localization/generated/app_localizations_de.dart +++ b/lib/src/localization/generated/app_localizations_de.dart @@ -814,4 +814,8 @@ class AppLocalizationsDe extends AppLocalizations { @override String get tutorialChatMessagesReopenMessageDesc => 'Wenn dein Freund dir ein Bild oder Video mit unendlicher Anzeigezeit gesendet hat, kannst du es bis zum Neustart der App jederzeit erneut öffnen. Um dies zu tun, musst du einfach doppelt auf die Nachricht klicken. Dein Freund erhält dann eine Benachrichtigung, dass du das Bild erneut angesehen hast.'; + + @override + String get memoriesEmpty => + 'Sobald du Bilder oder Videos speicherst, landen sie hier in deinen Erinnerungen.'; } diff --git a/lib/src/localization/generated/app_localizations_en.dart b/lib/src/localization/generated/app_localizations_en.dart index 7d05b84..c6c322e 100644 --- a/lib/src/localization/generated/app_localizations_en.dart +++ b/lib/src/localization/generated/app_localizations_en.dart @@ -808,4 +808,8 @@ class AppLocalizationsEn extends AppLocalizations { @override String get tutorialChatMessagesReopenMessageDesc => 'If your friend has sent you a picture or video with infinite display time, you can open it again at any time until you restart the app. To do this, simply double-click on the message. Your friend will then receive a notification that you have viewed the picture again.'; + + @override + String get memoriesEmpty => + 'As soon as you save pictures or videos, they end up here in your memories.'; } diff --git a/lib/src/views/memories/memories.view.dart b/lib/src/views/memories/memories.view.dart index 2360ca5..c95df90 100644 --- a/lib/src/views/memories/memories.view.dart +++ b/lib/src/views/memories/memories.view.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:twonly/globals.dart'; import 'package:twonly/src/database/twonly_database.dart'; import 'package:twonly/src/model/memory_item.model.dart'; +import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/views/memories/memories_item_thumbnail.dart'; import 'package:twonly/src/views/memories/memories_photo_slider.view.dart'; @@ -103,37 +104,43 @@ class MemoriesViewState extends State { return Scaffold( appBar: AppBar(title: Text('Memories')), body: Scrollbar( - child: ListView.builder( - itemCount: (months.length * 2), - itemBuilder: (context, mIndex) { - if (mIndex % 2 == 0) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Text(months[(mIndex / 2).toInt()]), - ); - } - int index = ((mIndex - 1) / 2).toInt(); - return GridView.builder( - shrinkWrap: true, - physics: const ClampingScrollPhysics(), - scrollDirection: Axis.vertical, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 4, - childAspectRatio: 9 / 16, + child: (galleryItems.isEmpty) + ? Center( + child: Text( + context.lang.memoriesEmpty, + textAlign: TextAlign.center, + )) + : ListView.builder( + itemCount: (months.length * 2), + itemBuilder: (context, mIndex) { + if (mIndex % 2 == 0) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Text(months[(mIndex / 2).toInt()]), + ); + } + int index = ((mIndex - 1) / 2).toInt(); + return GridView.builder( + shrinkWrap: true, + physics: const ClampingScrollPhysics(), + scrollDirection: Axis.vertical, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + childAspectRatio: 9 / 16, + ), + itemCount: orderedByMonth[months[index]]!.length, + itemBuilder: (context, gIndex) { + int gaIndex = orderedByMonth[months[index]]![gIndex]; + return MemoriesItemThumbnail( + galleryItem: galleryItems[gaIndex], + onTap: () { + open(context, gaIndex); + }, + ); + }, + ); + }, ), - itemCount: orderedByMonth[months[index]]!.length, - itemBuilder: (context, gIndex) { - int gaIndex = orderedByMonth[months[index]]![gIndex]; - return MemoriesItemThumbnail( - galleryItem: galleryItems[gaIndex], - onTap: () { - open(context, gaIndex); - }, - ); - }, - ); - }, - ), ), ); }