Dialog 생성후 취소를 눌러도 닫히지 않아 문의 드립니다.
전화걸기는 제대로 동작 하는대 취소가 동작이 안되는 이유가 무얼까요?
// 먼저 함수를 아래와 같이 만들고
void openDialog() {
Get.dialog(
AlertDialog(
title: const Text('쇼핑몰 콜센터'),
content: const Text('1600-0001'),
actions: [
TextButton(
child: const Text("전화걸기"),
onPressed: () => launch('tel:16000001'),
),
TextButton(
child: const Text("취소"),
onPressed: () => Get.back(),
//Get.back 오류 수정 필요 (alert 창 닫히지 않음)
),
],
),
);
}
// 버튼 생성을 아래와 같이 함
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
primary: Colors.white,
side: BorderSide(width: 2, color: Colors.black),
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30)),
padding: EdgeInsets.all(10)),
onPressed: () {
openDialog();
},
icon: Icon(
Icons.phone,
size: 15,
color: Colors.black,
),
label: Text(
'상담센터 전화하기',
style: TextStyle(fontSize: 15, color: Colors.black),
),
),