2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Refactor create state (#184)

* Refactor createstate for api_form

- Refer to attributes of widget

* Refactor barcode state variables

* More udpates
This commit is contained in:
Oliver
2022-07-19 23:34:26 +10:00
committed by GitHub
parent 13ebaf43e1
commit 277193ecb0
4 changed files with 37 additions and 57 deletions

View File

@ -606,20 +606,18 @@ class InvenTreeQRView extends StatefulWidget {
final BarcodeHandler _handler;
@override
State<StatefulWidget> createState() => _QRViewState(_handler);
State<StatefulWidget> createState() => _QRViewState();
}
class _QRViewState extends State<InvenTreeQRView> {
_QRViewState(this._handler) : super();
_QRViewState() : super();
final GlobalKey qrKey = GlobalKey(debugLabel: "QR");
QRViewController? _controller;
final BarcodeHandler _handler;
bool flash_status = false;
Future<void> updateFlashStatus() async {
@ -652,7 +650,7 @@ class _QRViewState extends State<InvenTreeQRView> {
_controller?.pauseCamera();
if (barcode.code != null) {
_handler.processBarcode(_controller, barcode.code ?? "");
widget._handler.processBarcode(_controller, barcode.code ?? "");
}
});
}
@ -711,7 +709,7 @@ class _QRViewState extends State<InvenTreeQRView> {
children: [
Spacer(),
Padding(
child: Text(_handler.getOverlayText(context),
child: Text(widget._handler.getOverlayText(context),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),