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
4680ff3a
Unverified
Commit
4680ff3a
authored
Aug 06, 2020
by
Ayaan Khan
Committed by
GitHub
Aug 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: MaterialColor Swatch Map comparison (#61974)
parent
4c3a14c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
colors.dart
packages/flutter/lib/src/painting/colors.dart
+1
-1
colors_test.dart
packages/flutter/test/painting/colors_test.dart
+19
-0
No files found.
packages/flutter/lib/src/painting/colors.dart
View file @
4680ff3a
...
...
@@ -450,7 +450,7 @@ class ColorSwatch<T> extends Color {
return
false
;
return
super
==
other
&&
other
is
ColorSwatch
<
T
>
&&
other
.
_swatch
==
_swatch
;
&&
mapEquals
<
T
,
Color
>(
other
.
_swatch
,
_swatch
)
;
}
@override
...
...
packages/flutter/test/painting/colors_test.dart
View file @
4680ff3a
...
...
@@ -7,6 +7,7 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
const
double
_doubleColorPrecision
=
0.01
;
...
...
@@ -440,4 +441,22 @@ void main() {
final
Map
<
String
,
Object
>
json
=
property
.
toJsonMap
(
const
DiagnosticsSerializationDelegate
());
expect
(
json
.
containsKey
(
'valueProperties'
),
isFalse
);
});
test
(
'MaterialColor swatch comparison'
,
()
{
const
Map
<
int
,
MaterialColor
>
sampleMap
=
<
int
,
MaterialColor
>{
0
:
Colors
.
lightBlue
,
1
:
Colors
.
deepOrange
,
2
:
Colors
.
blueGrey
,
};
const
MaterialColor
first
=
MaterialColor
(
0
,
sampleMap
);
const
MaterialColor
second
=
MaterialColor
(
0
,
sampleMap
);
const
MaterialColor
third
=
MaterialColor
(
0
,
<
int
,
MaterialColor
>{
0
:
Colors
.
lightBlue
,
1
:
Colors
.
deepOrange
,
2
:
Colors
.
blueGrey
,
});
expect
(
first
==
second
,
true
);
expect
(
first
==
third
,
true
);
});
}
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