반응형
ShowDialog
- barrierDismissible : 바깥 영역 터치시 닫을지 여부
- title : 제목
- center : 내용
- actions : 버튼
- 코드 예시
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
child: Text(
"다이얼로그 열기",
),
onPressed: () {
showDialog(
context: context,
barrierDismissible: true, //바깥 영역 터치시 닫을지 여부 결정
builder: ((context) {
return AlertDialog(
title: Text("제목"),
content: Text("내용"),
actions: <Widget>[
Container(
child: ElevatedButton(
onPressed: () {
Navigator.of(context).pop(); //창 닫기
},
child: Text("네"),
),
),
Container(
child: ElevatedButton(
onPressed: () {
Navigator.of(context).pop(); //창 닫기
},
child: Text("아니요"),
),
),
],
);
}),
);
},
),
),
);
}
}
참고할만한 글
반응형
'개발 > Flutter' 카테고리의 다른 글
Flutter 플러터 랜덤 숫자 간단 사용법 Random (0) | 2022.12.24 |
---|---|
Flutter 플러터 앱 상태 확인하기 AppLifecycleState (0) | 2022.12.24 |
Flutter 플러터 진동 간단 사용법 vibration (0) | 2022.12.24 |
Flutter 플러터 설정 화면 UI 간단 구현 setting ui (0) | 2022.12.24 |
Flutter 플러터 스낵바 SnackBar 간단 사용법 (0) | 2022.12.24 |
Flutter 플러터 화면 전환 Navigator.push 간단 사용법 (0) | 2022.12.24 |
Flutter 플러터 Text 크기 변경, 정렬, 색깔 변경 간단 사용법 (0) | 2022.12.24 |
Flutter 플러터 Appbar 간단 사용법 (0) | 2022.12.24 |
댓글