Skip to content

Commit 33df05b

Browse files
author
Ellet
committed
Bug fixes
1 parent 67122a3 commit 33df05b

File tree

7 files changed

+35
-42
lines changed

7 files changed

+35
-42
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 9.1.0-dev.1
6+
* Bug fixes in the simple toolbar buttons
7+
58
## 9.1.0-dev
69
* **Breaking Change**: in the `QuillSimpleToolbar` Fix the `QuillIconTheme` by replacing all the properties with two properties of type `ButtonStyle`, use `IconButton.styleFrom()`
710

example/lib/presentation/quill/my_quill_toolbar.dart

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -201,25 +201,12 @@ class MyQuillToolbar extends StatelessWidget {
201201
configurations: QuillSimpleToolbarConfigurations(
202202
controller: controller,
203203
showAlignmentButtons: true,
204+
multiRowsDisplay: false,
204205
buttonOptions: QuillSimpleToolbarButtonOptions(
205206
base: QuillToolbarBaseButtonOptions(
206207
// Request editor focus when any button is pressed
207208
afterButtonPressed: focusNode.requestFocus,
208209
// globalIconSize: 18,
209-
iconTheme: QuillIconTheme(
210-
iconButtonUnselectedStyle: IconButton.styleFrom(
211-
backgroundColor: Colors.green,
212-
),
213-
iconButtonSelectedStyle: IconButton.styleFrom(
214-
backgroundColor: Colors.red,
215-
),
216-
),
217-
),
218-
selectHeaderStyleDropdownButton:
219-
const QuillToolbarSelectHeaderStyleDropdownButtonOptions(
220-
textStyle: TextStyle(
221-
fontSize: 20,
222-
),
223210
),
224211
),
225212
customButtons: [

lib/src/models/config/toolbar/buttons/color_configurations.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class QuillToolbarColorButtonExtraOptions
1818

1919
final Color? iconColor;
2020
final Color? iconColorBackground;
21-
final Color fillColor;
22-
final Color fillColorBackground;
21+
final Color? fillColor;
22+
final Color? fillColorBackground;
2323
}
2424

2525
class QuillToolbarColorButtonOptions extends QuillToolbarBaseButtonOptions<

lib/src/widgets/toolbar/buttons/color/color_button.dart

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,22 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
145145

146146
@override
147147
Widget build(BuildContext context) {
148-
// final iconColor = _isToggledColor && !widget.isBackground && !_isWhite
149-
// ? stringToColor(_selectionStyle.attributes['color']!.value)
150-
// : (iconTheme?.iconUnselectedFillColor ?? theme.iconTheme.color);
151-
152-
// final iconColorBackground =
153-
// _isToggledBackground && widget.isBackground && !_isWhiteBackground
154-
// ? stringToColor(_selectionStyle.attributes['background']!.value)
155-
// : (iconTheme?.iconUnselectedFillColor ?? theme.iconTheme.color);
156-
157-
// final fillColor = _isToggledColor && !widget.isBackground && _isWhite
158-
// ? stringToColor('#ffffff')
159-
// : (iconTheme?.iconUnselectedFillColor ?? theme.canvasColor);
160-
// final fillColorBackground =
161-
// _isToggledBackground && widget.isBackground && _isWhiteBackground
162-
// ? stringToColor('#ffffff')
163-
// : (iconTheme?.iconUnselectedFillColor ?? theme.canvasColor);
148+
final iconColor = _isToggledColor && !widget.isBackground && !_isWhite
149+
? stringToColor(_selectionStyle.attributes['color']!.value)
150+
: null;
151+
152+
final iconColorBackground =
153+
_isToggledBackground && widget.isBackground && !_isWhiteBackground
154+
? stringToColor(_selectionStyle.attributes['background']!.value)
155+
: null;
156+
157+
final fillColor = _isToggledColor && !widget.isBackground && _isWhite
158+
? stringToColor('#ffffff')
159+
: null;
160+
final fillColorBackground =
161+
_isToggledBackground && widget.isBackground && _isWhiteBackground
162+
? stringToColor('#ffffff')
163+
: null;
164164

165165
final childBuilder =
166166
options.childBuilder ?? baseButtonExtraOptions?.childBuilder;
@@ -186,9 +186,9 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
186186
afterButtonPressed?.call();
187187
},
188188
iconColor: null,
189-
iconColorBackground: Colors.red,
190-
fillColor: Colors.red,
191-
fillColorBackground: Colors.red,
189+
iconColorBackground: iconColorBackground,
190+
fillColor: fillColor,
191+
fillColorBackground: fillColorBackground,
192192
),
193193
);
194194
}
@@ -198,7 +198,7 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
198198
iconSize: iconSize * iconButtonFactor,
199199
icon: Icon(
200200
iconData,
201-
// color: widget.isBackground ? iconColorBackground : iconColor,
201+
color: widget.isBackground ? iconColorBackground : iconColor,
202202
),
203203
onPressed: _showColorPicker,
204204
);

lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState
173173
final isMaterial3 = Theme.of(context).useMaterial3;
174174
final child = Row(
175175
mainAxisSize: MainAxisSize.min,
176+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
176177
children: [
177178
Text(
178179
_label(_selectedItem),

lib/src/widgets/toolbar/buttons/history_button.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,10 @@ class QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
102102
icon: Icon(
103103
iconData,
104104
size: iconSize * iconButtonFactor,
105-
// TODO: HEeeerre
106-
// color: _canPressed
107-
// ? iconTheme?.iconUnselectedColor ?? theme.iconTheme.color
108-
// : iconTheme?.disabledIconColor ?? theme.disabledColor,
109105
),
110-
isSelected: false,
106+
isSelected: _canPressed,
107+
iconSelectedStyle: iconTheme?.iconButtonSelectedStyle,
108+
iconUnselectedStyle: iconTheme?.iconButtonUnselectedStyle,
111109
onPressed: _updateHistory,
112110
afterPressed: afterButtonPressed,
113111
);

lib/src/widgets/toolbar/buttons/toggle_style_button.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ class QuillToolbarToggleStyleButtonState
119119
'left' => (context.loc.alignLeft, Icons.format_align_left),
120120
'right' => (context.loc.alignRight, Icons.format_align_right),
121121
'center' => (context.loc.alignCenter, Icons.format_align_center),
122-
Object() => (context.loc.alignCenter, Icons.format_align_center),
122+
'justify' => (
123+
context.loc.justifyWinWidth,
124+
Icons.format_align_justify
125+
),
126+
Object() => throw ArgumentError(widget.attribute.value),
123127
null => (context.loc.alignCenter, Icons.format_align_center),
124128
};
125129
default:

0 commit comments

Comments
 (0)