Home > OS >  How to make background image to be fixed in flutter
How to make background image to be fixed in flutter

Time:11-06

I'm using an image as a background, and it looks good until I use the keyboard, how to solve that?

before the keyboard is shown and that's after the keyboard is shown

Container(
          width: double.infinity,
          height: double.infinity,
          decoration: BoxDecoration(
              image: DecorationImage(
                  image: AssetImage(
                    'images/joker.jpg',
                  ),
                  fit: BoxFit.fill)),


 

CodePudding user response:

Try to add this to Scaffold of this widget:

Scaffold(
   resizeToAvoidBottomInset: false,
)

CodePudding user response:

You can do that by using The Stack widget, it uses the children[] widget. but make sure to set the Image widget at the top of the list (so that the image can appears behind the form).

You can use this structure: Stack(children:[ Image() , SingleChildScrollView( child: YourFormWidgetHere())])

  • Related