Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 16.0.2-ohos

* Support to harmony os

## 16.0.2

* Fix issue that the caret offset is not right after pinyin(composing) is completed on windows desktop(#255)
Expand Down
1 change: 1 addition & 0 deletions lib/src/extended/material/selectable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class _ExtendedSelectableTextState extends _SelectableTextState {

case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.ohos:
forcePressEnabled = false;
textSelectionControls ??= materialTextSelectionHandleControls;
paintCursorAboveText = false;
Expand Down
1 change: 1 addition & 0 deletions lib/src/extended/widgets/editable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ class ExtendedEditableTextState extends _EditableTextState {
return false;
}
case TargetPlatform.android:
case TargetPlatform.ohos:
// Gboard on Android puts non-CJK words in composing regions. Coalesce
// composing text in order to allow the saving of partial words in that
// case.
Expand Down
3 changes: 3 additions & 0 deletions lib/src/extended/widgets/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class ExtendedTextField extends _TextField {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
return ExtendedSpellCheckSuggestionsToolbar.editableText(
editableTextState: editableTextState,
);
Expand Down Expand Up @@ -335,6 +336,7 @@ class ExtendedTextFieldState extends _TextFieldState {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
// zmtzawqlp
spellCheckConfiguration =
ExtendedTextField.inferAndroidSpellCheckConfiguration(
Expand Down Expand Up @@ -401,6 +403,7 @@ class ExtendedTextFieldState extends _TextFieldState {

case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.ohos:
forcePressEnabled = false;
textSelectionControls ??= materialTextSelectionHandleControls;
paintCursorAboveText = false;
Expand Down
2 changes: 2 additions & 0 deletions lib/src/extended/widgets/text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ExtendedTextSelectionOverlay extends _TextSelectionOverlay {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
newSelection = TextSelection(
baseOffset: position.offset,
extentOffset: _selection.extentOffset,
Expand Down Expand Up @@ -171,6 +172,7 @@ class ExtendedTextSelectionOverlay extends _TextSelectionOverlay {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
newSelection = TextSelection(
baseOffset: _selection.baseOffset,
extentOffset: position.offset,
Expand Down
3 changes: 3 additions & 0 deletions lib/src/official/material/selectable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class _SelectableTextSelectionGestureDetectorBuilder
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
renderEditable.selectPosition(cause: SelectionChangedCause.tap);
}
}
Expand Down Expand Up @@ -641,6 +642,7 @@ class _SelectableTextState extends State<_SelectableText>
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
// Do nothing.
}
}
Expand Down Expand Up @@ -740,6 +742,7 @@ class _SelectableTextState extends State<_SelectableText>
iOSHorizontalOffset / MediaQuery.devicePixelRatioOf(context), 0);

case TargetPlatform.android:
case TargetPlatform.ohos:
case TargetPlatform.fuchsia:
forcePressEnabled = false;
textSelectionControls ??= materialTextSelectionHandleControls;
Expand Down
3 changes: 3 additions & 0 deletions lib/src/official/rendering/editable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,7 @@ class _RenderEditable extends RenderBox
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
// Override the height to take the full height of the glyph at the TextPosition
// when not on iOS. iOS has special handling that creates a taller caret.
// TODO(garyq): see https://github.com/flutter/flutter/issues/120836.
Expand Down Expand Up @@ -2231,6 +2232,7 @@ class _RenderEditable extends RenderBox
extentOffset: position.offset,
);
}
case TargetPlatform.ohos:
case TargetPlatform.fuchsia:
case TargetPlatform.macOS:
case TargetPlatform.linux:
Expand Down Expand Up @@ -2301,6 +2303,7 @@ class _RenderEditable extends RenderBox
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
_caretPrototype = Rect.fromLTWH(0.0, _kCaretHeightOffset, cursorWidth,
cursorHeight - 2.0 * _kCaretHeightOffset);
}
Expand Down
11 changes: 10 additions & 1 deletion lib/src/official/widgets/editable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,7 @@ class _EditableText extends StatefulWidget {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
break;
}
}
Expand Down Expand Up @@ -2070,6 +2071,7 @@ class _EditableTextState extends State<_EditableText>
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
return textEditingValue.text.isNotEmpty &&
!(textEditingValue.selection.start == 0 &&
textEditingValue.selection.end == textEditingValue.text.length);
Expand Down Expand Up @@ -2114,6 +2116,7 @@ class _EditableTextState extends State<_EditableText>
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
return false;
}
}
Expand Down Expand Up @@ -2165,6 +2168,7 @@ class _EditableTextState extends State<_EditableText>
case TargetPlatform.linux:
case TargetPlatform.windows:
break;
case TargetPlatform.ohos:
case TargetPlatform.android:
case TargetPlatform.fuchsia:
// Collapse the selection and hide the toolbar and handles.
Expand Down Expand Up @@ -2276,6 +2280,7 @@ class _EditableTextState extends State<_EditableText>
case TargetPlatform.android:
case TargetPlatform.iOS:
case TargetPlatform.fuchsia:
case TargetPlatform.ohos:
break;
case TargetPlatform.macOS:
case TargetPlatform.linux:
Expand All @@ -2287,6 +2292,7 @@ class _EditableTextState extends State<_EditableText>
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
bringIntoView(textEditingValue.selection.extent);
case TargetPlatform.macOS:
case TargetPlatform.iOS:
Expand Down Expand Up @@ -3533,7 +3539,8 @@ class _EditableTextState extends State<_EditableText>
TargetPlatform.fuchsia ||
TargetPlatform.linux ||
TargetPlatform.macOS ||
TargetPlatform.windows =>
TargetPlatform.windows ||
TargetPlatform.ohos =>
false,
};

