2

I am trying to move slider for zoom in flutter camera. I tried many things but I could not get solution. I am attaching my code with screenshot. Please give right suggestion.

enter image description here

double _minAvailableZoom = 2.0;
  double _maxAvailableZoom = 2.0;
  double _currentZoomLevel = 2.0;

Expanded(
                      child: Slider(
                        value: _currentZoomLevel,
                        max: _maxAvailableZoom,
                        min: _minAvailableZoom,
                        activeColor: Colors.white,
                        inactiveColor: Colors.white30,
                        onChanged: (value) async {
                          setState(() {
                            _currentZoomLevel = value;
                          });
                          await cameraController!.setZoomLevel(value);
                        },
                      ),
                    ),
Parth Patel
  • 105
  • 1
  • 8

2 Answers2

1

just do this,

double _minAvailableZoom = 0.0;
double _currentZoomLevel = 0.0;
0

You have set that maximum available zoom is equal to minimun available zoom so you are unable to zoom. don't add maximum zoom property if it is required the set to some higherpoints as you require to zoom.

sahilatahar
  • 568
  • 2
  • 13