Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QR goes black when animated in Android #5

Closed
ctkqiang opened this issue Oct 14, 2020 · 1 comment
Closed

QR goes black when animated in Android #5

ctkqiang opened this issue Oct 14, 2020 · 1 comment

Comments

@ctkqiang
Copy link

My Qr show Black after I zoomed In. What can possibly went wrong ? As My following code :

Library I used: animated_qr_code_scanner: {i used the latest 0.1.7}

bool _topContainerHasFocus = true;
...
...
  void _switchFocus() {
    if (_topContainerHasFocus) {
      _topContainerHeight = _shrunkenHeight;
      _bottomContainerHeight = _focusedHeight;
      _topContainerHasFocus = false;
    } else {
      _topContainerHeight = _focusedHeight;
      _bottomContainerHeight = _shrunkenHeight;
      _topContainerHasFocus = true;
    }
  }
...

...
  AnimatedQRView scannerFunctionality() {
    return AnimatedQRView(
      squareBorderColor: Colors.blue,
      animationDuration: const Duration(
        milliseconds: 40,
      ),
      onScanBeforeAnimation: (String str) {
        debugPrint(str);
      },
      onScan: (String something) {
        debugPrint(something);
      },
      controller: controller,
    );
  }

  AnimatedContainer qrScanner() {
    return AnimatedContainer(
      duration: const Duration(milliseconds: 60),
      curve: Curves.bounceIn,
      child: GestureDetector(
        onTap: () {
          setState(() {
            _switchFocus();
            resumeScanner();
          });
        },
        child: Container(
          width: _bottomContainerHeight * 0.75,
          height: _bottomContainerHeight * 0.75,
          decoration: BoxDecoration(
            borderRadius: const BorderRadius.all(Radius.circular(12)),
            color: Colors.white,
          ),
          child: Expanded(
            flex: 5,
            child: scannerFunctionality(),
          ),
        ),
      ),
    );
  }

and I got error like

I/Camera  (19607): handleMessage: 16
D/BufferQueueProducer(19607): [SurfaceTexture-0-19607-0](this:0x7b0559a800,id:0,api:1,p:577,c:19607) cancelBuffer: slot 0
I/BufferQueueProducer(19607): [SurfaceTexture-0-19607-1](this:0x7af2c36000,id:1,api:4,p:654,c:19607) queueBuffer: slot 2 is dropped, 
@ctkqiang
Copy link
Author

I solved it with

void reRegisterCamerOverlay() {
    controller.flipCamera();
    controller.flipCamera();
  }

which in implement into the setState(); and it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant