Skip to content

Commit 3d4fd55

Browse files
Reverts "Enable explicitChildNodes for the AlertDialog content (#149130)" (#149333)
Reverts: flutter/flutter#149130 Initiated by: Piinks Reason for reverting: Google testing did not run on this PR and multiple semantics screen shots from internal testing look incorrect. Original PR Author: TahaTesser Reviewed By: {goderbauer} This change reverts the following previous change: fixes [AlertDialog content semantics merged](flutter/flutter#147574) ### Code sample <details> <summary>expand to view the code sample</summary> ```dart import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @OverRide Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, // showSemanticsDebugger: true, home: Scaffold( body: SafeArea( child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[ const Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text('Some text'), Text('More text'), ], ), Builder(builder: (BuildContext context) { return ElevatedButton( onPressed: () { showDialog<void>( context: context, builder: (BuildContext context) { return AlertDialog( title: const Text('Dialog Title'), content: const Column( children: <Widget>[ Text('Some text'), Text('More text'), ], ), actions: <Widget>[ TextButton( onPressed: () { Navigator.of(context).pop(); }, child: const Text('Close'), ), ], ); }, ); }, child: const Text('Open Dialog'), ); }), ], ), ), ), ), ); } } ``` </details> ### Before vs After ![Screenshot 2024-05-27 at 14 59 57](https://github.com/flutter/flutter/assets/48603081/3b231a7a-db71-4dbf-bd4a-dd44a537cae8) ![Screenshot 2024-05-27 at 14 56 04](https://github.com/flutter/flutter/assets/48603081/219c1de5-ad35-49b3-a80f-4f036184e22b)
1 parent 11cbe41 commit 3d4fd55

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

packages/flutter/lib/src/material/dialog.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ class AlertDialog extends StatelessWidget {
812812
style: contentTextStyle ?? dialogTheme.contentTextStyle ?? defaults.contentTextStyle!,
813813
child: Semantics(
814814
container: true,
815-
explicitChildNodes: true,
816815
child: content,
817816
),
818817
),

packages/flutter/test/material/dialog_test.dart

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,12 +1700,7 @@ void main() {
17001700
theme: ThemeData(platform: TargetPlatform.iOS),
17011701
home: const AlertDialog(
17021702
title: Text('title'),
1703-
content: Column(
1704-
children: <Widget>[
1705-
Text('some content'),
1706-
Text('more content'),
1707-
],
1708-
),
1703+
content: Text('content'),
17091704
actions: <Widget>[ TextButton(onPressed: null, child: Text('action')) ],
17101705
),
17111706
),
@@ -1736,21 +1731,11 @@ void main() {
17361731
// node 4.
17371732
TestSemantics(
17381733
id: 6,
1739-
children: <TestSemantics>[
1740-
TestSemantics(
1741-
id: 7,
1742-
label: 'some content',
1743-
textDirection: TextDirection.ltr,
1744-
),
1745-
TestSemantics(
1746-
id: 8,
1747-
label: 'more content',
1748-
textDirection: TextDirection.ltr,
1749-
),
1750-
],
1734+
label: 'content',
1735+
textDirection: TextDirection.ltr,
17511736
),
17521737
TestSemantics(
1753-
id: 9,
1738+
id: 7,
17541739
flags: <SemanticsFlag>[
17551740
SemanticsFlag.isButton,
17561741
SemanticsFlag.hasEnabledState,

0 commit comments

Comments
 (0)