【问题标题】:Flutter how can I fill one edge of a container ? [ Toast notificaton container]Flutter 如何填充容器的一个边缘? [ Toast 通知容器]
【发布时间】:2021-09-17 11:29:40
【问题描述】:

我想要做的是跟随容器的左角。

我尝试将另一个绿色容器放入其中,但它不符合原始容器的边框半径。

【问题讨论】:

    标签: flutter containers toast


    【解决方案1】:

    像这样?

    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"),
                    ],
                  ),
                ],
              ),
            ),
          ],
        ),
      )
    

    【讨论】:

    • 谢谢,这正是我想要的!
    【解决方案2】:

    您可以通过在Border 中设置BorderSide 来实现。

    Container(
                height: 100,
                width: 400,
                decoration: BoxDecoration(
                  color: Colors.green[200],
                  border: const Border(
                    left: BorderSide(
                      width: 16.0,
                      color: Colors.green,
                    ),
                  ),
                ),
              ),
    

    【讨论】:

      猜你喜欢
      • 2020-07-18
      • 2020-11-08
      • 1970-01-01
      • 2020-08-02
      • 1970-01-01
      • 2013-05-10
      • 2021-07-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多