Reverts flutter/flutter#143334 Initiated by: hangyujin Reason for reverting: broke g3 tests Original PR Author: hangyujin Reviewed By: {LongCatIsLooong} This change reverts the following previous change: Original Description: Add a semantics flag to text field to fix https://github.com/flutter/flutter/issues/143337 (in IOS the disabled text field is not read `dimmed`) internal: b/322345393
This commit is contained in:
parent
eae0c6a357
commit
0fac13b443
@ -1574,7 +1574,6 @@ class _TextFieldState extends State<TextField> with RestorationMixin implements
|
||||
animation: controller, // changes the _currentLength
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
return Semantics(
|
||||
enabled: _isEnabled,
|
||||
maxValueLength: semanticsMaxValueLength,
|
||||
currentValueLength: _currentLength,
|
||||
onTap: widget.readOnly ? null : () {
|
||||
|
@ -529,11 +529,8 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled,],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap,
|
||||
SemanticsAction.didGainAccessibilityFocus,],
|
||||
textDirection: TextDirection.ltr,
|
||||
|
@ -279,8 +279,6 @@ void main() {
|
||||
expect(tester.getSemantics(find.byType(EditableText)), matchesSemantics(
|
||||
label: 'Enter Date',
|
||||
isTextField: true,
|
||||
hasEnabledState: true,
|
||||
isEnabled: true,
|
||||
isFocused: true,
|
||||
value: '01/15/2016',
|
||||
hasTapAction: true,
|
||||
|
@ -670,8 +670,6 @@ void main() {
|
||||
id: 9,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
SemanticsFlag.isHeader,
|
||||
if (debugDefaultTargetPlatformOverride != TargetPlatform.iOS &&
|
||||
@ -820,8 +818,6 @@ void main() {
|
||||
id: 11,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
SemanticsFlag.isHeader,
|
||||
if (debugDefaultTargetPlatformOverride != TargetPlatform.iOS &&
|
||||
|
@ -746,7 +746,7 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
SemanticsAction.didGainAccessibilityFocus,
|
||||
@ -1856,12 +1856,7 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 1,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isFocused],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
SemanticsAction.moveCursorBackwardByCharacter,
|
||||
@ -5194,8 +5189,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
),
|
||||
TestSemantics.rootChild(
|
||||
@ -6537,7 +6530,7 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(semantics, includesNodeWith(flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled]));
|
||||
expect(semantics, includesNodeWith(flags: <SemanticsFlag>[SemanticsFlag.isTextField]));
|
||||
|
||||
semantics.dispose();
|
||||
});
|
||||
@ -6951,7 +6944,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(semantics, includesNodeWith(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField],
|
||||
maxValueLength: 10,
|
||||
currentValueLength: 0,
|
||||
));
|
||||
@ -6966,12 +6959,7 @@ void main() {
|
||||
await tester.pump();
|
||||
|
||||
expect(semantics, includesNodeWith(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isFocused],
|
||||
maxValueLength: 10,
|
||||
currentValueLength: 3,
|
||||
));
|
||||
@ -6997,12 +6985,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
semantics,
|
||||
includesNodeWith(flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isReadOnly,
|
||||
]),
|
||||
includesNodeWith(flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isReadOnly]),
|
||||
);
|
||||
|
||||
semantics.dispose();
|
||||
@ -8028,8 +8011,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -8049,8 +8030,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -8076,8 +8055,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8106,8 +8083,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8135,8 +8110,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8162,8 +8135,6 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
value: 'Hello',
|
||||
)
|
||||
@ -8179,8 +8150,6 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isObscured,
|
||||
],
|
||||
)
|
||||
@ -8196,8 +8165,6 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
value: 'Hello',
|
||||
)
|
||||
@ -8240,8 +8207,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8277,8 +8242,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
),
|
||||
],
|
||||
@ -8305,8 +8268,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8337,8 +8298,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8388,8 +8347,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8438,8 +8395,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
),
|
||||
@ -8476,7 +8431,7 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: inputFieldId,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
||||
value: textInTextField,
|
||||
textDirection: TextDirection.ltr,
|
||||
@ -8496,8 +8451,6 @@ void main() {
|
||||
id: inputFieldId,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
@ -8551,7 +8504,7 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: inputFieldId,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
||||
value: textInTextField,
|
||||
textDirection: TextDirection.ltr,
|
||||
@ -8571,8 +8524,6 @@ void main() {
|
||||
id: inputFieldId,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
@ -8753,8 +8704,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
@ -8790,8 +8739,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocused,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
@ -8849,8 +8796,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
@ -8898,8 +8843,6 @@ void main() {
|
||||
],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
],
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
|
@ -1343,12 +1343,7 @@ void main() {
|
||||
label: 'Hour',
|
||||
value: '07',
|
||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isMultiline,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isMultiline],
|
||||
),
|
||||
);
|
||||
expect(
|
||||
@ -1357,12 +1352,7 @@ void main() {
|
||||
label: 'Minute',
|
||||
value: '00',
|
||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isTextField,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isMultiline,
|
||||
],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isMultiline],
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -883,7 +883,6 @@ void main() {
|
||||
group('simulatedTraversal', () {
|
||||
final List<Matcher> fullTraversalMatchers = <Matcher>[
|
||||
containsSemantics(isHeader: true, label: 'Semantics Test'),
|
||||
containsSemantics(label: 'Text Field'),
|
||||
containsSemantics(isTextField: true),
|
||||
containsSemantics(label: 'Off Switch'),
|
||||
containsSemantics(hasToggledState: true),
|
||||
@ -914,7 +913,7 @@ void main() {
|
||||
await tester.pumpWidget(const MaterialApp(home: _SemanticsTestWidget()));
|
||||
|
||||
// We're expecting the traversal to start where the slider is.
|
||||
final List<Matcher> expectedMatchers = <Matcher>[...fullTraversalMatchers]..removeRange(0, 9);
|
||||
final List<Matcher> expectedMatchers = <Matcher>[...fullTraversalMatchers]..removeRange(0, 8);
|
||||
|
||||
expect(
|
||||
tester.semantics.simulatedAccessibilityTraversal(start: find.byType(Slider)),
|
||||
@ -977,7 +976,7 @@ void main() {
|
||||
await tester.pumpWidget(const MaterialApp(home: _SemanticsTestWidget()));
|
||||
|
||||
// We're expecting the traversal to end where the slider is, inclusive.
|
||||
final Iterable<Matcher> expectedMatchers = <Matcher>[...fullTraversalMatchers].getRange(0, 10);
|
||||
final Iterable<Matcher> expectedMatchers = <Matcher>[...fullTraversalMatchers].getRange(0, 9);
|
||||
|
||||
expect(
|
||||
tester.semantics.simulatedAccessibilityTraversal(end: find.byType(Slider)),
|
||||
@ -1038,7 +1037,7 @@ void main() {
|
||||
await tester.pumpWidget(const MaterialApp(home: _SemanticsTestWidget()));
|
||||
|
||||
// We're expecting the traversal to start at the text field and end at the slider.
|
||||
final Iterable<Matcher> expectedMatchers = <Matcher>[...fullTraversalMatchers].getRange(1, 10);
|
||||
final Iterable<Matcher> expectedMatchers = <Matcher>[...fullTraversalMatchers].getRange(1, 9);
|
||||
|
||||
expect(
|
||||
tester.semantics.simulatedAccessibilityTraversal(
|
||||
@ -1766,7 +1765,7 @@ class _SemanticsTestWidget extends StatelessWidget {
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
const _SemanticsTestCard(
|
||||
label: 'Text Field',
|
||||
label: 'TextField',
|
||||
widget: TextField(),
|
||||
),
|
||||
_SemanticsTestCard(
|
||||
|
Loading…
x
Reference in New Issue
Block a user