mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 06:50:42 +00:00
downsize text only for long values
This commit is contained in:
parent
6ee6c81164
commit
e8785b234a
1 changed files with 19 additions and 9 deletions
|
@ -50,20 +50,30 @@ class ExposurePairsListItem<T extends PhotographyStopValue> extends StatelessWid
|
|||
|
||||
class _Title<T extends PhotographyStopValue> extends StatelessWidget {
|
||||
final T value;
|
||||
late final String _title = value.toString();
|
||||
|
||||
const _Title(this.value, {super.key});
|
||||
_Title(this.value, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Flexible(
|
||||
child: AutoSizeText(
|
||||
value.toString(),
|
||||
stepGranularity: 0.5,
|
||||
style: labelTextStyle(context).copyWith(color: Theme.of(context).colorScheme.onBackground),
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 1,
|
||||
),
|
||||
child: _title.length > 5 // downsize text only for long values like 1/4000
|
||||
? AutoSizeText(
|
||||
value.toString(),
|
||||
stepGranularity: 0.5,
|
||||
minFontSize: 10,
|
||||
style: labelTextStyle(context).copyWith(color: Theme.of(context).colorScheme.onBackground),
|
||||
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,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue