Contents
스택말고 다른 방법import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
// *** 스택 먼저들어간게 밑으로 깔린다.
// 세트로 POSITION 이라는 위젯이 있다. >> Align 안됨!!!
Stack(
children: [
Container(
width: 100,
height: 100,
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.circular(50),
),
),
Positioned(
left: 10,
top: 10,
child: Container(
width: 80,
height: 80,
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.circular(40),
),
),
),
],
),
],
),
);
}
}
스택말고 다른 방법
부모 컨테이너 와 자식 컨테이너가 있을 때, 자식 컨테이너를 가운데에 위치시키고 싶다면,
자식 컨테이너를 Align 위젯으로 감싸서 해결하는 방법도 있습니다.
Share article