简体   繁体   English

Flutter - 底部溢出 230 像素 Stak 布局

[英]Flutter - Bottom Overflowed By 230 Pixels Stak Layout

someone help me please enter image description here https://imgur.com/yGEzU2n有人帮助我请在此处输入图片描述https://imgur.com/yGEzU2n

i need the box resized automatically fot the content.我需要根据内容自动调整大小的框。

i'm new in flutter any suggestions?我是新手,有什么建议吗?

bodyWidget(BuildContext context) => Stack(

children: <Widget>[
  Positioned(
    height: MediaQuery.of(context).size.height / 1.5, //Altura del box cone squinas redondeadas
    width: MediaQuery.of(context).size.width - 20,
    left: 10.0,
    top: MediaQuery.of(context).size.height * 0.1,
    child: Card(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(15.0),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: <Widget>[
          SizedBox(
            height: 130.0, // espacion entre el texto de la descripcion y la foto del producto
          ),

Use resizeToAvoidBottomPadding: false .使用resizeToAvoidBottomPadding: false Read about it here . 在这里阅读。

First Solution: you usually need to provide a scroll widget on top of your widgets because if you try to open the keyboard or change the orientation of your phone, flutter needs to know how to handle the distribution of the widgets on the screen.第一种解决方案:您通常需要在小部件顶部提供一个滚动小部件,因为如果您尝试打开键盘或更改手机的方向,flutter 需要知道如何处理小部件在屏幕上的分布。

Please review this resource, you can check the different options that flutter provide Out of the box, and choose the best option for your scenario.请查看此资源,您可以检查 Flutter 提供的各种开箱即用的选项,并为您的场景选择最佳选项。

Scrolling滚动

Second Option:第二种选择:

resizeToAvoidBottomPadding: false 

That should make the error disappear那应该会使错误消失

You can see through a sample code :您可以通过示例代码查看:

appBar: new AppBar(title: new Text('Create A Parking Slot')),
      body: new Center(
          child: new SingleChildScrollView(
              child: new Container(
        margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0),
        color: Colors.white,
        child: new Column(children: <Widget>[
          new TextField(
            decoration: InputDecoration(labelText: "Title*"),
          ),
          new TextField(
            decoration: InputDecoration(labelText: "Available Space in Sqft*"),
          ),
          new TextField(
            decoration: InputDecoration(labelText: "Available Space*"),
          ),
          new TextField(
            decoration: InputDecoration(labelText: "Address*"),
          ),
          new TextField(
            decoration: InputDecoration(labelText: "Contact Number*"),
          ),
          new ListTile(
            title: const Text('Select Your Plan'),
            trailing: new DropdownButton<String>(
              value: "Hourly",
              onChanged: (String newValue) {
                print(newValue);
              },
              items:
                  <String>['Hourly', 'Weekly', 'Monthly'].map((String value) {
                return new DropdownMenuItem<String>(
                  value: value,
                  child: new Text(value),
                );
              }).toList(),
            ),
          ),
          new Container(
            height: 1.0,
            width: width,
            color: Colors.grey,
          ),
          new TextField(
            decoration: InputDecoration(labelText: "Rate*"),
          ),
          new UploadImage(),
          new RaisedButton(
            child: const Text('Create'),
            color: Theme.of(context).accentColor,
            textColor: Colors.white,
            elevation: 4.0,
            splashColor: Colors.blueGrey,
            onPressed: () {
              // Perform some action
              //button1(context);
            },
          )

          //
        ]),
      )))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM