downsize text only for long values

This commit is contained in:
Vadim 2024-09-23 15:49:22 +02:00
parent 6ee6c81164
commit e8785b234a

View file

@ -50,20 +50,30 @@ class ExposurePairsListItem<T extends PhotographyStopValue> extends StatelessWid
class _Title<T extends PhotographyStopValue> extends StatelessWidget { class _Title<T extends PhotographyStopValue> extends StatelessWidget {
final T value; final T value;
late final String _title = value.toString();
const _Title(this.value, {super.key}); _Title(this.value, {super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Flexible( return Flexible(
child: AutoSizeText( child: _title.length > 5 // downsize text only for long values like 1/4000
value.toString(), ? AutoSizeText(
stepGranularity: 0.5, value.toString(),
style: labelTextStyle(context).copyWith(color: Theme.of(context).colorScheme.onBackground), stepGranularity: 0.5,
softWrap: false, minFontSize: 10,
overflow: TextOverflow.fade, style: labelTextStyle(context).copyWith(color: Theme.of(context).colorScheme.onBackground),
maxLines: 1, softWrap: false,
), overflow: TextOverflow.fade,
maxLines: 1,
)
: Text(
value.toString(),
style: labelTextStyle(context).copyWith(color: Theme.of(context).colorScheme.onBackground),
softWrap: false,
overflow: TextOverflow.fade,
maxLines: 1,
),
); );
} }