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

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

Loading…
Cancel
Save