fixed thumbnail overlay icon scaling
This commit is contained in:
parent
65b6c9b355
commit
0dc429efc5
1 changed files with 16 additions and 12 deletions
|
@ -93,7 +93,7 @@ class AnimatedImageIcon extends StatelessWidget {
|
||||||
return OverlayIcon(
|
return OverlayIcon(
|
||||||
icon: AIcons.animated,
|
icon: AIcons.animated,
|
||||||
size: iconSize,
|
size: iconSize,
|
||||||
iconSize: iconSize * .8,
|
iconScale: .8,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,27 +114,31 @@ class GpsIcon extends StatelessWidget {
|
||||||
|
|
||||||
class OverlayIcon extends StatelessWidget {
|
class OverlayIcon extends StatelessWidget {
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final double size, iconSize;
|
final double size;
|
||||||
final String text;
|
final String text;
|
||||||
|
final double iconScale;
|
||||||
|
|
||||||
const OverlayIcon({
|
const OverlayIcon({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.icon,
|
@required this.icon,
|
||||||
@required this.size,
|
@required this.size,
|
||||||
double iconSize,
|
this.iconScale = 1,
|
||||||
this.text,
|
this.text,
|
||||||
}) : iconSize = iconSize ?? size,
|
}) : super(key: key);
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final iconChild = SizedBox(
|
final iconChild = Icon(icon, size: size);
|
||||||
|
final iconBox = SizedBox(
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
child: Icon(
|
// using a transform is better than modifying the icon size to properly center the scaled icon
|
||||||
icon,
|
child: iconScale != 1
|
||||||
size: iconSize,
|
? Transform.scale(
|
||||||
),
|
scale: iconScale,
|
||||||
|
child: iconChild,
|
||||||
|
)
|
||||||
|
: iconChild,
|
||||||
);
|
);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
|
@ -145,12 +149,12 @@ class OverlayIcon extends StatelessWidget {
|
||||||
borderRadius: BorderRadius.circular(size),
|
borderRadius: BorderRadius.circular(size),
|
||||||
),
|
),
|
||||||
child: text == null
|
child: text == null
|
||||||
? iconChild
|
? iconBox
|
||||||
: Row(
|
: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
iconChild,
|
iconBox,
|
||||||
SizedBox(width: 2),
|
SizedBox(width: 2),
|
||||||
Text(text),
|
Text(text),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue