0

I am having a text form field at the bottom of the screen. I wrap this text form field inside a Interactive Viewer. When the text form field is focused, the soft keyboard rises and hides the text form field.

  @override
  Widget build(BuildContext context) {
    return InteractiveViewer(
      child: Stack(
        children: <Widget>[
          Positioned(
            left: 0,
            top: 700,
            right: 0,
            bottom: 0,
            child: TextFormField(),
          ),
        ],
      ),
    );
  }

I have tried resizeToAvoidBottomInset: true. How to move the text form field to the top of the soft keyboard so that it stays visisble? And I don't want to wrap the InteractiveViewer in a SingleChildScrollView.

kumar
  • 3
  • 2

1 Answers1

0

Try not specifying the top: 700. Just have bottom: 0 if you want the TextFormField pinned to the bottom of the available space.

John Weidner
  • 2,055
  • 3
  • 18
  • 31
  • I don't want the TextFormField to be pinned to the bottom. In my application, the TextFormField are spread across the screen which will be positioned by the `Positioned` Widget. The TextFormField which are positioned to the bottom of the screen are hidden by the keyboard. – kumar Aug 04 '23 at 11:50
  • If you specify a top of 700, that will end up getting hidden. You need to come up with a layout that will adjust to different size containers. When the keyboard is displayed, your InteractiveViewer will be contained in a smaller space. – John Weidner Aug 04 '23 at 14:13