feat: finalize AI analyzer, sync endpoints, and stabilize builds

This commit is contained in:
2026-05-19 12:27:08 +07:00
parent f697ef16cd
commit 23d0cf6f66
23 changed files with 375 additions and 142 deletions
@@ -127,11 +127,10 @@ class _AppState extends ChangeNotifier {
notifyListeners();
}
Future<void> sendSos() async {
await Future.delayed(const Duration(milliseconds: 200));
_sosSent = true;
notifyListeners();
}
void sendSos() {
_sosSent = true;
notifyListeners();
}
void markAllRead() {
_notifications = _notifications
@@ -60,14 +60,11 @@ class _AppState extends ChangeNotifier {
notifyListeners();
}
Future<void> startWalkGuide() async {
_walkGuideStatus = _WalkGuideStatus.active;
notifyListeners();
// Simulasi obstacle terdeteksi setelah 300ms
await Future.delayed(const Duration(milliseconds: 300));
_detectedObstacles = ['person (87%)', 'motorcycle (72%)'];
notifyListeners();
}
Future<void> startWalkGuide() async {
_walkGuideStatus = _WalkGuideStatus.active;
_detectedObstacles = ['person (87%)', 'motorcycle (72%)'];
notifyListeners();
}
void stopWalkGuide() {
_walkGuideStatus = _WalkGuideStatus.idle;
@@ -80,11 +77,10 @@ class _AppState extends ChangeNotifier {
notifyListeners();
}
Future<void> sendSos() async {
await Future.delayed(const Duration(milliseconds: 150));
_sosStatus = _SosStatus.triggered;
notifyListeners();
}
Future<void> sendSos() async {
_sosStatus = _SosStatus.triggered;
notifyListeners();
}
void goBack() {
if (_currentScreen == 'walkguide' || _currentScreen == 'sos') {
@@ -101,11 +101,10 @@ class _AppState extends ChangeNotifier {
}
}
Future<void> markAllAsRead() async {
await Future.delayed(const Duration(milliseconds: 150));
for (final n in _notifications) {
n.isRead = true;
}
Future<void> markAllAsRead() async {
for (final n in _notifications) {
n.isRead = true;
}
notifyListeners();
}
}
@@ -221,39 +220,42 @@ class _DashboardScreen extends StatelessWidget {
Widget build(BuildContext context) {
final unread = state.unreadCount;
return Scaffold(
appBar: AppBar(
title: const Text('Dashboard'),
actions: [
Stack(
alignment: Alignment.topRight,
children: [
IconButton(
key: const Key('notifIconButton'),
icon: const Icon(Icons.notifications),
tooltip: 'Notifikasi',
onPressed: state.openNotifications,
),
if (unread > 0)
Positioned(
right: 8,
top: 8,
child: Container(
key: const Key('dashboardBadge'),
padding: const EdgeInsets.all(4),
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
child: Text(
'$unread',
style: const TextStyle(color: Colors.white, fontSize: 10),
),
),
),
],
),
],
),
appBar: AppBar(
title: const Text('Dashboard'),
actions: [
IconButton(
key: const Key('notifIconButton'),
icon: Stack(
clipBehavior: Clip.none,
children: [
const Icon(Icons.notifications),
if (unread > 0)
Positioned(
right: -4,
top: -4,
child: IgnorePointer(
child: Container(
key: const Key('dashboardBadge'),
padding: const EdgeInsets.all(4),
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
child: Text(
'$unread',
style: const TextStyle(
color: Colors.white, fontSize: 10),
),
),
),
),
],
),
tooltip: 'Notifikasi',
onPressed: state.openNotifications,
),
],
),
body: Center(
child: Column(mainAxisSize: MainAxisSize.min, children: [
const Text('Selamat datang di Dashboard'),