album icons: shadow only in section headers
This commit is contained in:
parent
d460f7c8ef
commit
31eb61433e
2 changed files with 16 additions and 14 deletions
|
@ -97,8 +97,18 @@ class SectionSliver extends StatelessWidget {
|
||||||
if (collection.sortFactor == SortFactor.date) {
|
if (collection.sortFactor == SortFactor.date) {
|
||||||
switch (collection.groupFactor) {
|
switch (collection.groupFactor) {
|
||||||
case GroupFactor.album:
|
case GroupFactor.album:
|
||||||
|
Widget albumIcon = IconUtils.getAlbumIcon(context, sectionKey);
|
||||||
|
if (albumIcon != null) {
|
||||||
|
albumIcon = Material(
|
||||||
|
type: MaterialType.circle,
|
||||||
|
elevation: 3,
|
||||||
|
color: Colors.transparent,
|
||||||
|
shadowColor: Colors.black,
|
||||||
|
child: albumIcon,
|
||||||
|
);
|
||||||
|
}
|
||||||
header = SectionHeader(
|
header = SectionHeader(
|
||||||
leading: IconUtils.getAlbumIcon(context, sectionKey),
|
leading: albumIcon,
|
||||||
title: collection.getUniqueAlbumName(sectionKey, sections.keys.toList()),
|
title: collection.getUniqueAlbumName(sectionKey, sections.keys.toList()),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -92,28 +92,20 @@ class IconUtils {
|
||||||
appNameMap = await AndroidAppService.getAppNames();
|
appNameMap = await AndroidAppService.getAppNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Widget _buildAlbumIcon(Widget child) => Material(
|
|
||||||
type: MaterialType.circle,
|
|
||||||
elevation: 3,
|
|
||||||
color: Colors.transparent,
|
|
||||||
shadowColor: Colors.black,
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
|
|
||||||
static Widget getAlbumIcon(BuildContext context, String albumDirectory) {
|
static Widget getAlbumIcon(BuildContext context, String albumDirectory) {
|
||||||
if (albumDirectory == null) return null;
|
if (albumDirectory == null) return null;
|
||||||
if (androidFileUtils.isCameraPath(albumDirectory)) return _buildAlbumIcon(Icon(Icons.photo_camera));
|
if (androidFileUtils.isCameraPath(albumDirectory)) return Icon(Icons.photo_camera);
|
||||||
if (androidFileUtils.isScreenshotsPath(albumDirectory)) return _buildAlbumIcon(Icon(Icons.smartphone));
|
if (androidFileUtils.isScreenshotsPath(albumDirectory)) return Icon(Icons.smartphone);
|
||||||
if (androidFileUtils.isDownloadPath(albumDirectory)) return _buildAlbumIcon(Icon(Icons.file_download));
|
if (androidFileUtils.isDownloadPath(albumDirectory)) return Icon(Icons.file_download);
|
||||||
|
|
||||||
final parts = albumDirectory.split(separator);
|
final parts = albumDirectory.split(separator);
|
||||||
if (albumDirectory.startsWith(androidFileUtils.picturesPath) && appNameMap.keys.contains(parts.last)) {
|
if (albumDirectory.startsWith(androidFileUtils.picturesPath) && appNameMap.keys.contains(parts.last)) {
|
||||||
final packageName = appNameMap[parts.last];
|
final packageName = appNameMap[parts.last];
|
||||||
return _buildAlbumIcon(AppIcon(
|
return AppIcon(
|
||||||
packageName: packageName,
|
packageName: packageName,
|
||||||
size: IconTheme.of(context).size,
|
size: IconTheme.of(context).size,
|
||||||
devicePixelRatio: MediaQuery.of(context).devicePixelRatio,
|
devicePixelRatio: MediaQuery.of(context).devicePixelRatio,
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue