浏览代码

Added small delay to updateDimensions to ensure that renderbox is loaded. (#250)

flutter-beta
Julian Steenbakker 5 年前
父节点
当前提交
f940d6811b
找不到此签名对应的密钥 GPG 密钥 ID: 16E437C7A3D94250
共有 1 个文件被更改,包括 2 次插入5 次删除
  1. +2
    -5
      lib/src/qr_code_scanner.dart

+ 2
- 5
lib/src/qr_code_scanner.dart 查看文件

@@ -212,7 +212,6 @@ class QRViewController {

Stream<Barcode> get scannedDataStream => _scanUpdateController.stream;

static bool _firstRun = true;
SystemFeatures _features;
bool _hasPermissions;

@@ -320,10 +319,8 @@ class QRViewController {
static Future<void> updateDimensions(GlobalKey key, MethodChannel channel,
{QrScannerOverlayShape overlay}) async {
if (defaultTargetPlatform == TargetPlatform.iOS) {
if (_firstRun) {
_firstRun = false;
await Future.delayed(Duration(milliseconds: 300));
}
// Add small delay to ensure the renderbox is loaded
await Future.delayed(Duration(milliseconds: 100));
final RenderBox renderBox = key.currentContext.findRenderObject();
try {
await channel.invokeMethod('setDimensions', {


正在加载...
取消
保存