Рендеринг переполнения, когда TextField находится в фокусе - PullRequest
0 голосов
/ 11 мая 2018

У меня есть столбец с TextField и гибким внутри него.Гибкая структура ListView, отображающая список героев.Когда я фокусируюсь на TextField, на дисплее отображается переполнение рендера на x пикселей.Что делать, чтобы этого избежать?

  @override
  Widget build(BuildContext context) {
    return new Stack(
      children: <Widget>[
        new Padding(
          padding: new EdgeInsets.all(10.0),
          child: new TextField(
            keyboardType: TextInputType.text,
            controller: tc,
          ),
        ),
        new Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            new Container(
              margin: new EdgeInsets.only(top: 60.0),
              height: MediaQuery.of(context).size.height * 0.67,
              child: checkList(context, characterDataWrapper), //MY LISTVIEW
            ),
            new Flexible(
              fit: FlexFit.loose,
              child: new Container(),
            ),
            new Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisSize: MainAxisSize.max,
                mainAxisAlignment: MainAxisAlignment.end,
                children: <Widget>[
                  new RaisedButton(
                    onPressed: getData,
                    color: Colors.red,
                    textColor: Colors.white,
                    child: new Text("Click"),
                  ),
                ]),
          ],
        )
      ],
    );
  }

1 Ответ

0 голосов
/ 12 мая 2018

Я думаю, что эта проблема в

new Container(
              margin: new EdgeInsets.only(top: 60.0),
              height: MediaQuery.of(context).size.height * 0.67,
              child: checkList(context, characterDataWrapper), //MY LISTVIEW
            ),

Пожалуйста, предоставьте ваш код или скриншот.

Я думаю, у вас есть текстовое поле вверху, Listview в середине и кнопка внизу.

Тогда вы можете попробовать вот так ...

@override
  Widget build(BuildContext context) {
    return new Column(
      children: <Widget>[
        new TextField(
          decoration: new InputDecoration(hintText: "I am the TextField"),
        ),
        new Flexible(
            flex: 1,
            child: new ListView(
              children: <Widget>[
                new ListTile(
                  title: new Text("Some Text"),
                ),
                new ListTile(
                  title: new Text("Some Text"),
                ),
                new ListTile(
                  title: new Text("Some Text"),
                ),
                new ListTile(
                  title: new Text("Some Text"),
                ),
                new ListTile(
                  title: new Text("Some Text"),
                ),
                new ListTile(
                  title: new Text("Some Text"),
                ),
                new ListTile(
                  title: new Text("Some Text"),
                ),
                new ListTile(
                  title: new Text("Some Text"),
                ),
              ],
            )),
        new RaisedButton(onPressed: () {})
      ],
    );
  }

Я думаю, это поможет вам.

...