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
19ff5969
Unverified
Commit
19ff5969
authored
Apr 08, 2020
by
Gary Qian
Committed by
GitHub
Apr 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing properties to TextStyle.apply (#54305)
parent
cf5e4b54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
4 deletions
+31
-4
text_style.dart
packages/flutter/lib/src/painting/text_style.dart
+9
-4
theme_test.dart
packages/flutter/test/material/theme_test.dart
+5
-0
text_style_test.dart
packages/flutter/test/painting/text_style_test.dart
+17
-0
No files found.
packages/flutter/lib/src/painting/text_style.dart
View file @
19ff5969
...
...
@@ -794,12 +794,17 @@ class TextStyle with Diagnosticable {
double
fontSizeFactor
=
1.0
,
double
fontSizeDelta
=
0.0
,
int
fontWeightDelta
=
0
,
FontStyle
fontStyle
,
double
letterSpacingFactor
=
1.0
,
double
letterSpacingDelta
=
0.0
,
double
wordSpacingFactor
=
1.0
,
double
wordSpacingDelta
=
0.0
,
double
heightFactor
=
1.0
,
double
heightDelta
=
0.0
,
TextBaseline
textBaseline
,
Locale
locale
,
List
<
ui
.
Shadow
>
shadows
,
List
<
ui
.
FontFeature
>
fontFeatures
,
})
{
assert
(
fontSizeFactor
!=
null
);
assert
(
fontSizeDelta
!=
null
);
...
...
@@ -834,16 +839,16 @@ class TextStyle with Diagnosticable {
fontFamilyFallback:
fontFamilyFallback
??
this
.
fontFamilyFallback
,
fontSize:
fontSize
==
null
?
null
:
fontSize
*
fontSizeFactor
+
fontSizeDelta
,
fontWeight:
fontWeight
==
null
?
null
:
FontWeight
.
values
[(
fontWeight
.
index
+
fontWeightDelta
).
clamp
(
0
,
FontWeight
.
values
.
length
-
1
)
as
int
],
fontStyle:
fontStyle
,
fontStyle:
fontStyle
??
this
.
fontStyle
,
letterSpacing:
letterSpacing
==
null
?
null
:
letterSpacing
*
letterSpacingFactor
+
letterSpacingDelta
,
wordSpacing:
wordSpacing
==
null
?
null
:
wordSpacing
*
wordSpacingFactor
+
wordSpacingDelta
,
textBaseline:
textBaseline
,
height:
height
==
null
?
null
:
height
*
heightFactor
+
heightDelta
,
locale:
locale
,
locale:
locale
??
this
.
locale
,
foreground:
foreground
,
background:
background
,
shadows:
shadows
,
fontFeatures:
fontFeatures
,
shadows:
shadows
??
this
.
shadows
,
fontFeatures:
fontFeatures
??
this
.
fontFeatures
,
decoration:
decoration
??
this
.
decoration
,
decorationColor:
decorationColor
??
this
.
decorationColor
,
decorationStyle:
decorationStyle
??
this
.
decorationStyle
,
...
...
packages/flutter/test/material/theme_test.dart
View file @
19ff5969
...
...
@@ -774,12 +774,17 @@ class _TextStyleProxy implements TextStyle {
double
fontSizeFactor
=
1.0
,
double
fontSizeDelta
=
0.0
,
int
fontWeightDelta
=
0
,
FontStyle
fontStyle
,
double
letterSpacingFactor
=
1.0
,
double
letterSpacingDelta
=
0.0
,
double
wordSpacingFactor
=
1.0
,
double
wordSpacingDelta
=
0.0
,
double
heightFactor
=
1.0
,
double
heightDelta
=
0.0
,
TextBaseline
textBaseline
,
Locale
locale
,
List
<
ui
.
Shadow
>
shadows
,
List
<
ui
.
FontFeature
>
fontFeatures
,
})
{
throw
UnimplementedError
();
}
...
...
packages/flutter/test/painting/text_style_test.dart
View file @
19ff5969
...
...
@@ -233,6 +233,11 @@ void main() {
final
ui
.
TextStyle
uis1
=
s2
.
getTextStyle
();
expect
(
uis1
.
toString
(),
'TextStyle(color: unspecified, decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, decorationThickness: unspecified, fontWeight: unspecified, fontStyle: unspecified, textBaseline: unspecified, fontFamily: foo, fontFamilyFallback: [Roboto, test], fontSize: unspecified, letterSpacing: unspecified, wordSpacing: unspecified, height: unspecified, locale: unspecified, background: unspecified, foreground: unspecified, shadows: unspecified, fontFeatures: unspecified)'
);
expect
(
s2
.
apply
().
fontFamily
,
'foo'
);
expect
(
s2
.
apply
().
fontFamilyFallback
,
const
<
String
>[
'Roboto'
,
'test'
]);
expect
(
s2
.
apply
(
fontFamily:
'bar'
).
fontFamily
,
'bar'
);
expect
(
s2
.
apply
(
fontFamilyFallback:
const
<
String
>[
'Banana'
]).
fontFamilyFallback
,
const
<
String
>[
'Banana'
]);
},
skip:
isBrowser
);
test
(
'TextStyle.debugLabel'
,
()
{
...
...
@@ -367,4 +372,16 @@ void main() {
expect
(
paragraphStyle0
==
paragraphStyle1
,
true
);
});
test
(
'TextStyle apply'
,
()
{
const
TextStyle
style
=
TextStyle
(
fontSize:
10
);
expect
(
style
.
apply
().
shadows
,
isNull
);
expect
(
style
.
apply
(
shadows:
const
<
ui
.
Shadow
>[
ui
.
Shadow
(
blurRadius:
2.0
)]).
shadows
,
const
<
ui
.
Shadow
>[
ui
.
Shadow
(
blurRadius:
2.0
)]);
expect
(
style
.
apply
().
fontStyle
,
isNull
);
expect
(
style
.
apply
(
fontStyle:
FontStyle
.
italic
).
fontStyle
,
FontStyle
.
italic
);
expect
(
style
.
apply
().
locale
,
isNull
);
expect
(
style
.
apply
(
locale:
const
Locale
.
fromSubtags
(
languageCode:
'es'
)).
locale
,
const
Locale
.
fromSubtags
(
languageCode:
'es'
));
expect
(
style
.
apply
().
fontFeatures
,
isNull
);
expect
(
style
.
apply
(
fontFeatures:
const
<
ui
.
FontFeature
>[
ui
.
FontFeature
.
enable
(
'test'
)]).
fontFeatures
,
const
<
ui
.
FontFeature
>[
ui
.
FontFeature
.
enable
(
'test'
)]);
});
}
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