颤振-底部溢出230像素Stak布局

时间:2019-02-07 17:57:38

标签: android-studio flutter

有人帮助我,请在此处输入图片描述 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
          ),

2 个答案:

答案 0 :(得分:0)

使用resizeToAvoidBottomPadding: false。阅读here

答案 1 :(得分:0)

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

请查看此资源,您可以立即检查flutter提供的其他选项,然后为您的方案选择最佳选项。

https://www.aviationweather.gov/dataserver

第二个选项:

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

          //
        ]),
      )))