Closed migalv closed 1 year ago
Ideally, all of your camera UI should stay in the builder method. I already planned to try to implement the first solution in a future PR, among other things. :) I'll let you know when there are news on that area !
Alright sounds good thanks a lot for the quick response. I'll be looking forward for your PR
I've got the preview alignment working on PR #228
I also added a previewPadding parameter. It should let you position better your UI around the preview if needed.
There is still some work to do on the PR itself before it lands, so if you want to try it earlier you can depend on it and share your thoughts :)
dependencies:
camerawesome:
git:
url: https://github.com/Apparence-io/CamerAwesome.git
ref: ui_customization
PS: awesome()
constructor is now way more customizable and might fit your needs.
I've got the preview alignment working on PR #228
I also added a previewPadding parameter. It should let you position better your UI around the preview if needed.
There is still some work to do on the PR itself before it lands, so if you want to try it earlier you can depend on it and share your thoughts :)
dependencies: camerawesome: git: url: https://github.com/Apparence-io/CamerAwesome.git ref: ui_customization
PS:
awesome()
constructor is now way more customizable and might fit your needs.
I found some problems on this branch with aspect ratios, I'll update you again when it's fixed. Don't try this PR yet as it's still buggy, sorry!
Preview aspect ratio should be fixed now, you can try it if you want :)
Great news! I'll try it tomorrow then :)
Hey @apalala-dev I've been testing it. It seems to work as expected. Now I'm not too sure how to properly use the PreviewSize & PreviewRect values to properly place my UI.
Closing this since 1.3 is out with this feature.
You might want to take a look at the updated documentation.
PreviewSize
and PreviewRect
are a bit more detailed in the barcode example (Scan area part).
For most use cases, I think they are not really needed thanks to previewAlignment
and previewPadding
.
If you still struggle to position your UI, feel free to share your screen (with dummy widgets if you'd like) so we can take a look at what you want to do. 👌
First let me say Congratulations for your work. The package is amazing! This was so need from the community keep up the good work.
I was trying build a design using CamerAwesome when I found a limitation. I was not able to have widgets that controlled the state of the camera outside of the CameraPreview space.
Here is an example of what I'm trying to acheive
As you can see the buttons are outside of the camera preview.
If let the preview expand, and set
BoxFit.contain
then the preview stays the same size, but it has black paddings on top and bottom like this:Example with black paddings
It always centers the preview within the boundaries
You can see how it's centering itself with the yellow arrows
This is how it looks with the UI on top
But I try to size the preview to my liking the widgets can no longer be "outside" of the preview
Example with set height
Now my custom UI is on top of the preview
But I want it to be just under as in the first image
Since the buttons depend on the
CameraState
and this is only accessible from thebuilder
method inside of theCamerAwesomeBuilder.custom
constructor, I can not use aStack
to place them outside of the preview.So I propose 2 options/solutions:
CameraConfiguration
or acontroller
object to theCamerAwesomeBuilder
widget, so it can control the state of the camera outside of the function. Like this:the dev will be able to access the state stream outside of the builder method so they will be able to stack on top of the preview anything they like. I was thinking of something like this
cameraController.setFlashMode()
orconfig.setFlashMode()
to acces config andCameraAwesome.of(context).state$
to access its state