From 47dd10b1dbb671bca253233799b091f116373691 Mon Sep 17 00:00:00 2001 From: X Code Date: Tue, 28 Dec 2021 15:26:21 -0800 Subject: [PATCH] Add comments --- lib/src/widgets/editor.dart | 2 + lib/src/widgets/raw_editor.dart | 91 +++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart index 283ac14a..fb4a86cd 100644 --- a/lib/src/widgets/editor.dart +++ b/lib/src/widgets/editor.dart @@ -619,6 +619,8 @@ class _QuillEditorSelectionGestureDetectorBuilder break; case PointerDeviceKind.touch: case PointerDeviceKind.unknown: + // On macOS/iOS/iPadOS a touch tap places the cursor at the edge + // of the word. try { getRenderEditor()!.selectWordEdge(SelectionChangedCause.tap); } finally { diff --git a/lib/src/widgets/raw_editor.dart b/lib/src/widgets/raw_editor.dart index 76afb863..9a0b86dc 100644 --- a/lib/src/widgets/raw_editor.dart +++ b/lib/src/widgets/raw_editor.dart @@ -73,11 +73,17 @@ class RawEditor extends StatefulWidget { 'maxHeight cannot be null'), showCursor = showCursor ?? true, super(key: key); + + /// Controls the document being edited. final QuillController controller; + + /// Controls whether this editor has keyboard focus. final FocusNode focusNode; final ScrollController scrollController; final bool scrollable; final double scrollBottomInset; + + /// Additional space around the editor contents. final EdgeInsetsGeometry padding; /// Whether the text can be changed. @@ -99,20 +105,105 @@ class RawEditor extends StatefulWidget { /// By default, all options are enabled. If [readOnly] is true, /// paste and cut will be disabled regardless. final ToolbarOptions toolbarOptions; + + /// Whether to show selection handles. + /// + /// When a selection is active, there will be two handles at each side of + /// boundary, or one handle if the selection is collapsed. The handles can be + /// dragged to adjust the selection. + /// + /// See also: + /// + /// * [showCursor], which controls the visibility of the cursor. final bool showSelectionHandles; + + /// Whether to show cursor. + /// + /// The cursor refers to the blinking caret when the editor is focused. + /// + /// See also: + /// + /// * [cursorStyle], which controls the cursor visual representation. + /// * [showSelectionHandles], which controls the visibility of the selection + /// handles. final bool showCursor; + + /// The style to be used for the editing cursor. final CursorStyle cursorStyle; + + /// Configures how the platform keyboard will select an uppercase or + /// lowercase keyboard. + /// + /// Only supports text keyboards, other keyboard types will ignore this + /// configuration. Capitalization is locale-aware. + /// + /// Defaults to [TextCapitalization.none]. Must not be null. + /// + /// See also: + /// + /// * [TextCapitalization], for a description of each capitalization behavior final TextCapitalization textCapitalization; + + /// The maximum height this editor can have. + /// + /// If this is null then there is no limit to the editor's height and it will + /// expand to fill its parent. final double? maxHeight; + + /// The minimum height this editor can have. final double? minHeight; final DefaultStyles? customStyles; + + /// Whether this widget's height will be sized to fill its parent. + /// + /// If set to true and wrapped in a parent widget like [Expanded] or + /// + /// Defaults to false. final bool expands; + + /// Whether this editor should focus itself if nothing else is already + /// focused. + /// + /// If true, the keyboard will open as soon as this text field obtains focus. + /// Otherwise, the keyboard is only shown after the user taps the text field. + /// + /// Defaults to false. Cannot be null. final bool autoFocus; + + /// The color to use when painting the selection. final Color selectionColor; + + /// Delegate for building the text selection handles and toolbar. + /// + /// The [RawEditor] widget used on its own will not trigger the display + /// of the selection toolbar by itself. The toolbar is shown by calling + /// [RawEditorState.showToolbar] in response to an appropriate user event. final TextSelectionControls selectionCtrls; + + /// The appearance of the keyboard. + /// + /// This setting is only honored on iOS devices. + /// + /// Defaults to [Brightness.light]. final Brightness keyboardAppearance; + + /// If true, then long-pressing this TextField will select text and show the + /// cut/copy/paste menu, and tapping will move the text caret. + /// + /// True by default. + /// + /// If false, most of the accessibility support for selecting text, copy + /// and paste, and moving the caret will be disabled. final bool enableInteractiveSelection; + + /// The [ScrollPhysics] to use when vertically scrolling the input. + /// + /// If not specified, it will behave according to the current platform. + /// + /// See [Scrollable.physics]. final ScrollPhysics? scrollPhysics; + + /// Builder function for embeddable objects. final EmbedBuilder embedBuilder; final LinkActionPickerDelegate linkActionPickerDelegate; final CustomStyleBuilder? customStyleBuilder;