This commit is contained in:
JMARyA 2024-09-05 11:08:52 +02:00
parent fb1677ed73
commit 378e777589
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
8 changed files with 156 additions and 24 deletions

View file

@ -1,5 +1,6 @@
import 'package:cdb_ui/api.dart';
import 'package:flutter/material.dart';
import 'package:qr_bar_code_scanner_dialog/qr_bar_code_scanner_dialog.dart';
class ItemView extends StatelessWidget {
final Item item;
@ -217,29 +218,45 @@ class _SupplyPageState extends State<SupplyPage> {
),
// Location Dropdown
DropdownButtonFormField<String>(
hint: const Text('Select Location'),
value: _selectedLocation,
onChanged: (value) {
setState(() {
_selectedLocation = value!;
});
},
items: locations.map<DropdownMenuItem<String>>((location) {
return DropdownMenuItem<String>(
value: location,
child: Text(location),
);
}).toList(),
validator: (value) {
if (value == null) {
return 'Please select a location';
}
return null;
},
onSaved: (value) {
_selectedLocation = value!;
},
Row(
children: [
DropdownButtonFormField<String>(
hint: const Text('Select Location'),
value: _selectedLocation,
onChanged: (value) {
setState(() {
_selectedLocation = value!;
});
},
items:
locations.map<DropdownMenuItem<String>>((location) {
return DropdownMenuItem<String>(
value: location,
child: Text(location),
);
}).toList(),
validator: (value) {
if (value == null) {
return 'Please select a location';
}
return null;
},
onSaved: (value) {
_selectedLocation = value!;
},
),
IconButton(
onPressed: () {
QrBarCodeScannerDialog().getScannedQrBarCode(
context: context,
onCode: (code) {
setState(() {
_selectedLocation = code!;
});
});
},
icon: const Icon(Icons.qr_code))
],
),
const SizedBox(height: 20),