update
This commit is contained in:
parent
20bc5a9ae6
commit
3da48add7e
6 changed files with 98 additions and 87 deletions
|
@ -3,6 +3,7 @@ import 'package:http/http.dart' as http;
|
|||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
// todo : api errors
|
||||
// todo : api caching
|
||||
|
||||
class API {
|
||||
late SharedPreferences pref;
|
||||
|
|
|
@ -20,9 +20,11 @@ class _EndFlowWithProduceState extends State<EndFlowWithProduce> {
|
|||
List<Widget> ret = [];
|
||||
|
||||
for (var i in widget.info.produces!) {
|
||||
ret.add(ElevatedButton(onPressed: () {
|
||||
// todo : implement adding
|
||||
}, child: Text("Produced $i")));
|
||||
ret.add(ElevatedButton(
|
||||
onPressed: () {
|
||||
// todo : implement adding
|
||||
},
|
||||
child: Text("Produced $i")));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -38,14 +40,20 @@ class _EndFlowWithProduceState extends State<EndFlowWithProduce> {
|
|||
Widget build(BuildContext context) {
|
||||
// todo : show end screen with produce
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text("End ${widget.info.name} Flow"),),
|
||||
body: Column(children: [
|
||||
...addProduceButtons(),
|
||||
const Divider(),
|
||||
// todo : add produced list
|
||||
const SizedBox(height: 10,),
|
||||
ElevatedButton(onPressed: _endFlow, child: const Text("End Flow"))
|
||||
],),
|
||||
appBar: AppBar(
|
||||
title: Text("End ${widget.info.name} Flow"),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
...addProduceButtons(),
|
||||
const Divider(),
|
||||
// todo : add produced list
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
ElevatedButton(onPressed: _endFlow, child: const Text("End Flow"))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,4 +158,4 @@ class _FlowsPageState extends State<FlowsPage> {
|
|||
_ => const Text("..."),
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class _ItemViewState extends State<ItemView> {
|
|||
fallbackWidth: 100,
|
||||
fallbackHeight: 100,
|
||||
),
|
||||
), // todo
|
||||
),
|
||||
const SizedBox(
|
||||
width: 16.0,
|
||||
),
|
||||
|
|
|
@ -178,10 +178,9 @@ class _SupplyPageState extends State<SupplyPage> {
|
|||
|
||||
// Note
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(labelText: 'Note'),
|
||||
controller: _noteController,
|
||||
maxLines: 5
|
||||
),
|
||||
decoration: const InputDecoration(labelText: 'Note'),
|
||||
controller: _noteController,
|
||||
maxLines: 5),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
|
|
|
@ -23,78 +23,81 @@ class _TransactionPageState extends State<TransactionPage> {
|
|||
title: Text(widget.transaction.item),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
final locations = await API().getLocations();
|
||||
List<String> locationList = locations.keys.toList();
|
||||
String? selectedLocationID;
|
||||
onPressed: () {
|
||||
API().getLocations().then((locations) {
|
||||
List<String> locationList = locations.keys.toList();
|
||||
String? selectedLocationID;
|
||||
|
||||
await showDialog<int>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Select Location'),
|
||||
content: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DropdownButton<String>(
|
||||
value: selectedLocationID,
|
||||
onChanged: (value) {
|
||||
selectedLocationID = value!;
|
||||
API()
|
||||
.moveTransaction(widget.transaction.uuid,
|
||||
selectedLocationID!)
|
||||
.then((x) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
items: locationList
|
||||
.map<DropdownMenuItem<String>>((locationID) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: locationID,
|
||||
child: Text(locations[locationID]!.name),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
API().getLocations().then((locations) {
|
||||
QrBarCodeScannerDialog().getScannedQrBarCode(
|
||||
context: context,
|
||||
onCode: (code) {
|
||||
// library is retarded
|
||||
code = code!.replaceFirst(
|
||||
"Code scanned = ", "");
|
||||
if (!locations.containsKey(code)) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'The location $code does not exist.')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
API()
|
||||
.moveTransaction(
|
||||
widget.transaction.uuid,
|
||||
selectedLocationID!)
|
||||
.then(
|
||||
(x) {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
});
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Move Transaction'),
|
||||
content: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DropdownButton<String>(
|
||||
value: selectedLocationID,
|
||||
onChanged: (value) {
|
||||
selectedLocationID = value!;
|
||||
API()
|
||||
.moveTransaction(widget.transaction.uuid,
|
||||
selectedLocationID!)
|
||||
.then((x) {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.qr_code))
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
items: locationList
|
||||
.map<DropdownMenuItem<String>>((locationID) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: locationID,
|
||||
child: Text(locations[locationID]!.name),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
API().getLocations().then((locations) {
|
||||
QrBarCodeScannerDialog()
|
||||
.getScannedQrBarCode(
|
||||
context: context,
|
||||
onCode: (code) {
|
||||
// library is retarded
|
||||
code = code!.replaceFirst(
|
||||
"Code scanned = ", "");
|
||||
if (!locations
|
||||
.containsKey(code)) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'The location $code does not exist.')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
API()
|
||||
.moveTransaction(
|
||||
widget.transaction.uuid,
|
||||
selectedLocationID!)
|
||||
.then(
|
||||
(x) {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
setState(() {});
|
||||
},
|
||||
icon: const Icon(Icons.qr_code))
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.move_up))
|
||||
],
|
||||
|
@ -327,4 +330,4 @@ class TransactionSelectPage extends StatelessWidget {
|
|||
.toList()),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue