csdnQXX105 2020-05-27 19:51 采纳率: 100%
浏览 267

flutter开发,在输入框中输入内容,按底下button后会出现键盘溢出,我也用SingleChildScrollView包住了,求大神解答为什么?

A RenderFlex overflowed by 265 pixels on the bottom.

class HomeSettingWifiSSIDAndSecurity extends StatefulWidget {

HomeSettingWifiSSIDAndSecurity({Key key}) : super(key: key);

@override
_HomeSettingWifiSSIDAndSecurityState createState() => _HomeSettingWifiSSIDAndSecurityState();
}

class _HomeSettingWifiSSIDAndSecurityState
extends State {
final _networkFormKey = GlobalKey();
Network network = Network();
String ssid;
String password;
@override
void initState() {
super.initState();
}

Future _onWillPop() {
return showDialog(
barrierDismissible: false,
context: context,
builder: (context) => new AlertDialog(
title: new Text('Are you sure?', style: me20blue),
content: new Text('Do you want to exit the App ?',
strutStyle: StrutStyle(height: 2), style: re16a54),
actions: [
new FlatButton(
onPressed: () => Navigator.of(context).pop(false),
child: new Text('No', style: me14blue),
),
new FlatButton(
onPressed: () => Navigator.of(context).pop(true),
child: new Text('Yes', style: me14blue),
),
],
),
) ??
false;
}

@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: _onWillPop,
child:Scaffold(
appBar: new AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
iconTheme: IconThemeData(
color: Color(0xFF000000),
),

      automaticallyImplyLeading: true,
    ),
    body: SingleChildScrollView(
      child: new Column(
        crossAxisAlignment: CrossAxisAlignment.start,

        children: <Widget>[
          SizedBox(height: MediaQuery.of(context).size.height * 45 / 640),

          Padding(
            padding: const EdgeInsets.fromLTRB(24, 0, 0, 0),
            child: Text("Home network", style: me20blue),
          ),
          SizedBox(height: MediaQuery.of(context).size.height * 17 / 640),

          Form(
            key: _networkFormKey,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                new Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.fromLTRB(24,0, 46, 5),
                      child: Row(
                        children: <Widget>[
                          Padding(
                            padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
                            child: Text("SSID", style: re16grey),
                          ),
                        ],
                      ),
                    ),
                    // new Text("         SSID:"),
                    new Container(
                      child:new Flexible(///Flexible
                        child: new TextFormField(
                          decoration: InputDecoration(
                            labelStyle:me14grey,
                            labelText: 'SSID',
                            hintText:   "New SSID",
                            border: OutlineInputBorder(borderSide: BorderSide()),
                            fillColor: Colors.white,
                            filled: true,
                            //prefixIcon: Icon(Icons.lock),
                            contentPadding: EdgeInsets.fromLTRB(10,5,10,5),
                          ),
                          validator: (String value) {
                            //檢查是否非空
                            if (value.isEmpty) {
                              return 'Please enter your network SSID';
                            } else if (value.length > 32) {
                              return 'SSID is too long.';
                            }
                            return null;
                          },
                          onChanged: (String value) {
                            network.ssid = value;
                          },
                        ),
                      ),
                      //padding: const EdgeInsets.fromLTRB(0, 0, 8, 0),
                    ),
                    Padding(
                      padding: const EdgeInsets.fromLTRB(16,0, 24, 5),
                      child: Row(
                        children: <Widget>[
                          Padding(
                            padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),

                          ),
                        ],
                      ),
                    ),
                  ],
                ),
                SizedBox(height: MediaQuery.of(context).size.height * 17 / 640),
                new Row(
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.fromLTRB(24,0, 10, 3),
                      child: Row(
                        children: <Widget>[
                          Padding(
                            padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
                            child: Text("Password", style: re16grey),
                          ),
                        ],
                      ),
                    ),

                    new Container(
                      child:new Expanded(
                        child: new TextFormField(
                          decoration: InputDecoration(
                            labelStyle:me14grey,
                            labelText: 'Password',
                            hintText:   "New Password",
                            border: OutlineInputBorder(borderSide: BorderSide()),
                            fillColor: Colors.white,
                            filled: true,
                            //prefixIcon: Icon(Icons.lock),
                            contentPadding: EdgeInsets.fromLTRB(10,0,0,0),
                          ),

                          validator: (String value) {
                            if (value.length < 8) {
                              return 'The password must be at least 8 characterics.';
                            }

                            return null;
                          },
                          onChanged: (String value) {
                            network.password = value;
                          },
                        ),
                      ),
                      //padding: const EdgeInsets.fromLTRB(0, 0, 8, 0),
                    ),
                    Padding(
                      padding: const EdgeInsets.fromLTRB(16,0, 24, 5),
                      child: Row(
                        children: <Widget>[
                          Padding(
                            padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),

                          ),
                        ],
                      ),
                    ),

                  ],//widget
                ),

              ],
            ),
          ),

        ],
      ),
    ),
    bottomNavigationBar: BottomAppBar(
        color: Colors.transparent,
        elevation: 0,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.end,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.fromLTRB(0, 0, 8, 10),
              child: OutlineButton(
                child: Row(
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
                      child: Text("BACK TO HOME", style: me14blue),
                    ),
                  ],
                ),
                onPressed: () {
                  Navigator.pushAndRemoveUntil(
                      context,
                      MyCustomRoute100(builder: (context) => HomeHomePage()),
                          (Route<dynamic> rout) => false);
                },
              ),
            ),
            Padding(
              padding: const EdgeInsets.fromLTRB(0, 0, 24, 10),
              child: OutlineButton(
                borderSide: BorderSide(color: Color(0x66999999)),
                child: Row(
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
                      child: Text("NEXT", style: me14blue),
                    ),
                  ],
                ),
                onPressed: () {
                  Navigator.push(
                    context,
                    MyCustomRoute100(
                        builder: (context) =>
                        //NextPage1,MeshWifiSetting
                        MasterCreatingYourWiFiNetwork()),
                  );
                },
              ),
            ),
          ],

        )),

  ),
);

}
}

  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2020-09-16 12:57
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器