f dotted line
fdottedline provides developers with the ability to create dashed lines. it also supports creating a dashed border for a widget. support for controlling the thickness, spacing, and corners of the dotted border.
✨ features
- supports dotted lines in both horizontal and vertical directions
- support to create dashed shapes
- provide super easy way to add dotted border to widget
- support creating flexible dotted corner effects
⚙️ parameter & interface
�� fdottedline param
param | type | necessary | default | desc |
---|---|---|---|---|
color | color | false | colors.black |
dotted line color |
height | double | false | null | height. if there is only [height] and no [width], you will get a dotted line in the vertical direction.if there are both [width] and [height], you will get a dotted border. |
width | double | false | null | width. if there is only [width] and no [height], you will get a dotted line in the horizontal direction.if there are both [width] and [height], you will get a dotted border. |
strokewidth | double | false | 1.0 | the thickness of the dotted line |
dottedlength | double | false | 5.0 | the length of each small segment in the dotted line |
space | double | false | 3.0 | the distance between each segment in the dotted line |
corner | fdottedlinecorner | false | null | the corners of the dotted border. see [fdottedlinecorner] for details |
child | widget | false | null | if [child] is set, [fdottedline] will serve as the dotted border of [child].at this time, [width] and [height] will no longer be valid. |
�� demo
�� horizontal demo
fdottedline(
color: color,
width: 160.0,
strokewidth: 2.0,
dottedlength: 10.0,
space: 2.0,
)
it is very simple to create a horizontal dotted line through fdottedline.
the developer only needs to set the width
parameter, but not the height
parameter, which is all the developer needs to do for this.
if you want to control the thickness of the dotted line, set strokewidth
.
through the dottedlength
and space
parameters, developers can freely control the length of each small segment in the dotted line and the distance between them.
⛓ vertical demo
fdottedline(
color: color,
height: 160.0,
strokewidth: 2.0,
dottedlength: 10.0,
space: 2.0,
)
if you want to create a dotted line in the vertical direction, it is also very simple.
developers only need to assign a value to height
and leave width
to be null
or 0.
�� dotted shape demo
fdottedline(
color: colors.lightblue[600],
height: 100.0,
width: 50,
strokewidth: 2.0,
dottedlength: 10.0,
space: 2.0,
)
fdottedline can not only create simple dotted lines ��.
when developers assign values to both width and height, they will be able to get a dotted rectangle! it’s incredible.
�� corner demo
fdottedline(
color: colors.lightblue[600],
height: 70.0,
width: 70.0,
strokewidth: 2.0,
dottedlength: 10.0,
space: 2.0,
/// set corner
corner: fdottedlinecorner.all(50),
)
with fdottedline, developers can even create corner effects of dashed rectangles. for example: dotted rounded rectangle, dotted round…
�� child demo
fdottedline(
color: color,
strokewidth: 2.0,
dottedlength: 8.0,
space: 3.0,
corner: fdottedlinecorner.all(6.0),
/// add widget
child: container(
color: colors.blue[100],
width: 130,
height: 70,
alignment: alignment.center,
child: text("0873"),
),
)
in the past, it was very difficult to add a dotted border to a widget.
because the official did not provide us with a good solution. but now, fdottedline makes things easier than ever. developers only need to use their widget as a child of fdottedline.
/// #1
fdottedline(
color: color,
strokewidth: 2.0,
dottedlength: 8.0,
space: 3.0,
corner: fdottedlinecorner.all(75.0),
child: container(
width: 130,
height: 130,
alignment: alignment.center,
/// #2
child: fdottedline(
color: color,
strokewidth: 2.0,
dottedlength: 8.0,
space: 3.0,
corner: fdottedlinecorner.all(20.0),
child: container(
width: 43.0,
height: 43.0,
color: colors.grey[900],
),
),
),
)
this also means that through the nesting of fdottedline, many super interesting views can be created.
�� more demo
see what fdottedline can do!
when there is such a simple way to create a dotted line, developers can freely build more wonderful views.
more about the application of fdottedline , look forward to the exploration of developers ��.
Comments are closed.