Row and Column Widget
import "package:flutter/Material.dart";
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Welcome Flutter App",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.brown,
),
home: const FlutterApp(),
);
}
}
class FlutterApp extends StatelessWidget {
const FlutterApp({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text(
"Hello Flutter",
style: TextStyle(fontWeight: FontWeight.bold),
),
centerTitle: true,
backgroundColor: Colors.grey,
),
/*body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: const [
Text("A", style: TextStyle(fontSize:25, fontWeight: FontWeight.bold),),
Text("B", style: TextStyle(fontSize:25, fontWeight: FontWeight.bold),),
Text("C", style: TextStyle(fontSize:25, fontWeight: FontWeight.bold),),
Text("D", style: TextStyle(fontSize:25, fontWeight: FontWeight.bold),),
],
),*/
body: Container(
height: 300,
//width: 500,
child: Column(
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
//mainAxisAlignment: MainAxisAlignment.spaceAround,
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
//mainAxisAlignment: MainAxisAlignment.center,
//mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.start,
// By Default AxisAlignment will be "start" position
//crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
//crossAxisAlignment: CrossAxisAlignment.stretch,
//crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
const Text(
"R1",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
const Text(
"R2",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
Column(
children: [
ElevatedButton(
onPressed: () {},
child: const Text("Button 1"),
),
const SizedBox(
height: 5,
),
ElevatedButton(
onPressed: () {},
child: const Text("Button 2"),
),
],
),
const Text(
"R3",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
const Text(
"R4",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
],
),
const Text(
"A",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
const Text(
"B",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
const Text(
"C",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
const Text(
"D",
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
const ElevatedButton(
onPressed: /*(){}*/ null,
child: Text("Hello"),
),
],
),
),
);
}
}
Comments
Post a Comment