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
750dbe09
Unverified
Commit
750dbe09
authored
May 18, 2020
by
Hans Muller
Committed by
GitHub
May 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ThemeData.brightness == ThemeData.colorScheme.brightness (#56956)
parent
f64f6e2b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
72 deletions
+82
-72
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+59
-69
theme_data_test.dart
packages/flutter/test/material/theme_data_test.dart
+23
-3
No files found.
packages/flutter/lib/src/material/theme_data.dart
View file @
750dbe09
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/theme_data_test.dart
View file @
750dbe09
...
...
@@ -216,7 +216,6 @@ void main() {
);
final
ThemeData
theme
=
ThemeData
.
raw
(
brightness:
Brightness
.
dark
,
visualDensity:
const
VisualDensity
(),
primaryColor:
Colors
.
black
,
primaryColorBrightness:
Brightness
.
dark
,
...
...
@@ -298,7 +297,6 @@ void main() {
);
final
ThemeData
otherTheme
=
ThemeData
.
raw
(
brightness:
Brightness
.
light
,
visualDensity:
const
VisualDensity
(),
primaryColor:
Colors
.
white
,
primaryColorBrightness:
Brightness
.
light
,
...
...
@@ -367,7 +365,6 @@ void main() {
);
final
ThemeData
themeDataCopy
=
theme
.
copyWith
(
brightness:
otherTheme
.
brightness
,
primaryColor:
otherTheme
.
primaryColor
,
primaryColorBrightness:
otherTheme
.
primaryColorBrightness
,
primaryColorLight:
otherTheme
.
primaryColorLight
,
...
...
@@ -517,4 +514,27 @@ void main() {
expect
(
lightTheme
.
toString
().
length
,
lessThan
(
200
));
});
testWidgets
(
'ThemeData brightness parameter overrides ColorScheme brightness'
,
(
WidgetTester
tester
)
async
{
const
ColorScheme
lightColors
=
ColorScheme
.
light
();
expect
(()
=>
ThemeData
(
colorScheme:
lightColors
,
brightness:
Brightness
.
dark
),
throwsAssertionError
);
});
testWidgets
(
'ThemeData.copyWith brightness parameter overrides ColorScheme brightness'
,
(
WidgetTester
tester
)
async
{
const
ColorScheme
lightColors
=
ColorScheme
.
light
();
final
ThemeData
theme
=
ThemeData
.
from
(
colorScheme:
lightColors
).
copyWith
(
brightness:
Brightness
.
dark
);
// The brightness parameter only overrides ColorScheme.brightness.
expect
(
theme
.
brightness
,
equals
(
Brightness
.
dark
));
expect
(
theme
.
colorScheme
.
brightness
,
equals
(
Brightness
.
dark
));
expect
(
theme
.
primaryColor
,
equals
(
lightColors
.
primary
));
expect
(
theme
.
accentColor
,
equals
(
lightColors
.
secondary
));
expect
(
theme
.
cardColor
,
equals
(
lightColors
.
surface
));
expect
(
theme
.
backgroundColor
,
equals
(
lightColors
.
background
));
expect
(
theme
.
canvasColor
,
equals
(
lightColors
.
background
));
expect
(
theme
.
scaffoldBackgroundColor
,
equals
(
lightColors
.
background
));
expect
(
theme
.
dialogBackgroundColor
,
equals
(
lightColors
.
background
));
expect
(
theme
.
errorColor
,
equals
(
lightColors
.
error
));
expect
(
theme
.
applyElevationOverlayColor
,
isFalse
);
});
}
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