init
This commit is contained in:
33
lib/shared/widgets/app_dialog.dart
Normal file
33
lib/shared/widgets/app_dialog.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppDialog {
|
||||
AppDialog._();
|
||||
|
||||
static Future<bool?> confirm(
|
||||
BuildContext context, {
|
||||
String title = '确认操作',
|
||||
String message = '是否继续?',
|
||||
String cancelText = '取消',
|
||||
String confirmText = '确认',
|
||||
}) {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(message),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(false),
|
||||
child: Text(cancelText),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
child: Text(confirmText),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user