import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
Expanded(child: Top()),
Expanded(child: Bottom()),
],
),
),
);
}
}
class Top extends StatefulWidget {
const Top({super.key});
@override
State<Top> createState() => _TopState();
}
class _TopState extends State<Top> {
@override
Widget build(BuildContext context) {
return Column(
children: [
Top1(),
Top2(),
],
);
}
}
class Top1 extends StatelessWidget {
const Top1({
super.key,
});
@override
Widget build(BuildContext context) {
return Expanded(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Top 1", style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
Text("num : 1", style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold))
],
),
),
);
}
}
class Top2 extends StatelessWidget {
const Top2({
super.key,
});
@override
Widget build(BuildContext context) {
return Expanded(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Top 2", style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
ElevatedButton(onPressed: (){}, child: Icon(Icons.add))
],
),
),
);
}
}
class Bottom extends StatelessWidget {
const Bottom({
super.key,
});
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Bottom", style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold)),
],
),
);
}
}