google preperation 1

This commit is contained in:
2026-10-26 20:48:16 +01:00
parent 9a65ff7ad4
commit 3b50cb0fe9
47 changed files with 4969 additions and 4580 deletions
+240 -595
View File
@@ -12,41 +12,34 @@ import 'yolo_detector.dart';
import 'preview_screen.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
import '../utils/translations.dart';
import '../widgets/camera_sheet.dart';
import '../widgets/image_settings.dart';
import '../services/wifi_binding.dart';
enum ImageFilterType { none, greyscale, invert }
// Top-level: runs in background isolate via compute()
Uint8List _processStreamImage(List<dynamic> args) {
final bytes = args[0] as Uint8List;
final filter = args[1] as int; // ImageFilterType.index
// Top-level: runs in background isolate via compute().
// Crops the capture to a square; filters are already baked into the screenshot.
Uint8List _processStreamImage(Uint8List bytes) {
final decoded = img.decodeImage(bytes)!;
final w = decoded.width, h = decoded.height;
final size = w < h ? w : h;
img.Image cropped = img.copyCrop(decoded,
final cropped = img.copyCrop(decoded,
x: (w - size) ~/ 2, y: (h - size) ~/ 2, width: size, height: size);
img.Image processed;
if (filter == ImageFilterType.greyscale.index) {
processed = img.grayscale(cropped);
} else if (filter == ImageFilterType.invert.index) {
final result = img.Image.from(cropped);
for (int y = 0; y < result.height; y++) {
for (int x = 0; x < result.width; x++) {
final p = result.getPixel(x, y);
result.setPixelRgb(
x, y, 255 - p.r.toInt(), 255 - p.g.toInt(), 255 - p.b.toInt());
}
}
processed = result;
} else {
processed = cropped;
}
return Uint8List.fromList(img.encodeJpg(processed));
return Uint8List.fromList(img.encodeJpg(cropped));
}
class CameraStreamScreen extends StatefulWidget {
final int cameraIndex;
final int cameraIndex; // shooting position 1–6
final String? ip; // chosen camera; falls back to the saved IP of the position
final String? location; // strelišče the camera belongs to
const CameraStreamScreen({super.key, required this.cameraIndex});
const CameraStreamScreen(
{super.key, required this.cameraIndex, this.ip, this.location});
// Image settings are kept per camera, i.e. per position and location
String get settingsId =>
location == null ? '$cameraIndex' : '${cameraIndex}_$location';
String get title =>
location == null ? '$cameraIndex' : '$cameraIndex · $location';
@override
State<CameraStreamScreen> createState() => _CameraStreamScreenState();
@@ -60,15 +53,11 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
final ScreenshotController _screenshotController = ScreenshotController();
final TransformationController _transformationController =
TransformationController();
ImageFilterType _selectedFilter = ImageFilterType.none;
ImageAdjustments _image = const ImageAdjustments();
late YOLODetector _yoloDetector;
int _numberOfBullets = 5;
// Brightness and contrast controls
double _brightness = 0.0;
double _contrast = 1.0;
late AnimationController _zoomAnimController;
Animation<Matrix4>? _zoomAnimation;
Matrix4? _originalMatrix;
@@ -121,10 +110,13 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
bool _reloadEnabled = false;
bool _waitEnabled = false;
late final Future<void> _wifiReady;
Future<void> _loadAllPrefs() async {
await _wifiReady; // stream must start after traffic is pinned to Wi-Fi
final prefs = await SharedPreferences.getInstance();
final filterIndex = prefs.getInt('selectedFilter');
final url = prefs.getString('cameraIP_${widget.cameraIndex}');
final image = await ImageAdjustments.load(widget.settingsId);
final url = widget.ip ?? prefs.getString('cameraIP_${widget.cameraIndex}');
final streamUrl = (url != null && url.trim().isNotEmpty)
? (url.startsWith(RegExp(r"https?://")) ? url : "http://$url")
: null;
@@ -137,15 +129,9 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
setState(() {
_selectedLanguage = prefs.getString('language') ?? 'English';
_numberOfBullets = prefs.getInt('bulletCount') ?? 5;
_selectedFilter = (filterIndex != null &&
filterIndex >= 0 &&
filterIndex < ImageFilterType.values.length)
? ImageFilterType.values[filterIndex]
: ImageFilterType.none;
_image = image;
_bulletColor =
_getColorFromName(prefs.getString('bulletColor') ?? 'Blue');
_brightness = prefs.getDouble('brightness') ?? 0.0;
_contrast = prefs.getDouble('contrast') ?? 1.0;
_streamUrl = streamUrl;
_isError = streamUrl == null;
if (savedShoot != null) _shootSeconds = savedShoot;
@@ -184,6 +170,7 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
@override
void initState() {
super.initState();
_wifiReady = WifiBinding.acquire();
_loadAllPrefs();
YOLODetector.create().then((detector) => _yoloDetector = detector);
@@ -218,12 +205,6 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
});
}
Future<void> _saveBrightnessContrast() async {
final prefs = await SharedPreferences.getInstance();
await prefs.setDouble('brightness', _brightness);
await prefs.setDouble('contrast', _contrast);
}
Color _getColorFromName(String colorName) {
switch (colorName.toLowerCase()) {
case 'blue':
@@ -268,6 +249,8 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
statusBarIconBrightness: Brightness.light, // white icons
systemNavigationBarColor: Colors.grey[900],
systemNavigationBarIconBrightness: Brightness.light,
// No grey scrim behind 3-button navigation; we paint the strip ourselves
systemNavigationBarContrastEnforced: false,
),
);
}
@@ -282,7 +265,8 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
Future<void> _loadStreamUrl() async {
final prefs = await SharedPreferences.getInstance();
String? url = prefs.getString('cameraIP_${widget.cameraIndex}');
String? url =
widget.ip ?? prefs.getString('cameraIP_${widget.cameraIndex}');
setState(() {
_streamUrl = (url != null && url.trim().isNotEmpty)
@@ -328,8 +312,7 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
final dir = await getApplicationDocumentsDirectory();
final path = '${dir.path}/ip_capture_temp.jpg';
final processedBytes = await compute(
_processStreamImage, [imageBytes, _selectedFilter.index]);
final processedBytes = await compute(_processStreamImage, imageBytes);
final file = File(path)..writeAsBytesSync(processedBytes);
// Detect objects in the image using YOLO
@@ -396,232 +379,49 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
}
void _showImageSettingsDialog() {
showDialog(
context: context,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (context, setDialogState) {
return Dialog(
backgroundColor: Colors.grey[900],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
_t('Image Settings'),
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
),
IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () => Navigator.of(context).pop(),
),
],
),
const SizedBox(height: 16),
Text(
'${_t('Brightness')}: ${(_brightness * 100).toInt()}',
style:
const TextStyle(color: Colors.white70, fontSize: 14),
),
Slider(
value: _brightness,
min: -1.0,
max: 1.0,
divisions: 40,
activeColor: _bulletColor,
onChanged: (value) {
setState(() => _brightness = value);
setDialogState(() {});
_saveBrightnessContrast();
},
),
Text(
'${_t('Contrast')}: ${(_contrast * 100).toInt()}%',
style:
const TextStyle(color: Colors.white70, fontSize: 14),
),
Slider(
value: _contrast,
min: 0.5,
max: 2.0,
divisions: 30,
activeColor: _bulletColor,
onChanged: (value) {
setState(() => _contrast = value);
setDialogState(() {});
_saveBrightnessContrast();
},
),
const SizedBox(height: 8),
Text(
_t('Filter'),
style:
const TextStyle(color: Colors.white70, fontSize: 14),
),
const SizedBox(height: 8),
Wrap(
spacing: 8,
runSpacing: 8,
children: ImageFilterType.values.map((f) {
final isSelected = _selectedFilter == f;
final label = f.toString().split('.').last;
final translatedLabel =
_t(label[0].toUpperCase() + label.substring(1));
return GestureDetector(
onTap: () async {
setState(() => _selectedFilter = f);
setDialogState(() {});
final prefs = await SharedPreferences.getInstance();
await prefs.setInt('selectedFilter', f.index);
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 14, vertical: 8),
decoration: BoxDecoration(
color:
isSelected ? _bulletColor : Colors.grey[800],
borderRadius: BorderRadius.circular(20),
),
child: Text(
translatedLabel,
style: const TextStyle(
color: Colors.white, fontSize: 13),
),
),
);
}).toList(),
),
const SizedBox(height: 16),
Align(
alignment: Alignment.centerRight,
child: TextButton(
onPressed: () {
setState(() {
_brightness = 0.0;
_contrast = 1.0;
});
setDialogState(() {});
_saveBrightnessContrast();
},
child: Text(_t('Reset'),
style: const TextStyle(color: Colors.white54)),
),
),
],
),
),
);
},
);
},
showImageSettingsSheet(
context,
initial: _image,
settingsId: widget.settingsId,
cameraLabel: "${_t('Camera')} ${widget.title}",
accent: _bulletColor,
t: _t,
onChanged: (value) => setState(() => _image = value),
);
}
void _showBulletDialog() {
showDialog(
context: context,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (context, setDialogState) {
Future<void> setCount(int count) async {
final clamped = count.clamp(1, 10);
setState(() => _numberOfBullets = clamped);
setDialogState(() {});
final prefs = await SharedPreferences.getInstance();
await prefs.setInt('bulletCount', clamped);
}
showCameraSheet(
context,
builder: (sheet) => StatefulBuilder(
builder: (context, setSheetState) {
Future<void> setCount(int count) async {
final clamped = count.clamp(1, 10);
setState(() => _numberOfBullets = clamped);
setSheetState(() {});
final prefs = await SharedPreferences.getInstance();
await prefs.setInt('bulletCount', clamped);
}
return Dialog(
backgroundColor: Colors.grey[900],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_t('Select the number of bullets'),
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: _numberOfBullets > 1
? () => setCount(_numberOfBullets - 1)
: null,
icon: const Icon(Icons.remove,
color: Colors.white, size: 28),
style: IconButton.styleFrom(
backgroundColor: _numberOfBullets > 1
? Colors.grey[700]
: Colors.grey[850],
shape: const CircleBorder(),
),
),
const SizedBox(width: 24),
Text(
'$_numberOfBullets',
style: TextStyle(
fontSize: 48,
fontWeight: FontWeight.bold,
color: _bulletColor,
),
),
const SizedBox(width: 24),
IconButton(
onPressed: _numberOfBullets < 10
? () => setCount(_numberOfBullets + 1)
: null,
icon: const Icon(Icons.add,
color: Colors.white, size: 28),
style: IconButton.styleFrom(
backgroundColor: _numberOfBullets < 10
? Colors.grey[700]
: Colors.grey[850],
shape: const CircleBorder(),
),
),
],
),
const SizedBox(height: 8),
Text(
'1 – 10',
style:
const TextStyle(color: Colors.white38, fontSize: 12),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(),
style: ElevatedButton.styleFrom(
backgroundColor: _bulletColor,
foregroundColor: Colors.white,
),
child: Text(_t('Done')),
),
],
),
return Column(
mainAxisSize: MainAxisSize.min,
children: [
CameraSheetHeader(
title: _t('Select the number of bullets'),
subtitle: '1 – 10',
),
);
},
);
},
SheetStepper(
value: _numberOfBullets,
min: 1,
max: 10,
accent: _bulletColor,
onChanged: setCount,
),
const SizedBox(height: 8),
],
);
},
),
);
}
@@ -706,6 +506,7 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
_flashController.dispose();
_zoomAnimController.dispose();
_yoloDetector.close();
WifiBinding.release();
_restoreScreenSettings();
_setSystemBarStyle();
super.dispose();
@@ -1470,8 +1271,8 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
}
void _showTimerDialog() {
showDialog(
context: context,
showCameraSheet(
context,
builder: (ctx) => _TimerConfigDialog(
shootSeconds: _shootSeconds,
reloadSeconds: _reloadSecondsRaw,
@@ -1510,142 +1311,11 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
);
}
ColorFilter _buildColorFilter() {
// Base filter matrix
List<double> baseMatrix;
switch (_selectedFilter) {
case ImageFilterType.greyscale:
baseMatrix = [
0.2126,
0.7152,
0.0722,
0,
0,
0.2126,
0.7152,
0.0722,
0,
0,
0.2126,
0.7152,
0.0722,
0,
0,
0,
0,
0,
1,
0,
];
break;
case ImageFilterType.invert:
baseMatrix = [
-1.0,
0.0,
0.0,
0.0,
255.0,
0.0,
-1.0,
0.0,
0.0,
255.0,
0.0,
0.0,
-1.0,
0.0,
255.0,
0.0,
0.0,
0.0,
1.0,
0.0,
];
break;
default:
baseMatrix = [
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
];
}
// Apply brightness and contrast adjustments
final b = _brightness * 255.0; // Convert to 0-255 range
final c = _contrast;
// Combine filter with brightness/contrast
final adjustedMatrix = <double>[
c,
0.0,
0.0,
0.0,
b,
0.0,
c,
0.0,
0.0,
b,
0.0,
0.0,
c,
0.0,
b,
0.0,
0.0,
0.0,
1.0,
0.0,
];
// Multiply base matrix with adjustment matrix
return ColorFilter.matrix(_multiplyMatrices(baseMatrix, adjustedMatrix));
}
List<double> _multiplyMatrices(List<double> a, List<double> b) {
// For simplicity, just apply brightness/contrast on top of base filter
final result = <double>[];
for (int i = 0; i < a.length; i++) {
result.add(a[i]);
}
// Apply contrast to RGB components
result[0] = result[0] * b[0]; // R
result[6] = result[6] * b[6]; // G
result[12] = result[12] * b[12]; // B
// Apply brightness
result[4] = result[4] + b[4]; // R offset
result[9] = result[9] + b[9]; // G offset
result[14] = result[14] + b[14]; // B offset
return result;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("${_t('Camera')} ${widget.cameraIndex}"),
title: Text("${_t('Camera')} ${widget.title}"),
backgroundColor: Colors.grey[900],
foregroundColor: Colors.white,
leading: IconButton(
@@ -1682,26 +1352,29 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
height: constraints.maxHeight,
child: RepaintBoundary(
child: ColorFiltered(
colorFilter: _buildColorFilter(),
child: Mjpeg(
key: ValueKey(_streamUrl),
stream: _streamUrl!,
isLive: true,
fit: BoxFit.contain,
error: (context, error, stackTrace) {
// Mark as error so we can display error placeholder outside filters
WidgetsBinding.instance
.addPostFrameCallback((_) {
if (mounted) {
setState(() {
_isError = true;
});
}
});
return SizedBox.expand(
child: Container(color: Colors.black),
);
},
colorFilter: _image.colorFilter,
child: RotatedBox(
quarterTurns: _image.quarterTurns,
child: Mjpeg(
key: ValueKey(_streamUrl),
stream: _streamUrl!,
isLive: true,
fit: BoxFit.contain,
error: (context, error, stackTrace) {
// Mark as error so we can display error placeholder outside filters
WidgetsBinding.instance
.addPostFrameCallback((_) {
if (mounted) {
setState(() {
_isError = true;
});
}
});
return SizedBox.expand(
child: Container(color: Colors.black),
);
},
),
),
),
),
@@ -1942,12 +1615,13 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
const SizedBox(height: 12),
Row(
children: [
const Icon(Icons.signal_cellular_off,
// Mobile data can stay on: the app pins camera traffic to Wi-Fi
const Icon(Icons.videocam_outlined,
color: Colors.white, size: 18),
const SizedBox(width: 12),
Expanded(
child: Text(
_t("Mobile data is disabled"),
_t("Cameras and PC are switched on"),
style: const TextStyle(
color: Colors.white70,
fontSize: 14,
@@ -2230,187 +1904,158 @@ class _TimerConfigDialogState extends State<_TimerConfigDialog> {
@override
Widget build(BuildContext context) {
final c = widget.bulletColor;
return Dialog(
backgroundColor: Colors.grey[900],
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
child: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CameraSheetHeader(
title: _t('Shooting Timer'),
icon: Icons.timer,
iconColor: c,
),
// Single / Full target
Row(
children: [
// Header
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(Icons.timer, color: c, size: 22),
const SizedBox(width: 8),
Text(_t('Shooting Timer'),
style: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold)),
],
),
IconButton(
icon:
const Icon(Icons.close, color: Colors.white54, size: 20),
onPressed: () => Navigator.of(context).pop(),
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
),
],
),
const SizedBox(height: 12),
_buildTargetPill(false),
const SizedBox(width: 8),
_buildTargetPill(true),
],
),
const SizedBox(height: 12),
const Divider(color: Colors.white12, height: 4),
const SizedBox(height: 8),
// Single / Full target
// Shoot time — always on in full target, toggleable in single shot
if (_targetSelected && _fullTarget)
_buildAlwaysOnRow(
_t('Shoot time'),
Icons.play_circle_outline,
Colors.blue,
_shoot,
() {
setState(() {
if (_shoot > _minSeconds) _shoot -= _step;
});
_notify();
},
() {
setState(() {
if (_shoot < _maxSeconds) _shoot += _step;
});
_notify();
},
)
else
_buildToggleRow(
_t('Shoot time'),
Icons.play_circle_outline,
Colors.blue,
_shootEnabled,
(v) {
setState(() => _shootEnabled = v);
_notify();
},
_shoot,
() {
setState(() {
if (_shoot > _minSeconds) _shoot -= _step;
});
_notify();
},
() {
setState(() {
if (_shoot < _maxSeconds) _shoot += _step;
});
_notify();
},
),
const Divider(color: Colors.white12, height: 4),
const SizedBox(height: 8),
// Reload toggle + stepper
_buildToggleRow(
_t('Reload time'),
Icons.refresh,
Colors.orange,
_reloadEnabled,
(v) {
setState(() => _reloadEnabled = v);
_notify();
},
_reload,
() {
setState(() {
if (_reload > _minSeconds) _reload -= _step;
});
_notify();
},
() {
setState(() {
if (_reload < _maxSeconds) _reload += _step;
});
_notify();
},
),
const Divider(color: Colors.white12, height: 4),
const SizedBox(height: 8),
// Wait toggle + stepper
_buildToggleRow(
_t('Wait time'),
Icons.hourglass_empty,
Colors.red,
_waitEnabled,
(v) {
setState(() => _waitEnabled = v);
_notify();
},
_wait,
() {
setState(() {
if (_wait > _minSeconds) _wait -= _step;
});
_notify();
},
() {
setState(() {
if (_wait < _maxSeconds) _wait += _step;
});
_notify();
},
),
const Divider(color: Colors.white12, height: 12),
const SizedBox(height: 4),
// Change target overlay toggle
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
_buildTargetPill(false),
Icon(Icons.article_outlined,
color: _changeTargetEnabled ? Colors.green : Colors.white38,
size: 18),
const SizedBox(width: 8),
_buildTargetPill(true),
],
),
const SizedBox(height: 12),
const Divider(color: Colors.white12, height: 4),
const SizedBox(height: 8),
// Shoot time — always on in full target, toggleable in single shot
if (_targetSelected && _fullTarget)
_buildAlwaysOnRow(
_t('Shoot time'),
Icons.play_circle_outline,
Colors.blue,
_shoot,
() {
setState(() {
if (_shoot > _minSeconds) _shoot -= _step;
});
_notify();
},
() {
setState(() {
if (_shoot < _maxSeconds) _shoot += _step;
});
_notify();
},
)
else
_buildToggleRow(
_t('Shoot time'),
Icons.play_circle_outline,
Colors.blue,
_shootEnabled,
(v) {
setState(() => _shootEnabled = v);
_notify();
},
_shoot,
() {
setState(() {
if (_shoot > _minSeconds) _shoot -= _step;
});
_notify();
},
() {
setState(() {
if (_shoot < _maxSeconds) _shoot += _step;
});
_notify();
},
),
const Divider(color: Colors.white12, height: 4),
const SizedBox(height: 8),
// Reload toggle + stepper
_buildToggleRow(
_t('Reload time'),
Icons.refresh,
Colors.orange,
_reloadEnabled,
(v) {
setState(() => _reloadEnabled = v);
_notify();
},
_reload,
() {
setState(() {
if (_reload > _minSeconds) _reload -= _step;
});
_notify();
},
() {
setState(() {
if (_reload < _maxSeconds) _reload += _step;
});
_notify();
},
),
const Divider(color: Colors.white12, height: 4),
const SizedBox(height: 8),
// Wait toggle + stepper
_buildToggleRow(
_t('Wait time'),
Icons.hourglass_empty,
Colors.red,
_waitEnabled,
(v) {
setState(() => _waitEnabled = v);
_notify();
},
_wait,
() {
setState(() {
if (_wait > _minSeconds) _wait -= _step;
});
_notify();
},
() {
setState(() {
if (_wait < _maxSeconds) _wait += _step;
});
_notify();
},
),
const Divider(color: Colors.white12, height: 12),
const SizedBox(height: 4),
// Change target overlay toggle
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(Icons.article_outlined,
Text(_t('Change target sign'),
style: TextStyle(
color: _changeTargetEnabled
? Colors.green
? Colors.white
: Colors.white38,
size: 18),
const SizedBox(width: 8),
Text(_t('Change target sign'),
style: TextStyle(
color: _changeTargetEnabled
? Colors.white
: Colors.white38,
fontSize: 15)),
],
),
Switch(
value: _changeTargetEnabled,
activeThumbColor: Colors.green,
onChanged: (v) {
setState(() => _changeTargetEnabled = v);
widget.onChangeTargetToggle(v);
},
),
fontSize: 15)),
],
),
Switch(
value: _changeTargetEnabled,
activeThumbColor: Colors.green,
onChanged: (v) {
setState(() => _changeTargetEnabled = v);
widget.onChangeTargetToggle(v);
},
),
],
),
),
],
);
}
}