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
80ee2ff0
Commit
80ee2ff0
authored
Jan 06, 2020
by
神楽坂花火
Committed by
Flutter GitHub Bot
Jan 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `Border.symmetric` constructor (#47523)
parent
7fee0c52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
box_border.dart
packages/flutter/lib/src/painting/box_border.dart
+13
-0
border_test.dart
packages/flutter/test/painting/border_test.dart
+12
-0
No files found.
packages/flutter/lib/src/painting/box_border.dart
View file @
80ee2ff0
...
...
@@ -326,6 +326,19 @@ class Border extends BoxBorder {
bottom
=
side
,
left
=
side
;
/// Creates a border with symmetrical vertical and horizontal sides.
///
/// All arguments default to [BorderSide.none] and must not be null.
const
Border
.
symmetric
({
BorderSide
vertical
=
BorderSide
.
none
,
BorderSide
horizontal
=
BorderSide
.
none
,
})
:
assert
(
vertical
!=
null
),
assert
(
horizontal
!=
null
),
left
=
horizontal
,
top
=
vertical
,
right
=
horizontal
,
bottom
=
vertical
;
/// A uniform border with all sides the same color and width.
///
/// The sides default to black solid borders, one logical pixel wide.
...
...
packages/flutter/test/painting/border_test.dart
View file @
80ee2ff0
...
...
@@ -23,6 +23,18 @@ void main() {
expect
(
border
.
bottom
,
same
(
side
));
});
test
(
'Border.symmetric constructor'
,
()
{
expect
(()
=>
Border
.
symmetric
(
vertical:
nonconst
(
null
)),
throwsAssertionError
);
expect
(()
=>
Border
.
symmetric
(
horizontal:
nonconst
(
null
)),
throwsAssertionError
);
const
BorderSide
side1
=
BorderSide
(
color:
Color
(
0xFFFFFFFF
));
const
BorderSide
side2
=
BorderSide
(
color:
Color
(
0xFF000000
));
const
Border
border
=
Border
.
symmetric
(
vertical:
side1
,
horizontal:
side2
);
expect
(
border
.
left
,
same
(
side2
));
expect
(
border
.
top
,
same
(
side1
));
expect
(
border
.
right
,
same
(
side2
));
expect
(
border
.
bottom
,
same
(
side1
));
});
test
(
'Border.merge'
,
()
{
const
BorderSide
magenta3
=
BorderSide
(
color:
Color
(
0xFFFF00FF
),
width:
3.0
);
const
BorderSide
magenta6
=
BorderSide
(
color:
Color
(
0xFFFF00FF
),
width:
6.0
);
...
...
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