mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-13 18:58:53 +01:00
Show number of extra dirs in album screen
This commit is contained in:
parent
c7176692d3
commit
afdb895542
2 changed files with 36 additions and 11 deletions
|
@ -8,6 +8,7 @@ class AlbumGridItem extends StatelessWidget {
|
|||
@required this.cover,
|
||||
@required this.title,
|
||||
this.subtitle,
|
||||
this.subtitle2,
|
||||
this.icon,
|
||||
this.isSelected = false,
|
||||
this.onTap,
|
||||
|
@ -38,16 +39,32 @@ class AlbumGridItem extends StatelessWidget {
|
|||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle ?? "",
|
||||
style: Theme.of(context).textTheme.bodyText2.copyWith(
|
||||
fontSize: 10,
|
||||
color: AppTheme.getSecondaryTextColor(context),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
subtitle ?? "",
|
||||
style: Theme.of(context).textTheme.bodyText2.copyWith(
|
||||
fontSize: 10,
|
||||
color: AppTheme.getSecondaryTextColor(context),
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
textAlign: TextAlign.start,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (subtitle2?.isNotEmpty == true)
|
||||
Text(
|
||||
subtitle2,
|
||||
style: Theme.of(context).textTheme.bodyText2.copyWith(
|
||||
fontSize: 10,
|
||||
color: AppTheme.getSecondaryTextColor(context),
|
||||
),
|
||||
textAlign: TextAlign.end,
|
||||
maxLines: 1,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -100,6 +117,9 @@ class AlbumGridItem extends StatelessWidget {
|
|||
final Widget cover;
|
||||
final String title;
|
||||
final String subtitle;
|
||||
|
||||
/// Appears after [subtitle], aligned to the end side of parent
|
||||
final String subtitle2;
|
||||
final IconData icon;
|
||||
final bool isSelected;
|
||||
final VoidCallback onTap;
|
||||
|
|
|
@ -177,17 +177,22 @@ class _HomeAlbumsState extends State<HomeAlbums> {
|
|||
Widget _buildAlbumItem(BuildContext context, int index) {
|
||||
final item = _items[index];
|
||||
var subtitle = "";
|
||||
String subtitle2;
|
||||
if (item.album.provider is AlbumStaticProvider) {
|
||||
subtitle = AppLocalizations.of(context)
|
||||
.albumSize(AlbumStaticProvider.of(item.album).items.length);
|
||||
} else if (item.album.provider is AlbumDirProvider) {
|
||||
subtitle =
|
||||
(item.album.provider as AlbumDirProvider).dirs.first.strippedPath;
|
||||
final provider = item.album.provider as AlbumDirProvider;
|
||||
subtitle = provider.dirs.first.strippedPath;
|
||||
if (provider.dirs.length > 1) {
|
||||
subtitle2 = "+${provider.dirs.length - 1}";
|
||||
}
|
||||
}
|
||||
return AlbumGridItem(
|
||||
cover: _buildAlbumCover(context, item.album),
|
||||
title: item.album.name,
|
||||
subtitle: subtitle,
|
||||
subtitle2: subtitle2,
|
||||
icon: item.album.provider is AlbumDirProvider ? Icons.folder : null,
|
||||
isSelected: _selectedItems.contains(item),
|
||||
onTap: () => _onItemTap(item),
|
||||
|
|
Loading…
Reference in a new issue