showErrorDialog function

void showErrorDialog(
  1. BuildContext context,
  2. String message, {
  3. VoidCallback? onConfirm,
})

Implementation

void showErrorDialog(BuildContext context, String message, {VoidCallback? onConfirm}) {
  showDialog(
    context: context,
    builder: (_) => Dialog(
      backgroundColor: Colors.transparent,
      child: Container(
        padding: const EdgeInsets.symmetric(vertical: 16),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(16),
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            // Icon cảnh báo
            SvgPicture.asset(Assets.images.icons.icError.path),
            const SizedBox(height: 16),

            // Nội dung mô tả lỗi
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 16),
              child: Text(
                message,
                style: const TextStyle(
                  fontSize: 14,
                  color: Colors.black,

                ),
                textAlign: TextAlign.center,
              ),
            ),

            // Nút xác nhận
            const Divider(thickness: 0.5,color: Color(0xFFE7E7E8),),
            GestureDetector(
              onTap: () {
                Navigator.of(context).pop();
                onConfirm?.call();
              },
              child: Container(
                alignment: Alignment.center,
                padding: const EdgeInsets.only(top: 8),
                child: const Text(
                  'Xác nhận',
                  style: TextStyle(
                    fontSize: 14,
                    color: AppColors.primary,
                    fontWeight: FontWeight.w700,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    ),
  );
}