- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.5k
          [camerax] Implement setZoomLevel
          #4950
        
          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
Conversation
| } | ||
| }, | ||
| onLongPress: | ||
| () {}, // TODO(camsim99): Add functionality back here., | 
There was a problem hiding this comment.
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.
| 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. | 
There was a problem hiding this 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!
        
          
                packages/camera/camera_android_camerax/lib/src/camera_control.dart
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | /// | ||
| /// 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. | 
There was a problem hiding this comment.
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 ?? | 
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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!
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
Implements
setZoomLevel.Fixes flutter/flutter#125371.
Fixes flutter/flutter#115847.
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).