mintware-de / flutter_barcode_reader

A flutter plugin for reading 2D barcodes and QR codes.
MIT License
628 stars 463 forks source link

3.0.0 setting button language is invalid #221

Closed Qson8 closed 4 years ago

Qson8 commented 4 years ago

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, ), );

  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;
  // });
}

}

devtronic commented 4 years ago

I'm sorry, but I don't understand your problem. Please provide more details about the actual and the expected behavior.