split Thumbnail
This commit is contained in:
parent
96fe885752
commit
742cd7ad65
1 changed files with 39 additions and 29 deletions
|
@ -18,6 +18,7 @@ class Thumbnail extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final image = ImagePreview(
|
||||
key: ValueKey(entry.uri),
|
||||
entry: entry,
|
||||
width: extent,
|
||||
height: extent,
|
||||
|
@ -51,7 +52,6 @@ class Thumbnail extends StatelessWidget {
|
|||
);
|
||||
},
|
||||
);
|
||||
final icons = _buildOverlayIcons();
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
|
@ -59,43 +59,53 @@ class Thumbnail extends StatelessWidget {
|
|||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: icons != null
|
||||
? Stack(
|
||||
child: Stack(
|
||||
alignment: AlignmentDirectional.bottomStart,
|
||||
children: [
|
||||
image,
|
||||
icons,
|
||||
_ThumbnailOverlay(
|
||||
entry: entry,
|
||||
extent: extent,
|
||||
),
|
||||
],
|
||||
)
|
||||
: image,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildOverlayIcons() {
|
||||
class _ThumbnailOverlay extends StatelessWidget {
|
||||
final ImageEntry entry;
|
||||
final double extent;
|
||||
|
||||
const _ThumbnailOverlay({
|
||||
Key key,
|
||||
@required this.entry,
|
||||
@required this.extent,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final fontSize = min(14.0, (extent / 8).roundToDouble());
|
||||
final iconSize = fontSize * 2;
|
||||
final icons = [
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (entry.hasGps) GpsIcon(iconSize: iconSize),
|
||||
if (entry.isGif)
|
||||
GifIcon(iconSize: iconSize)
|
||||
else if (entry.isVideo)
|
||||
VideoIcon(
|
||||
entry: entry,
|
||||
iconSize: iconSize,
|
||||
),
|
||||
];
|
||||
return icons.isNotEmpty
|
||||
? DefaultTextStyle(
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: Colors.grey[200],
|
||||
fontSize: fontSize,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: icons,
|
||||
child: VideoIcon(
|
||||
entry: entry,
|
||||
iconSize: iconSize,
|
||||
),
|
||||
)
|
||||
: null;
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue