This commit is contained in:
JMARyA 2024-09-25 10:49:21 +02:00
parent 20bc5a9ae6
commit 3da48add7e
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
6 changed files with 98 additions and 87 deletions

View file

@ -3,6 +3,7 @@ import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
// todo : api errors // todo : api errors
// todo : api caching
class API { class API {
late SharedPreferences pref; late SharedPreferences pref;

View file

@ -20,9 +20,11 @@ class _EndFlowWithProduceState extends State<EndFlowWithProduce> {
List<Widget> ret = []; List<Widget> ret = [];
for (var i in widget.info.produces!) { for (var i in widget.info.produces!) {
ret.add(ElevatedButton(onPressed: () { ret.add(ElevatedButton(
onPressed: () {
// todo : implement adding // todo : implement adding
}, child: Text("Produced $i"))); },
child: Text("Produced $i")));
} }
return ret; return ret;
@ -38,14 +40,20 @@ class _EndFlowWithProduceState extends State<EndFlowWithProduce> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
// todo : show end screen with produce // todo : show end screen with produce
return Scaffold( return Scaffold(
appBar: AppBar(title: Text("End ${widget.info.name} Flow"),), appBar: AppBar(
body: Column(children: [ title: Text("End ${widget.info.name} Flow"),
),
body: Column(
children: [
...addProduceButtons(), ...addProduceButtons(),
const Divider(), const Divider(),
// todo : add produced list // todo : add produced list
const SizedBox(height: 10,), const SizedBox(
height: 10,
),
ElevatedButton(onPressed: _endFlow, child: const Text("End Flow")) ElevatedButton(onPressed: _endFlow, child: const Text("End Flow"))
],), ],
),
); );
} }
} }

View file

@ -40,7 +40,7 @@ class _ItemViewState extends State<ItemView> {
fallbackWidth: 100, fallbackWidth: 100,
fallbackHeight: 100, fallbackHeight: 100,
), ),
), // todo ),
const SizedBox( const SizedBox(
width: 16.0, width: 16.0,
), ),

View file

@ -180,8 +180,7 @@ class _SupplyPageState extends State<SupplyPage> {
TextFormField( TextFormField(
decoration: const InputDecoration(labelText: 'Note'), decoration: const InputDecoration(labelText: 'Note'),
controller: _noteController, controller: _noteController,
maxLines: 5 maxLines: 5),
),
const SizedBox(height: 20), const SizedBox(height: 20),

View file

@ -23,16 +23,16 @@ class _TransactionPageState extends State<TransactionPage> {
title: Text(widget.transaction.item), title: Text(widget.transaction.item),
actions: [ actions: [
IconButton( IconButton(
onPressed: () async { onPressed: () {
final locations = await API().getLocations(); API().getLocations().then((locations) {
List<String> locationList = locations.keys.toList(); List<String> locationList = locations.keys.toList();
String? selectedLocationID; String? selectedLocationID;
await showDialog<int>( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Select Location'), title: const Text('Move Transaction'),
content: Row( content: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -60,13 +60,15 @@ class _TransactionPageState extends State<TransactionPage> {
IconButton( IconButton(
onPressed: () { onPressed: () {
API().getLocations().then((locations) { API().getLocations().then((locations) {
QrBarCodeScannerDialog().getScannedQrBarCode( QrBarCodeScannerDialog()
.getScannedQrBarCode(
context: context, context: context,
onCode: (code) { onCode: (code) {
// library is retarded // library is retarded
code = code!.replaceFirst( code = code!.replaceFirst(
"Code scanned = ", ""); "Code scanned = ", "");
if (!locations.containsKey(code)) { if (!locations
.containsKey(code)) {
ScaffoldMessenger.of(context) ScaffoldMessenger.of(context)
.showSnackBar( .showSnackBar(
SnackBar( SnackBar(
@ -95,6 +97,7 @@ class _TransactionPageState extends State<TransactionPage> {
); );
}, },
); );
});
}, },
icon: const Icon(Icons.move_up)) icon: const Icon(Icons.move_up))
], ],