Closed ToyZ-95 closed 1 year ago
I was having this problem too so I ended controlling on my end using GestureDetector and opaque hit behavior.
One thing that happens on some devices is the zoom is too maxed out when you change from 0.0 to 0.2 for example.
I was having this problem too so I ended controlling on my end using GestureDetector and opaque hit behavior.
May I request you to provide me a little demo or something that I can use it?
final _zoomScaleFactor = .1;
final _previousZoomValue = ValueNotifier(0.0);
return state.when(
onPreparingCamera: (state) => const Center(
child: CircularProgressIndicator(),
),
onPhotoMode: (state) => GestureDetector(
behavior: HitTestBehavior.opaque,
onScaleUpdate: (details) async {
final scale = details.scale;
final result =
_previousZoomValue.value * scale - _zoomScaleFactor;
if (result > 0 && result < 1) {
await state.sensorConfig.setZoom(result);
}
},
onScaleStart: (_) {
_previousZoomValue.value = zoom + _zoomScaleFactor;
},
child: Container(),
),
);
state.when( onPreparingCamera: (state) => const Center( child: CircularProgressIndicator(), ), onPhotoMode: (state) => GestureDetector( behavior: HitTestBehavior.opaque, onScaleUpdate: (details) async { final scale = details.scale;
final result = _previousZoomValue.value * scale - _zoomScaleFactor; if (result > 0 && result < 1) { await state.sensorConfig.setZoom(result); } }, onS
Thank you very much for the help, I will definitely implement it and update it here
@GabrielAraujo Thank you sharing this 👏 This could help us if you could make a PR about your changes.
Hi @g-apparence I have created PR which fixes zoom in/out problem. Credit goes to @GabrielAraujo as he provided the basic solution, I just modified it and make it work properly.
Here is the link to PR: https://github.com/Apparence-io/CamerAwesome/pull/263
Ok, @apalala-dev had some questions about this. I'll try to investigate a bit too to understand this. (Didn't had much times these days sorry).
I made a PR #270. Could you test it and tell me if it's okay ?
Steps to Reproduce
Just try to zoom by pinching it
Expected results
It should zoom gradually
Actual results
It zooms to max or too much on one pinch
About your device
Any device
Your flutter version
Flutter 3.7.1 • channel stable • https://github.com/flutter/flutter.git Framework • revision 7048ed95a5 (4 weeks ago) • 2023-02-01 09:07:31 -0800 Engine • revision 800594f1f4 Tools • Dart 2.19.1 • DevTools 2.20.1