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
f10965f2
Unverified
Commit
f10965f2
authored
Jan 11, 2023
by
Rydmike
Committed by
GitHub
Jan 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: UnderlineInputBorder hashCode and equality by including borderRadius (#118284)
parent
957781a1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
10 deletions
+68
-10
input_border.dart
packages/flutter/lib/src/material/input_border.dart
+4
-3
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+64
-7
No files found.
packages/flutter/lib/src/material/input_border.dart
View file @
f10965f2
...
...
@@ -259,12 +259,13 @@ class UnderlineInputBorder extends InputBorder {
if
(
other
.
runtimeType
!=
runtimeType
)
{
return
false
;
}
return
other
is
InputBorder
&&
other
.
borderSide
==
borderSide
;
return
other
is
UnderlineInputBorder
&&
other
.
borderSide
==
borderSide
&&
other
.
borderRadius
==
borderRadius
;
}
@override
int
get
hashCode
=>
borderSide
.
hashCode
;
int
get
hashCode
=>
Object
.
hash
(
borderSide
,
borderRadius
)
;
}
/// Draws a rounded rectangle around an [InputDecorator]'s container.
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
f10965f2
...
...
@@ -5338,11 +5338,40 @@ void main() {
gapPadding:
32.0
,
));
expect
(
outlineInputBorder
,
isNot
(
const
OutlineInputBorder
()));
expect
(
outlineInputBorder
,
isNot
(
const
OutlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
red
),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
9.0
)),
gapPadding:
32.0
,
)));
expect
(
outlineInputBorder
,
isNot
(
const
OutlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10.0
)),
gapPadding:
32.0
,
)));
expect
(
outlineInputBorder
,
isNot
(
const
OutlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
9.0
)),
gapPadding:
33.0
,
)));
// UnderlineInputBorder's equality is defined only by the borderSide
const
UnderlineInputBorder
underlineInputBorder
=
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
));
expect
(
underlineInputBorder
,
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
)));
// UnderlineInputBorder's equality is defined by the borderSide and borderRadius
const
UnderlineInputBorder
underlineInputBorder
=
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5.0
),
topRight:
Radius
.
circular
(
5.0
)),
);
expect
(
underlineInputBorder
,
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5.0
),
topRight:
Radius
.
circular
(
5.0
)),
));
expect
(
underlineInputBorder
,
isNot
(
const
UnderlineInputBorder
()));
expect
(
underlineInputBorder
,
isNot
(
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
red
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5.0
),
topRight:
Radius
.
circular
(
5.0
)),
)));
expect
(
underlineInputBorder
,
isNot
(
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
6.0
),
topRight:
Radius
.
circular
(
6.0
)),
)));
});
test
(
'InputBorder hashCodes'
,
()
{
...
...
@@ -5358,11 +5387,39 @@ void main() {
gapPadding:
32.0
,
).
hashCode
);
expect
(
outlineInputBorder
.
hashCode
,
isNot
(
const
OutlineInputBorder
().
hashCode
));
expect
(
outlineInputBorder
.
hashCode
,
isNot
(
const
OutlineInputBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
9.0
)),
borderSide:
BorderSide
(
color:
Colors
.
red
),
gapPadding:
32.0
,
).
hashCode
));
expect
(
outlineInputBorder
.
hashCode
,
isNot
(
const
OutlineInputBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
10.0
)),
borderSide:
BorderSide
(
color:
Colors
.
blue
),
gapPadding:
32.0
,
).
hashCode
));
expect
(
outlineInputBorder
.
hashCode
,
isNot
(
const
OutlineInputBorder
(
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
9.0
)),
borderSide:
BorderSide
(
color:
Colors
.
blue
),
gapPadding:
33.0
,
).
hashCode
));
// UnderlineInputBorder's hashCode is defined only by the borderSide
const
UnderlineInputBorder
underlineInputBorder
=
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
));
expect
(
underlineInputBorder
.
hashCode
,
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
)).
hashCode
);
expect
(
underlineInputBorder
.
hashCode
,
isNot
(
const
UnderlineInputBorder
().
hashCode
));
// UnderlineInputBorder's hashCode is defined by the borderSide and borderRadius
const
UnderlineInputBorder
underlineInputBorder
=
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5.0
),
topRight:
Radius
.
circular
(
5.0
)),
);
expect
(
underlineInputBorder
.
hashCode
,
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5.0
),
topRight:
Radius
.
circular
(
5.0
)),
).
hashCode
);
expect
(
underlineInputBorder
.
hashCode
,
isNot
(
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
red
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
5.0
),
topRight:
Radius
.
circular
(
5.0
)),
).
hashCode
));
expect
(
underlineInputBorder
.
hashCode
,
isNot
(
const
UnderlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
),
borderRadius:
BorderRadius
.
only
(
topLeft:
Radius
.
circular
(
6.0
),
topRight:
Radius
.
circular
(
6.0
)),
).
hashCode
));
});
testWidgets
(
'InputDecorationTheme implements debugFillDescription'
,
(
WidgetTester
tester
)
async
{
...
...
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