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

fix: Scanner preview over other widgets fix #939

Merged
merged 1 commit into from
Jan 13, 2022
Merged

Conversation

M123-dev
Copy link
Member

Fixes: #930

Just a wrong order in the Stack

@teolemon
Copy link
Member

Can we speedy merge this one ?

@M123-dev M123-dev merged commit c5ea875 into develop Jan 13, 2022
@M123-dev M123-dev deleted the scanner-fix branch January 13, 2022 15:44
@jasmeet0817
Copy link
Contributor

technically this should fix the issue, I tried the same thing on my local to fix this but the camera went black on my simulator, but I haven't tried it on my phone

@teolemon
Copy link
Member

Black screen on a physical device as well

@M123-dev
Copy link
Member Author

Thats really interesting, you could see the image before but now after just switching the widgets the screen is black

@jasmeet0817
Copy link
Contributor

jasmeet0817 commented Jan 13, 2022

yeah, it's because getScannerWidgets is indeed taking the whole screen, it creates the qr scanner box etc. So if you put it on top of the camera, the camera is not shown.

I actually don't understand how this was working before, I'm taking a look as well...

@jasmeet0817
Copy link
Contributor

jasmeet0817 commented Jan 13, 2022

ok so I did a quick dirty fix and moved the black screen (Container for assets/actions/scanner_alt_2.svg) from scan_page_helper to ml_kit_scan_page

Screenshot_1642097895

Come to think of it, I'm not even sure the Container with assets/actions/scanner_alt_2.svg is useful at all. It just gives a black background.

I still don't understand why the camera doesn't fill up the whole screen.

@M123-dev
Copy link
Member Author

Found it

@jasmeet0817
Copy link
Contributor

jasmeet0817 commented Jan 13, 2022

ok got it, removed the Container, removed the scale in the camera and this is what I get:

Screenshot_1642098324

Do we know why these things were added?

The code I have is this:

ml_kit_page:

Stack(
          fit: StackFit.expand,
          children: <Widget>[
            SmoothRevealAnimation(
              delay: 400,
              startOffset: Offset.zero,
              animationCurve: Curves.easeInOutBack,
              child: CameraPreview(
                _controller!,
              ),
            ),
            ...getScannerWidgets(
              context,
              constraints,
              _model,
            ),
          ],
        );

ScanPageHelper:

return <Widget>[
    SmoothRevealAnimation(
      delay: 400,
      startOffset: const Offset(0.0, 0.1),
      animationCurve: Curves.easeInOutBack,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: <Widget>[
          Padding(
            padding: qrScannerPadding,
            child: SmoothViewFinder(
              boxSize: scannerSize,
              lineLength: screenSize.width * 0.8,
            ),
          ),
        ],
      ),
    ),
    SmoothRevealAnimation(
      delay: 400,
      startOffset: const Offset(0.0, -0.1),
      animationCurve: Curves.easeInOutBack,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: <Widget>[
          buildButtonsRow(context, model),
          const Spacer(),
          SmoothProductCarousel(
            showSearchCard: true,
            height: carouselHeight,
          ),
        ],
      ),
    ),
  ];

@M123-dev
Copy link
Member Author

Yes noticed this too, I am going to PR a fix combined with permission management

@jasmeet0817
Copy link
Contributor

ok:)

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

Successfully merging this pull request may close these issues.

The scan card disappears (with or without) the new MLKit scanner
3 participants