simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../api/errors/error_mapper.dart';
|
||||
import '../utils/clipboard_helper.dart';
|
||||
|
||||
class InfoDialog {
|
||||
@@ -40,4 +41,15 @@ class InfoDialog {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Error dialog with the user-facing [message] (default: mapped from
|
||||
/// [error]) plus the technical details when they add information.
|
||||
static void showError(BuildContext context, Object error, {String? message}) {
|
||||
final text = message ?? errorToUserMessage(error);
|
||||
final details = errorToTechnicalDetails(error);
|
||||
final body = details != null && details != text
|
||||
? '$text\n\n$details'
|
||||
: text;
|
||||
show(context, body, copyable: true, title: 'Fehler');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user