Flutter Tutorial - Flutter Frame Layout | RRTutors

Flutter Frame Layout | Stack Widget

Flutter uses Stack widgets to control child widgets at a layer. Child widgets can completely or partially cover the base widgets.

 

Stack control positions its children relative to the edges of its box. This class is useful if you just want to overlap multiple child widgets.


 

class StackWidget extends StatelessWidget {

 // This widget is the root of your application.

 @override

 Widget build(BuildContext context) {

   return MaterialApp(

     title: 'Flutter Tutorial',

     theme: ThemeData(

       primarySwatch: Colors.blue,

     ),

     home: Scaffold(

       body: SafeArea(child:

       Center(

         child: Stack(

           alignment: const Alignment(0, 0),

           children: <Widget>[

             Image.network("https://cdn.pixabay.com/photo/2017/04/23/19/17/climate-change-2254711_960_720.jpg"),

 

             Container(

               decoration: BoxDecoration(

                 color: Colors.white,

               ),

               child: Text('GLobal Warming',style: TextStyle(fontSize: 20),),

             ),

           ],

         ),

       )),

     ),

   );

 }

}

Advertisements