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

@ -21,6 +21,7 @@ class QuillToolbarFontFamilyButton extends StatefulWidget {
final QuillToolbarFontFamilyButtonOptions options;
@Deprecated('Please use the default display text from the options')
final String defaultDispalyText;
/// Since we can't get the state from the instace of the widget for comparing
@ -60,7 +61,10 @@ class QuillToolbarFontFamilyButtonState
// }
String get _defaultDisplayText {
return options.initialValue ?? widget.defaultDispalyText;
return options.initialValue ??
widget.options.defaultDisplayText ??
// ignore: deprecated_member_use_from_same_package
widget.defaultDispalyText;
}
// @override

Loading…
Cancel
Save