mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-25 02:48:54 +01:00
Improve how album is shown in fix shares widget
This commit is contained in:
parent
cd3476f9e8
commit
d84ff1ed64
1 changed files with 42 additions and 20 deletions
|
@ -11,6 +11,7 @@ import 'package:nc_photos/bloc/list_album_share_outlier.dart';
|
||||||
import 'package:nc_photos/cache_manager_util.dart';
|
import 'package:nc_photos/cache_manager_util.dart';
|
||||||
import 'package:nc_photos/entity/album.dart';
|
import 'package:nc_photos/entity/album.dart';
|
||||||
import 'package:nc_photos/entity/file.dart';
|
import 'package:nc_photos/entity/file.dart';
|
||||||
|
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
||||||
import 'package:nc_photos/entity/share.dart';
|
import 'package:nc_photos/entity/share.dart';
|
||||||
import 'package:nc_photos/entity/share/data_source.dart';
|
import 'package:nc_photos/entity/share/data_source.dart';
|
||||||
import 'package:nc_photos/entity/sharee.dart';
|
import 'package:nc_photos/entity/sharee.dart';
|
||||||
|
@ -18,6 +19,7 @@ import 'package:nc_photos/entity/sharee/data_source.dart';
|
||||||
import 'package:nc_photos/exception_util.dart' as exception_util;
|
import 'package:nc_photos/exception_util.dart' as exception_util;
|
||||||
import 'package:nc_photos/k.dart' as k;
|
import 'package:nc_photos/k.dart' as k;
|
||||||
import 'package:nc_photos/snack_bar_manager.dart';
|
import 'package:nc_photos/snack_bar_manager.dart';
|
||||||
|
import 'package:nc_photos/string_extension.dart';
|
||||||
import 'package:nc_photos/theme.dart';
|
import 'package:nc_photos/theme.dart';
|
||||||
import 'package:nc_photos/use_case/create_share.dart';
|
import 'package:nc_photos/use_case/create_share.dart';
|
||||||
import 'package:nc_photos/use_case/remove_share.dart';
|
import 'package:nc_photos/use_case/remove_share.dart';
|
||||||
|
@ -216,7 +218,7 @@ class _AlbumShareOutlierBrowserState extends State<AlbumShareOutlierBrowser> {
|
||||||
return UnboundedListTile(
|
return UnboundedListTile(
|
||||||
leading: _buildFileThumbnail(item.file),
|
leading: _buildFileThumbnail(item.file),
|
||||||
title: Text(
|
title: Text(
|
||||||
item.file.filename,
|
_buildFilename(item.file),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
@ -249,7 +251,7 @@ class _AlbumShareOutlierBrowserState extends State<AlbumShareOutlierBrowser> {
|
||||||
return UnboundedListTile(
|
return UnboundedListTile(
|
||||||
leading: _buildFileThumbnail(item.file),
|
leading: _buildFileThumbnail(item.file),
|
||||||
title: Text(
|
title: Text(
|
||||||
item.file.filename,
|
_buildFilename(item.file),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
@ -260,6 +262,17 @@ class _AlbumShareOutlierBrowserState extends State<AlbumShareOutlierBrowser> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFileThumbnail(File file) {
|
Widget _buildFileThumbnail(File file) {
|
||||||
|
if (file_util.isAlbumFile(widget.account, file)) {
|
||||||
|
return SizedBox(
|
||||||
|
width: 56,
|
||||||
|
height: 56,
|
||||||
|
child: Icon(
|
||||||
|
Icons.photo_album,
|
||||||
|
size: 32,
|
||||||
|
color: AppTheme.getUnfocusedIconColor(context),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
return CachedNetworkImage(
|
return CachedNetworkImage(
|
||||||
width: 56,
|
width: 56,
|
||||||
height: 56,
|
height: 56,
|
||||||
|
@ -279,6 +292,15 @@ class _AlbumShareOutlierBrowserState extends State<AlbumShareOutlierBrowser> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _buildFilename(File file) {
|
||||||
|
if (widget.album.albumFile?.path.equalsIgnoreCase(file.path) == true) {
|
||||||
|
return widget.album.name;
|
||||||
|
} else {
|
||||||
|
return file.filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildFixButton({
|
Widget _buildFixButton({
|
||||||
required VoidCallback onPressed,
|
required VoidCallback onPressed,
|
||||||
|
|
Loading…
Reference in a new issue