update
This commit is contained in:
parent
b299297fa5
commit
11fc5c43bf
29 changed files with 1041 additions and 124 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:pharmacy_mobile/tables/ref_medicines.dart';
|
||||
|
|
@ -10,6 +12,7 @@ import 'package:pharmacy_mobile/widgets/input_widget.dart';
|
|||
import 'package:pharmacy_mobile/widgets/page_background_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/text_widget.dart';
|
||||
import 'package:pharmacy_mobile/widgets/title_widget.dart';
|
||||
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||
|
||||
class AddStockPage extends StatefulWidget {
|
||||
const AddStockPage({super.key});
|
||||
|
|
@ -18,7 +21,7 @@ class AddStockPage extends StatefulWidget {
|
|||
State<AddStockPage> createState() => _AddStockPageState();
|
||||
}
|
||||
|
||||
class _AddStockPageState extends State<AddStockPage> {
|
||||
class _AddStockPageState extends State<AddStockPage> with WidgetsBindingObserver {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final FocusNode _focusNode = FocusNode();
|
||||
final _refMedicines = RefMedicines();
|
||||
|
|
@ -31,6 +34,7 @@ class _AddStockPageState extends State<AddStockPage> {
|
|||
late List _medicineList = [];
|
||||
late String _selectedMedicine = '';
|
||||
late DateTime selectedDate = DateTime.now();
|
||||
late String barcode = '';
|
||||
|
||||
void autoRun() async {
|
||||
_medicineList = await _refMedicines.getList();
|
||||
|
|
@ -101,7 +105,34 @@ class _AddStockPageState extends State<AddStockPage> {
|
|||
value: selectedDate,
|
||||
),
|
||||
const Gap(32),
|
||||
ButtonWidget(text: 'Add Stock', onPressed: _saveStock)
|
||||
ButtonWidget(text: 'Add Stock', onPressed: _saveStock),
|
||||
const Gap(16),
|
||||
ButtonWidget(
|
||||
text: 'Barcode',
|
||||
onPressed: () async {
|
||||
String? bc = await SimpleBarcodeScanner.scanBarcode(
|
||||
context,
|
||||
// barcodeAppBar: const BarcodeAppBar(
|
||||
// // appBarTitle: 'Test',
|
||||
// // centerTitle: false,
|
||||
// // enableBackButton: false,
|
||||
// // backButtonIcon: Icon(Icons.arrow_back_ios),
|
||||
// ),
|
||||
// isShowFlashIcon: true,
|
||||
delayMillis: 2000,
|
||||
scanType: ScanType.barcode,
|
||||
cameraFace: CameraFace.back,
|
||||
);
|
||||
setState(() {
|
||||
barcode = bc as String;
|
||||
});
|
||||
},
|
||||
),
|
||||
const Gap(16),
|
||||
TextWidget(
|
||||
text: barcode,
|
||||
size: 14,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue