Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
14 changes: 14 additions & 0 deletions lib/ui/semantics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ class SemanticsFlag {
static const int _kHasToggledStateIndex = 1 << 16;
static const int _kIsToggledIndex = 1 << 17;
static const int _kHasImplicitScrollingIndex = 1 << 18;
static const int _kIsMultilineIndex = 1 << 19;
static const int _kIsReadOnlyIndex = 1 << 20;

const SemanticsFlag._(this.index);
Expand Down Expand Up @@ -386,6 +387,13 @@ class SemanticsFlag {
/// is a password or contains other sensitive information.
static const SemanticsFlag isObscured = SemanticsFlag._(_kIsObscuredIndex);

/// Whether the value of the semantics node is coming from a multi-line text
/// field.
///
/// This is used for text fields to distinguish single-line text fields from
/// multi-line ones.
static const SemanticsFlag isMultiline = SemanticsFlag._(_kIsMultilineIndex);

/// Whether the semantics node is the root of a subtree for which a route name
/// should be announced.
///
Expand Down Expand Up @@ -512,6 +520,10 @@ class SemanticsFlag {
_kHasToggledStateIndex: hasToggledState,
_kIsToggledIndex: isToggled,
_kHasImplicitScrollingIndex: hasImplicitScrolling,
// TODO(mdebbar): Uncomment after both these PRs are landed:
// - https://github.com/flutter/engine/pull/9850
// - https://github.com/flutter/flutter/pull/36297
// _kIsMultilineIndex: isMultiline,
_kIsReadOnlyIndex: isReadOnly,
};

Expand Down Expand Up @@ -556,6 +568,8 @@ class SemanticsFlag {
return 'SemanticsFlag.isToggled';
case _kHasImplicitScrollingIndex:
return 'SemanticsFlag.hasImplicitScrolling';
case _kIsMultilineIndex:
return 'SemanticsFlag.isMultiline';
case _kIsReadOnlyIndex:
return 'SemanticsFlag.isReadOnly';
}
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/semantics/semantics_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ enum class SemanticsFlags : int32_t {
kHasToggledState = 1 << 16,
kIsToggled = 1 << 17,
kHasImplicitScrolling = 1 << 18,
// The Dart API defines the following flag but it isn't used in iOS.
// kIsMultiline = 1 << 19,
kIsReadOnly = 1 << 20,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,8 @@ private enum Flag {
HAS_TOGGLED_STATE(1 << 16),
IS_TOGGLED(1 << 17),
HAS_IMPLICIT_SCROLLING(1 << 18),
// The Dart API defines the following flag but it isn't used in Android.
// IS_MULTILINE(1 << 19);
IS_READ_ONLY(1 << 20);

final int value;
Expand Down