mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-29 05:56:47 +00:00
Allow toggle of camera and flash when scanning barcodes
This commit is contained in:
parent
d296d589d9
commit
b9ee0157d2
@ -4,6 +4,9 @@
|
|||||||
### 0.x.x - January 2022
|
### 0.x.x - January 2022
|
||||||
---
|
---
|
||||||
|
|
||||||
|
- Enable usage of camera flash when scanning barcodes
|
||||||
|
- Enable camera toggle when scanning barcodes
|
||||||
|
- Updated icon set
|
||||||
- Removed "upload error report" functionality (instead link to GitHub issues)
|
- Removed "upload error report" functionality (instead link to GitHub issues)
|
||||||
- Updated multiple language translations
|
- Updated multiple language translations
|
||||||
|
|
||||||
|
@ -461,6 +461,19 @@ class _QRViewState extends State<InvenTreeQRView> {
|
|||||||
|
|
||||||
final BarcodeHandler _handler;
|
final BarcodeHandler _handler;
|
||||||
|
|
||||||
|
bool flash_status = false;
|
||||||
|
|
||||||
|
Future<void> updateFlashStatus() async {
|
||||||
|
final bool? status = await _controller?.getFlashStatus();
|
||||||
|
|
||||||
|
flash_status = status != null && status;
|
||||||
|
|
||||||
|
// Reload
|
||||||
|
setState(() {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// In order to get hot reload to work we need to pause the camera if the platform
|
// In order to get hot reload to work we need to pause the camera if the platform
|
||||||
// is android, or resume the camera if the platform is iOS.
|
// is android, or resume the camera if the platform is iOS.
|
||||||
@override
|
@override
|
||||||
@ -494,6 +507,21 @@ class _QRViewState extends State<InvenTreeQRView> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(L10().scanBarcode),
|
title: Text(L10().scanBarcode),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.flip_camera_android),
|
||||||
|
onPressed: () {
|
||||||
|
_controller?.flipCamera();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: flash_status ? Icon(Icons.flash_off) : Icon(Icons.flash_on),
|
||||||
|
onPressed: () {
|
||||||
|
_controller?.toggleFlash();
|
||||||
|
updateFlashStatus();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user