[Reland] - Enable explicitChildNodes for the AlertDialog content (#149597)

Fixes the semantics of AlertDialog.
This commit is contained in:
Taha Tesser
2024-07-08 19:47:20 +03:00
committed by GitHub
parent 3cffdf6c43
commit f080102350
2 changed files with 20 additions and 4 deletions

View File

@@ -812,6 +812,7 @@ class AlertDialog extends StatelessWidget {
style: contentTextStyle ?? dialogTheme.contentTextStyle ?? defaults.contentTextStyle!,
child: Semantics(
container: true,
explicitChildNodes: true,
child: content,
),
),

View File

@@ -1722,7 +1722,12 @@ void main() {
theme: ThemeData(platform: TargetPlatform.iOS),
home: const AlertDialog(
title: Text('title'),
content: Text('content'),
content: Column(
children: <Widget>[
Text('some content'),
Text('more content'),
],
),
actions: <Widget>[ TextButton(onPressed: null, child: Text('action')) ],
),
),
@@ -1753,11 +1758,21 @@ void main() {
// node 4.
TestSemantics(
id: 6,
label: 'content',
textDirection: TextDirection.ltr,
children: <TestSemantics>[
TestSemantics(
id: 7,
label: 'some content',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 8,
label: 'more content',
textDirection: TextDirection.ltr,
),
],
),
TestSemantics(
id: 7,
id: 9,
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.hasEnabledState,