Show 'Size' in QuillFontSizeButton when attribute size is not defined

pull/817/head
X Code 3 years ago
parent 2815833889
commit caa397c138
  1. 15
      lib/src/widgets/toolbar/quill_font_size_button.dart

@ -68,13 +68,11 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
} }
final attribute = _selectionStyle.attributes[widget.attribute.key]; final attribute = _selectionStyle.attributes[widget.attribute.key];
if (attribute == null) { if (attribute == null) {
setState(() => _currentValue = defaultDisplayText);
return; return;
} }
final keyName = _getKeyName(attribute.value); final keyName = _getKeyName(attribute.value);
if (keyName == null) { setState(() => _currentValue = keyName ?? defaultDisplayText);
return;
}
setState(() => _currentValue = keyName);
} }
String? _getKeyName(dynamic value) { String? _getKeyName(dynamic value) {
@ -131,12 +129,11 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
return; return;
} }
final keyName = _getKeyName(newValue); final keyName = _getKeyName(newValue);
if (keyName == null) {
return;
}
setState(() { setState(() {
_currentValue = keyName; _currentValue = keyName ?? defaultDisplayText;
widget.onSelected(newValue); if (keyName != null) {
widget.onSelected(newValue);
}
}); });
}); });
} }

Loading…
Cancel
Save