diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index e8049dfdbaf2..09ac978cef96 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -812,6 +812,7 @@ class AlertDialog extends StatelessWidget { style: contentTextStyle ?? dialogTheme.contentTextStyle ?? defaults.contentTextStyle!, child: Semantics( container: true, + explicitChildNodes: true, child: content, ), ), diff --git a/packages/flutter/test/material/dialog_test.dart b/packages/flutter/test/material/dialog_test.dart index 9415e58aae88..ebc1af01fcec 100644 --- a/packages/flutter/test/material/dialog_test.dart +++ b/packages/flutter/test/material/dialog_test.dart @@ -1700,7 +1700,12 @@ void main() { theme: ThemeData(platform: TargetPlatform.iOS), home: const AlertDialog( title: Text('title'), - content: Text('content'), + content: Column( + children: [ + Text('some content'), + Text('more content'), + ], + ), actions: [ TextButton(onPressed: null, child: Text('action')) ], ), ), @@ -1731,11 +1736,21 @@ void main() { // node 4. TestSemantics( id: 6, - label: 'content', - textDirection: TextDirection.ltr, + children: [ + 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.isButton, SemanticsFlag.hasEnabledState,