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
64029ba6
Unverified
Commit
64029ba6
authored
Oct 04, 2018
by
jslavitz
Committed by
GitHub
Oct 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vertical divider (#22641)
* Vertical divider bug fix and additional cleaning.
parent
4a13be41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
34 deletions
+26
-34
divider.dart
packages/flutter/lib/src/material/divider.dart
+2
-34
divider_test.dart
packages/flutter/test/material/divider_test.dart
+24
-0
No files found.
packages/flutter/lib/src/material/divider.dart
View file @
64029ba6
...
@@ -170,49 +170,17 @@ class VerticalDivider extends StatelessWidget {
...
@@ -170,49 +170,17 @@ class VerticalDivider extends StatelessWidget {
/// ```
/// ```
final
Color
color
;
final
Color
color
;
/// Computes the [BorderSide] that represents a divider of the specified
/// color, or, if there is no specified color, of the default
/// [ThemeData.dividerColor] specified in the ambient [Theme].
///
/// The `width` argument can be used to override the default width of the
/// divider border, which is usually 0.0 (a hairline border).
///
/// ## Sample code
///
/// This example uses this method to create a box that has a divider above and
/// below it. This is sometimes useful with lists, for instance, to separate a
/// scrollable section from the rest of the interface.
///
/// ```dart
/// DecoratedBox(
/// decoration: BoxDecoration(
/// border: Border(
/// top: Divider.createBorderSide(context),
/// bottom: Divider.createBorderSide(context),
/// ),
/// ),
/// // child: ...
/// )
/// ```
static
BorderSide
createBorderSide
(
BuildContext
context
,
{
Color
color
,
double
width
=
0.0
})
{
assert
(
width
!=
null
);
return
BorderSide
(
color:
color
??
Theme
.
of
(
context
).
dividerColor
,
width:
width
,
);
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
SizedBox
(
return
SizedBox
(
width:
width
,
width:
width
,
child:
Center
(
child:
Center
(
child:
Container
(
child:
Container
(
height
:
0.0
,
width
:
0.0
,
margin:
EdgeInsetsDirectional
.
only
(
start:
indent
),
margin:
EdgeInsetsDirectional
.
only
(
start:
indent
),
decoration:
BoxDecoration
(
decoration:
BoxDecoration
(
border:
Border
(
border:
Border
(
left:
createBorderSide
(
context
,
color:
color
),
left:
Divider
.
createBorderSide
(
context
,
color:
color
),
),
),
),
),
),
),
...
...
packages/flutter/test/material/divider_test.dart
View file @
64029ba6
...
@@ -35,4 +35,28 @@ void main() {
...
@@ -35,4 +35,28 @@ void main() {
expect
(
box
.
size
.
width
,
16.0
);
expect
(
box
.
size
.
width
,
16.0
);
expect
(
find
.
byType
(
VerticalDivider
),
paints
..
path
(
strokeWidth:
0.0
));
expect
(
find
.
byType
(
VerticalDivider
),
paints
..
path
(
strokeWidth:
0.0
));
});
});
testWidgets
(
'Vertical Divider Test 2'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
Container
(
height:
24.0
,
child:
Row
(
children:
const
<
Widget
>[
Text
(
'Hey.'
),
VerticalDivider
(),
],
),
),
),
),
);
final
RenderBox
box
=
tester
.
firstRenderObject
(
find
.
byType
(
VerticalDivider
));
final
RenderBox
containerBox
=
tester
.
firstRenderObject
(
find
.
byType
(
Container
).
last
);
expect
(
box
.
size
.
width
,
16.0
);
expect
(
containerBox
.
size
.
height
,
600.0
);
expect
(
find
.
byType
(
VerticalDivider
),
paints
..
path
(
strokeWidth:
0.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