2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 18:55:34 +00:00

Add a connection checker

This commit is contained in:
Oliver Walters
2020-04-06 22:33:38 +10:00
parent 0e35c370ba
commit 37cdf23ae1
3 changed files with 51 additions and 0 deletions

View File

@ -1,6 +1,9 @@
import 'package:InvenTree/api.dart';
import 'package:InvenTree/barcode.dart';
import 'package:flutter/material.dart';
import 'package:InvenTree/api.dart';
import 'package:InvenTree/widget/category_display.dart';
import 'package:InvenTree/widget/location_display.dart';
@ -33,6 +36,7 @@ class InvenTreeDrawer extends StatelessWidget {
* Upon successful scan, data are passed off to be decoded.
*/
void _scan() async {
if (!InvenTreeAPI().checkConnection(context)) return;
_closeDrawer();
scanQrCode(context);
@ -42,6 +46,7 @@ class InvenTreeDrawer extends StatelessWidget {
* Display the top-level PartCategory list
*/
void _showParts() {
if (!InvenTreeAPI().checkConnection(context)) return;
_closeDrawer();
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
@ -51,6 +56,7 @@ class InvenTreeDrawer extends StatelessWidget {
* Display the top-level StockLocation list
*/
void _showStock() {
if (!InvenTreeAPI().checkConnection(context)) return;
_closeDrawer();
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null)));
}
@ -72,6 +78,7 @@ class InvenTreeDrawer extends StatelessWidget {
leading: new Image.asset(
"assets/image/icon.png",
fit: BoxFit.scaleDown,
width: 40,
),
title: new Text("InvenTree"),
onTap: _home,