pull/1634/head
Ellet 1 year ago
parent 67122a3282
commit 33df05bfcc
  1. 3
      CHANGELOG.md
  2. 15
      example/lib/presentation/quill/my_quill_toolbar.dart
  3. 4
      lib/src/models/config/toolbar/buttons/color_configurations.dart
  4. 40
      lib/src/widgets/toolbar/buttons/color/color_button.dart
  5. 1
      lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart
  6. 8
      lib/src/widgets/toolbar/buttons/history_button.dart
  7. 6
      lib/src/widgets/toolbar/buttons/toggle_style_button.dart

@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 9.1.0-dev.1
* Bug fixes in the simple toolbar buttons
## 9.1.0-dev ## 9.1.0-dev
* **Breaking Change**: in the `QuillSimpleToolbar` Fix the `QuillIconTheme` by replacing all the properties with two properties of type `ButtonStyle`, use `IconButton.styleFrom()` * **Breaking Change**: in the `QuillSimpleToolbar` Fix the `QuillIconTheme` by replacing all the properties with two properties of type `ButtonStyle`, use `IconButton.styleFrom()`

@ -201,25 +201,12 @@ class MyQuillToolbar extends StatelessWidget {
configurations: QuillSimpleToolbarConfigurations( configurations: QuillSimpleToolbarConfigurations(
controller: controller, controller: controller,
showAlignmentButtons: true, showAlignmentButtons: true,
multiRowsDisplay: false,
buttonOptions: QuillSimpleToolbarButtonOptions( buttonOptions: QuillSimpleToolbarButtonOptions(
base: QuillToolbarBaseButtonOptions( base: QuillToolbarBaseButtonOptions(
// Request editor focus when any button is pressed // Request editor focus when any button is pressed
afterButtonPressed: focusNode.requestFocus, afterButtonPressed: focusNode.requestFocus,
// globalIconSize: 18, // globalIconSize: 18,
iconTheme: QuillIconTheme(
iconButtonUnselectedStyle: IconButton.styleFrom(
backgroundColor: Colors.green,
),
iconButtonSelectedStyle: IconButton.styleFrom(
backgroundColor: Colors.red,
),
),
),
selectHeaderStyleDropdownButton:
const QuillToolbarSelectHeaderStyleDropdownButtonOptions(
textStyle: TextStyle(
fontSize: 20,
),
), ),
), ),
customButtons: [ customButtons: [

@ -18,8 +18,8 @@ class QuillToolbarColorButtonExtraOptions
final Color? iconColor; final Color? iconColor;
final Color? iconColorBackground; final Color? iconColorBackground;
final Color fillColor; final Color? fillColor;
final Color fillColorBackground; final Color? fillColorBackground;
} }
class QuillToolbarColorButtonOptions extends QuillToolbarBaseButtonOptions< class QuillToolbarColorButtonOptions extends QuillToolbarBaseButtonOptions<

@ -145,22 +145,22 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// final iconColor = _isToggledColor && !widget.isBackground && !_isWhite final iconColor = _isToggledColor && !widget.isBackground && !_isWhite
// ? stringToColor(_selectionStyle.attributes['color']!.value) ? stringToColor(_selectionStyle.attributes['color']!.value)
// : (iconTheme?.iconUnselectedFillColor ?? theme.iconTheme.color); : null;
// final iconColorBackground = final iconColorBackground =
// _isToggledBackground && widget.isBackground && !_isWhiteBackground _isToggledBackground && widget.isBackground && !_isWhiteBackground
// ? stringToColor(_selectionStyle.attributes['background']!.value) ? stringToColor(_selectionStyle.attributes['background']!.value)
// : (iconTheme?.iconUnselectedFillColor ?? theme.iconTheme.color); : null;
// final fillColor = _isToggledColor && !widget.isBackground && _isWhite final fillColor = _isToggledColor && !widget.isBackground && _isWhite
// ? stringToColor('#ffffff') ? stringToColor('#ffffff')
// : (iconTheme?.iconUnselectedFillColor ?? theme.canvasColor); : null;
// final fillColorBackground = final fillColorBackground =
// _isToggledBackground && widget.isBackground && _isWhiteBackground _isToggledBackground && widget.isBackground && _isWhiteBackground
// ? stringToColor('#ffffff') ? stringToColor('#ffffff')
// : (iconTheme?.iconUnselectedFillColor ?? theme.canvasColor); : null;
final childBuilder = final childBuilder =
options.childBuilder ?? baseButtonExtraOptions?.childBuilder; options.childBuilder ?? baseButtonExtraOptions?.childBuilder;
@ -186,9 +186,9 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
afterButtonPressed?.call(); afterButtonPressed?.call();
}, },
iconColor: null, iconColor: null,
iconColorBackground: Colors.red, iconColorBackground: iconColorBackground,
fillColor: Colors.red, fillColor: fillColor,
fillColorBackground: Colors.red, fillColorBackground: fillColorBackground,
), ),
); );
} }
@ -198,7 +198,7 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
iconSize: iconSize * iconButtonFactor, iconSize: iconSize * iconButtonFactor,
icon: Icon( icon: Icon(
iconData, iconData,
// color: widget.isBackground ? iconColorBackground : iconColor, color: widget.isBackground ? iconColorBackground : iconColor,
), ),
onPressed: _showColorPicker, onPressed: _showColorPicker,
); );

@ -173,6 +173,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState
final isMaterial3 = Theme.of(context).useMaterial3; final isMaterial3 = Theme.of(context).useMaterial3;
final child = Row( final child = Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
_label(_selectedItem), _label(_selectedItem),

@ -102,12 +102,10 @@ class QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
icon: Icon( icon: Icon(
iconData, iconData,
size: iconSize * iconButtonFactor, size: iconSize * iconButtonFactor,
// TODO: HEeeerre
// color: _canPressed
// ? iconTheme?.iconUnselectedColor ?? theme.iconTheme.color
// : iconTheme?.disabledIconColor ?? theme.disabledColor,
), ),
isSelected: false, isSelected: _canPressed,
iconSelectedStyle: iconTheme?.iconButtonSelectedStyle,
iconUnselectedStyle: iconTheme?.iconButtonUnselectedStyle,
onPressed: _updateHistory, onPressed: _updateHistory,
afterPressed: afterButtonPressed, afterPressed: afterButtonPressed,
); );

@ -119,7 +119,11 @@ class QuillToolbarToggleStyleButtonState
'left' => (context.loc.alignLeft, Icons.format_align_left), 'left' => (context.loc.alignLeft, Icons.format_align_left),
'right' => (context.loc.alignRight, Icons.format_align_right), 'right' => (context.loc.alignRight, Icons.format_align_right),
'center' => (context.loc.alignCenter, Icons.format_align_center), 'center' => (context.loc.alignCenter, Icons.format_align_center),
Object() => (context.loc.alignCenter, Icons.format_align_center), 'justify' => (
context.loc.justifyWinWidth,
Icons.format_align_justify
),
Object() => throw ArgumentError(widget.attribute.value),
null => (context.loc.alignCenter, Icons.format_align_center), null => (context.loc.alignCenter, Icons.format_align_center),
}; };
default: default:

Loading…
Cancel
Save