mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Dialog improvements (#308)
This commit is contained in:
parent
26b86a2194
commit
cb5c292326
@ -175,16 +175,18 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
// Navigator.of(context, rootNavigator: true).pop();
|
// Navigator.of(context, rootNavigator: true).pop();
|
||||||
confirmationDialog(
|
confirmationDialog(
|
||||||
L10().delete,
|
L10().delete,
|
||||||
L10().profileDelete + "?",
|
L10().profileDelete + "?",
|
||||||
onAccept: () {
|
color: Colors.red,
|
||||||
_deleteProfile(profile);
|
icon: FontAwesomeIcons.trashCan,
|
||||||
}
|
onAccept: () {
|
||||||
|
_deleteProfile(profile);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text(L10().profileDelete),
|
title: Text(L10().profileDelete, style: TextStyle(color: Colors.red)),
|
||||||
leading: FaIcon(FontAwesomeIcons.trashCan),
|
leading: FaIcon(FontAwesomeIcons.trashCan, color: Colors.red),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -13,7 +13,7 @@ import "package:inventree/widget/snacks.dart";
|
|||||||
/*
|
/*
|
||||||
* Display a "confirmation" dialog allowing the user to accept or reject an action
|
* Display a "confirmation" dialog allowing the user to accept or reject an action
|
||||||
*/
|
*/
|
||||||
Future<void> confirmationDialog(String title, String text, {IconData icon = FontAwesomeIcons.circleQuestion, String? acceptText, String? rejectText, Function? onAccept, Function? onReject}) async {
|
Future<void> confirmationDialog(String title, String text, {Color? color, IconData icon = FontAwesomeIcons.circleQuestion, String? acceptText, String? rejectText, Function? onAccept, Function? onReject}) async {
|
||||||
|
|
||||||
String _accept = acceptText ?? L10().ok;
|
String _accept = acceptText ?? L10().ok;
|
||||||
String _reject = rejectText ?? L10().cancel;
|
String _reject = rejectText ?? L10().cancel;
|
||||||
@ -21,9 +21,10 @@ Future<void> confirmationDialog(String title, String text, {IconData icon = Font
|
|||||||
OneContext().showDialog(
|
OneContext().showDialog(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
|
iconColor: color,
|
||||||
title: ListTile(
|
title: ListTile(
|
||||||
title: Text(title),
|
title: Text(title, style: TextStyle(color: color)),
|
||||||
leading: FaIcon(icon),
|
leading: FaIcon(icon, color: color),
|
||||||
),
|
),
|
||||||
content: Text(text),
|
content: Text(text),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -293,6 +293,8 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
L10().stockItemDelete,
|
L10().stockItemDelete,
|
||||||
L10().stockItemDeleteConfirm,
|
L10().stockItemDeleteConfirm,
|
||||||
icon: FontAwesomeIcons.trashCan,
|
icon: FontAwesomeIcons.trashCan,
|
||||||
|
color: Colors.red,
|
||||||
|
acceptText: L10().delete,
|
||||||
onAccept: () async {
|
onAccept: () async {
|
||||||
final bool result = await widget.item.delete();
|
final bool result = await widget.item.delete();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user