본문 바로가기
Programming/Flutter

플러터(Flutter) 컨펌 팝업 (취소/확인) 사용하기

by web data 2024. 6. 9.

컨펌 팝업 사용하기

 

Future<void> deleteConfirmPopup() async {
    showDialog(
      context: context,
      builder: (context) => AlertDialog(
        title: const Text('삭제할까요?'),
        content: const Text('삭제 이후엔 복구할 수 없습니다.'),
        actions: [
          TextButton(
            onPressed: () {
              // 팝업 닫기
              Get.back();
            },
            child: Text(
              '취소',
            ),
          ),
          TextButton(
            onPressed: () async {
              // action 삽입
              // 팝업 닫기
              Get.back();
            },
            child: Text(
              '예',
            ),
          ),
        ],
      ),
    );