繁体   English   中英

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

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

有人帮助我请在此处输入图片描述https://imgur.com/yGEzU2n

我需要根据内容自动调整大小的框。

我是新手,有什么建议吗?

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
          ),

使用resizeToAvoidBottomPadding: false 在这里阅读。

第一种解决方案:您通常需要在小部件顶部提供一个滚动小部件,因为如果您尝试打开键盘或更改手机的方向,flutter 需要知道如何处理小部件在屏幕上的分布。

请查看此资源,您可以检查 Flutter 提供的各种开箱即用的选项,并为您的场景选择最佳选项。

滚动

第二种选择:

resizeToAvoidBottomPadding: false 

那应该会使错误消失

您可以通过示例代码查看:

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