flutter

Background image on scafold

class BgImage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      home: Scaffold(
        resizeToAvoidBottomInset: false,
        appBar: AppBar(
          title: Text('Background'),
        ),
        body: Container(
          constraints: BoxConstraints.expand(),
          decoration: BoxDecoration(
              image: DecorationImage(
                  image: AssetImage("images/app_bg.jpg"), fit: BoxFit.cover)),
                  //image: NetworkImage(
                //"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQXDPKPH6IhukvE5AAx-L3_bwhAIKfiV0fI64LrZBqfLg4XclKGe6kjOZqbNpfQ4jRx5QRkguEDMGxxqjTk5QGUa8FrgEJS&usqp=CAU"),
          child: TextField(
            decoration: InputDecoration(fillColor: Colors.amber, filled: true),
          ),
        ),
      ),
    );
  }
}
Was this helpful?