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 |
31 |
Tags
- ML
- 백준
- fastapi를 사용한 파이썬 웹 개발
- Computer Architecture
- BOF
- ARM
- Algorithm
- MATLAB
- Stream
- study book
- Kaggle
- 파이토치 트랜스포머를 활용한 자연어 처리와 컴퓨터비전 심층학습
- pytorch
- FastAPI
- Image Processing
- bloc
- BAEKJOON
- Dreamhack
- llm을 활용 단어장 앱 개발일지
- PCA
- DART
- rao
- Got
- 영상처리
- MDP
- Widget
- Flutter
- BFS
- C++
- system hacking
Archives
- Today
- Total
Bull
[Flutter::Widget] StatefulBuilder 본문
https://api.flutter.dev/flutter/widgets/StatefulBuilder-class.html
StatefulBuilder class - widgets library - Dart API
A platonic widget that both has state and calls a closure to obtain its child widget. The StateSetter function passed to the builder is used to invoke a rebuild instead of a typical State's State.setState. Since the builder is re-invoked when the StateSett
api.flutter.dev
StatefulBuilder
는 특정 부분의 위젯 트리 내에서 상태를 관리할 수 있도록 돕는 위젯이다. 전체 위젯에 대한 상태 관리를 제공하지만, 때로는 모달 다이얼로그나 바텀 시트 등의 소규모 구성 요소 내에서만 상태를 업데이트하고 싶을 때가 있다. 이러한 경우 StatefulBuilder
를 사용하면, 상태 변경이 필요한 특정 부분만을 위한 로컬 상태를 생성하고 관리할 수 있다.
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
int counter = 0;
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Container(
padding: EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text('Counter: $counter'),
ElevatedButton(
onPressed: () {
setState(() {
counter++;
});
},
child: Text('Increment'),
),
],
),
);
},
);
},
);
'Software Framework > Flutter' 카테고리의 다른 글
[Flutter] 부모위젯이 자식위젯의 method 호출 방법 (0) | 2024.09.07 |
---|---|
[Flutter::Widget] Netiveview(ImagePicker)에서 상태 변경으로 이미지가 렌더링될 때 스크롤 하는 방법 (1) | 2024.09.01 |
[Flutter::Widget] Dialog 종류 (0) | 2024.08.27 |
[Flutter::State] ChangeNotifierProvider와 Provider 차이 (0) | 2024.08.23 |
[Flutter::package] "pdf" package review 하기 (0) | 2024.08.21 |