mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-18 02:42:34 +01:00
fix: Stickers always in square
This commit is contained in:
parent
099f9cf881
commit
bc1a92be03
@ -21,24 +21,11 @@ class _StickerState extends State<Sticker> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// stickers should default to a ratio of 1:1
|
|
||||||
var ratio = 1.0;
|
|
||||||
// if a width and a height is specified for stickers, use those!
|
|
||||||
if (widget.event.infoMap['w'] is int && widget.event.infoMap['h'] is int) {
|
|
||||||
ratio = widget.event.infoMap['w'] / widget.event.infoMap['h'];
|
|
||||||
// make sure the ratio is within 0.9 - 2.0
|
|
||||||
if (ratio > 2.0) {
|
|
||||||
ratio = 2.0;
|
|
||||||
}
|
|
||||||
if (ratio < 0.9) {
|
|
||||||
ratio = 0.9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ImageBubble(
|
return ImageBubble(
|
||||||
widget.event,
|
widget.event,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 400 / ratio,
|
height: 400,
|
||||||
fit: ratio <= 1.0 ? BoxFit.contain : BoxFit.cover,
|
fit: BoxFit.contain,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() => animated = true);
|
setState(() => animated = true);
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
|
Loading…
Reference in New Issue
Block a user