dashed container
a dashed_container plugin for flutter, easy to implement dashed line for your widgets
usage
to use plugin, just import package import 'package:dashed_container/dashed_container.dart';
example
you can check example directory to know how to use it like the demo image.
import 'package:flutter/material.dart';
import 'package:dashed_container/dashed_container.dart';
void main() => runapp(myapp());
class myapp extends statelesswidget {
@override
widget build(buildcontext context) {
return materialapp(
title: 'flutter demo',
theme: themedata(
primaryswatch: colors.blue,
),
home: myhomepage(title: 'flutter demo home page'),
);
}
}
class myhomepage extends statefulwidget {
myhomepage({key key, this.title}) : super(key: key);
final string title;
@override
_myhomepagestate createstate() => _myhomepagestate();
}
class _myhomepagestate extends state<myhomepage> {
@override
widget build(buildcontext context) {
return scaffold(
appbar: appbar(title: text(widget.title)),
body: singlechildscrollview(
child: center(
child: column(
mainaxissize: mainaxissize.max,
crossaxisalignment: crossaxisalignment.center,
mainaxisalignment: mainaxisalignment.center,
children: <widget>[
text('line container - blanklength = 0'),
_buildspace(),
dashedcontainer(
child: container(
height: 200.0,
width: 200.0,
decoration: boxdecoration(color: colors.blue, borderradius: borderradius.circular(10.0)),
),
dashcolor: colors.black,
borderradius: 10.0,
dashedlength: 30.0,
blanklength: 0.0,
strokewidth: 6.0,
),
_buildspace(),
text('dashed container - rectangle'),
_buildspace(),
dashedcontainer(
child: container(
height: 100.0,
width: 200.0,
decoration: boxdecoration(color: colors.red, borderradius: borderradius.circular(20.0)),
),
dashcolor: colors.black,
borderradius: 20.0,
dashedlength: 30.0,
blanklength: 6.0,
strokewidth: 6.0,
),
_buildspace(),
text('dashed container - circle'),
_buildspace(),
dashedcontainer(
child: container(
height: 200.0,
width: 200.0,
decoration: boxdecoration(color: colors.orange, shape: boxshape.circle),
),
dashcolor: colors.black,
boxshape: boxshape.circle,
dashedlength: 30.0,
blanklength: 6.0,
strokewidth: 6.0,
),
_buildspace(),
text('dashed container - custom'),
_buildspace(),
dashedcontainer(
child: padding(
padding: const edgeinsets.all(20.0),
child: flutterlogo(
size: 80,
),
),
dashcolor: colors.black,
boxshape: boxshape.circle,
dashedlength: 30.0,
blanklength: 6.0,
strokewidth: 6.0,
),
_buildspace(),
],
),
),
),
);
}
widget _buildspace() {
return sizedbox(height: 10.0);
}
}
Comments are closed.