Deprecate the default display text in the font family button

pull/1649/head
Ellet 1 year ago
parent f45287f2f7
commit 62755f2bd3
  1. 4
      lib/src/models/config/toolbar/buttons/font_family_configurations.dart
  2. 6
      lib/src/widgets/toolbar/buttons/font_family_button.dart

@ -51,6 +51,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
this.renderFontFamilies = true, this.renderFontFamilies = true,
this.iconSize, this.iconSize,
this.iconButtonFactor, this.iconButtonFactor,
this.defaultDisplayText,
}); });
/// By default it will be [fontFamilyValues] from [QuillSimpleToolbarConfigurations] /// By default it will be [fontFamilyValues] from [QuillSimpleToolbarConfigurations]
@ -69,6 +70,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
final double? itemHeight; final double? itemHeight;
final EdgeInsets? itemPadding; final EdgeInsets? itemPadding;
final Color? defaultItemColor; final Color? defaultItemColor;
final String? defaultDisplayText;
/// By default will use [globalIconSize] /// By default will use [globalIconSize]
final double? iconSize; final double? iconSize;
@ -95,6 +97,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
VoidCallback? afterButtonPressed, VoidCallback? afterButtonPressed,
String? tooltip, String? tooltip,
QuillIconTheme? iconTheme, QuillIconTheme? iconTheme,
String? defaultDisplayText,
}) { }) {
return QuillToolbarFontFamilyButtonOptions( return QuillToolbarFontFamilyButtonOptions(
attribute: attribute ?? this.attribute, attribute: attribute ?? this.attribute,
@ -117,6 +120,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
defaultItemColor: defaultItemColor ?? this.defaultItemColor, defaultItemColor: defaultItemColor ?? this.defaultItemColor,
iconSize: iconSize ?? this.iconSize, iconSize: iconSize ?? this.iconSize,
iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor, iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor,
defaultDisplayText: defaultDisplayText ?? this.defaultDisplayText,
); );
} }
} }

@ -21,6 +21,7 @@ class QuillToolbarFontFamilyButton extends StatefulWidget {
final QuillToolbarFontFamilyButtonOptions options; final QuillToolbarFontFamilyButtonOptions options;
@Deprecated('Please use the default display text from the options')
final String defaultDispalyText; final String defaultDispalyText;
/// 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
@ -60,7 +61,10 @@ class QuillToolbarFontFamilyButtonState
// } // }
String get _defaultDisplayText { String get _defaultDisplayText {
return options.initialValue ?? widget.defaultDispalyText; return options.initialValue ??
widget.options.defaultDisplayText ??
// ignore: deprecated_member_use_from_same_package
widget.defaultDispalyText;
} }
// @override // @override

Loading…
Cancel
Save