Fix font size button label

pull/1640/head
Ellet 1 year ago
parent ab60e7d3c7
commit e4dcbac9cf
  1. 15
      lib/src/widgets/toolbar/buttons/font_size_button.dart

@ -53,6 +53,16 @@ class QuillToolbarFontSizeButtonState
return fontSizes; return fontSizes;
} }
String? getLabel(String? currentValue) {
return switch (currentValue) {
'small' => context.loc.small,
'large' => context.loc.large,
'huge' => context.loc.huge,
String() => currentValue,
null => null,
};
}
String get _defaultDisplayText { String get _defaultDisplayText {
return options.initialValue ?? widget.defaultDisplayText; return options.initialValue ?? widget.defaultDisplayText;
} }
@ -235,7 +245,6 @@ class QuillToolbarFontSizeButtonState
} }
Widget _buildContent(BuildContext context) { Widget _buildContent(BuildContext context) {
// final theme = Theme.of(context);
final hasFinalWidth = options.width != null; final hasFinalWidth = options.width != null;
return Padding( return Padding(
padding: options.padding ?? const EdgeInsets.fromLTRB(10, 0, 0, 0), padding: options.padding ?? const EdgeInsets.fromLTRB(10, 0, 0, 0),
@ -247,7 +256,9 @@ class QuillToolbarFontSizeButtonState
enabled: hasFinalWidth, enabled: hasFinalWidth,
wrapper: (child) => Expanded(child: child), wrapper: (child) => Expanded(child: child),
child: Text( child: Text(
widget.controller.selectedFontSize ?? _currentValue, getLabel(widget.controller.selectedFontSize) ??
getLabel(_currentValue) ??
'',
overflow: options.labelOverflow, overflow: options.labelOverflow,
style: options.style ?? style: options.style ??
TextStyle( TextStyle(

Loading…
Cancel
Save