1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

Fix/album title (#440)

* Fix album title overflow

* i18n

* More i18n
This commit is contained in:
Matthias Rupp 2022-08-08 15:11:56 +02:00 committed by GitHub
parent b46e834220
commit dea304ac39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 24 deletions

View File

@ -104,5 +104,11 @@
"version_announcement_overlay_text_1": "Hi friend, there is a new release of", "version_announcement_overlay_text_1": "Hi friend, there is a new release of",
"version_announcement_overlay_text_2": "please take your time to visit the ", "version_announcement_overlay_text_2": "please take your time to visit the ",
"version_announcement_overlay_text_3": " and ensure your docker-compose and .env setup is up-to-date to prevent any misconfigurations, especially if you use WatchTower or any mechanism that handles updating your server application automatically.", "version_announcement_overlay_text_3": " and ensure your docker-compose and .env setup is up-to-date to prevent any misconfigurations, especially if you use WatchTower or any mechanism that handles updating your server application automatically.",
"version_announcement_overlay_title": "New Server Version Available \uD83C\uDF89" "version_announcement_overlay_title": "New Server Version Available \uD83C\uDF89",
"album_thumbnail_card_item": "1 item",
"album_thumbnail_card_items": "{} items",
"album_thumbnail_card_shared": " · Shared",
"library_page_albums": "Albums",
"library_page_new_album": "New album",
"create_album_page_untitled": "Untitled"
} }

View File

@ -1,4 +1,5 @@
import 'package:auto_route/auto_route.dart'; import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:immich_mobile/constants/hive_box.dart'; import 'package:immich_mobile/constants/hive_box.dart';
@ -15,6 +16,8 @@ class AlbumThumbnailCard extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var box = Hive.box(userInfoBox); var box = Hive.box(userInfoBox);
final cardSize = MediaQuery.of(context).size.width / 2 - 18;
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
AutoRouter.of(context).push(AlbumViewerRoute(albumId: album.id)); AutoRouter.of(context).push(AlbumViewerRoute(albumId: album.id));
@ -27,8 +30,8 @@ class AlbumThumbnailCard extends StatelessWidget {
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
child: FadeInImage( child: FadeInImage(
width: MediaQuery.of(context).size.width / 2 - 18, width: cardSize,
height: MediaQuery.of(context).size.width / 2 - 18, height: cardSize,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholder: MemoryImage(kTransparentImage), placeholder: MemoryImage(kTransparentImage),
image: NetworkImage( image: NetworkImage(
@ -43,11 +46,14 @@ class AlbumThumbnailCard extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Text( child: SizedBox(
album.albumName, width: cardSize,
style: const TextStyle( child: Text(
fontWeight: FontWeight.bold, album.albumName,
fontSize: 12, style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 12,
),
), ),
), ),
), ),
@ -55,18 +61,20 @@ class AlbumThumbnailCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
'${album.assets.length} item${album.assets.length > 1 ? 's' : ''}', album.assets.length == 1
? 'album_thumbnail_card_item'
: 'album_thumbnail_card_items',
style: const TextStyle( style: const TextStyle(
fontSize: 10, fontSize: 10,
), ),
), ).tr(args: ['${album.assets.length }']),
if (album.shared) if (album.shared)
const Text( const Text(
' · Shared', 'album_thumbnail_card_shared',
style: TextStyle( style: TextStyle(
fontSize: 10, fontSize: 10,
), ),
) ).tr()
], ],
) )
], ],

View File

@ -37,8 +37,10 @@ class CreateAlbumPage extends HookConsumerWidget {
isAlbumTitleTextFieldFocus.value = false; isAlbumTitleTextFieldFocus.value = false;
if (albumTitleController.text.isEmpty) { if (albumTitleController.text.isEmpty) {
albumTitleController.text = 'Untitled'; albumTitleController.text = 'create_album_page_untitled'.tr();
ref.watch(albumTitleProvider.notifier).setAlbumTitle('Untitled'); ref
.watch(albumTitleProvider.notifier)
.setAlbumTitle('create_album_page_untitled'.tr());
} }
} }

View File

@ -1,4 +1,5 @@
import 'package:auto_route/auto_route.dart'; import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
@ -66,15 +67,15 @@ class LibraryPage extends HookConsumerWidget {
), ),
), ),
), ),
const Padding( Padding(
padding: EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Text( child: const Text(
"New album", 'library_page_new_album',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ).tr(),
) )
], ],
), ),
@ -85,13 +86,13 @@ class LibraryPage extends HookConsumerWidget {
body: CustomScrollView( body: CustomScrollView(
slivers: [ slivers: [
_buildAppBar(), _buildAppBar(),
const SliverToBoxAdapter( SliverToBoxAdapter(
child: Padding( child: Padding(
padding: EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Text( child: const Text(
"Albums", 'library_page_albums',
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(fontWeight: FontWeight.bold),
), ).tr(),
), ),
), ),
SliverPadding( SliverPadding(