add enableUnfocusOnTapOutside field to RawEditor and Editor widgets (#1177)

pull/1181/head
bohdanudreambit 2 years ago committed by GitHub
parent f7e1a50df1
commit 3f7437b863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      lib/src/widgets/editor.dart
  2. 3
      lib/src/widgets/raw_editor.dart

@ -182,6 +182,7 @@ class QuillEditor extends StatefulWidget {
this.customShortcuts,
this.customActions,
this.detectWordBoundary = true,
this.enableUnfocusOnTapOutside = true,
this.customLinkPrefixes = const <String>[],
Key? key})
: super(key: key);
@ -246,6 +247,9 @@ class QuillEditor extends StatefulWidget {
/// Defaults to `false`. Cannot be `null`.
final bool autoFocus;
/// Whether focus should be revoked on tap outside the editor.
final bool enableUnfocusOnTapOutside;
/// Whether to show cursor.
///
/// The cursor refers to the blinking caret when the editor is focused.
@ -506,6 +510,7 @@ class QuillEditorState extends State<QuillEditor>
customShortcuts: widget.customShortcuts,
customActions: widget.customActions,
customLinkPrefixes: widget.customLinkPrefixes,
enableUnfocusOnTapOutside: widget.enableUnfocusOnTapOutside,
);
final editor = I18n(

@ -72,6 +72,7 @@ class RawEditor extends StatefulWidget {
this.customActions,
this.expands = false,
this.autoFocus = false,
this.enableUnfocusOnTapOutside = true,
this.keyboardAppearance = Brightness.light,
this.enableInteractiveSelection = true,
this.scrollPhysics,
@ -95,6 +96,7 @@ class RawEditor extends StatefulWidget {
final ScrollController scrollController;
final bool scrollable;
final double scrollBottomInset;
final bool enableUnfocusOnTapOutside;
/// Additional space around the editor contents.
final EdgeInsetsGeometry padding;
@ -494,6 +496,7 @@ class RawEditorState extends EditorState
maxHeight: widget.maxHeight ?? double.infinity);
return TextFieldTapRegion(
enabled: widget.enableUnfocusOnTapOutside,
onTapOutside: _defaultOnTapOutside,
child: QuillStyles(
data: _styles!,

Loading…
Cancel
Save