【问题标题】:Flutter LBS to KG designFlutter LBS 到 KG 设计
【发布时间】:2018-10-24 09:06:07
【问题描述】:

我正在尝试制作我在这里绘制的设计:

我的代码现在是:

  @override
  Widget build(BuildContext context) {
    // Build a Form widget using the _formKey we created above
    return Form(
      key: _formKey,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          new Text(
            'LBS: ',
          ),
          TextFormField(
            validator: (value) {
              if (value.isEmpty) {
                return 'Please enter LBS';
              }
            },
          ),

          new Text(
            'KG: ',
          ),
          new Text(
            '{kg value} ',
          ),

          new Row(
              new RaisedButton(
                onPressed: null,
                child: Text('Convert'),
              ),
              new RaisedButton(
                onPressed: null,
                child: Text('Swap'),
              )

          ),
        ],
      ),
    );
  }

我的问题是我想要两个按钮的新行。 "new Row(" 不需要参数。

【问题讨论】:

  • 你需要将你的按钮包装成一个children: &lt;Widget&gt; [ ... ]

标签: flutter flutter-layout


【解决方案1】:

将你的按钮包装成一个孩子:[ ... ]

Row(
        children: <Widget>[
                    new RaisedButton(
                    onPressed: null,
                    child: Text('Convert'),
                  ),
                  new RaisedButton(
                    onPressed: null,
                    child: Text('Swap'),
            ],
        )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-27
    • 2022-12-14
    • 2019-01-09
    • 1970-01-01
    • 2022-01-18
    • 2022-01-18
    • 2021-10-22
    • 2021-06-20
    相关资源
    最近更新 更多