From 9c79046dc98616fa218563b8d3ebf56c1dc814cd Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:52:49 +0100 Subject: [PATCH] Restore old build of `QuillToolbarFontSizeButton` --- .../buttons/font_size_configurations.dart | 25 +++++++++---------- .../toolbar/buttons/font_size_button.dart | 20 ++++++++++++--- 2 files changed, 28 insertions(+), 17 deletions(-) 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..2f28c55b 100644 --- a/lib/src/models/config/toolbar/buttons/font_size_configurations.dart +++ b/lib/src/models/config/toolbar/buttons/font_size_configurations.dart @@ -2,15 +2,9 @@ import 'dart:ui'; import 'package:flutter/foundation.dart' show immutable; import 'package:flutter/material.dart' - show ButtonStyle, Colors, PopupMenuEntry, ValueChanged; + show Colors, PopupMenuEntry, ValueChanged; import 'package:flutter/widgets.dart' - show - Color, - EdgeInsets, - EdgeInsetsGeometry, - OutlinedBorder, - TextOverflow, - TextStyle; + show Color, EdgeInsets, EdgeInsetsGeometry, TextOverflow, TextStyle; import '../../../documents/attribute.dart'; import '../../quill_configurations.dart'; @@ -35,6 +29,9 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions< const QuillToolbarFontSizeButtonOptions({ this.iconSize, this.iconButtonFactor, + this.fillColor, + this.hoverElevation = 1, + this.highlightElevation = 1, this.rawItemsMap, this.onSelected, this.attribute = Attribute.size, @@ -49,15 +46,15 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions< this.itemPadding, this.defaultItemColor = Colors.red, super.childBuilder, - this.shape, }); final double? iconSize; final double? iconButtonFactor; + final Color? fillColor; + final double hoverElevation; + final double highlightElevation; - final ButtonStyle? shape; - - /// By default it will be [fontSizesValues] from [QuillSimpleToolbarConfigurations] + /// By default it will be [fontSizesValues] from [QuillToolbarConfigurations] /// You can override this if you want final Map? rawItemsMap; final ValueChanged? onSelected; @@ -91,11 +88,13 @@ class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions< Color? defaultItemColor, VoidCallback? afterButtonPressed, String? tooltip, - OutlinedBorder? shape, }) { return QuillToolbarFontSizeButtonOptions( iconSize: iconSize ?? this.iconSize, iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor, + fillColor: fillColor ?? this.fillColor, + hoverElevation: hoverElevation ?? this.hoverElevation, + highlightElevation: highlightElevation ?? this.highlightElevation, rawItemsMap: rawItemsMap ?? this.rawItemsMap, onSelected: onSelected ?? this.onSelected, attribute: attribute ?? this.attribute, diff --git a/lib/src/widgets/toolbar/buttons/font_size_button.dart b/lib/src/widgets/toolbar/buttons/font_size_button.dart index 5dc41c38..145f9840 100644 --- a/lib/src/widgets/toolbar/buttons/font_size_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_size_button.dart @@ -146,9 +146,21 @@ class QuillToolbarFontSizeButtonState builder: (context) { final isMaterial3 = Theme.of(context).useMaterial3; if (!isMaterial3) { - return RawMaterialButton( - onPressed: _onPressed, - child: _buildContent(context), + return Tooltip( + message: tooltip, + child: RawMaterialButton( + visualDensity: VisualDensity.compact, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(iconTheme?.borderRadius ?? 2), + ), + fillColor: options.fillColor, + elevation: 0, + hoverElevation: options.hoverElevation, + highlightElevation: options.hoverElevation, + onPressed: _onPressed, + child: _buildContent(context), + ), ); } return IconButton( @@ -158,7 +170,7 @@ class QuillToolbarFontSizeButtonState shape: iconTheme?.borderRadius != null ? RoundedRectangleBorder( borderRadius: - BorderRadius.circular(iconTheme?.borderRadius ?? -1), + BorderRadius.circular(iconTheme?.borderRadius ?? 2), ) : null, ),