diff --git a/lib/pages/transaction.dart b/lib/pages/transaction.dart index cc1e691..d0d64c9 100644 --- a/lib/pages/transaction.dart +++ b/lib/pages/transaction.dart @@ -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 locationList = locations.keys.toList(); + String? selectedLocationID; + + await showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: const Text('Select Location'), + content: Row( + mainAxisSize: MainAxisSize.min, + children: [ + DropdownButton( + value: selectedLocationID, + onChanged: (value) { + selectedLocationID = value!; + }, + items: locationList + .map>((locationID) { + return DropdownMenuItem( + 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(context); + }, + child: const Text('Done'), + ), + ], + ); + }, + ); + }, + icon: const Icon(Icons.move_up)) + ], + ), body: Column( children: [ Text("UUID: ${transaction.uuid}"),