小编Ana*_*man的帖子

如何在 Flutter 中的行小部件内的容器上添加边框?

        Container(
    //            decoration: BoxDecoration(
    //              border: Border.all(color: Colors.black45),
    //              borderRadius: BorderRadius.circular(8.0),
    //            ),
                child: Row(
                  children: <Widget>[
                    Container(
                      child: Text("hi"),
                      margin : EdgeInsets.fromLTRB(20, 8, 8, 16),
                      width: MediaQuery.of(context).size.width *0.42,
                      height: 90,
                      color: Colors.black12,
                    ),

                    Container(
                      child: Text("Hi"),
                      margin: EdgeInsets.fromLTRB(16, 8, 8, 16),
                      width: MediaQuery.of(context).size.width * 0.42 ,
                      height: 90,
                      color: Colors.black12,
                    )
                  ],
                ),
              ),
Run Code Online (Sandbox Code Playgroud)

我可以在外部容器上使用 Box 装饰添加边框,但当我尝试在内部容器上执行相同操作时,它会引发错误。问题是什么以及如何解决?

layout border widget flutter flutter-layout

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

border ×1

flutter ×1

flutter-layout ×1

layout ×1

widget ×1