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

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

Loading…
Cancel
Save