迁移 Flutter 端与训练脚本,模型/训练产物移出 git(遵循纯代码约定)

This commit is contained in:
2026-08-24 12:35:24 +08:00
parent d056f01965
commit 961523d94c
218 changed files with 13391 additions and 3232 deletions
+34
View File
@@ -0,0 +1,34 @@
import 'dart:async';
import 'package:audioplayers/audioplayers.dart';
import 'package:vibration/vibration.dart';
/// 提醒:同类目标 10s 内只提醒一次。
/// 震动/提示音默认开启,不提供关闭入口。
class Reminder {
final AudioPlayer _player = AudioPlayer();
String? _lastAlertLabel;
int _lastAlertAt = 0;
/// 同类目标 10s 内只提醒一次
void onDetected(String label) {
final now = DateTime.now().millisecondsSinceEpoch;
if (label == _lastAlertLabel && now - _lastAlertAt < 10000) return;
_lastAlertAt = now;
_lastAlertLabel = label;
_vibrate();
_playTone();
}
void _vibrate() => Vibration.vibrate(duration: 200);
Future<void> _playTone() async {
await _player.stop();
await _player.play(AssetSource('beep.wav'));
}
void release() {
_player.dispose();
}
}