10
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Flutter]TextFieldタップでA RenderFlex overflowed by <xxx> pixels on the bottom. が出るときの対処法

Posted at

TextFieldTextFormField をタップすると、キーボードが立ち上がる関係で、次のようなエラーが出ることがあります。

Widget build(BuildContext context) {
    return Form(
        key: _formKey,
        child: Column(
          children: <Widget>[
            TextFormField(),
          ],
        ),
      );
}
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during layout:
A RenderFlex overflowed by 198 pixels on the bottom.

image.png

回避方法

SingleChildScrollView でウィジェットを囲むことで、画面が適切にスクロールし、エラーを回避できます。

Widget build(BuildContext context) {
    return SingleChildScrollView(
        child:Form(
          key: _formKey,
          child: Column(
            children: <Widget>[
              TextFormField(),
            ],
          ),
        ),
    );
}

image.png

参考

How to fix bottom overflowed when keyboard shows error in Flutter - Programming Addict - YouTube

10
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?