mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Improve error message handlers
This commit is contained in:
parent
02982cea5e
commit
47929c888b
@ -1,6 +1,7 @@
|
||||
import 'package:InvenTree/widget/dialogs.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
//import 'package:qr_utils/qr_utils.dart';
|
||||
//import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
@ -58,11 +59,13 @@ class _QRViewState extends State<InvenTreeQRView> {
|
||||
|
||||
showErrorDialog(
|
||||
context,
|
||||
"Server Error: ${response.statusCode}",
|
||||
"Status Code: ${response.statusCode}",
|
||||
"${response.body.toString().split('\n').first}",
|
||||
onDismissed: () {
|
||||
_controller.resumeCamera();
|
||||
}
|
||||
},
|
||||
error: "Server Error",
|
||||
icon: FontAwesomeIcons.server,
|
||||
);
|
||||
|
||||
return;
|
||||
@ -79,6 +82,7 @@ class _QRViewState extends State<InvenTreeQRView> {
|
||||
body['error'] ?? '',
|
||||
body['plugin'] ?? 'No barcode plugin information',
|
||||
error: "Barcode Error",
|
||||
icon: FontAwesomeIcons.barcode,
|
||||
onDismissed: () {
|
||||
_controller.resumeCamera();
|
||||
}
|
||||
|
@ -9,13 +9,13 @@ void showMessage(BuildContext context, String message) {
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> showErrorDialog(BuildContext context, String title, String description, {String error = "Error", Function onDismissed}) async {
|
||||
Future<void> showErrorDialog(BuildContext context, String title, String description, {IconData icon = FontAwesomeIcons.exclamationCircle, String error = "Error", Function onDismissed}) async {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: SimpleDialog(
|
||||
title: ListTile(
|
||||
title: Text(error),
|
||||
leading: FaIcon(FontAwesomeIcons.exclamationCircle),
|
||||
leading: FaIcon(icon),
|
||||
),
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
|
Loading…
x
Reference in New Issue
Block a user