Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- rdbms nosql 차이
- 빅데이터 분석기사
- 작업 1유형
- flutter 믹스인
- 빅분기 필기 pdf
- SQL
- mysql mongo 성능 비교
- MySQL
- 빅분기
- 빅분기 필기
- 빅분기 판다스 100제
- null safety
- 빅분기 1유형
- 빅분기 캐글놀이터
- my_sql
- 앱개발 가보자고
- ?. ?? ! late
- null 병합 연산자
- 주말도 한다
- 오늘은 1일 2쿼리
- 주말도 식지않아
- late 키워드
- 1일 1쿼리
- null check 연산자
- null 억제 연산자
- FLUTTER
- 비동기 처리
- 주말에도 1일 1쿼리
- 빅데이터분석기사
- 컴포지션과 집합
Archives
- Today
- Total
subindev 님의 블로그
[Flutter] #10 Stack 위젯 본문
Stack 위젯
Stack 위젯은 Flutter에서 여러 자식 위젯을 겹치게 배치할 수 있게 해주는 컨테이너 위젯입니다 Stack 내의 모든 자식은 오버레이 구조로 배열되어, 리스트의 앞쪽에 있는 위젯이 아래쪽에 위치하게 됩니다. Stack 위젯은 주로 위젯들 간의 위치를 상대적으로 정의할 때 사용됩니다.
Stack 위젯과 alignment 속성의 사용
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(
home: SafeArea(
child: Scaffold(
body: Stack(
alignment: Alignment.bottomRight,
children: [
Container(
width: 200,
height: 200,
color: Colors.red,
),
Container(
width: 100,
height: 100,
color: Colors.blue,
),
],
),
),
),
);
}
}
Stack 위젯과 Positioned 위젯의 사용
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(
home: SafeArea(
child: Scaffold(
body: Stack(
// alignment: Alignment.bottomRight,
// Stack 위젯안에 Positioned 위젯을 사용할 수 있다.
children: [
Positioned(
top: 50,
left: 50,
child: Container(
width: 100,
height: 100,
color: Colors.red,
),
),
Positioned(
bottom: 50,
right: 50,
child: Container(
width: 50,
height: 50,
color: Colors.blue,
),
),
],
),
),
),
);
}
}
실습 - 만들어보기
'앱개발 > Flutter' 카테고리의 다른 글
[Flutter] #12 Dart 비동기 프로그래밍 (0) | 2025.01.21 |
---|---|
[Flutter] #11 콜백 함수의 이해 (0) | 2025.01.20 |
[Flutter] #9 ListView, GridView, PageView 위젯 (0) | 2025.01.14 |
[Flutter] #8 - 플러터의 핵심 철학과 프로젝트 구조 (0) | 2025.01.14 |
[Flutter] #7 Dart 기본 문법 추상 클래스 (0) | 2025.01.07 |