Julian Steenbakker

style: format

... ... @@ -16,10 +16,10 @@ class _BarcodeScannerWithControllerState
String? barcode;
MobileScannerController controller = MobileScannerController(
torchEnabled: true,
// formats: [BarcodeFormat.qrCode]
// facing: CameraFacing.front,
);
torchEnabled: true,
// formats: [BarcodeFormat.qrCode]
// facing: CameraFacing.front,
);
bool isStarted = true;
... ...
... ... @@ -60,41 +60,36 @@ class _MobileScannerState extends State<MobileScanner>
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, BoxConstraints constraints) {
return ValueListenableBuilder(
valueListenable: controller.args,
builder: (context, value, child) {
value = value as MobileScannerArguments?;
if (value == null) {
return Container(color: Colors.black);
} else {
controller.barcodes.listen(
(a) =>
widget.onDetect!(a, value as MobileScannerArguments));
return ClipRect(
child: SizedBox(
width: MediaQuery
.of(context)
.size
.width,
height: MediaQuery
.of(context)
.size
.height,
child: FittedBox(
fit: widget.fit,
child: SizedBox(
width: value.size.width,
height: value.size.height,
child: kIsWeb ? HtmlElementView(viewType: value.webId!) : Texture(textureId: value.textureId!),
),
return LayoutBuilder(builder: (context, BoxConstraints constraints) {
return ValueListenableBuilder(
valueListenable: controller.args,
builder: (context, value, child) {
value = value as MobileScannerArguments?;
if (value == null) {
return Container(color: Colors.black);
} else {
controller.barcodes.listen(
(a) => widget.onDetect!(a, value as MobileScannerArguments));
return ClipRect(
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: FittedBox(
fit: widget.fit,
child: SizedBox(
width: value.size.width,
height: value.size.height,
child: kIsWeb
? HtmlElementView(viewType: value.webId!)
: Texture(textureId: value.textureId!),
),
),
);
}
});
});
}
),
);
}
});
});
}
@override
void didUpdateWidget(covariant MobileScanner oldWidget) {
... ...
... ... @@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'mobile_scanner_arguments.dart';
import 'objects/barcode_utility.dart';
/// The facing of a camera.
... ... @@ -188,7 +187,6 @@ class MobileScannerController {
size: Size(startResult['videoWidth'], startResult['videoHeight']),
hasTorch: hasTorch);
} else {
args.value = MobileScannerArguments(
textureId: startResult['textureId'],
size: toSize(startResult['size']),
... ...