我想在两个容器之间提供一个分隔线,我通常使用分隔线或容器边框,我可以尝试一下,但使用分隔线我无法在颤振中给出虚线虚线边框。
分隔线( 高度:1, 颜色: Colors.grey.shade200, 厚度:1, 缩进:1, 结束缩进:1, );
尝试使用下面的类作为分隔线
class SeparatorLine extends StatelessWidget {
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final boxWidth = constraints.constrainWidth();
const dashWidth = 10.0;
final dashCount = (boxWidth / (2 * dashWidth)).floor();
return Flex(
children: List.generate(dashCount, (_) {
return SizedBox(
width: dashWidth,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.grey),
),
);
}),
mainAxisAlignment: MainAxisAlignment.spaceBetween,
direction: Axis.horizontal,
);
},
);
}
}