add qr
This commit is contained in:
parent
fb1677ed73
commit
378e777589
8 changed files with 156 additions and 24 deletions
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue