0

その中に TextField と Flexible を含む Column があります。柔軟にヒーロー キャラクターのリストを表示する ListView で構成されます。TextField に注目すると、ディスプレイに Render Overflow が 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"),
                  ),
                ]),
          ],
        )
      ],
    );
  }
4

1 に答える 1

1

この問題は

new Container(
              margin: new EdgeInsets.only(top: 60.0),
              height: MediaQuery.of(context).size.height * 0.67,
              child: checkList(context, characterDataWrapper), //MY 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: () {})
      ],
    );
  }

これが役立つと思います。

于 2018-05-12T13:20:56.097 に答える