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
7a63fac0
Unverified
Commit
7a63fac0
authored
Oct 17, 2018
by
Hans Muller
Committed by
GitHub
Oct 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TextTheme.apply() should not assume non-null TextStyle fields (#23184)
parent
a0010d39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
14 deletions
+23
-14
text_theme.dart
packages/flutter/lib/src/material/text_theme.dart
+13
-13
text_theme_test.dart
packages/flutter/test/material/text_theme_test.dart
+10
-1
No files found.
packages/flutter/lib/src/material/text_theme.dart
View file @
7a63fac0
...
...
@@ -331,7 +331,7 @@ class TextTheme extends Diagnosticable {
TextDecorationStyle
decorationStyle
,
})
{
return
TextTheme
(
display4:
display4
.
apply
(
display4:
display4
?
.
apply
(
color:
displayColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -340,7 +340,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
display3:
display3
.
apply
(
display3:
display3
?
.
apply
(
color:
displayColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -349,7 +349,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
display2:
display2
.
apply
(
display2:
display2
?
.
apply
(
color:
displayColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -358,7 +358,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
display1:
display1
.
apply
(
display1:
display1
?
.
apply
(
color:
displayColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -367,7 +367,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
headline:
headline
.
apply
(
headline:
headline
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -376,7 +376,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
title:
title
.
apply
(
title:
title
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -385,7 +385,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
subhead:
subhead
.
apply
(
subhead:
subhead
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -394,7 +394,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
body2:
body2
.
apply
(
body2:
body2
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -403,7 +403,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
body1:
body1
.
apply
(
body1:
body1
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -412,7 +412,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
caption:
caption
.
apply
(
caption:
caption
?
.
apply
(
color:
displayColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -421,7 +421,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
button:
button
.
apply
(
button:
button
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -430,7 +430,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
subtitle:
subtitle
.
apply
(
subtitle:
subtitle
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
@@ -439,7 +439,7 @@ class TextTheme extends Diagnosticable {
fontSizeFactor:
fontSizeFactor
,
fontSizeDelta:
fontSizeDelta
,
),
overline:
overline
.
apply
(
overline:
overline
?
.
apply
(
color:
bodyColor
,
decoration:
decoration
,
decorationColor:
decorationColor
,
...
...
packages/flutter/test/material/text_theme_test.dart
View file @
7a63fac0
...
...
@@ -6,11 +6,20 @@ import 'package:flutter/material.dart';
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
test
(
'TextTheme copyWith apply, merge basics'
,
()
{
test
(
'TextTheme copyWith apply, merge basics with const TextTheme()'
,
()
{
expect
(
const
TextTheme
(),
equals
(
const
TextTheme
().
copyWith
()));
expect
(
const
TextTheme
(),
equals
(
const
TextTheme
().
apply
()));
expect
(
const
TextTheme
(),
equals
(
const
TextTheme
().
merge
(
null
)));
expect
(
const
TextTheme
().
hashCode
,
equals
(
const
TextTheme
().
copyWith
().
hashCode
));
expect
(
const
TextTheme
(),
equals
(
const
TextTheme
().
copyWith
()));
});
test
(
'TextTheme copyWith apply, merge basics with Typography.black'
,
()
{
final
Typography
typography
=
Typography
(
platform:
TargetPlatform
.
android
);
expect
(
typography
.
black
,
equals
(
typography
.
black
.
copyWith
()));
expect
(
typography
.
black
,
equals
(
typography
.
black
.
apply
()));
expect
(
typography
.
black
,
equals
(
typography
.
black
.
merge
(
null
)));
expect
(
typography
.
black
,
equals
(
const
TextTheme
().
merge
(
typography
.
black
)));
expect
(
typography
.
black
,
equals
(
typography
.
black
.
merge
(
typography
.
black
)));
expect
(
typography
.
white
,
equals
(
typography
.
black
.
merge
(
typography
.
white
)));
expect
(
typography
.
black
.
hashCode
,
equals
(
typography
.
black
.
copyWith
().
hashCode
));
...
...
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