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:InvenTree/widget/dialogs.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
|
||||||
//import 'package:qr_utils/qr_utils.dart';
|
//import 'package:qr_utils/qr_utils.dart';
|
||||||
//import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
//import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||||
@ -58,11 +59,13 @@ class _QRViewState extends State<InvenTreeQRView> {
|
|||||||
|
|
||||||
showErrorDialog(
|
showErrorDialog(
|
||||||
context,
|
context,
|
||||||
"Server Error: ${response.statusCode}",
|
"Status Code: ${response.statusCode}",
|
||||||
"${response.body.toString().split('\n').first}",
|
"${response.body.toString().split('\n').first}",
|
||||||
onDismissed: () {
|
onDismissed: () {
|
||||||
_controller.resumeCamera();
|
_controller.resumeCamera();
|
||||||
}
|
},
|
||||||
|
error: "Server Error",
|
||||||
|
icon: FontAwesomeIcons.server,
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -79,6 +82,7 @@ class _QRViewState extends State<InvenTreeQRView> {
|
|||||||
body['error'] ?? '',
|
body['error'] ?? '',
|
||||||
body['plugin'] ?? 'No barcode plugin information',
|
body['plugin'] ?? 'No barcode plugin information',
|
||||||
error: "Barcode Error",
|
error: "Barcode Error",
|
||||||
|
icon: FontAwesomeIcons.barcode,
|
||||||
onDismissed: () {
|
onDismissed: () {
|
||||||
_controller.resumeCamera();
|
_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(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
child: SimpleDialog(
|
child: SimpleDialog(
|
||||||
title: ListTile(
|
title: ListTile(
|
||||||
title: Text(error),
|
title: Text(error),
|
||||||
leading: FaIcon(FontAwesomeIcons.exclamationCircle),
|
leading: FaIcon(icon),
|
||||||
),
|
),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ListTile(
|
ListTile(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user