I used the new version of 3.0.0 to set the button language according to the following code, but in order to take effect, the demo you provided is valid. Is there anything to be configured in the project?
var result = await BarcodeScanner.scan(options: options);
// setState(() => scanResult = result);
} on PlatformException catch (e) {
var result = ScanResult(
type: ResultType.Error,
format: BarcodeFormat.unknown,
);
if (e.code == BarcodeScanner.cameraAccessDenied) {
setState(() {
result.rawContent = 'The user did not grant the camera permission!';
});
} else {
result.rawContent = 'Unknown error: $e';
}
// setState(() {
// scanResult = result;
// });
}
I used the new version of 3.0.0 to set the button language according to the following code, but in order to take effect, the demo you provided is valid. Is there anything to be configured in the project?
code
Future scan() async { try { var options = ScanOptions( strings: { "cancel": "取消", "flash_on": "开启", "flash_off": "关闭", }, restrictFormat: selectedFormats, useCamera: _selectedCamera, autoEnableFlash: _autoEnableFlash, android: AndroidOptions( aspectTolerance: _aspectTolerance, useAutoFocus: _useAutoFocus, ), );
}