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
33d01519
Unverified
Commit
33d01519
authored
Sep 23, 2020
by
Juyeong Lee
Committed by
GitHub
Sep 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CupertinoAlertDialog TextStyle (#64468)
parent
943b41bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
6 deletions
+42
-6
dialog.dart
packages/flutter/lib/src/cupertino/dialog.dart
+11
-5
dialog_test.dart
packages/flutter/test/cupertino/dialog_test.dart
+31
-1
No files found.
packages/flutter/lib/src/cupertino/dialog.dart
View file @
33d01519
...
...
@@ -18,22 +18,28 @@ import 'scrollbar.dart';
// TODO(abarth): These constants probably belong somewhere more general.
// Used XD to flutter plugin(https://github.com/AdobeXD/xd-to-flutter-plugin/)
// to derive values of TextStyle(height and letterSpacing) from
// Adobe XD template for iOS 13, which can be found in
// Apple Design Resources(https://developer.apple.com/design/resources/).
// However the values are not exactly the same as native, so eyeballing is needed.
const
TextStyle
_kCupertinoDialogTitleStyle
=
TextStyle
(
fontFamily:
'.SF UI Display'
,
inherit:
false
,
fontSize:
1
8
.0
,
fontSize:
1
7
.0
,
fontWeight:
FontWeight
.
w600
,
letterSpacing:
0.48
,
height:
1.3
,
letterSpacing:
-
0.5
,
textBaseline:
TextBaseline
.
alphabetic
,
);
const
TextStyle
_kCupertinoDialogContentStyle
=
TextStyle
(
fontFamily:
'.SF UI Text'
,
inherit:
false
,
fontSize:
13.
4
,
fontSize:
13.
0
,
fontWeight:
FontWeight
.
w400
,
height:
1.
036
,
letterSpacing:
-
0.2
5
,
height:
1.
35
,
letterSpacing:
-
0.2
,
textBaseline:
TextBaseline
.
alphabetic
,
);
...
...
packages/flutter/test/cupertino/dialog_test.dart
View file @
33d01519
...
...
@@ -320,7 +320,7 @@ void main() {
// Visually the "Cancel" button and "OK" button are the same height when using the
// regular font. However, when using the test font, "Cancel" becomes 2 lines which
// is why the height we're verifying for "Cancel" is larger than "OK".
expect
(
tester
.
getSize
(
find
.
text
(
'The Title'
)),
equals
(
const
Size
(
270.0
,
1
6
2.0
)));
expect
(
tester
.
getSize
(
find
.
text
(
'The Title'
)),
equals
(
const
Size
(
270.0
,
1
3
2.0
)));
expect
(
tester
.
getTopLeft
(
find
.
text
(
'The Title'
)),
equals
(
const
Offset
(
265.0
,
80.0
+
24.0
)));
expect
(
tester
.
getSize
(
find
.
widgetWithText
(
CupertinoDialogAction
,
'Cancel'
)),
equals
(
const
Size
(
310.0
,
148.0
)));
expect
(
tester
.
getSize
(
find
.
widgetWithText
(
CupertinoDialogAction
,
'OK'
)),
equals
(
const
Size
(
310.0
,
98.0
)));
...
...
@@ -1147,6 +1147,36 @@ void main() {
// once animation settles the dialog is padded by the new viewInsets
expect
(
tester
.
getRect
(
find
.
byType
(
Placeholder
)),
placeholderRectWithoutInsets
.
translate
(
10
,
10
));
});
testWidgets
(
'Default cupertino dialog golden'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
createAppWithButtonThatLaunchesDialog
(
dialogBuilder:
(
BuildContext
context
)
{
return
MediaQuery
(
data:
MediaQuery
.
of
(
context
).
copyWith
(
textScaleFactor:
3.0
),
child:
const
RepaintBoundary
(
child:
CupertinoAlertDialog
(
title:
Text
(
'Title'
),
content:
Text
(
'text'
),
actions:
<
Widget
>[
CupertinoDialogAction
(
child:
Text
(
'No'
)),
CupertinoDialogAction
(
child:
Text
(
'OK'
)),
],
),
),
);
}
),
);
await
tester
.
tap
(
find
.
text
(
'Go'
));
await
tester
.
pumpAndSettle
();
await
expectLater
(
find
.
byType
(
CupertinoAlertDialog
),
matchesGoldenFile
(
'dialog_test.cupertino.default.png'
),
);
});
}
RenderBox
findActionButtonRenderBoxByTitle
(
WidgetTester
tester
,
String
title
)
{
...
...
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