Question Detail

How to set Background image Widget flutter

5 years ago Views 9803 Visit Post Reply

I have import Image in My Flutter Project How to set Background Image on the Mobile Screen in the Flutter Framework.


Thread Reply

Anonymous

- 5 years ago

If you want the image to fill the entire screen you can use a DecorationImage with a fit of BoxFit.cover.

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context){
    return new Scaffold(
      body: new Container(
        decoration: new BoxDecoration(
          image: new DecorationImage(
            image: new AssetImage("assets/google.jpg"),
            fit: BoxFit.cover,
          ),
        ),
        child: null,
      ),
    );
  }
}

Anonymous

- 4 years ago

Center(
  child:Text("hello world",textDirection: TextDirection.ltr),
) );