warningBottomSheet static method

void warningBottomSheet({
  1. required String title,
  2. required String message,
  3. required String buttonText,
  4. String? note,
  5. bool cancelButtonEnable = true,
  6. dynamic onPressed()?,
  7. Color color = Colors.redAccent,
  8. bool isDismissible = false,
  9. bool enableDrag = false,
})

Implementation

static void warningBottomSheet({
  required String title,
  required String message,
  required String buttonText,
  String? note,
  bool cancelButtonEnable = true,
  Function()? onPressed,
  Color color = Colors.redAccent,
  bool isDismissible = false,
  bool enableDrag = false,
}) {
  Get.bottomSheet(
    shape: RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(20))),
    backgroundColor: Colors.white,
    clipBehavior: Clip.hardEdge,
    isDismissible: isDismissible,
    enableDrag: enableDrag,
    Column(
      spacing: 16,
      mainAxisSize: MainAxisSize.min,
      children: [
        Container(
          height: 6,
          width: 60,
          decoration: BoxDecoration(
            color: Colors.black26,
            borderRadius: BorderRadius.circular(20),
          ),
        ),
        Text(
          title,
          style: const TextStyle(
            fontSize: 20,
            fontWeight: FontWeight.bold,
            color: Colors.black,
          ),
          textAlign: TextAlign.center,
        ),
        Text(
          message,
          style: const TextStyle(fontSize: 14),
          textAlign: TextAlign.center,
        ),
        if (note != null)
          Text(
            note,
            style: TextStyle(fontSize: 12, color: Colors.grey),
            textAlign: TextAlign.center,
          ),
        Row(
          spacing: 10,
          children: [
            if (cancelButtonEnable)
              Expanded(
                child: ElevatedButton(
                  onPressed: Get.back,
                  style: ElevatedButton.styleFrom(
                    padding: const EdgeInsets.all(16),
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(5),
                      side: const BorderSide(color: Colors.black),
                    ),
                    overlayColor: Colors.grey.shade400,
                    backgroundColor: Colors.white,
                  ),
                  child: const Text(
                    "Cancel",
                    style: TextStyle(fontSize: 16, color: Colors.black),
                  ),
                ),
              ),
            Expanded(
              child: InkWell(
                onTap: onPressed,
                child: Container(
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(5),
                    color: color,
                  ),
                  padding: const EdgeInsets.all(16),
                  child: Text(
                    buttonText,
                    style: const TextStyle(fontSize: 16, color: Colors.white),
                    textAlign: TextAlign.center,
                  ),
                ),
              ),
            ),
          ],
        ),
      ],
    ).paddingAll(10),
  );
}