small updates
This commit is contained in:
@@ -12,7 +12,9 @@ import 'yolo_detector.dart';
|
||||
import 'preview_screen.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
import '../utils/translations.dart';
|
||||
import '../services/app_settings.dart';
|
||||
import '../widgets/camera_sheet.dart';
|
||||
import '../widgets/help_sheet.dart';
|
||||
import '../widgets/image_settings.dart';
|
||||
import '../services/wifi_binding.dart';
|
||||
|
||||
@@ -128,7 +130,9 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
|
||||
final waitOn = prefs.getBool('timerWaitEnabled') ?? false;
|
||||
setState(() {
|
||||
_selectedLanguage = prefs.getString('language') ?? 'English';
|
||||
_numberOfBullets = prefs.getInt('bulletCount') ?? 5;
|
||||
// Older versions allowed up to 10
|
||||
_numberOfBullets = (prefs.getInt('bulletCount') ?? AppSettings.maxBullets)
|
||||
.clamp(AppSettings.minBullets, AppSettings.maxBullets);
|
||||
_image = image;
|
||||
_bulletColor =
|
||||
_getColorFromName(prefs.getString('bulletColor') ?? 'Blue');
|
||||
@@ -396,7 +400,8 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
|
||||
builder: (sheet) => StatefulBuilder(
|
||||
builder: (context, setSheetState) {
|
||||
Future<void> setCount(int count) async {
|
||||
final clamped = count.clamp(1, 10);
|
||||
final clamped =
|
||||
count.clamp(AppSettings.minBullets, AppSettings.maxBullets);
|
||||
setState(() => _numberOfBullets = clamped);
|
||||
setSheetState(() {});
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
@@ -408,12 +413,13 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
|
||||
children: [
|
||||
CameraSheetHeader(
|
||||
title: _t('Select the number of bullets'),
|
||||
subtitle: '1 – 10',
|
||||
subtitle:
|
||||
'${AppSettings.minBullets} – ${AppSettings.maxBullets}',
|
||||
),
|
||||
SheetStepper(
|
||||
value: _numberOfBullets,
|
||||
min: 1,
|
||||
max: 10,
|
||||
min: AppSettings.minBullets,
|
||||
max: AppSettings.maxBullets,
|
||||
accent: _bulletColor,
|
||||
onChanged: setCount,
|
||||
),
|
||||
@@ -426,74 +432,26 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
|
||||
}
|
||||
|
||||
void _showHelpDialog() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
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: [
|
||||
Text(
|
||||
_t('Help'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildHelpItem(Icons.timer,
|
||||
_t('Timer icon: Configure shoot/wait timer and start session')),
|
||||
const SizedBox(height: 12),
|
||||
_buildHelpItem(Icons.filter_9_plus,
|
||||
_t('Bottom left number: Set expected bullet count (1-5)')),
|
||||
const SizedBox(height: 12),
|
||||
_buildHelpItem(Icons.brightness_6,
|
||||
_t('Sun icon: Adjust brightness and contrast for better visibility')),
|
||||
const SizedBox(height: 12),
|
||||
_buildHelpItem(Icons.filter_alt,
|
||||
_t('Filter icon: Apply color filters (None, Greyscale, Invert)')),
|
||||
const SizedBox(height: 12),
|
||||
_buildHelpItem(
|
||||
Icons.pinch, _t('Pinch to zoom on the camera stream')),
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: _bulletColor,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: Text(_t('Got it!')),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHelpItem(IconData icon, String text) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(icon, color: _bulletColor, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(color: Colors.white, fontSize: 14),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
showHelpSheet(context, accent: _bulletColor, t: _t, items: const [
|
||||
(Icons.pinch, 'Pinch to zoom on the camera stream'),
|
||||
(Icons.filter_5_rounded, 'Number bottom left: shots per target (1–5).'),
|
||||
(
|
||||
Icons.timer,
|
||||
'Timer icon: set shoot, reload and wait times. While the timer runs, tap it to stop.'
|
||||
),
|
||||
(
|
||||
Icons.play_arrow,
|
||||
'Play / pause / stop in the middle: control the timer.'
|
||||
),
|
||||
(
|
||||
Icons.circle_outlined,
|
||||
'Circle icon: shot counter. Tap + after each shot; when the target is full you get a "Change target!" warning.'
|
||||
),
|
||||
(
|
||||
Icons.tune,
|
||||
'Settings icon: brightness, contrast, filters and rotation, saved for each camera.'
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1324,7 +1282,7 @@ class _CameraStreamScreenState extends State<CameraStreamScreen>
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.help_outline, color: Colors.white),
|
||||
icon: const Icon(Icons.info_outline_rounded, color: Colors.white),
|
||||
onPressed: _showHelpDialog,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
Reference in New Issue
Block a user