2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +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:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.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) { void showErrorDialog(BuildContext context, String title, String description) {
showDialog( showDialog(
context: context, context: context,

View File

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

View File

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