mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-16 06:19:35 +00:00
39 lines
908 B
Dart
39 lines
908 B
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:vaani/generated/l10n.dart';
|
||
|
|
|
||
|
|
class DialogUtils {
|
||
|
|
DialogUtils._();
|
||
|
|
|
||
|
|
// 自定义删除 dialog
|
||
|
|
static deleteDialog(
|
||
|
|
BuildContext context, {
|
||
|
|
String? name,
|
||
|
|
required Function() onPressed,
|
||
|
|
}) {
|
||
|
|
showDialog(
|
||
|
|
context: context,
|
||
|
|
builder: (context) {
|
||
|
|
return AlertDialog(
|
||
|
|
title: Text(S.of(context).delete),
|
||
|
|
content: Text(S.of(context).deleteDialog(name ?? '')),
|
||
|
|
actions: [
|
||
|
|
TextButton(
|
||
|
|
onPressed: () {
|
||
|
|
onPressed();
|
||
|
|
Navigator.pop(context);
|
||
|
|
},
|
||
|
|
child: Text(S.of(context).yes),
|
||
|
|
),
|
||
|
|
TextButton(
|
||
|
|
onPressed: () {
|
||
|
|
Navigator.pop(context);
|
||
|
|
},
|
||
|
|
child: Text(S.of(context).no),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
);
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|