Fix local dev config and ALOTTTT OFF FLUTTER, im tired boss..

This commit is contained in:
Wowieee4
2026-05-26 21:09:13 +07:00
parent b8ad8df993
commit a629357e8c
72 changed files with 2566 additions and 530 deletions
@@ -0,0 +1,57 @@
import '../services/haptic_service.dart';
import '../services/tts_service.dart';
import 'obstacle_analyzer.dart';
abstract class ObstacleAlertStrategy {
Future<void> alert(DetectionResult detection);
}
class TtsOnlyObstacleAlertStrategy implements ObstacleAlertStrategy {
final TtsService _ttsService;
const TtsOnlyObstacleAlertStrategy(this._ttsService);
@override
Future<void> alert(DetectionResult detection) {
return _ttsService.speakImmediate(detection.spokenId);
}
}
class HapticOnlyObstacleAlertStrategy implements ObstacleAlertStrategy {
final HapticService _hapticService;
const HapticOnlyObstacleAlertStrategy(this._hapticService);
@override
Future<void> alert(DetectionResult detection) {
return _vibrateByDistance(detection);
}
Future<void> _vibrateByDistance(DetectionResult detection) {
final distance = detection.estimatedDistance.toLowerCase();
if (distance.startsWith('very close')) {
return _hapticService.obstacleVeryClose();
}
if (distance.startsWith('close')) {
return _hapticService.obstacleClose();
}
return _hapticService.obstacleMedium();
}
}
class TtsWithHapticObstacleAlertStrategy implements ObstacleAlertStrategy {
final TtsService _ttsService;
final HapticService _hapticService;
const TtsWithHapticObstacleAlertStrategy(
this._ttsService,
this._hapticService,
);
@override
Future<void> alert(DetectionResult detection) async {
final haptic = HapticOnlyObstacleAlertStrategy(_hapticService);
await haptic.alert(detection);
await _ttsService.speakImmediate(detection.spokenId);
}
}