From 62755f2bd303ed99258f1de99175605e13f3e449 Mon Sep 17 00:00:00 2001 From: Ellet Date: Tue, 26 Dec 2023 16:20:41 +0300 Subject: [PATCH] Deprecate the default display text in the font family button --- .../config/toolbar/buttons/font_family_configurations.dart | 4 ++++ lib/src/widgets/toolbar/buttons/font_family_button.dart | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/models/config/toolbar/buttons/font_family_configurations.dart b/lib/src/models/config/toolbar/buttons/font_family_configurations.dart index 8d7daf9e..410636fe 100644 --- a/lib/src/models/config/toolbar/buttons/font_family_configurations.dart +++ b/lib/src/models/config/toolbar/buttons/font_family_configurations.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, ); } } diff --git a/lib/src/widgets/toolbar/buttons/font_family_button.dart b/lib/src/widgets/toolbar/buttons/font_family_button.dart index 45414e43..f85b3f66 100644 --- a/lib/src/widgets/toolbar/buttons/font_family_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_family_button.dart @@ -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