2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Add some //TODO items

This commit is contained in:
Oliver Walters 2020-04-18 22:53:02 +10:00
parent c4d8b5ce1c
commit 8374691d8c
3 changed files with 25 additions and 7 deletions

View File

@ -3,6 +3,12 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
void showMessage(BuildContext context, String message) {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(message),
));
}
void showErrorDialog(BuildContext context, String title, String description) {
showDialog(
context: context,

View File

@ -68,9 +68,13 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
appBar: getAppBar(context),
drawer: getDrawer(context),
floatingActionButton: getFab(context),
body: RefreshIndicator(
onRefresh: refresh,
child: getBody(context)
body: Builder(
builder: (BuildContext context) {
return RefreshIndicator(
onRefresh: refresh,
child: getBody(context)
);
}
),
bottomNavigationBar: getBottomNavBar(context),
);

View File

@ -97,6 +97,8 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
// TODO - Handle error cases
refresh();
// TODO - Display a snackbar here indicating the action was successful (or otherwise)
}
void _addStockDialog() async {
@ -141,6 +143,8 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
// TODO - Handle error cases
refresh();
// TODO - Display a snackbar here indicating the action was successful (or otherwise)
}
void _removeStockDialog() {
@ -187,6 +191,8 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
// TODO - Handle error cases, timeout, etc
refresh();
// TODO - Display a snackbar here indicating the action was successful (or otherwise)
}
void _countStockDialog() async {
@ -218,7 +224,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
}
void _transferStock(int location) async {
void _transferStock(BuildContext context, InvenTreeStockLocation location) async {
Navigator.of(context).pop();
double quantity = double.parse(_quantityController.text);
@ -227,11 +233,13 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
_quantityController.clear();
_notesController.clear();
var response = await item.transferStock(quantity, location, notes: notes);
var response = await item.transferStock(quantity, location.pk, notes: notes);
// TODO - Error handling
// TODO - Error handling (potentially return false?)
refresh();
// TODO - Display a snackbar here indicating the action was successful (or otherwise)
}
void _transferStockDialog() async {
@ -293,7 +301,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
_selectedController.text = selectedLocation.pathstring;
},
onSaved: (value) {
_transferStock(selectedLocation.pk);
_transferStock(context, selectedLocation);
},
itemBuilder: (context, suggestion) {
var location = suggestion as InvenTreeStockLocation;