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];
if (attribute == null) {
setState(() => _currentValue = defaultDisplayText);
return;
}
final keyName = _getKeyName(attribute.value);
if (keyName == null) {
return;
}
setState(() => _currentValue = keyName);
setState(() => _currentValue = keyName ?? defaultDisplayText);
}
String? _getKeyName(dynamic value) {
@ -131,12 +129,11 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
return;
}
final keyName = _getKeyName(newValue);
if (keyName == null) {
return;
}
setState(() {
_currentValue = keyName;
widget.onSelected(newValue);
_currentValue = keyName ?? defaultDisplayText;
if (keyName != null) {
widget.onSelected(newValue);
}
});
});
}

Loading…
Cancel
Save