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
f5cc816c
Commit
f5cc816c
authored
Oct 12, 2017
by
gspencergoog
Committed by
GitHub
Oct 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep CircleAvatar from scaling the text with textScaleFactor (#12499)
Fixes #12483
parent
c3d56b1d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
circle_avatar.dart
packages/flutter/lib/src/material/circle_avatar.dart
+8
-3
circle_avatar_test.dart
packages/flutter/test/material/circle_avatar_test.dart
+27
-0
No files found.
packages/flutter/lib/src/material/circle_avatar.dart
View file @
f5cc816c
...
...
@@ -117,9 +117,14 @@ class CircleAvatar extends StatelessWidget {
shape:
BoxShape
.
circle
,
),
child:
child
!=
null
?
new
Center
(
child:
new
MediaQuery
(
// Need to reset the textScaleFactor here so that the
// text doesn't escape the avatar when the textScaleFactor is large.
data:
const
MediaQueryData
(
textScaleFactor:
1.0
),
child:
new
DefaultTextStyle
(
style:
textStyle
.
copyWith
(
color:
foregroundColor
),
child:
child
,
),
)
)
:
null
,
);
...
...
packages/flutter/test/material/circle_avatar_test.dart
View file @
f5cc816c
...
...
@@ -101,6 +101,33 @@ void main() {
final
RenderParagraph
paragraph
=
tester
.
renderObject
(
find
.
text
(
'Z'
));
expect
(
paragraph
.
text
.
style
.
color
,
equals
(
theme
.
primaryTextTheme
.
title
.
color
));
});
testWidgets
(
'CircleAvatar text does not expand with textScaleFactor'
,
(
WidgetTester
tester
)
async
{
final
Color
foregroundColor
=
Colors
.
red
.
shade100
;
await
tester
.
pumpWidget
(
wrap
(
child:
new
CircleAvatar
(
foregroundColor:
foregroundColor
,
child:
const
Text
(
'Z'
),
),
),
);
expect
(
tester
.
getSize
(
find
.
text
(
'Z'
)),
equals
(
const
Size
(
20.0
,
20.0
)));
await
tester
.
pumpWidget
(
wrap
(
child:
new
MediaQuery
(
data:
const
MediaQueryData
(
textScaleFactor:
2.0
),
child:
new
CircleAvatar
(
foregroundColor:
foregroundColor
,
child:
const
Text
(
'Z'
),
),
),
),
);
expect
(
tester
.
getSize
(
find
.
text
(
'Z'
)),
equals
(
const
Size
(
20.0
,
20.0
)));
});
}
Widget
wrap
(
{
Widget
child
})
{
...
...
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