Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

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

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
2
Help us understand the problem. What are the problem?