Skip to content

Conversation

@bparrishMines
Copy link
Contributor

Description

Add a live barcode scanner to the Shrine example in the flutter_gallery app.

Related Issues

Replace this paragraph with a list of issues related to this PR from our issue database. Indicate, which of these issues are resolved or fixed by this PR.

Tests

No tests since this is uses camera and firebase_ml_vision. Also, its example code.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

}) : assert(frontTitle != null),
assert(backTitle != null),
super(key: key, listenable: listenable);
}) : assert(frontTitle != null),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the extra padding?

@ghost
Copy link

ghost commented May 16, 2019

related : #32526
btw i tried your code but there is something wrong with barcode.boundingbox

its x,y are reversed for some reason - android 9 : honor play
so i need to do this to fix the check if the barcode is in valid:

final reversedXY = Rect.fromLTRB( barcode.boundingBox.top, barcode.boundingBox.left, barcode.boundingBox.bottom, barcode.boundingBox.right, ); final Rect intersection = validRect.intersect(reversedXY);

@skreborn
Copy link

skreborn commented May 16, 2019

@KirolousNashaat I believe this might be because the detector is given the camera's current orientation, but I don't see _handleResult accounting for the same. Perhaps your camera is detected as rotated - can you test and see what camera.sensorOrientation is for you.

Then again, I might be completely off here.

@ghost
Copy link

ghost commented May 16, 2019

@KirolousNashaat I believe this might be because the detector is given the camera's current orientation, but I don't see _handleResult accounting for the same. Perhaps your camera is detected as rotated - can you test and see what camera.sensorOrientation is for you.

Then again, I might be completely off here.

u are right , just tested my orientation is 90 in portrait ?
i think i should rotate the validRect with my sensor orientation , 90 / 270 = treat them the same ?

@ghost
Copy link

ghost commented May 16, 2019

like this :

if (cameraDescription.sensorOrientation == 90 || cameraDescription.sensorOrientation == 270) {
    validRect = Rect.fromLTRB(
        center.dy - halfHeight,
        center.dx - halfWidth,
        center.dy + halfHeight,
        center.dx + halfWidth,
    );
} else {
    validRect = Rect.fromLTRB(
        center.dx - halfWidth,
        center.dy - halfHeight,
        center.dx + halfWidth,
        center.dy + halfHeight,
    );
}

btw :
_cameraController.stopImageStream(); freezes the app for a moment

@HansMuller HansMuller added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. customer: gallery Relating to flutter/gallery repository. Please transfer non-framework issues there. labels May 16, 2019
@bparrishMines
Copy link
Contributor Author

This example is now in the flutter/plugins repo with PR flutter/plugins#1758

@bparrishMines bparrishMines deleted the shrine_barcode branch June 19, 2019 22:30
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

customer: gallery Relating to flutter/gallery repository. Please transfer non-framework issues there. f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants