๐ Container, SizedBox, Center
1. Center
child ๋ฅผ ๊ฐ์ด๋ฐ ๋ฐฐ์นํฉ๋๋ค.
const Center(
child: Text('Flutter My Home Page');
)
2. Containsar
child ๋ ์ด์์์ ์์ ฏ
class MyHomePage extends StatelessWidget {
const MyHomePage({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Center(child: const Text('Flutter My App Bar')),
),
body: Container(
color: Colors.yellow,
alignment: const Alignment(1, -1),
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 50,
),
margin: const EdgeInsets.symmetric(
horizontal: 50,
vertical: 50,
),
width: 100,
height: 300,
child: const Text('Flutter My Home Page'),
),
);
}
}
๐ Alignment
x์ถ
• -1 left
• 0 center
• 1 right
y์ถ
• -1 bottom
• 0 center
• -1 top
// x = 0 center
// y = 0 center
alignment: const Alignment(1, -1.1),
'๐ Programming > Flutter' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Fltutter] MaterialApp, Text, Scaffold, Appbar (0) | 2022.06.07 |
---|---|
[Flutter] ํ๋ฌํฐ ํ๋ก์ ํธ ๊ตฌ์กฐ ์ดํดํ๊ธฐ (0) | 2022.06.07 |
[Flutter] Windows ์ ๊ฐ๋ฐ ํ๊ฒฝ ๊ตฌ์ถ (0) | 2022.05.02 |