【问题标题】:Flutter how to make container like below with divider lineFlutter 如何使用分隔线制作如下所示的容器
【发布时间】:2022-11-17 16:55:21
【问题描述】:

我想制作这样的容器,但无法获得我想要的结果。

下面是我的代码,我尝试像图像一样制作,但我无法用分隔线分隔颜色

enter image description here

Expanded(
                            child:
                              Container(
                                padding: EdgeInsets.only(left: 20,top: 5),
                                decoration: BoxDecoration(
                                    border: Border.all(
                                        color: Colors.black, width: 1.0),
                                    borderRadius: const BorderRadius.all(
                                      Radius.circular(32),
                                    )),
                                height: 150,
                                width: 500,
                                child: Column(
                                  children: [Container(
                                    child:Column(
                                      children: [Container(
                                        child: Text("TOTAL: GGWP  " +
                                            totalCart.toString()+ " ITEMS",style:
                                        TextStyle(fontSize: 40,color: Colors.black,fontWeight: FontWeight.w400)),

                                      ),  Text("TOTAL: GGWP  " +
                                          totalCart.toString()+ " ITEMS",style:
                                      TextStyle(fontSize: 40,color: Colors.black,fontWeight: FontWeight.w400)),],

                                    ),
                                  )],
                                ),
                              ),

                          ),

【问题讨论】:

  • 请提供您目前所取得成就的代码 sn-p。

标签: flutter containers


【解决方案1】:

我想这就是你想要的。

Container(
          clipBehavior: Clip.hardEdge,
          decoration: BoxDecoration(
              border: Border.all(color: Colors.black, width: 2),
              borderRadius: const BorderRadius.all(
                Radius.circular(32),
              )),
          width: 200,
          child: Column(
            children: [
              Container(
                padding: EdgeInsets.only(left: 20, top: 5),
                color: Colors.orange,
                child: Text("TOTAL: GGWP  " + "---" + " ITEMS",
                    style: TextStyle(fontSize: 24, color: Colors.black, fontWeight: FontWeight.w400)),
              ),
              Padding(
                padding: EdgeInsets.only(left: 20, top: 5),
                child: Text("TOTAL: GGWP  " + "---" + " ITEMS",
                    style: TextStyle(fontSize: 24, color: Colors.black, fontWeight: FontWeight.w400)),
              ),
            ],
          ),
        ),

【讨论】:

    猜你喜欢
    • 2018-11-27
    • 2022-12-14
    • 2020-05-13
    • 1970-01-01
    • 2020-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多