Skip to content

Conversation

@camsim99
Copy link
Contributor

@camsim99 camsim99 commented Sep 19, 2023

Implements setZoomLevel.

Fixes flutter/flutter#125371.
Fixes flutter/flutter#115847.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

camsim99 added 30 commits May 1, 2023 16:46
}
},
onLongPress:
() {}, // TODO(camsim99): Add functionality back here.,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just taking out for now as they do cause errors.

@camsim99 camsim99 marked this pull request as ready for review October 24, 2023 22:37
@camsim99 camsim99 requested a review from gmackall October 24, 2023 22:37
@camsim99
Copy link
Contributor Author

cc @mossmana if you want to try zooming out on a larger device! You can run the example app, choose a camera to show a preview, then try zooming in/out with your fingers.

Copy link
Member

@gmackall gmackall left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, just have one question about how we are broadcasting errors and a couple nits!

///
/// Ratio should be between what the `minZoomRatio` and `maxZoomRatio` of the
/// [ZoomState] of the [CameraInfo] instance that is retrievable from the same
/// Camera] instance; otherwise, an error will be thrown.
Copy link
Member

Choose a reason for hiding this comment

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

nit: specify which error will be thrown

try {
await setZoomRatio(identifier, ratio);
} on PlatformException catch (e) {
SystemServices.cameraErrorStreamController.add(e.message ??
Copy link
Member

@gmackall gmackall Oct 25, 2023

Choose a reason for hiding this comment

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

This will lose the stack trace right? It looks like we are doing this in other places as well (I probably missed this in earlier reviews), but do we want to include the stack trace in the message as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is true, but this follows suit from the other camera platform implementations. I would argue that it's okay that we don't include it because we should only be catching camera errors like this when the camera was unable to complete the operation and not due to a code error. If you feel strongly though, I don't think it would hurt to include!

Copy link
Member

Choose a reason for hiding this comment

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

No strong feelings either way!

@camsim99 camsim99 requested a review from gmackall October 25, 2023 18:10
@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 25, 2023
@auto-submit auto-submit bot merged commit f2124f7 into flutter:main Oct 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 26, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Oct 26, 2023
flutter/packages@f751ffb...fea24c5

2023-10-25 [email protected] [url_launcher] Fix launch mode types in new APIs (flutter/packages#5232)
2023-10-25 [email protected] [camerax] Implement `setZoomLevel` (flutter/packages#4950)
2023-10-25 [email protected] Roll Flutter from 5e8b5f4 to 5dd2a4e (59 revisions) (flutter/packages#5231)
2023-10-25 [email protected] [file_selector_android] Run tests on AVDs running Android 34 (flutter/packages#5218)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@reidbaker reidbaker mentioned this pull request Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: camera platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[camerax] Implement zoom configuration [camera] Add CameraControl class to CameraX plugin

2 participants