Flutter 如何填充容器的一个边缘? [吐司通知容器]
Flutter how can I fill one edge of a container ? [ Toast notificaton container]
我想做的是跟随容器中的左角。
我尝试将另一个绿色容器放入其中,但它不适合原始容器的边界半径。
像这样?
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(16)),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: 10,
height: 100,
decoration: BoxDecoration(
color: Colors.green,
),
),
Container(
width: 390,
height: 100,
decoration: BoxDecoration(
color: Colors.greenAccent,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.check_circle),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("YOUR MAIN TEXT"),
Text("YOUR TEXT"),
],
),
],
),
),
],
),
)
您可以通过在 Border
中设置 BorderSide
来实现它。
Container(
height: 100,
width: 400,
decoration: BoxDecoration(
color: Colors.green[200],
border: const Border(
left: BorderSide(
width: 16.0,
color: Colors.green,
),
),
),
),
我想做的是跟随容器中的左角。
我尝试将另一个绿色容器放入其中,但它不适合原始容器的边界半径。
像这样?
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(16)),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: 10,
height: 100,
decoration: BoxDecoration(
color: Colors.green,
),
),
Container(
width: 390,
height: 100,
decoration: BoxDecoration(
color: Colors.greenAccent,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.check_circle),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("YOUR MAIN TEXT"),
Text("YOUR TEXT"),
],
),
],
),
),
],
),
)
您可以通过在 Border
中设置 BorderSide
来实现它。
Container(
height: 100,
width: 400,
decoration: BoxDecoration(
color: Colors.green[200],
border: const Border(
left: BorderSide(
width: 16.0,
color: Colors.green,
),
),
),
),