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
b1e1dd68
Unverified
Commit
b1e1dd68
authored
Jul 12, 2021
by
Payam Zahedi
Committed by
GitHub
Jul 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
borderRadius param updated in copyWith functions (#85822)
parent
7a0b4669
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
4 deletions
+75
-4
beveled_rectangle_border.dart
...es/flutter/lib/src/painting/beveled_rectangle_border.dart
+1
-1
continuous_rectangle_border.dart
...flutter/lib/src/painting/continuous_rectangle_border.dart
+1
-1
rounded_rectangle_border.dart
...es/flutter/lib/src/painting/rounded_rectangle_border.dart
+2
-2
beveled_rectangle_border_test.dart
.../flutter/test/painting/beveled_rectangle_border_test.dart
+32
-0
continuous_rectangle_border_test.dart
...utter/test/painting/continuous_rectangle_border_test.dart
+32
-0
rounded_rectangle_border_test.dart
.../flutter/test/painting/rounded_rectangle_border_test.dart
+7
-0
No files found.
packages/flutter/lib/src/painting/beveled_rectangle_border.dart
View file @
b1e1dd68
...
...
@@ -82,7 +82,7 @@ class BeveledRectangleBorder extends OutlinedBorder {
/// Returns a copy of this RoundedRectangleBorder with the given fields
/// replaced with the new values.
@override
BeveledRectangleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
?
borderRadius
})
{
BeveledRectangleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
Geometry
?
borderRadius
})
{
return
BeveledRectangleBorder
(
side:
side
??
this
.
side
,
borderRadius:
borderRadius
??
this
.
borderRadius
,
...
...
packages/flutter/lib/src/painting/continuous_rectangle_border.dart
View file @
b1e1dd68
...
...
@@ -134,7 +134,7 @@ class ContinuousRectangleBorder extends OutlinedBorder {
}
@override
ContinuousRectangleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
?
borderRadius
})
{
ContinuousRectangleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
Geometry
?
borderRadius
})
{
return
ContinuousRectangleBorder
(
side:
side
??
this
.
side
,
borderRadius:
borderRadius
??
this
.
borderRadius
,
...
...
packages/flutter/lib/src/painting/rounded_rectangle_border.dart
View file @
b1e1dd68
...
...
@@ -93,7 +93,7 @@ class RoundedRectangleBorder extends OutlinedBorder {
/// Returns a copy of this RoundedRectangleBorder with the given fields
/// replaced with the new values.
@override
RoundedRectangleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
?
borderRadius
})
{
RoundedRectangleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
Geometry
?
borderRadius
})
{
return
RoundedRectangleBorder
(
side:
side
??
this
.
side
,
borderRadius:
borderRadius
??
this
.
borderRadius
,
...
...
@@ -272,7 +272,7 @@ class _RoundedRectangleToCircleBorder extends OutlinedBorder {
}
@override
_RoundedRectangleToCircleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
?
borderRadius
,
double
?
circleness
})
{
_RoundedRectangleToCircleBorder
copyWith
({
BorderSide
?
side
,
BorderRadius
Geometry
?
borderRadius
,
double
?
circleness
})
{
return
_RoundedRectangleToCircleBorder
(
side:
side
??
this
.
side
,
borderRadius:
borderRadius
??
this
.
borderRadius
,
...
...
packages/flutter/test/painting/beveled_rectangle_border_test.dart
View file @
b1e1dd68
...
...
@@ -19,10 +19,16 @@ void main() {
expect
(
const
BeveledRectangleBorder
().
hashCode
,
const
BeveledRectangleBorder
().
copyWith
().
hashCode
);
const
BorderSide
side
=
BorderSide
(
width:
10.0
,
color:
Color
(
0xff123456
));
const
BorderRadius
radius
=
BorderRadius
.
all
(
Radius
.
circular
(
16.0
));
const
BorderRadiusDirectional
directionalRadius
=
BorderRadiusDirectional
.
all
(
Radius
.
circular
(
16.0
));
expect
(
const
BeveledRectangleBorder
().
copyWith
(
side:
side
,
borderRadius:
radius
),
const
BeveledRectangleBorder
(
side:
side
,
borderRadius:
radius
),
);
expect
(
const
BeveledRectangleBorder
().
copyWith
(
side:
side
,
borderRadius:
directionalRadius
),
const
BeveledRectangleBorder
(
side:
side
,
borderRadius:
directionalRadius
),
);
});
test
(
'BeveledRectangleBorder scale and lerp'
,
()
{
...
...
@@ -74,4 +80,30 @@ void main() {
expect
(
border
.
getInnerPath
(
rect
),
looksLikeRect
);
});
test
(
'BeveledRectangleBorder non-zero BorderRadiusDirectional'
,
()
{
const
Rect
rect
=
Rect
.
fromLTRB
(
10.0
,
20.0
,
30.0
,
40.0
);
final
Matcher
looksLikeRectLtr
=
isPathThat
(
includes:
const
<
Offset
>[
Offset
(
15.0
,
25.0
),
Offset
(
20.0
,
30.0
)],
excludes:
const
<
Offset
>[
Offset
(
10.0
,
20.0
),
Offset
(
10.0
,
40.0
)],
);
const
BeveledRectangleBorder
border
=
BeveledRectangleBorder
(
borderRadius:
BorderRadiusDirectional
.
only
(
topStart:
Radius
.
circular
(
5.0
),
bottomStart:
Radius
.
circular
(
5.0
),
),
);
// Test ltr situation
expect
(
border
.
getOuterPath
(
rect
,
textDirection:
TextDirection
.
ltr
),
looksLikeRectLtr
);
expect
(
border
.
getInnerPath
(
rect
,
textDirection:
TextDirection
.
ltr
),
looksLikeRectLtr
);
final
Matcher
looksLikeRectRtl
=
isPathThat
(
includes:
const
<
Offset
>[
Offset
(
25.0
,
35.0
),
Offset
(
25.0
,
25.0
)],
excludes:
const
<
Offset
>[
Offset
(
30.0
,
20.0
),
Offset
(
30.0
,
40.0
)],
);
// Test Rtl situation
expect
(
border
.
getOuterPath
(
rect
,
textDirection:
TextDirection
.
rtl
),
looksLikeRectRtl
);
expect
(
border
.
getInnerPath
(
rect
,
textDirection:
TextDirection
.
rtl
),
looksLikeRectRtl
);
});
}
packages/flutter/test/painting/continuous_rectangle_border_test.dart
View file @
b1e1dd68
...
...
@@ -19,10 +19,17 @@ void main() {
expect
(
const
ContinuousRectangleBorder
().
hashCode
,
const
ContinuousRectangleBorder
().
copyWith
().
hashCode
);
const
BorderSide
side
=
BorderSide
(
width:
10.0
,
color:
Color
(
0xff123456
));
const
BorderRadius
radius
=
BorderRadius
.
all
(
Radius
.
circular
(
16.0
));
const
BorderRadiusDirectional
directionalRadius
=
BorderRadiusDirectional
.
all
(
Radius
.
circular
(
16.0
));
expect
(
const
ContinuousRectangleBorder
().
copyWith
(
side:
side
,
borderRadius:
radius
),
const
ContinuousRectangleBorder
(
side:
side
,
borderRadius:
radius
),
);
expect
(
const
ContinuousRectangleBorder
().
copyWith
(
side:
side
,
borderRadius:
directionalRadius
),
const
ContinuousRectangleBorder
(
side:
side
,
borderRadius:
directionalRadius
),
);
});
test
(
'ContinuousRectangleBorder scale and lerp'
,
()
{
...
...
@@ -73,6 +80,31 @@ void main() {
expect
(
border
.
getInnerPath
(
rect
),
looksLikeRect
);
});
test
(
'ContinuousRectangleBorder non-zero BorderRadiusDirectional'
,
()
{
const
Rect
rect
=
Rect
.
fromLTRB
(
10.0
,
20.0
,
30.0
,
40.0
);
final
Matcher
looksLikeRectLtr
=
isPathThat
(
includes:
const
<
Offset
>[
Offset
(
15.0
,
25.0
),
Offset
(
20.0
,
30.0
)],
excludes:
const
<
Offset
>[
Offset
(
10.0
,
20.0
),
Offset
(
10.0
,
40.0
)],
);
const
ContinuousRectangleBorder
border
=
ContinuousRectangleBorder
(
borderRadius:
BorderRadiusDirectional
.
only
(
topStart:
Radius
.
circular
(
5.0
),
bottomStart:
Radius
.
circular
(
5.0
),
),
);
expect
(
border
.
getOuterPath
(
rect
,
textDirection:
TextDirection
.
ltr
),
looksLikeRectLtr
);
expect
(
border
.
getInnerPath
(
rect
,
textDirection:
TextDirection
.
ltr
),
looksLikeRectLtr
);
final
Matcher
looksLikeRectRtl
=
isPathThat
(
includes:
const
<
Offset
>[
Offset
(
25.0
,
35.0
),
Offset
(
25.0
,
25.0
)],
excludes:
const
<
Offset
>[
Offset
(
30.0
,
20.0
),
Offset
(
30.0
,
40.0
)],
);
expect
(
border
.
getOuterPath
(
rect
,
textDirection:
TextDirection
.
rtl
),
looksLikeRectRtl
);
expect
(
border
.
getInnerPath
(
rect
,
textDirection:
TextDirection
.
rtl
),
looksLikeRectRtl
);
});
testWidgets
(
'Golden test even radii'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
RepaintBoundary
(
child:
Material
(
...
...
packages/flutter/test/painting/rounded_rectangle_border_test.dart
View file @
b1e1dd68
...
...
@@ -20,10 +20,17 @@ void main() {
expect
(
const
RoundedRectangleBorder
().
hashCode
,
const
RoundedRectangleBorder
().
copyWith
().
hashCode
);
const
BorderSide
side
=
BorderSide
(
width:
10.0
,
color:
Color
(
0xff123456
));
const
BorderRadius
radius
=
BorderRadius
.
all
(
Radius
.
circular
(
16.0
));
const
BorderRadiusDirectional
directionalRadius
=
BorderRadiusDirectional
.
all
(
Radius
.
circular
(
16.0
));
expect
(
const
RoundedRectangleBorder
().
copyWith
(
side:
side
,
borderRadius:
radius
),
const
RoundedRectangleBorder
(
side:
side
,
borderRadius:
radius
),
);
expect
(
const
RoundedRectangleBorder
().
copyWith
(
side:
side
,
borderRadius:
directionalRadius
),
const
RoundedRectangleBorder
(
side:
side
,
borderRadius:
directionalRadius
),
);
});
test
(
'RoundedRectangleBorder'
,
()
{
...
...
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