Exploring Stack and Indexed Stack Widget
Complete Code For Exploring Stack and Indexed Stack In Flutter
Main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.red,
title: Text('Stack Widget')
),
body: Center(
child: StackWidget()
)
)
);
} }
class StackWidget extends StatefulWidget {
@override
_StackWidgetState createState() => _StackWidgetState();
}
class _StackWidgetState extends State<StackWidget> {
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
Container(
color: Colors.deepOrangeAccent,
),
Container(
color: Colors.orange,
height: 300.0,
width: 300.0,
),
Container(
color: Colors.orange[100],
height: 150.0,
width: 150.0,
)
],
),
);
}
}