【问题标题】:unable to add 2 buttons in flutter under build widget无法在构建小部件下的颤动中添加 2 个按钮
【发布时间】:2020-04-21 18:59:35
【问题描述】:

我只是想在这个 ui 中添加 2 个按钮:

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('VIDEOCALL'),
      ),
      body: Center(
        child: Container(
          padding: const EdgeInsets.symmetric(horizontal: 20),
          height: 400,
          child: Column(
            children: <Widget>[
              Row(
                children: <Widget>[
                  Expanded(
                      child: TextField(
                    controller: _channelController,
                    decoration: InputDecoration(
                      errorText:
                          _validateError ? 'Channel name is mandatory' : null,
                      border: UnderlineInputBorder(
                        borderSide: BorderSide(width: 1),
                      ),
                      hintText: 'ENTER ENTRY CODE',
                    ),
                  ))
                ],
              ),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 20),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: RaisedButton(
                        onPressed: onJoin,
                        child: Text('Join'),
                        color: Colors.blueAccent,
                        textColor: Colors.white,
                      ),
                    )
                  ],
                ),
              )
            ],
          ),
        ),
      ),
    );
  }

但我无法添加它。 有时我有一个孩子已经定义了错误,或者即使代码被接受,它也不会在屏幕上弹出。

【问题讨论】:

  • 好吧,我说我什么都试过了,但我没有重新启动我的系统。似乎只是重新启动系统解决了这个问题,现在我可以使用代码 new RaisedButton.... 并且它可以正常工作。

标签: flutter flutter-layout


【解决方案1】:

我说我什么都试过了,但我没有重新启动我的系统。 似乎只是重新启动系统解决了这个问题,现在我可以使用代码了 新的 RaisedButton.... 它可以正常工作

Padding(
                padding: const EdgeInsets.symmetric(vertical: 20),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: RaisedButton(
                        onPressed: onJoin1,
                        child: Text('Join'),
                        color: Colors.blueAccent,
                        textColor: Colors.white,
                      ),
                    ),
                  ],
                ),
              ),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 30),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      child: RaisedButton(
                        onPressed: onJoin1,
                        child: Text('Join'),
                        color: Colors.blueAccent,
                        textColor: Colors.white,
                      ),
                    ),
                  ],
                ),

【讨论】:

    猜你喜欢
    • 2019-06-27
    • 2022-07-20
    • 2020-03-12
    • 2020-12-10
    • 2021-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多