diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index bfd74e5ee4..d31a6ab63d 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -1944,10 +1944,9 @@ class _RawChipState extends State with TickerProviderStateMixin[ - SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, - ], ), ], ), @@ -1666,10 +1662,6 @@ void main() { TestSemantics( label: 'test', textDirection: TextDirection.ltr, - flags: [ - SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, - ], children: [ TestSemantics( label: 'Delete', @@ -1720,7 +1712,6 @@ void main() { textDirection: TextDirection.ltr, flags: [ SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, SemanticsFlag.isEnabled, SemanticsFlag.isFocusable, ], @@ -1772,7 +1763,6 @@ void main() { textDirection: TextDirection.ltr, flags: [ SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, SemanticsFlag.isEnabled, SemanticsFlag.isFocusable, ], @@ -1818,7 +1808,6 @@ void main() { textDirection: TextDirection.ltr, flags: [ SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, SemanticsFlag.isEnabled, SemanticsFlag.isFocusable, SemanticsFlag.isSelected, @@ -1864,10 +1853,7 @@ void main() { TestSemantics( label: 'test', textDirection: TextDirection.ltr, - flags: [ - SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, - ], + flags: [], actions: [], ), ], @@ -1881,140 +1867,6 @@ void main() { semanticsTester.dispose(); }); - - testWidgets('tapEnabled explicitly false', (WidgetTester tester) async { - final SemanticsTester semanticsTester = SemanticsTester(tester); - - await tester.pumpWidget(const MaterialApp( - home: Material( - child: RawChip( - tapEnabled: false, - label: Text('test'), - ), - ), - )); - - expect(semanticsTester, hasSemantics( - TestSemantics.root( - children: [ - TestSemantics( - textDirection: TextDirection.ltr, - children: [ - TestSemantics( - children: [ - TestSemantics( - flags: [SemanticsFlag.scopesRoute], - children: [ - TestSemantics( - label: 'test', - textDirection: TextDirection.ltr, - flags: [], // Must not be a button when tapping is disabled. - actions: [], - ), - ], - ), - ], - ), - ], - ), - ], - ), ignoreTransform: true, ignoreId: true, ignoreRect: true)); - - semanticsTester.dispose(); - }); - - testWidgets('enabled when tapEnabled and canTap', (WidgetTester tester) async { - final SemanticsTester semanticsTester = SemanticsTester(tester); - - // These settings make a Chip which can be tapped, both in general and at this moment. - await tester.pumpWidget(MaterialApp( - home: Material( - child: RawChip( - isEnabled: true, - tapEnabled: true, - onPressed: () {}, - label: const Text('test'), - ), - ), - )); - - expect(semanticsTester, hasSemantics( - TestSemantics.root( - children: [ - TestSemantics( - textDirection: TextDirection.ltr, - children: [ - TestSemantics( - children: [ - TestSemantics( - flags: [SemanticsFlag.scopesRoute], - children: [ - TestSemantics( - label: 'test', - textDirection: TextDirection.ltr, - flags: [ - SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, - SemanticsFlag.isEnabled, - SemanticsFlag.isFocusable, - ], - actions: [SemanticsAction.tap], - ), - ], - ), - ], - ), - ], - ), - ], - ), ignoreTransform: true, ignoreId: true, ignoreRect: true)); - - semanticsTester.dispose(); - }); - - testWidgets('disabled when tapEnabled but not canTap', (WidgetTester tester) async { - final SemanticsTester semanticsTester = SemanticsTester(tester); - // These settings make a Chip which _could_ be tapped, but not currently (ensures `canTap == false`). - await tester.pumpWidget(const MaterialApp( - home: Material( - child: RawChip( - isEnabled: true, - tapEnabled: true, - label: Text('test'), - ), - ), - )); - - expect(semanticsTester, hasSemantics( - TestSemantics.root( - children: [ - TestSemantics( - textDirection: TextDirection.ltr, - children: [ - TestSemantics( - children: [ - TestSemantics( - flags: [SemanticsFlag.scopesRoute], - children: [ - TestSemantics( - label: 'test', - textDirection: TextDirection.ltr, - flags: [ - SemanticsFlag.hasEnabledState, - SemanticsFlag.isButton, - ], - ), - ], - ), - ], - ), - ], - ), - ], - ), ignoreTransform: true, ignoreId: true, ignoreRect: true)); - - semanticsTester.dispose(); - }); }); testWidgets('can be tapped outside of chip delete icon', (WidgetTester tester) async {