feat: 优化缩略图组件的高度和宽度计算逻辑,支持根据可用尺寸动态调整

This commit is contained in:
2025-03-08 20:21:16 +08:00
parent bd0da666f6
commit f51e4fb697

View File

@@ -56,14 +56,18 @@ class Thumbnail extends StatefulWidget {
int get height => _height != null
? _height!
: _pMeta.height > _pMeta.width
? _max
: _max * _pMeta.height ~/ _pMeta.width;
: _width != null
? _width! * _pMeta.height ~/ _pMeta.width
: _pMeta.height > _pMeta.width
? _max
: _max * _pMeta.height ~/ _pMeta.width;
int get width => _width != null
? _width!
: _pMeta.width > _pMeta.height
? _max
: _max * _pMeta.width ~/ _pMeta.height;
: _height != null
? _height! * _pMeta.width ~/ _pMeta.height
: _pMeta.width > _pMeta.height
? _max
: _max * _pMeta.width ~/ _pMeta.height;
@override
State<Thumbnail> createState() => _Thumbnail();