feat(mobile): add option to show asset owner name in asset list

This commit is contained in:
idubnori
2025-12-06 23:08:37 +09:00
parent 8416397589
commit f13a5ba418
13 changed files with 136 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ class ThumbnailTile extends ConsumerWidget {
this.showStorageIndicator = false,
this.lockSelection = false,
this.heroOffset,
this.ownerName,
super.key,
});
@@ -28,6 +29,7 @@ class ThumbnailTile extends ConsumerWidget {
final bool showStorageIndicator;
final bool lockSelection;
final int? heroOffset;
final String? ownerName;
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -45,6 +47,9 @@ class ThumbnailTile extends ConsumerWidget {
final bool storageIndicator =
ref.watch(settingsProvider.select((s) => s.get(Setting.showStorageIndicator))) && showStorageIndicator;
final bool showOwnerNameSetting = ref.watch(settingsProvider.select((s) => s.get(Setting.showOwnerName)));
final shouldShowOwnerName = showOwnerNameSetting && ownerName != null;
return Stack(
children: [
Container(color: lockSelection ? context.colorScheme.surfaceContainerHighest : assetContainerColor),
@@ -72,6 +77,14 @@ class ThumbnailTile extends ConsumerWidget {
alignment: Alignment.topRight,
child: _AssetTypeIcons(asset: asset),
),
if (shouldShowOwnerName)
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.only(right: 10.0, bottom: 6.0),
child: _OwnerNameLabel(ownerName: ownerName!),
),
),
if (storageIndicator && asset != null)
switch (asset.storage) {
AssetState.local => const Align(
@@ -229,3 +242,27 @@ class _AssetTypeIcons extends StatelessWidget {
);
}
}
class _OwnerNameLabel extends StatelessWidget {
final String ownerName;
const _OwnerNameLabel({required this.ownerName});
@override
Widget build(BuildContext context) {
return Container(
constraints: const BoxConstraints(maxWidth: 120),
child: Text(
ownerName,
style: const TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w600,
shadows: [Shadow(blurRadius: 5.0, color: Color.fromRGBO(0, 0, 0, 0.6), offset: Offset(0.0, 0.0))],
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
);
}
}