Expand Down Expand Up @@ -4034,6 +4041,7 @@ class _EditableTextState extends State<_EditableText>
case TargetPlatform.windows:
case TargetPlatform.fuchsia:
case TargetPlatform.android:
case TargetPlatform.ohos:
if (cause == SelectionChangedCause.drag) {
if (oldSelection.baseOffset != newSelection.baseOffset) {
bringIntoView(newSelection.base);
Expand Down Expand Up @@ -4993,6 +5001,7 @@ class _EditableTextState extends State<_EditableText>
case TargetPlatform.android:
case TargetPlatform.iOS:
case TargetPlatform.fuchsia:
case TargetPlatform.ohos:
// On mobile platforms, we don't unfocus on touch events unless they're
// in the web browser, but we do unfocus for all other kinds of events.
switch (event.kind) {
Expand Down
6 changes: 6 additions & 0 deletions lib/src/official/widgets/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class _TextFieldSelectionGestureDetectorBuilder
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
Feedback.forLongPress(_state.context);
}
}
Expand Down Expand Up @@ -862,6 +863,7 @@ class _TextField extends StatefulWidget {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
return SpellCheckSuggestionsToolbar.editableText(
editableTextState: editableTextState,
);
Expand Down Expand Up @@ -1312,6 +1314,7 @@ class _TextFieldState extends State<_TextField>
case TargetPlatform.windows:
case TargetPlatform.fuchsia:
case TargetPlatform.android:
case TargetPlatform.ohos:
if (cause == SelectionChangedCause.longPress) {
_editableText?.bringIntoView(selection.extent);
}
Expand All @@ -1321,6 +1324,7 @@ class _TextFieldState extends State<_TextField>
case TargetPlatform.iOS:
case TargetPlatform.fuchsia:
case TargetPlatform.android:
case TargetPlatform.ohos:
break;
case TargetPlatform.macOS:
case TargetPlatform.linux:
Expand Down Expand Up @@ -1458,6 +1462,7 @@ class _TextFieldState extends State<_TextField>
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
spellCheckConfiguration = TextField.inferAndroidSpellCheckConfiguration(
widget.spellCheckConfiguration,
);
Expand Down Expand Up @@ -1522,6 +1527,7 @@ class _TextFieldState extends State<_TextField>

case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.ohos:
forcePressEnabled = false;
textSelectionControls ??= materialTextSelectionHandleControls;
paintCursorAboveText = false;
Expand Down
16 changes: 16 additions & 0 deletions lib/src/official/widgets/text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ class _TextSelectionOverlay {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
newSelection = TextSelection(
baseOffset: _selection.baseOffset,
extentOffset: position.offset,
Expand Down Expand Up @@ -658,6 +659,7 @@ class _TextSelectionOverlay {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
newSelection = TextSelection(
baseOffset: position.offset,
extentOffset: _selection.extentOffset,
Expand Down Expand Up @@ -1052,6 +1054,7 @@ class _SelectionOverlay {
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
case TargetPlatform.ohos:
break;
}
}
Expand Down Expand Up @@ -1806,6 +1809,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
case TargetPlatform.ohos:
}
}

Expand All @@ -1819,6 +1823,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
case TargetPlatform.ohos:
}
}

Expand Down Expand Up @@ -2046,6 +2051,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.iOS:
case TargetPlatform.ohos:
// On mobile platforms the selection is set on tap up.
break;
case TargetPlatform.macOS:
Expand Down Expand Up @@ -2167,6 +2173,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.windows:
break;
// On desktop platforms the selection is set on tap down.
case TargetPlatform.ohos:
case TargetPlatform.android:
editableText.hideToolbar(false);
if (isShiftPressedValid) {
Expand Down Expand Up @@ -2318,6 +2325,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.ohos:
case TargetPlatform.windows:
renderEditable.selectWord(cause: SelectionChangedCause.longPress);
}
Expand Down Expand Up @@ -2380,6 +2388,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
renderEditable.selectWordsInRange(
from: details.globalPosition -
details.offsetFromOrigin -
Expand Down Expand Up @@ -2442,6 +2451,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.ohos:
case TargetPlatform.windows:
if (!renderEditable.hasFocus) {
renderEditable.selectPosition(cause: SelectionChangedCause.tap);
Expand Down Expand Up @@ -2581,6 +2591,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.iOS:
case TargetPlatform.macOS:
case TargetPlatform.windows:
case TargetPlatform.ohos:
_selectParagraphsInRange(
from: details.globalPosition, cause: SelectionChangedCause.tap);
case TargetPlatform.linux:
Expand Down Expand Up @@ -2633,6 +2644,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.ohos:
_extendSelection(details.globalPosition, SelectionChangedCause.drag);
}
} else {
Expand All @@ -2653,6 +2665,7 @@ class _TextSelectionGestureDetectorBuilder {
}
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.ohos:
switch (details.kind) {
case PointerDeviceKind.mouse:
case PointerDeviceKind.trackpad:
Expand Down Expand Up @@ -2747,6 +2760,7 @@ class _TextSelectionGestureDetectorBuilder {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.iOS:
case TargetPlatform.ohos:
switch (details.kind) {
case PointerDeviceKind.mouse:
case PointerDeviceKind.trackpad:
Expand Down Expand Up @@ -2808,6 +2822,7 @@ class _TextSelectionGestureDetectorBuilder {
return;
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.ohos:
// With a precise pointer device, such as a mouse, trackpad, or stylus,
// the drag will select the text spanning the origin of the drag to the end of the drag.
// With a touch device, the cursor should move with the drag.
Expand Down Expand Up @@ -2968,6 +2983,7 @@ class _TextSelectionGestureDetectorState {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.ohos:
// From observation, these platform's reset their tap count to 0 when
// the number of consecutive taps exceeds 3. For example on Debian Linux
// with GTK, when going past a triple click, on the fourth click the
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: extended_text_field
description: Extended official text field to build special text like inline image, @somebody, custom background etc quickly.It also support to build custom seleciton toolbar and handles.
version: 16.0.2
version: 16.0.2-ohos
repository: https://github.com/fluttercandies/extended_text_field
issue_tracker: https://github.com/fluttercandies/extended_text_field/issues
topics:
Expand Down