getCameraDrawer method

Drawer getCameraDrawer()

Implementation

Drawer getCameraDrawer() {
  return Drawer(
        child: ListView(
          padding: EdgeInsets.zero,
          children: <Widget>[
            const DrawerHeader(
              decoration: BoxDecoration(
                color: Colors.blue,
              ),
              child: Text('Camera Settings',
                style: TextStyle(color: Colors.white, fontSize: 24),
                ),
            ),
            ListTile(
              title: const Text('Quality'),
              subtitle: Slider(
                value: qualityIndex.toDouble(),
                min: 0,
                max: qualityValues.length - 1,
                divisions: qualityValues.length - 1,
                label: qualityValues[qualityIndex].toString(),
                onChanged: (value) {
                  setState(() {
                    qualityIndex = value.toInt();
                  });
                },
              ),
            ),
            SwitchListTile(
              title: const Text('Auto Exposure/Gain'),
              value: _isAutoExposure,
              onChanged: (bool value) {
                setState(() {
                  _isAutoExposure = value;
                });
              },
              subtitle: Text(_isAutoExposure ? 'Auto' : 'Manual'),
            ),
            if (_isAutoExposure) ...[
              // Widgets visible in Auto mode
              ListTile(
                title: const Text('Auto Exposure/Gain Runs'),
                subtitle: Slider(
                  value: autoExpGainTimes.toDouble(),
                  min: 1,
                  max: 30,
                  divisions: 29,
                  label: autoExpGainTimes.toInt().toString(),
                  onChanged: (value) {
                    setState(() {
                      autoExpGainTimes = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Auto Exposure Interval (ms)'),
                subtitle: Slider(
                  value: autoExpInterval.toDouble(),
                  min: 0,
                  max: 255,
                  divisions: 255,
                  label: autoExpInterval.toInt().toString(),
                  onChanged: (value) {
                    setState(() {
                      autoExpInterval = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Metering'),
                subtitle: DropdownButton<int>(
                  value: meteringIndex,
                  onChanged: (int? newValue) {
                    setState(() {
                      meteringIndex = newValue!;
                    });
                  },
                  items: meteringValues
                      .map<DropdownMenuItem<int>>((String value) {
                    return DropdownMenuItem<int>(
                      value: meteringValues.indexOf(value),
                      child: Text(value),
                    );
                  }).toList(),
                ),
              ),
              ListTile(
                title: const Text('Exposure'),
                subtitle: Slider(
                  value: exposure,
                  min: 0,
                  max: 1,
                  divisions: 20,
                  label: exposure.toString(),
                  onChanged: (value) {
                    setState(() {
                      exposure = value;
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Exposure Speed'),
                subtitle: Slider(
                  value: exposureSpeed,
                  min: 0,
                  max: 1,
                  divisions: 20,
                  label: exposureSpeed.toString(),
                  onChanged: (value) {
                    setState(() {
                      exposureSpeed = value;
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Shutter Limit'),
                subtitle: Slider(
                  value: shutterLimit.toDouble(),
                  min: 4,
                  max: 16383,
                  divisions: 10,
                  label: shutterLimit.toStringAsFixed(0),
                  onChanged: (value) {
                    setState(() {
                      shutterLimit = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Analog Gain Limit'),
                subtitle: Slider(
                  value: analogGainLimit.toDouble(),
                  min: 0,
                  max: 248,
                  divisions: 8,
                  label: analogGainLimit.toStringAsFixed(0),
                  onChanged: (value) {
                    setState(() {
                      analogGainLimit = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('White Balance Speed'),
                subtitle: Slider(
                  value: whiteBalanceSpeed,
                  min: 0,
                  max: 1,
                  divisions: 20,
                  label: whiteBalanceSpeed.toString(),
                  onChanged: (value) {
                    setState(() {
                      whiteBalanceSpeed = value;
                    });
                  },
                ),
              ),
            ] else ...[
              // Widgets visible in Manual mode
              ListTile(
                title: const Text('Manual Shutter'),
                subtitle: Slider(
                  value: manualShutter.toDouble(),
                  min: 4,
                  max: 16383,
                  divisions: 100,
                  label: manualShutter.toStringAsFixed(0),
                  onChanged: (value) {
                    setState(() {
                      manualShutter = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Manual Analog Gain'),
                subtitle: Slider(
                  value: manualAnalogGain.toDouble(),
                  min: 0,
                  max: 248,
                  divisions: 50,
                  label: manualAnalogGain.toStringAsFixed(0),
                  onChanged: (value) {
                    setState(() {
                      manualAnalogGain = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Red Gain'),
                subtitle: Slider(
                  value: manualRedGain.toDouble(),
                  min: 0,
                  max: 1023,
                  divisions: 100,
                  label: manualRedGain.toStringAsFixed(0),
                  onChanged: (value) {
                    setState(() {
                      manualRedGain = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Green Gain'),
                subtitle: Slider(
                  value: manualGreenGain.toDouble(),
                  min: 0,
                  max: 1023,
                  divisions: 100,
                  label: manualGreenGain.toStringAsFixed(0),
                  onChanged: (value) {
                    setState(() {
                      manualGreenGain = value.toInt();
                    });
                  },
                ),
              ),
              ListTile(
                title: const Text('Blue Gain'),
                subtitle: Slider(
                  value: manualBlueGain.toDouble(),
                  min: 0,
                  max: 1023,
                  divisions: 100,
                  label: manualBlueGain.toStringAsFixed(0),
                  onChanged: (value) {
                    setState(() {
                      manualBlueGain = value.toInt();
                    });
                  },
                ),
              ),
            ],
          ],
        ),
      );
}