Expanded Widget

 import "package:flutter/material.dart";


void main() {
runApp(const FlutterApp());
}

class FlutterApp extends StatelessWidget {
const FlutterApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Flutter Demo Project",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.amber,
),
home: const DashBoardScreen(),
);
}
}

class DashBoardScreen extends StatelessWidget {
const DashBoardScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(
"DashBoard",
style: TextStyle(fontWeight: FontWeight.bold),
),
centerTitle: true,
backgroundColor: Colors.grey,
),

/*body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 50,
height: 100,
color: Colors.blue,

),
],
),*/

body: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Container(
width: 50,
height: 100,
color: Colors.blue,
),
),
Expanded(
flex: 5,
child: Container(
width: 100,
height: 100,
color: Colors.deepPurple,
),
),
Container(
width: 50,
height: 100,
color: Colors.black,
),
Expanded(
flex: 1,
child: Container(
width: 78,
height: 100,
color: Colors.red,
),
),
Expanded(
flex: 5,
child: Container(
width: 50,
height: 100,
color: Colors.teal,
),
),
],
),
);
}
}

Comments

Popular posts from this blog

Pagination with Bloc Pattern in Flutter

Pagination First Practical in Flutter

ExpansionPanel with ExpansionPanelList with Complete Collapse Operation in Flutter