一个 Flutter 包,用于创建干净和极简的对话框。支持空安全和 Flutter 3
特点
- 可定制
- 轻量级
入门
- 通过此命令安装该软件包
flutter pub get clean_dialog
- 将该软件包导入到您希望包含对话框的文件中。
import 'package:clean_dialog/clean_dialog.dart';
- 将此行添加到所需 Button 或手势检测器的 onPress 函数中。
showDialog(
context: context,
builder: (context) => CleanDialog(
title: 'Error',
content: 'We were not able to update your information.',
backgroundColor: const Color(0XFFbe3a2c),
titleTextStyle: const TextStyle(fontSize: 25, fontWeight: FontWeight.bold, color: Colors.white),
contentTextStyle: const TextStyle(fontSize: 16, color: Colors.white),
actions: [
CleanDialogActionButtons(
actionTitle: 'Cancel',
onPressed: () => Navigator.pop(context),
),
CleanDialogActionButtons(
actionTitle: 'Try again',
textColor: const Color(0XFF27ae61),
onPressed: () {},
),
],
),
);

