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
b0816e63
Unverified
Commit
b0816e63
authored
Sep 08, 2021
by
Zachary Anderson
Committed by
GitHub
Sep 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Implement operator = and hashcode for CupertinoThemeData (#89604)" (#89670)
This reverts commit
bf8e1270
.
parent
bf8e1270
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
140 deletions
+1
-140
text_theme.dart
packages/flutter/lib/src/cupertino/text_theme.dart
+0
-38
theme.dart
packages/flutter/lib/src/cupertino/theme.dart
+0
-65
theme_test.dart
packages/flutter/test/cupertino/theme_test.dart
+0
-35
theme_test.dart
packages/flutter/test/material/theme_test.dart
+1
-2
No files found.
packages/flutter/lib/src/cupertino/text_theme.dart
View file @
b0816e63
...
...
@@ -247,44 +247,6 @@ class CupertinoTextThemeData with Diagnosticable {
);
}
@override
bool
operator
==(
Object
other
)
{
if
(
other
.
runtimeType
!=
runtimeType
)
{
return
false
;
}
// Warning: make sure these properties are in the exact same order as in
// hashValues() and in the raw constructor and in the order of fields in
// the class and in the lerp() method.
return
other
is
CupertinoTextThemeData
&&
other
.
textStyle
==
textStyle
&&
other
.
actionTextStyle
==
actionTextStyle
&&
other
.
tabLabelTextStyle
==
tabLabelTextStyle
&&
other
.
navTitleTextStyle
==
navTitleTextStyle
&&
other
.
navLargeTitleTextStyle
==
navLargeTitleTextStyle
&&
other
.
navActionTextStyle
==
navActionTextStyle
&&
other
.
pickerTextStyle
==
pickerTextStyle
&&
other
.
dateTimePickerTextStyle
==
dateTimePickerTextStyle
;
}
@override
int
get
hashCode
{
// Warning: For the sanity of the reader, please make sure these properties
// are in the exact same order as in operator == and in the raw constructor
// and in the order of fields in the class and in the lerp() method.
final
List
<
Object
?>
values
=
<
Object
?>[
textStyle
,
actionTextStyle
,
tabLabelTextStyle
,
navTitleTextStyle
,
navLargeTitleTextStyle
,
navActionTextStyle
,
pickerTextStyle
,
dateTimePickerTextStyle
,
];
return
hashList
(
values
);
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
...
...
packages/flutter/lib/src/cupertino/theme.dart
View file @
b0816e63
...
...
@@ -290,38 +290,6 @@ class CupertinoThemeData extends NoDefaultCupertinoThemeData with Diagnosticable
);
}
@override
bool
operator
==(
Object
other
)
{
if
(
other
.
runtimeType
!=
runtimeType
)
return
false
;
// Warning: make sure these properties are in the exact same order as in
// hashValues() and in the raw constructor and in the order of fields in
// the class and in the lerp() method.
return
other
is
CupertinoThemeData
&&
other
.
brightness
==
brightness
&&
other
.
primaryColor
==
primaryColor
&&
other
.
primaryContrastingColor
==
primaryContrastingColor
&&
other
.
textTheme
==
textTheme
&&
other
.
barBackgroundColor
==
barBackgroundColor
&&
other
.
scaffoldBackgroundColor
==
scaffoldBackgroundColor
;
}
@override
int
get
hashCode
{
// Warning: For the sanity of the reader, please make sure these properties
// are in the exact same order as in operator == and in the raw constructor
// and in the order of fields in the class and in the lerp() method.
final
List
<
Object
?>
values
=
<
Object
?>[
brightness
,
primaryColor
,
primaryContrastingColor
,
textTheme
,
barBackgroundColor
,
scaffoldBackgroundColor
,
];
return
hashList
(
values
);
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
...
...
@@ -347,7 +315,6 @@ class CupertinoThemeData extends NoDefaultCupertinoThemeData with Diagnosticable
///
/// * [CupertinoThemeData], which uses reasonable default values for
/// unspecified theme properties.
@immutable
class
NoDefaultCupertinoThemeData
{
/// Creates a [NoDefaultCupertinoThemeData] styling specification.
///
...
...
@@ -475,38 +442,6 @@ class NoDefaultCupertinoThemeData {
scaffoldBackgroundColor:
scaffoldBackgroundColor
??
this
.
scaffoldBackgroundColor
,
);
}
@override
bool
operator
==(
Object
other
)
{
if
(
other
.
runtimeType
!=
runtimeType
)
return
false
;
// Warning: make sure these properties are in the exact same order as in
// hashValues() and in the raw constructor and in the order of fields in
// the class and in the lerp() method.
return
other
is
NoDefaultCupertinoThemeData
&&
other
.
brightness
==
brightness
&&
other
.
primaryColor
==
primaryColor
&&
other
.
primaryContrastingColor
==
primaryContrastingColor
&&
other
.
textTheme
==
textTheme
&&
other
.
barBackgroundColor
==
barBackgroundColor
&&
other
.
scaffoldBackgroundColor
==
scaffoldBackgroundColor
;
}
@override
int
get
hashCode
{
// Warning: For the sanity of the reader, please make sure these properties
// are in the exact same order as in operator == and in the raw constructor
// and in the order of fields in the class and in the lerp() method.
final
List
<
Object
?>
values
=
<
Object
?>[
brightness
,
primaryColor
,
primaryContrastingColor
,
textTheme
,
barBackgroundColor
,
scaffoldBackgroundColor
,
];
return
hashList
(
values
);
}
}
@immutable
...
...
packages/flutter/test/cupertino/theme_test.dart
View file @
b0816e63
...
...
@@ -206,41 +206,6 @@ void main() {
);
});
test
(
'Theme operator == returns correct value for simple cases'
,
()
{
expect
(
const
CupertinoThemeData
(),
equals
(
const
CupertinoThemeData
()));
expect
(
const
CupertinoThemeData
(
brightness:
Brightness
.
light
),
isNot
(
equals
(
const
CupertinoThemeData
(
brightness:
Brightness
.
dark
))));
expect
(
const
CupertinoThemeData
(
textTheme:
CupertinoTextThemeData
(
primaryColor:
CupertinoColors
.
activeGreen
)),
isNot
(
equals
(
const
CupertinoThemeData
(
textTheme:
CupertinoTextThemeData
(
primaryColor:
CupertinoColors
.
activeOrange
)))));
});
test
(
'hashCode behaves correctly for simple cases'
,
()
{
expect
(
const
CupertinoThemeData
().
hashCode
,
equals
(
const
CupertinoThemeData
().
hashCode
));
expect
(
const
CupertinoThemeData
(
brightness:
Brightness
.
light
).
hashCode
,
isNot
(
equals
(
const
CupertinoThemeData
(
brightness:
Brightness
.
dark
))
.
hashCode
));
expect
(
const
CupertinoThemeData
(
textTheme:
CupertinoTextThemeData
(
primaryColor:
CupertinoColors
.
activeGreen
))
.
hashCode
,
isNot
(
equals
(
const
CupertinoThemeData
(
textTheme:
CupertinoTextThemeData
(
primaryColor:
CupertinoColors
.
activeOrange
))
.
hashCode
)));
});
late
Brightness
currentBrightness
;
void
colorMatches
(
Color
?
componentColor
,
CupertinoDynamicColor
expectedDynamicColor
)
{
switch
(
currentBrightness
)
{
...
...
packages/flutter/test/material/theme_test.dart
View file @
b0816e63
...
...
@@ -591,8 +591,7 @@ void main() {
),
));
// Widget does not rebuild as theme color remains overriden.
expect
(
buildCount
,
1
);
expect
(
buildCount
,
2
);
expect
(
theme
.
primaryColor
,
CupertinoColors
.
activeOrange
);
},
);
...
...
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