Deprecate the default display text in the font size button

pull/1649/head
Ellet 1 year ago
parent 6247e1e923
commit f45287f2f7
  1. 4
      lib/src/models/config/toolbar/buttons/font_size_configurations.dart
  2. 6
      lib/src/widgets/toolbar/buttons/font_size_button.dart

@ -50,6 +50,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
this.defaultItemColor = Colors.red,
super.childBuilder,
this.shape,
this.defaultDisplayText,
});
final double? iconSize;
@ -70,6 +71,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
final double? itemHeight;
final EdgeInsets? itemPadding;
final Color? defaultItemColor;
final String? defaultDisplayText;
QuillToolbarFontSizeButtonOptions copyWith({
double? iconSize,
@ -92,6 +94,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
VoidCallback? afterButtonPressed,
String? tooltip,
OutlinedBorder? shape,
String? defaultDisplayText,
}) {
return QuillToolbarFontSizeButtonOptions(
iconSize: iconSize ?? this.iconSize,
@ -109,6 +112,7 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions<
defaultItemColor: defaultItemColor ?? this.defaultItemColor,
tooltip: tooltip ?? super.tooltip,
afterButtonPressed: afterButtonPressed ?? super.afterButtonPressed,
defaultDisplayText: defaultDisplayText ?? this.defaultDisplayText,
);
}
}

@ -22,6 +22,7 @@ class QuillToolbarFontSizeButton extends StatefulWidget {
final QuillToolbarFontSizeButtonOptions options;
@Deprecated('Please use the default display text from the options')
final String defaultDisplayText;
/// Since we can't get the state from the instace of the widget for comparing
@ -64,7 +65,10 @@ class QuillToolbarFontSizeButtonState
}
String get _defaultDisplayText {
return options.initialValue ?? widget.defaultDisplayText;
return options.initialValue ??
widget.options.defaultDisplayText ??
// ignore: deprecated_member_use_from_same_package
widget.defaultDisplayText;
}
@override

Loading…
Cancel
Save