Background Image In Flutter Code Example


Example 1: flutter background image

Widget build(BuildContext context) {     return MaterialApp(       title: 'Welcome to Flutter',       home: Container(         decoration: BoxDecoration(             image: DecorationImage(                 image: AssetImage("images/logo.png"), fit: BoxFit.cover)),         child: Scaffold(           backgroundColor: Colors.transparent,           appBar: AppBar(             elevation: 0,             backgroundColor: Colors.transparent,             title: Text('My App'),             centerTitle: true,             leading: IconButton(                 icon: Icon(                   Icons.list,                   color: Colors.white,                 ),                 onPressed: () {}),           ),         ),       ),     );   }

Example 2: add bg image to scaffold flutter

@override Widget build(BuildContext context) {   return new Scaffold(     body: new Stack(       children: [         new Container(           decoration: new BoxDecoration(             image: new DecorationImage(image: new AssetImage("images/background.jpg"), fit: BoxFit.cover,),           ),         ),         new Center(           child: new Text("Hello background"),         )       ],     )   ); }

Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?