@@ -24,11 +24,13 @@ class InsertEmbedButton extends StatelessWidget {
24
24
const InsertEmbedButton ({
25
25
required this .controller,
26
26
required this .icon,
27
+ this .fillColor,
27
28
Key ? key,
28
29
}) : super (key: key);
29
30
30
31
final QuillController controller;
31
32
final IconData icon;
33
+ final Color ? fillColor;
32
34
33
35
@override
34
36
Widget build (BuildContext context) {
@@ -41,7 +43,7 @@ class InsertEmbedButton extends StatelessWidget {
41
43
size: iconSize,
42
44
color: Theme .of (context).iconTheme.color,
43
45
),
44
- fillColor: Theme .of (context).canvasColor,
46
+ fillColor: fillColor ?? Theme .of (context).canvasColor,
45
47
onPressed: () {
46
48
final index = controller.selection.baseOffset;
47
49
final length = controller.selection.extentOffset - index;
@@ -169,6 +171,7 @@ typedef ToggleStyleButtonBuilder = Widget Function(
169
171
BuildContext context,
170
172
Attribute attribute,
171
173
IconData icon,
174
+ Color ? fillColor,
172
175
bool ? isToggled,
173
176
VoidCallback ? onPressed,
174
177
);
@@ -178,6 +181,7 @@ class ToggleStyleButton extends StatefulWidget {
178
181
required this .attribute,
179
182
required this .icon,
180
183
required this .controller,
184
+ this .fillColor,
181
185
this .childBuilder = defaultToggleStyleButtonBuilder,
182
186
Key ? key,
183
187
}) : super (key: key);
@@ -186,6 +190,8 @@ class ToggleStyleButton extends StatefulWidget {
186
190
187
191
final IconData icon;
188
192
193
+ final Color ? fillColor;
194
+
189
195
final QuillController controller;
190
196
191
197
final ToggleStyleButtonBuilder childBuilder;
@@ -246,8 +252,7 @@ class _ToggleStyleButtonState extends State<ToggleStyleButton> {
246
252
_selectionStyle.attributes.containsKey (Attribute .codeBlock.key);
247
253
final isEnabled =
248
254
! isInCodeBlock || widget.attribute.key == Attribute .codeBlock.key;
249
- return widget.childBuilder (context, widget.attribute, widget.icon,
250
- _isToggled, isEnabled ? _toggleAttribute : null );
255
+ return widget.childBuilder (context, widget.attribute, widget.icon, widget.fillColor, _isToggled, isEnabled ? _toggleAttribute : null );
251
256
}
252
257
253
258
void _toggleAttribute () {
@@ -262,12 +267,15 @@ class ToggleCheckListButton extends StatefulWidget {
262
267
required this .icon,
263
268
required this .controller,
264
269
required this .attribute,
270
+ this .fillColor,
265
271
this .childBuilder = defaultToggleStyleButtonBuilder,
266
272
Key ? key,
267
273
}) : super (key: key);
268
274
269
275
final IconData icon;
270
276
277
+ final Color ? fillColor;
278
+
271
279
final QuillController controller;
272
280
273
281
final ToggleStyleButtonBuilder childBuilder;
@@ -331,8 +339,7 @@ class _ToggleCheckListButtonState extends State<ToggleCheckListButton> {
331
339
_selectionStyle.attributes.containsKey (Attribute .codeBlock.key);
332
340
final isEnabled =
333
341
! isInCodeBlock || Attribute .list.key == Attribute .codeBlock.key;
334
- return widget.childBuilder (context, Attribute .unchecked, widget.icon,
335
- _isToggled, isEnabled ? _toggleAttribute : null );
342
+ return widget.childBuilder (context, Attribute .unchecked, widget.icon, widget.fillColor, _isToggled, isEnabled ? _toggleAttribute : null );
336
343
}
337
344
338
345
void _toggleAttribute () {
@@ -346,6 +353,7 @@ Widget defaultToggleStyleButtonBuilder(
346
353
BuildContext context,
347
354
Attribute attribute,
348
355
IconData icon,
356
+ Color ? fillColor,
349
357
bool ? isToggled,
350
358
VoidCallback ? onPressed,
351
359
) {
@@ -356,14 +364,14 @@ Widget defaultToggleStyleButtonBuilder(
356
364
? theme.primaryIconTheme.color
357
365
: theme.iconTheme.color
358
366
: theme.disabledColor;
359
- final fillColor =
360
- isToggled == true ? theme.toggleableActiveColor : theme.canvasColor;
367
+ final fill =
368
+ isToggled == true ? theme.toggleableActiveColor : fillColor ?? theme.canvasColor;
361
369
return QuillIconButton (
362
370
highlightElevation: 0 ,
363
371
hoverElevation: 0 ,
364
372
size: iconSize * 1.77 ,
365
373
icon: Icon (icon, size: iconSize, color: iconColor),
366
- fillColor: fillColor ,
374
+ fillColor: fill ,
367
375
onPressed: onPressed,
368
376
);
369
377
}
0 commit comments