From 977f94b347f9812392f9bf3f0d6af04f98a4c93d Mon Sep 17 00:00:00 2001 From: Till Friebe Date: Sat, 27 Mar 2021 19:39:27 +0100 Subject: [PATCH] Fix "Show toolbar" bug (#120) --- lib/widgets/raw_editor.dart | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/widgets/raw_editor.dart b/lib/widgets/raw_editor.dart index e0774208..d48fea6b 100644 --- a/lib/widgets/raw_editor.dart +++ b/lib/widgets/raw_editor.dart @@ -1094,22 +1094,18 @@ class RawEditorState extends EditorState @override bool showToolbar() { + // Web is using native dom elements to enable clipboard functionality of the + // toolbar: copy, paste, select, cut. It might also provide additional + // functionality depending on the browser (such as translate). Due to this + // we should not show a Flutter toolbar for the editable text elements. + if (kIsWeb) { + return false; + } if (_selectionOverlay == null || _selectionOverlay!.toolbar != null) { - // Web is using native dom elements to enable clipboard functionality of the - // toolbar: copy, paste, select, cut. It might also provide additional - // functionality depending on the browser (such as translate). Due to this - // we should not show a Flutter toolbar for the editable text elements. - if (kIsWeb) { - return false; - } - - if (_selectionOverlay == null || _selectionOverlay!.toolbar != null) { - return false; - } - - _selectionOverlay!.showToolbar(); - return true; + return false; } + + _selectionOverlay!.showToolbar(); return true; }