用飞镖添加行

时间:2019-12-05 15:52:09

标签: flutter dart row

找不到一种方法,可以在dart中向现有列添加

这是我要创建的行:

    Row addInput(String type, String title) {
    Row row = Row(
      children: <Widget>[
        Expanded(
          flex: 10,
          child: Container(
            margin: EdgeInsets.symmetric(vertical: 15),
            decoration: BoxDecoration(
              color: Colors.white,
              border: Border.all(
                width: 1,
                color: Colors.white,
              ),
              borderRadius: BorderRadius.all(
                Radius.circular(10.0),
              ),
              boxShadow: <BoxShadow>[
                new BoxShadow(
                  color: Colors.grey[300],
                  blurRadius: 5.0,
                  offset: new Offset(0.0, 5.0),
                ),
              ],
            ),
            padding: EdgeInsets.symmetric(vertical: 25, horizontal: 30),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Text(
                  title,
                  style: new TextStyle(
                      fontSize: 18.0,
                      color: Colors.black,
                      fontWeight: FontWeight.w600,
                      fontFamily: "Roboto"),
                ),
                Image(
                  height: 18,
                  image: AssetImage("images/chevron.png"),
                )
              ],
            ),
          ),
        ),
      ],
    );

    return row;
  }

我要执行此操作:单击列表视图的元素时,添加带有单击的列表视图标题的新行

在android上,我们仅使用 Element.addView(view),但是如何在Flutter中做到这一点?

因此需要执行以下操作: MyColumn.addView(addInput('type','title');

0 个答案:

没有答案
相关问题