Closed migalv closed 1 year ago
Thank you for raising this issue!
We linked a few properties to each Sensor (back camera or front camera). Aspect ratio is among them. When switching camera, these properties are reset to their default value.
I am not sure that we could have a behaviour that fits for everyone.
For example, some people might want to reset to the original aspect ratio set in CamerAwesomeBuilder
, others would like to keep the last aspect ratio chosen.
I will add optional parameters in my next PR to switchCameraSensor()
to let you provide Sensor related properties (flash, aspect ratio...). I'll let you updated when it's ready.
Hello, @apalala-dev thanks a lot again for your quick response. That makes sense, I'll take a look.
Then I would have to store the current config somewhere and when the camera switches then reset the values of the current config is that right?
I've made a draft for the previously mentioned PR. It includes an example on what you could do to keep the same aspect ratio on both back and front cameras.
Your switch camera sensor button would look like this (custom_awesome_ui.dart
example):
AwesomeCameraSwitchButton(
state: state,
scale: 1.0,
onSwitchTap: (state) {
state.switchCameraSensor(
aspectRatio: state.sensorConfig.aspectRatio,
);
},
)
There are still lot of things to change/improve. I'll try to stick to the dart part for now to minimize potential iOS breaking changes (I don't have an iPhone to try the new changes).
More documentation should be available when this PR will land.
If you have any feedback on the PR btw, feel free to share it. :)
Hey @apalala-dev I just saw this.
Can you share the PR? I'm not sure which one it is :)
Sure! It's #228
Hey @apalala-dev I see that you merged the PR.
Could you solve this? When is there a new version available?
Hey @migalv
We'll try to publish it early next week. You can check the updated documentation in the meanwhile. There are several examples as well in the repo to demonstrate how to customize the UI / buttons behaviours with the updated API.
We finally published the 1.3. 🎉 It includes the ability to override the behaviour when switching sensors (and let you keep the same aspect ratio for example).
Closing this since it should be fixed now.
Steps to Reproduce
aspectRatio: CameraAspectRatios.ratio_16_9
sensor: Sensors.front
Expected results
The aspect ratio stays 16:9 when switching from selfie to front camera
Actual results
The aspect ratio changes to 4:3 when switching from selfie to front camera
Here is an example
About your device