flutterdartcamerazoomingflutter-apk

Can't move slider for camera zoom - Flutter


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);
                        },
                      ),
                    ),

Solution

  • just do this,

    double _minAvailableZoom = 0.0;
    double _currentZoomLevel = 0.0;