selection: darker overlay for selected items
This commit is contained in:
parent
ccfb5879ba
commit
11cbd6512d
2 changed files with 21 additions and 21 deletions
|
@ -55,14 +55,10 @@ class DecoratedThumbnail extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (showOverlay)
|
if (showOverlay)
|
||||||
Positioned(
|
ThumbnailSelectionOverlay(
|
||||||
top: 0,
|
|
||||||
right: 0,
|
|
||||||
child: ThumbnailSelectionOverlay(
|
|
||||||
entry: entry,
|
entry: entry,
|
||||||
extent: extent,
|
extent: extent,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -56,6 +56,7 @@ class ThumbnailSelectionOverlay extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final duration = Duration(milliseconds: (200 * timeDilation).toInt());
|
||||||
final fontSize = min(14.0, (extent / 8)).roundToDouble();
|
final fontSize = min(14.0, (extent / 8)).roundToDouble();
|
||||||
final iconSize = fontSize * 2;
|
final iconSize = fontSize * 2;
|
||||||
final collection = Provider.of<CollectionLens>(context);
|
final collection = Provider.of<CollectionLens>(context);
|
||||||
|
@ -67,13 +68,15 @@ class ThumbnailSelectionOverlay extends StatelessWidget {
|
||||||
animation: collection.selectionChangeNotifier,
|
animation: collection.selectionChangeNotifier,
|
||||||
builder: (context, child) {
|
builder: (context, child) {
|
||||||
final selected = collection.isSelected([entry]);
|
final selected = collection.isSelected([entry]);
|
||||||
final child = OverlayIcon(
|
var child = collection.isSelecting
|
||||||
|
? OverlayIcon(
|
||||||
key: ValueKey(selected),
|
key: ValueKey(selected),
|
||||||
icon: selected ? AIcons.selected : AIcons.unselected,
|
icon: selected ? AIcons.selected : AIcons.unselected,
|
||||||
size: iconSize,
|
size: iconSize,
|
||||||
);
|
)
|
||||||
return AnimatedSwitcher(
|
: const SizedBox.shrink();
|
||||||
duration: Duration(milliseconds: (300 * timeDilation).toInt()),
|
child = AnimatedSwitcher(
|
||||||
|
duration: duration,
|
||||||
switchInCurve: Curves.easeOutBack,
|
switchInCurve: Curves.easeOutBack,
|
||||||
switchOutCurve: Curves.easeOutBack,
|
switchOutCurve: Curves.easeOutBack,
|
||||||
transitionBuilder: (child, animation) => ScaleTransition(
|
transitionBuilder: (child, animation) => ScaleTransition(
|
||||||
|
@ -82,17 +85,18 @@ class ThumbnailSelectionOverlay extends StatelessWidget {
|
||||||
),
|
),
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
|
child = AnimatedContainer(
|
||||||
|
duration: duration,
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
color: selected ? Colors.black54 : Colors.transparent,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
return child;
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink();
|
: const SizedBox.shrink();
|
||||||
return AnimatedSwitcher(
|
return AnimatedSwitcher(
|
||||||
duration: Duration(milliseconds: (300 * timeDilation).toInt()),
|
duration: duration,
|
||||||
switchInCurve: Curves.easeOutBack,
|
|
||||||
switchOutCurve: Curves.easeOutBack,
|
|
||||||
transitionBuilder: (child, animation) => ScaleTransition(
|
|
||||||
child: child,
|
|
||||||
scale: animation,
|
|
||||||
),
|
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue