diff --git a/CHANGELOG.md b/CHANGELOG.md index cb368a9b..fcd4ebd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file. ## 9.0.2 -* Release instead of pre-release +* Remove unused properties in the `QuillToolbarSelectHeaderStyleDropdownButton` +* Fix the `QuillSimpleToolbar` when `useMaterial3` is false, please upgrade to the latest version of flutter for better support ## 9.0.2-dev.3 * Export `QuillSingleChildScrollView` diff --git a/flutter_quill_extensions/CHANGELOG.md b/flutter_quill_extensions/CHANGELOG.md index cb368a9b..fcd4ebd5 100644 --- a/flutter_quill_extensions/CHANGELOG.md +++ b/flutter_quill_extensions/CHANGELOG.md @@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file. ## 9.0.2 -* Release instead of pre-release +* Remove unused properties in the `QuillToolbarSelectHeaderStyleDropdownButton` +* Fix the `QuillSimpleToolbar` when `useMaterial3` is false, please upgrade to the latest version of flutter for better support ## 9.0.2-dev.3 * Export `QuillSingleChildScrollView` diff --git a/flutter_quill_test/CHANGELOG.md b/flutter_quill_test/CHANGELOG.md index cb368a9b..fcd4ebd5 100644 --- a/flutter_quill_test/CHANGELOG.md +++ b/flutter_quill_test/CHANGELOG.md @@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file. ## 9.0.2 -* Release instead of pre-release +* Remove unused properties in the `QuillToolbarSelectHeaderStyleDropdownButton` +* Fix the `QuillSimpleToolbar` when `useMaterial3` is false, please upgrade to the latest version of flutter for better support ## 9.0.2-dev.3 * Export `QuillSingleChildScrollView` diff --git a/lib/src/models/config/toolbar/buttons/select_header_style_dropdown_button_configurations.dart b/lib/src/models/config/toolbar/buttons/select_header_style_dropdown_button_configurations.dart index 8cc6659e..8aafcc78 100644 --- a/lib/src/models/config/toolbar/buttons/select_header_style_dropdown_button_configurations.dart +++ b/lib/src/models/config/toolbar/buttons/select_header_style_dropdown_button_configurations.dart @@ -1,14 +1,5 @@ -import 'package:flutter/material.dart' show PopupMenuEntry; import 'package:flutter/widgets.dart' - show - Color, - EdgeInsets, - EdgeInsetsGeometry, - IconData, - TextOverflow, - TextStyle, - ValueChanged, - VoidCallback; + show IconData, TextStyle, ValueChanged, VoidCallback; import '../../../../widgets/toolbar/base_toolbar.dart'; import '../../../documents/attribute.dart'; @@ -38,19 +29,7 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions this.iconButtonFactor, this.textStyle, super.iconData, - this.fillColor, - this.hoverElevation = 1, - this.highlightElevation = 1, - this.onSelected, this.attributes, - this.padding, - this.style, - this.width, - this.labelOverflow = TextOverflow.visible, - this.itemHeight, - this.itemPadding, - this.defaultItemColor, - this.renderItemTextStyle = false, }); /// By default we will the toolbar axis from [QuillSimpleToolbarConfigurations] @@ -58,11 +37,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions final double? iconButtonFactor; final TextStyle? textStyle; - final Color? fillColor; - final double hoverElevation; - final double highlightElevation; - final ValueChanged? onSelected; - /// Header attributes, defaults to: /// ```dart /// [ @@ -76,38 +50,17 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions /// ] /// ``` final List>? attributes; - final EdgeInsetsGeometry? padding; - final TextStyle? style; - final double? width; - final TextOverflow labelOverflow; - final double? itemHeight; - final EdgeInsets? itemPadding; - final Color? defaultItemColor; - final bool renderItemTextStyle; QuillToolbarSelectHeaderStyleDropdownButtonOptions copyWith({ - Color? fillColor, - double? hoverElevation, - double? highlightElevation, - List>? items, ValueChanged? onSelected, List>? attributes, - EdgeInsetsGeometry? padding, TextStyle? style, - double? width, - TextOverflow? labelOverflow, - bool? renderFontFamilies, - bool? overrideTooltipByFontFamily, - double? itemHeight, - EdgeInsets? itemPadding, - Color? defaultItemColor, double? iconSize, double? iconButtonFactor, IconData? iconData, VoidCallback? afterButtonPressed, String? tooltip, QuillIconTheme? iconTheme, - bool? renderItemTextStyle, }) { return QuillToolbarSelectHeaderStyleDropdownButtonOptions( attributes: attributes ?? this.attributes, @@ -115,20 +68,8 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions afterButtonPressed: afterButtonPressed ?? this.afterButtonPressed, tooltip: tooltip ?? this.tooltip, iconTheme: iconTheme ?? this.iconTheme, - onSelected: onSelected ?? this.onSelected, - padding: padding ?? this.padding, - style: style ?? this.style, - width: width ?? this.width, - labelOverflow: labelOverflow ?? this.labelOverflow, - itemHeight: itemHeight ?? this.itemHeight, - itemPadding: itemPadding ?? this.itemPadding, - defaultItemColor: defaultItemColor ?? this.defaultItemColor, iconSize: iconSize ?? this.iconSize, iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor, - fillColor: fillColor ?? this.fillColor, - hoverElevation: hoverElevation ?? this.hoverElevation, - highlightElevation: highlightElevation ?? this.highlightElevation, - renderItemTextStyle: renderItemTextStyle ?? this.renderItemTextStyle, ); } } diff --git a/lib/src/widgets/toolbar/buttons/font_family_button.dart b/lib/src/widgets/toolbar/buttons/font_family_button.dart index 17c87fb9..42c5ca6b 100644 --- a/lib/src/widgets/toolbar/buttons/font_family_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_family_button.dart @@ -183,19 +183,30 @@ class QuillToolbarFontFamilyButtonState } return Tooltip(message: effectiveTooltip, child: child); }, - child: IconButton( - // tooltip: '', // TODO: Use this here - visualDensity: VisualDensity.compact, - style: IconButton.styleFrom( - shape: iconTheme?.borderRadius != null - ? RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(iconTheme?.borderRadius ?? -1), - ) - : null, - ), - onPressed: _onPressed, - icon: _buildContent(context), + child: Builder( + builder: (context) { + final isMaterial3 = Theme.of(context).useMaterial3; + if (!isMaterial3) { + return RawMaterialButton( + onPressed: _onPressed, + child: _buildContent(context), + ); + } + return IconButton( + // tooltip: , // TODO: Use this here + visualDensity: VisualDensity.compact, + style: IconButton.styleFrom( + shape: iconTheme?.borderRadius != null + ? RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + iconTheme?.borderRadius ?? -1), + ) + : null, + ), + onPressed: _onPressed, + icon: _buildContent(context), + ); + }, ), ), ); diff --git a/lib/src/widgets/toolbar/buttons/font_size_button.dart b/lib/src/widgets/toolbar/buttons/font_size_button.dart index aa2c94ad..5dc41c38 100644 --- a/lib/src/widgets/toolbar/buttons/font_size_button.dart +++ b/lib/src/widgets/toolbar/buttons/font_size_button.dart @@ -142,21 +142,30 @@ class QuillToolbarFontSizeButtonState height: iconSize * 1.81, width: options.width, ), - child: UtilityWidgets.maybeTooltip( - message: tooltip, - child: IconButton( - visualDensity: VisualDensity.compact, - style: IconButton.styleFrom( - shape: iconTheme?.borderRadius != null - ? RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(iconTheme?.borderRadius ?? -1), - ) - : null, - ), - onPressed: _onPressed, - icon: _buildContent(context), - ), + child: Builder( + builder: (context) { + final isMaterial3 = Theme.of(context).useMaterial3; + if (!isMaterial3) { + return RawMaterialButton( + onPressed: _onPressed, + child: _buildContent(context), + ); + } + return IconButton( + tooltip: tooltip, + visualDensity: VisualDensity.compact, + style: IconButton.styleFrom( + shape: iconTheme?.borderRadius != null + ? RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(iconTheme?.borderRadius ?? -1), + ) + : null, + ), + onPressed: _onPressed, + icon: _buildContent(context), + ); + }, ), ); } diff --git a/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart b/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart index 698c42a9..fdfad12e 100644 --- a/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart +++ b/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart @@ -26,7 +26,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState extends State { Attribute _selectedItem = Attribute.header; - final _controller = MenuController(); + final _menuController = MenuController(); @override void initState() { super.initState(); @@ -158,7 +158,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState } return MenuAnchor( - controller: _controller, + controller: _menuController, menuChildren: headerAttributes .map( (e) => MenuItemButton( @@ -169,31 +169,45 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState ), ) .toList(), - child: IconButton( - onPressed: () { - if (_controller.isOpen) { - _controller.close(); - return; + child: Builder( + builder: (context) { + final isMaterial3 = Theme.of(context).useMaterial3; + final child = Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + _label(_selectedItem), + style: widget.options.textStyle ?? + TextStyle( + fontSize: iconSize / 1.15, + ), + ), + Icon( + Icons.arrow_drop_down, + size: iconSize * iconButtonFactor, + ), + ], + ); + if (!isMaterial3) { + return RawMaterialButton( + onPressed: _onDropdownButtonPressed, + child: child, + ); } - _controller.open(); + return IconButton( + onPressed: _onDropdownButtonPressed, + icon: child, + ); }, - icon: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - _label(_selectedItem), - style: widget.options.textStyle ?? - TextStyle( - fontSize: iconSize / 1.15, - ), - ), - Icon( - Icons.arrow_drop_down, - size: iconSize * iconButtonFactor, - ), - ], - ), ), ); } + + void _onDropdownButtonPressed() { + if (_menuController.isOpen) { + _menuController.close(); + return; + } + _menuController.open(); + } } diff --git a/quill_html_converter/CHANGELOG.md b/quill_html_converter/CHANGELOG.md index cb368a9b..fcd4ebd5 100644 --- a/quill_html_converter/CHANGELOG.md +++ b/quill_html_converter/CHANGELOG.md @@ -3,7 +3,8 @@ All notable changes to this project will be documented in this file. ## 9.0.2 -* Release instead of pre-release +* Remove unused properties in the `QuillToolbarSelectHeaderStyleDropdownButton` +* Fix the `QuillSimpleToolbar` when `useMaterial3` is false, please upgrade to the latest version of flutter for better support ## 9.0.2-dev.3 * Export `QuillSingleChildScrollView`