title: bottom overflow for textinput after entering few lines flutter
body: <p>I have a textfield widget that allows user to enter multiple lines, but after entering few lines, got overflow error as shown below.
  <img src="https://i.stack.imgur.com/rcl0O.png" alt="overflow example" /></p>
  <p>This happened because whenever there is new line, the textfield height increases and pushed down the keyboard. This is before entering new line.
  <img src="https://i.stack.imgur.com/069vX.png" alt="enter image description here" /></p>
  <p>I used <code>resizeToAvoidBottomInset: false,</code> to solve the problem where keyboard covers textfield but this doesn't seem to solve the problem above.</p>
  <p>Is there any way I can push the textfield up after entering new line as shown below so that the keyboard the textfield won't overflow the keyboard?
  <img src="https://i.stack.imgur.com/7KiDP.png" alt="enter image description here" /></p>
  <p>This is my code</p>
  <pre><code>import 'dart:async';
  import 'package:flutter/material.dart';
  
  
  class Detail extends StatefulWidget {
    const Detail({Key? key}) : super(key: key);
  
    @override
    State&lt;Detail&gt; createState() =&gt; _DetailState();
  }
  
  class _DetailState extends State&lt;Detail&gt; {
    final ScrollController scrollCtrl = ScrollController();
    bool isScrolled = false;
    bool isLoading = false;
    @override
    void initState() {
      super.initState();
    }
  
    @override
    Widget build(BuildContext context) {
      final bottom = MediaQuery.of(context).viewInsets.bottom;
      AppBar appbar = AppBar(
        backgroundColor: Colors.transparent,
        title: const Text('Approval Detail'),
      );
      WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
        scrollCtrl.addListener(() {});
        scrollCtrl.position.isScrollingNotifier.addListener(() {
          if (!scrollCtrl.position.isScrollingNotifier.value) {
            setState(() {
              isScrolled = false;
            });
          } else {
            setState(() {
              isScrolled = true;
            });
          }
        });
      });
      return Container(
        height: MediaQuery.of(context).size.height,
        decoration: const BoxDecoration(
          image: DecorationImage(
            image: AssetImage('images/bg_home.png'),
            fit: BoxFit.fill,
          ),
        ),
        child: Scaffold(
          resizeToAvoidBottomInset: false,
          // resizeToAvoidBottomPadding: false,
          backgroundColor: Colors.transparent,
          appBar: appbar,
          body: Stack(
            children: [
              SingleChildScrollView(
                controller: scrollCtrl,
                reverse: true,
                child: Padding(
                  padding: EdgeInsets.only(bottom: bottom),
                  child: Column(
                    children: [
                      Padding(
                          padding: const EdgeInsets.only(bottom: 200),
                          child: Text(&quot;Detail&quot;)),
                      Container(
                        height: 25,
                        color: columnColor,
                      ),
                    ],
                  ),
                ),
              ),
              IndexedStack(
                index: isScrolled
                    ? 0
                    : 1, // switch between Foo and Bar based on condition
                children: [
                  Container(),
                  Positioned(
                      child: Padding(
                    padding: EdgeInsets.only(
                        bottom: MediaQuery.of(context).viewInsets.bottom),
                    child: Align(
                        alignment: Alignment.bottomCenter, child: BottomWidget()),
                  )),
                ],
              )
            ],
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>This is my BottomWidget</p>
  <pre><code>import 'package:flutter/material.dart';
  
  
  class BottomWidget extends StatefulWidget {
    BottomWidget({
      Key? key,
      
    }) : super(key: key);
  
    @override
    State&lt;BottomWidget&gt; createState() =&gt; _BottomWidgetState();
  }
  
  class _BottomWidgetState extends State&lt;BottomWidget&gt; {
    
    @override
    Widget build(BuildContext context) {
      return Container(
        height: 180,
        width: double.maxFinite,
        decoration: BoxDecoration(
            boxShadow: [
              BoxShadow(
                color: Colors.grey[300]!,
                offset: const Offset(0.0, 2.5),
                blurRadius: 1.0,
              ),
              const BoxShadow(
                color: Colors.black12,
                offset: Offset(0.0, 0.0),
                blurRadius: 1.0,
              ),
            ],
            color: Colors.white,
            borderRadius:
                const BorderRadius.vertical(top: Radius.circular(20.0))),
        child: Column(
          children: [
            Padding(
              padding: const EdgeInsets.fromLTRB(10, 15, 10, 0),
              child: SizedBox(
                width: double.maxFinite,
                // height: 45,
                child: Row(
                  children: [
                    Flexible(
                      flex: 9,
                      child: TextField(
                        minLines: 1,
                        keyboardType: TextInputType.multiline,
                        maxLines: null,
                        decoration: InputDecoration(
                            enabledBorder: OutlineInputBorder(
                                borderRadius: BorderRadius.circular(20.0),
                                borderSide: BorderSide(color: Color(0xFFD6DDE1))),
                            focusedBorder: new OutlineInputBorder(
                              borderRadius: new BorderRadius.circular(20.0),
                              borderSide: BorderSide(color: cbossBlue),
                            ),
                            filled: true,
                            hintStyle: TextStyle(color: Color(0xFFD6DDE1)),
                            hintText: &quot;Add note here&quot;,
                            fillColor: Colors.white70),
                      ),
                    ),
                    Flexible(
                      flex: 1,
                      child: IconButton(
                        icon: Icon(Icons.fullscreen),
                        onPressed: () {
                        },
                      ),
                    )
                  ],
                ),
              ),
            ),
            Padding(
              padding: const EdgeInsets.fromLTRB(10, 15, 10, 0),
              child: Container(
                width: double.maxFinite,
                child: Row(
                  mainAxisSize: MainAxisSize.max,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: &lt;Widget&gt;[
                    Flexible(
                      flex: 5,
                      child: Padding(
                        padding: const EdgeInsets.only(right: 5),
                        child: Container(
                          decoration: BoxDecoration(
                              color: Colors.white,
                              border: Border.all(color: cbossBlue),
                              borderRadius: BorderRadius.all(Radius.circular(2))),
                          height: 50,
                          child: InkWell(
                            onTap: () {
                            },
                            child: Center(
                                child: Text('Reject',
                                    style: TextStyle(
                                        color: cbossBlue,
                                        fontWeight: FontWeight.bold))),
                          ),
                        ),
                      ),
                    ),
                    Flexible(
                      flex: 5,
                      child: Padding(
                        padding: const EdgeInsets.only(right: 5),
                        child: Container(
                          decoration: BoxDecoration(
                              color: Colors.blue,
                              borderRadius: BorderRadius.all(Radius.circular(2))),
                          height: 50,
                          child: InkWell(
                            onTap: () {
                            },
                            child: const Center(
                                child: Text(
                              'Approve',
                              style: TextStyle(
                                  fontWeight: FontWeight.bold,
                                  color: Colors.white),
                            )),
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>