Skip to content

Commit 237ddf8

Browse files
committed
fix(toolbar): remove context mounted check when calling color picker
There is no context used when calling color picker callback, remove all those unnecessary checks to fix color not applied on Android platform.
1 parent edc3484 commit 237ddf8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/src/editor_tool_bar.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ class _BBCodeEditorToolbarState extends State<BBCodeEditorToolbar> {
263263

264264
/// Refer: flutter_quill/lib/src/widgets/toolbar/color/color_button.dart
265265
void _changeColor(
266-
BuildContext context,
267266
QuillController controller,
268267
bool isBackground,
269268
Color? color,
@@ -291,14 +290,14 @@ class _BBCodeEditorToolbarState extends State<BBCodeEditorToolbar> {
291290
colorButtonOptions = QuillToolbarColorButtonOptions(
292291
customOnPressedCallback: (controller, isBackground) async {
293292
final pickResult = await widget._colorPicker!(context);
294-
if (pickResult == null || !mounted) {
293+
if (pickResult == null) {
295294
return;
296295
}
297296

298297
if (pickResult.clearColor) {
299-
_changeColor(context, controller, false, null);
298+
_changeColor(controller, false, null);
300299
} else {
301-
_changeColor(context, controller, false, pickResult.color);
300+
_changeColor(controller, false, pickResult.color);
302301
}
303302
},
304303
);
@@ -309,14 +308,14 @@ class _BBCodeEditorToolbarState extends State<BBCodeEditorToolbar> {
309308
backgroundColorButtonOptions = QuillToolbarColorButtonOptions(
310309
customOnPressedCallback: (controller, isBackground) async {
311310
final pickResult = await widget._backgroundColorPicker!(context);
312-
if (pickResult == null || !mounted) {
311+
if (pickResult == null) {
313312
return;
314313
}
315314

316315
if (pickResult.clearColor) {
317-
_changeColor(context, controller, true, null);
316+
_changeColor(controller, true, null);
318317
} else {
319-
_changeColor(context, controller, true, pickResult.color);
318+
_changeColor(controller, true, pickResult.color);
320319
}
321320
},
322321
);

0 commit comments

Comments
 (0)