12345678910111213141516171819202122232425262728293031323334353637 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vitalapp/components/alert_dialog.dart';
- class ConfirmBox {
- static Future<bool> show({
- String? title,
- required String content,
- VoidCallback? onConfirm,
- VoidCallback? onCancel,
- double? width,
- }) async {
- final result = await Get.dialog(
- VAlertDialog(
- title: title ?? "提示",
- width: width ?? 320,
- content: Container(
- height: 32,
- padding: const EdgeInsets.symmetric(horizontal: 24),
- alignment: Alignment.center,
- child: Text(content, style: TextStyle(fontSize: 20)),
- ),
- onConfirm: () async {
- onConfirm?.call();
- Get.back(result: true);
- },
- onCanceled: () {
- onCancel?.call();
- return false;
- },
- ),
- barrierDismissible: false,
- barrierColor: Colors.black.withOpacity(.4),
- );
- return result;
- }
- }
|