FLUTTER/Common
showDialog 메세지창 띄우기
atawlee
2022. 9. 11. 14:47
showDialog(
context: context,
builder: (context) {
String sDate = dateFormat.format(selectedDate);
return AlertDialog(
title: Text("$sDate 작성"),
content: TextField(
controller: createTextController,
),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text("취소")),
TextButton(
onPressed: () {
model.create(selectedDate, createTextController.text);
createTextController.text = "";
Navigator.pop(context);
},
child: Text("작성")),
],
);
},
);
메세지창에 대한 예제입니다.
actions : 버튼들을 놓습니다.
content : 내용을 넣습니다 . textfield등을 넣어서 입력을 받는것도 가능합니다.
복잡한 내용이 아니라 이하 설명은 생략합니다.