This commit is contained in:
JMARyA 2024-09-24 14:55:14 +02:00
parent f1abe6572d
commit 4a93adf463
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -13,6 +13,60 @@ class TransactionPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(transaction.item),
actions: [
IconButton(
onPressed: () async {
final locations = await API().getLocations();
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!;
},
items: locationList
.map<DropdownMenuItem<String>>((locationID) {
return DropdownMenuItem<String>(
value: locationID,
child: Text(locations[locationID]!.name),
);
}).toList(),
),
IconButton(
onPressed: () {
// todo : implement
},
icon: const Icon(Icons.qr_code))
],
),
actions: [
ElevatedButton(
onPressed: () async {
await API().moveTransaction(
transaction.uuid, selectedLocationID!);
Navigator.pop<int>(context);
},
child: const Text('Done'),
),
],
);
},
);
},
icon: const Icon(Icons.move_up))
],
),
body: Column(
children: [
Text("UUID: ${transaction.uuid}"),