mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
feat(mobile): Clip and change background for Asset selection (#3460)
This commit is contained in:
parent
54db2a48af
commit
74f04336bb
@ -37,11 +37,21 @@ class ThumbnailImage extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final isDarkTheme = Theme.of(context).brightness == Brightness.dark;
|
||||||
|
final assetContainerColor =
|
||||||
|
isDarkTheme ? Colors.blueGrey : Theme.of(context).primaryColorLight;
|
||||||
|
|
||||||
Widget buildSelectionIcon(Asset asset) {
|
Widget buildSelectionIcon(Asset asset) {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return Icon(
|
return Container(
|
||||||
Icons.check_circle,
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).primaryColor,
|
shape: BoxShape.circle,
|
||||||
|
color: assetContainerColor,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.check_circle_rounded,
|
||||||
|
color: Theme.of(context).primaryColor,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const Icon(
|
return const Icon(
|
||||||
@ -51,6 +61,36 @@ class ThumbnailImage extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildImage(Asset asset) {
|
||||||
|
var image = ImmichImage(
|
||||||
|
asset,
|
||||||
|
width: 300,
|
||||||
|
height: 300,
|
||||||
|
useGrayBoxPlaceholder: useGrayBoxPlaceholder,
|
||||||
|
);
|
||||||
|
if (!multiselectEnabled || !isSelected) {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
width: 0,
|
||||||
|
color: assetContainerColor,
|
||||||
|
),
|
||||||
|
color: assetContainerColor,
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topRight: Radius.circular(15.0),
|
||||||
|
bottomRight: Radius.circular(15.0),
|
||||||
|
bottomLeft: Radius.circular(15.0),
|
||||||
|
topLeft: Radius.zero,
|
||||||
|
),
|
||||||
|
child: image,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (multiselectEnabled) {
|
if (multiselectEnabled) {
|
||||||
@ -84,17 +124,12 @@ class ThumbnailImage extends HookConsumerWidget {
|
|||||||
? Border.all(
|
? Border.all(
|
||||||
color: onDeselect == null
|
color: onDeselect == null
|
||||||
? Colors.grey
|
? Colors.grey
|
||||||
: Theme.of(context).primaryColorLight,
|
: assetContainerColor,
|
||||||
width: 10,
|
width: 8,
|
||||||
)
|
)
|
||||||
: const Border(),
|
: const Border(),
|
||||||
),
|
),
|
||||||
child: ImmichImage(
|
child: buildImage(asset),
|
||||||
asset,
|
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
useGrayBoxPlaceholder: useGrayBoxPlaceholder,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (multiselectEnabled)
|
if (multiselectEnabled)
|
||||||
Padding(
|
Padding(
|
||||||
|
Loading…
Reference in New Issue
Block a user