From f45287f2f73c524d38c39073a60d1cd66af34bf2 Mon Sep 17 00:00:00 2001 From: Ellet Date: Tue, 26 Dec 2023 16:18:25 +0300 Subject: [PATCH] Deprecate the default display text in the font size button --- .../config/toolbar/buttons/font_size_configurations.dart | 4 ++++ lib/src/widgets/toolbar/buttons/font_size_button.dart | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/models/config/toolbar/buttons/font_size_configurations.dart b/lib/src/models/config/toolbar/buttons/font_size_configurations.dart index efd31e6e..f4f901ee 100644 --- a/lib/src/models/config/toolbar/buttons/font_size_configurations.dart +++ b/lib/src/models/config/toolbar/buttons/font_size_configurations.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, ); } } diff --git a/lib/src/widgets/toolbar/buttons/font_size_button.dart b/lib/src/widgets/toolbar/buttons/font_size_button.dart index 5ca4b895..8595eae9 100644 --- a/lib/src/widgets/toolbar/buttons/font_size_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_size_button.dart @@ -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