Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
00592ceb
Unverified
Commit
00592ceb
authored
Mar 23, 2021
by
chunhtai
Committed by
GitHub
Mar 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes AlertDialog and SimpleDialog to not merge their content semantics (#78633)
parent
0105c8f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
2 deletions
+147
-2
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+9
-2
dialog_test.dart
packages/flutter/test/material/dialog_test.dart
+138
-0
No files found.
packages/flutter/lib/src/material/dialog.dart
View file @
00592ceb
...
...
@@ -526,7 +526,10 @@ class AlertDialog extends StatelessWidget {
),
child:
DefaultTextStyle
(
style:
contentTextStyle
??
dialogTheme
.
contentTextStyle
??
theme
.
textTheme
.
subtitle1
!,
child:
content
!,
child:
Semantics
(
container:
true
,
child:
content
!,
),
),
);
}
...
...
@@ -877,7 +880,11 @@ class SimpleDialog extends StatelessWidget {
),
child:
DefaultTextStyle
(
style:
titleTextStyle
??
DialogTheme
.
of
(
context
).
titleTextStyle
??
theme
.
textTheme
.
headline6
!,
child:
Semantics
(
namesRoute:
label
==
null
,
child:
title
),
child:
Semantics
(
namesRoute:
label
==
null
,
container:
true
,
child:
title
),
),
);
}
...
...
packages/flutter/test/material/dialog_test.dart
View file @
00592ceb
...
...
@@ -1341,6 +1341,71 @@ void main() {
semantics
.
dispose
();
});
// Regression test for https://github.com/flutter/flutter/issues/78229.
testWidgets
(
'AlertDialog has correct semantics for content in iOS'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
const
AlertDialog
(
title:
Text
(
'title'
),
content:
Text
(
'content'
),
actions:
<
Widget
>[
TextButton
(
onPressed:
null
,
child:
Text
(
'action'
))
],
),
)
);
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
id:
1
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
id:
2
,
children:
<
TestSemantics
>[
TestSemantics
(
id:
3
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
id:
4
,
children:
<
TestSemantics
>[
TestSemantics
(
id:
5
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
namesRoute
],
label:
'title'
,
textDirection:
TextDirection
.
ltr
,
),
// The content semantics does not merge into the semantics
// node 4.
TestSemantics
(
id:
6
,
label:
'content'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
id:
7
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isButton
,
SemanticsFlag
.
hasEnabledState
],
label:
'action'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
),
],
),
],
),
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
semantics
.
dispose
();
});
testWidgets
(
'AlertDialog widget always contains alert route semantics for android'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
...
...
@@ -1439,6 +1504,79 @@ void main() {
semantics
.
dispose
();
});
// Regression test for https://github.com/flutter/flutter/issues/78229.
testWidgets
(
'SimpleDialog has correct semantics for title in iOS'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
const
SimpleDialog
(
title:
Text
(
'title'
),
children:
<
Widget
>[
Text
(
'content'
),
TextButton
(
onPressed:
null
,
child:
Text
(
'action'
))
],
),
)
);
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
id:
1
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
id:
2
,
children:
<
TestSemantics
>[
TestSemantics
(
id:
3
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
id:
4
,
children:
<
TestSemantics
>[
// Title semantics does not merge into the semantics
// node 4.
TestSemantics
(
id:
5
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
namesRoute
],
label:
'title'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
id:
6
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
children:
<
TestSemantics
>[
TestSemantics
(
id:
7
,
label:
'content'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
id:
8
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isButton
,
SemanticsFlag
.
hasEnabledState
],
label:
'action'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
),
],
),
],
),
],
),
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
semantics
.
dispose
();
});
testWidgets
(
'Dismissible.confirmDismiss defers to an AlertDialog'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
final
List
<
int
>
dismissedItems
=
<
int
>[];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment