api update and flutter update
This commit is contained in:
parent
c5d716248e
commit
53e612e221
1701
assets/api-path-collection.json
Normal file
1701
assets/api-path-collection.json
Normal file
File diff suppressed because it is too large
Load Diff
0
walkguide-mobile/walkguide_app/lib/app/app.dart
Normal file
0
walkguide-mobile/walkguide_app/lib/app/app.dart
Normal file
@ -0,0 +1,38 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'core/constants/app_constants.dart';
|
||||
import 'core/network/api_client.dart';
|
||||
import 'core/storage/secure_storage.dart';
|
||||
import 'core/services/tts_service.dart';
|
||||
import 'core/services/stt_service.dart';
|
||||
import 'core/services/voice_command_handler.dart';
|
||||
import 'core/services/haptic_service.dart';
|
||||
|
||||
final sl = GetIt.instance;
|
||||
|
||||
Future<void> initDependencies() async {
|
||||
// ── Core singletons ──────────────────────────────────────────────────────
|
||||
sl.registerLazySingleton<SecureStorage>(() => SecureStorage());
|
||||
sl.registerLazySingleton<ApiClient>(() => ApiClient(sl<SecureStorage>()));
|
||||
|
||||
sl.registerLazySingleton<TtsService>(() => TtsService());
|
||||
sl.registerLazySingleton<SttService>(() => SttService());
|
||||
sl.registerLazySingleton<HapticService>(() => HapticService());
|
||||
sl.registerLazySingleton<VoiceCommandHandler>(
|
||||
() => VoiceCommandHandler(sl<SttService>(), sl<TtsService>()),
|
||||
);
|
||||
|
||||
// ── Init ApiClient if serverUrl already saved ─────────────────────────────
|
||||
final serverUrl = await AppConstants.getServerUrl();
|
||||
if (serverUrl != null && serverUrl.isNotEmpty) {
|
||||
await sl<ApiClient>().init(serverUrl);
|
||||
}
|
||||
|
||||
// ── Init TTS ──────────────────────────────────────────────────────────────
|
||||
await sl<TtsService>().init();
|
||||
|
||||
// ── Init STT ──────────────────────────────────────────────────────────────
|
||||
await sl<SttService>().init();
|
||||
sl<VoiceCommandHandler>().loadDefaultCommands();
|
||||
}
|
||||
110
walkguide-mobile/walkguide_app/lib/app/router.dart
Normal file
110
walkguide-mobile/walkguide_app/lib/app/router.dart
Normal file
@ -0,0 +1,110 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'core/storage/secure_storage.dart';
|
||||
import 'core/constants/app_constants.dart';
|
||||
import 'injection_container.dart';
|
||||
|
||||
// Auth
|
||||
import 'features/server_connect/presentation/screens/server_connect_screen.dart';
|
||||
import 'features/auth/presentation/screens/splash_screen.dart';
|
||||
import 'features/auth/presentation/screens/login_screen.dart';
|
||||
import 'features/auth/presentation/screens/register_screen.dart';
|
||||
|
||||
// User shell + screens
|
||||
import 'shared/widgets/user_shell.dart';
|
||||
import 'features/walk_guide/presentation/screens/walk_guide_screen.dart';
|
||||
import 'features/sos/presentation/screens/sos_screen.dart';
|
||||
import 'features/activity_log/presentation/screens/activity_log_screen.dart';
|
||||
import 'features/notifications/presentation/screens/notification_screen.dart';
|
||||
import 'features/navigation_mode/presentation/screens/navigation_mode_screen.dart';
|
||||
import 'features/settings/presentation/screens/user_settings_screen.dart';
|
||||
|
||||
// Guardian shell + screens
|
||||
import 'shared/widgets/guardian_shell.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_dashboard_screen.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_map_screen.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_activity_log_screen.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_send_notif_screen.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_ai_config_screen.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_voice_cmd_screen.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_shortcut_screen.dart';
|
||||
import 'features/guardian/presentation/screens/guardian_geofence_screen.dart';
|
||||
import 'features/pairing/presentation/screens/guardian_pairing_screen.dart';
|
||||
import 'features/pairing/presentation/screens/user_pairing_screen.dart';
|
||||
|
||||
// Call
|
||||
import 'features/call/presentation/screens/call_screen.dart';
|
||||
import 'features/call/presentation/screens/incoming_call_screen.dart';
|
||||
|
||||
final GoRouter appRouter = GoRouter(
|
||||
initialLocation: '/splash',
|
||||
redirect: (context, state) async {
|
||||
final serverUrl = await AppConstants.getServerUrl();
|
||||
final path = state.matchedLocation;
|
||||
|
||||
// 1. No server URL → must go to server-connect
|
||||
if (serverUrl == null || serverUrl.isEmpty) {
|
||||
if (path != '/server-connect') return '/server-connect';
|
||||
return null;
|
||||
}
|
||||
|
||||
// 2. Already on server-connect but has URL → splash
|
||||
if (path == '/server-connect') return '/splash';
|
||||
|
||||
return null;
|
||||
},
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/server-connect',
|
||||
builder: (context, state) => const ServerConnectScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/splash',
|
||||
builder: (context, state) => const SplashScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/login',
|
||||
builder: (context, state) => const LoginScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/register',
|
||||
builder: (context, state) => const RegisterScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/incoming-call',
|
||||
builder: (context, state) => const IncomingCallScreen(),
|
||||
),
|
||||
|
||||
// ── USER SHELL ──────────────────────────────────────────────────────────
|
||||
ShellRoute(
|
||||
builder: (context, state, child) => UserShell(child: child),
|
||||
routes: [
|
||||
GoRoute(path: '/user/walkguide', builder: (c, s) => const WalkGuideScreen()),
|
||||
GoRoute(path: '/user/sos', builder: (c, s) => const SosScreen()),
|
||||
GoRoute(path: '/user/activity', builder: (c, s) => const ActivityLogScreen()),
|
||||
GoRoute(path: '/user/notifications',builder: (c, s) => const NotificationScreen()),
|
||||
GoRoute(path: '/user/navigation', builder: (c, s) => const NavigationModeScreen()),
|
||||
GoRoute(path: '/user/settings', builder: (c, s) => const UserSettingsScreen()),
|
||||
GoRoute(path: '/user/pairing', builder: (c, s) => const UserPairingScreen()),
|
||||
GoRoute(path: '/user/call', builder: (c, s) => const CallScreen()),
|
||||
],
|
||||
),
|
||||
|
||||
// ── GUARDIAN SHELL ──────────────────────────────────────────────────────
|
||||
ShellRoute(
|
||||
builder: (context, state, child) => GuardianShell(child: child),
|
||||
routes: [
|
||||
GoRoute(path: '/guardian/dashboard', builder: (c, s) => const GuardianDashboardScreen()),
|
||||
GoRoute(path: '/guardian/map', builder: (c, s) => const GuardianMapScreen()),
|
||||
GoRoute(path: '/guardian/logs', builder: (c, s) => const GuardianActivityLogScreen()),
|
||||
GoRoute(path: '/guardian/send-notif', builder: (c, s) => const GuardianSendNotifScreen()),
|
||||
GoRoute(path: '/guardian/ai-config', builder: (c, s) => const GuardianAiConfigScreen()),
|
||||
GoRoute(path: '/guardian/voice-cmd', builder: (c, s) => const GuardianVoiceCmdScreen()),
|
||||
GoRoute(path: '/guardian/shortcuts', builder: (c, s) => const GuardianShortcutScreen()),
|
||||
GoRoute(path: '/guardian/geofence', builder: (c, s) => const GuardianGeofenceScreen()),
|
||||
GoRoute(path: '/guardian/pairing', builder: (c, s) => const GuardianPairingScreen()),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -0,0 +1,44 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class AppConstants {
|
||||
static const String _serverUrlKey = 'server_base_url';
|
||||
|
||||
// Ambil base URL dari SharedPreferences
|
||||
static Future<String?> getServerUrl() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString(_serverUrlKey);
|
||||
}
|
||||
|
||||
// Simpan URL setelah berhasil connect
|
||||
static Future<void> setServerUrl(String url) async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
// Trim trailing slash
|
||||
final cleaned = url.endsWith('/') ? url.substring(0, url.length - 1) : url;
|
||||
await prefs.setString(_serverUrlKey, cleaned);
|
||||
}
|
||||
|
||||
static Future<void> clearServerUrl() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.remove(_serverUrlKey);
|
||||
}
|
||||
|
||||
static String buildApiUrl(String baseUrl) => '$baseUrl/api/v1';
|
||||
static String buildWsUrl(String baseUrl) => baseUrl.replaceFirst('http', 'ws') + '/ws';
|
||||
|
||||
// Timeouts
|
||||
static const Duration connectTimeout = Duration(seconds: 10);
|
||||
static const Duration receiveTimeout = Duration(seconds: 30);
|
||||
static const Duration pingTimeout = Duration(seconds: 5);
|
||||
|
||||
// Location intervals
|
||||
static const int locationIntervalWalkMs = 5000;
|
||||
static const int locationIntervalIdleMs = 30000;
|
||||
|
||||
// YOLO
|
||||
static const String yoloModelPath = 'assets/models/yolov8n.tflite';
|
||||
static const String yoloLabelsPath = 'assets/models/labels.txt';
|
||||
static const int yoloInputSize = 640;
|
||||
|
||||
// Agora - ganti dengan App ID dari agora.io
|
||||
static const String agoraAppId = 'YOUR_AGORA_APP_ID';
|
||||
}
|
||||
36
walkguide-mobile/walkguide_app/lib/core/errors/failures.dart
Normal file
36
walkguide-mobile/walkguide_app/lib/core/errors/failures.dart
Normal file
@ -0,0 +1,36 @@
|
||||
abstract class Failure {
|
||||
final String message;
|
||||
const Failure(this.message);
|
||||
}
|
||||
|
||||
class ServerFailure extends Failure {
|
||||
const ServerFailure(super.message);
|
||||
}
|
||||
|
||||
class NetworkFailure extends Failure {
|
||||
const NetworkFailure(super.message);
|
||||
}
|
||||
|
||||
class AuthFailure extends Failure {
|
||||
const AuthFailure(super.message);
|
||||
}
|
||||
|
||||
class NotFoundFailure extends Failure {
|
||||
const NotFoundFailure(super.message);
|
||||
}
|
||||
|
||||
class PairingFailure extends Failure {
|
||||
const PairingFailure(super.message);
|
||||
}
|
||||
|
||||
class ValidationFailure extends Failure {
|
||||
const ValidationFailure(super.message);
|
||||
}
|
||||
|
||||
class CacheFailure extends Failure {
|
||||
const CacheFailure(super.message);
|
||||
}
|
||||
|
||||
class ConnectionFailure extends Failure {
|
||||
const ConnectionFailure(super.message);
|
||||
}
|
||||
100
walkguide-mobile/walkguide_app/lib/core/network/api_client.dart
Normal file
100
walkguide-mobile/walkguide_app/lib/core/network/api_client.dart
Normal file
@ -0,0 +1,100 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import '../constants/app_constants.dart';
|
||||
import '../storage/secure_storage.dart';
|
||||
|
||||
class ApiClient {
|
||||
late Dio _dio;
|
||||
final SecureStorage _secureStorage;
|
||||
String? _baseUrl;
|
||||
|
||||
ApiClient(this._secureStorage);
|
||||
|
||||
Future<void> init(String serverUrl) async {
|
||||
_baseUrl = AppConstants.buildApiUrl(serverUrl);
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: _baseUrl!,
|
||||
connectTimeout: AppConstants.connectTimeout,
|
||||
receiveTimeout: AppConstants.receiveTimeout,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
));
|
||||
_dio.interceptors.addAll([
|
||||
_AuthInterceptor(_secureStorage, _dio),
|
||||
_ErrorInterceptor(),
|
||||
LogInterceptor(requestBody: true, responseBody: true),
|
||||
]);
|
||||
}
|
||||
|
||||
Dio get dio => _dio;
|
||||
|
||||
String? get baseUrl => _baseUrl;
|
||||
}
|
||||
|
||||
// ── Auth Interceptor: inject token & auto-refresh on 401 ──────────────────────
|
||||
class _AuthInterceptor extends Interceptor {
|
||||
final SecureStorage _storage;
|
||||
final Dio _dio;
|
||||
bool _refreshing = false;
|
||||
|
||||
_AuthInterceptor(this._storage, this._dio);
|
||||
|
||||
@override
|
||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) async {
|
||||
final token = await _storage.getAccessToken();
|
||||
if (token != null) {
|
||||
options.headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
handler.next(options);
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(DioException err, ErrorInterceptorHandler handler) async {
|
||||
if (err.response?.statusCode == 401 && !_refreshing) {
|
||||
_refreshing = true;
|
||||
try {
|
||||
final refresh = await _storage.getRefreshToken();
|
||||
if (refresh == null) {
|
||||
_refreshing = false;
|
||||
handler.next(err);
|
||||
return;
|
||||
}
|
||||
final res = await _dio.post('/auth/refresh',
|
||||
data: {'refreshToken': refresh},
|
||||
options: Options(headers: {'Authorization': null}));
|
||||
|
||||
if (res.statusCode == 200 && res.data['success'] == true) {
|
||||
final data = res.data['data'];
|
||||
await _storage.saveTokens(
|
||||
accessToken: data['accessToken'],
|
||||
refreshToken: data['refreshToken'] ?? refresh,
|
||||
role: data['role'],
|
||||
userId: data['userId'].toString(),
|
||||
displayName: data['displayName'],
|
||||
uniqueUserId: data['uniqueUserId'],
|
||||
);
|
||||
// Retry original request
|
||||
err.requestOptions.headers['Authorization'] =
|
||||
'Bearer ${data['accessToken']}';
|
||||
final retryRes = await _dio.fetch(err.requestOptions);
|
||||
_refreshing = false;
|
||||
handler.resolve(retryRes);
|
||||
return;
|
||||
}
|
||||
} catch (_) {}
|
||||
_refreshing = false;
|
||||
await _storage.clearAll();
|
||||
}
|
||||
handler.next(err);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Error Interceptor: normalize errors ───────────────────────────────────────
|
||||
class _ErrorInterceptor extends Interceptor {
|
||||
@override
|
||||
void onError(DioException err, ErrorInterceptorHandler handler) {
|
||||
// Let the calling code handle it — just pass through
|
||||
handler.next(err);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
import 'package:vibration/vibration.dart';
|
||||
|
||||
class HapticService {
|
||||
Future<bool> get _hasVibrator async => (await Vibration.hasVibrator()) ?? false;
|
||||
|
||||
Future<void> obstacleVeryClose() async {
|
||||
if (!await _hasVibrator) return;
|
||||
Vibration.vibrate(pattern: [0, 500, 100, 500, 100, 500]);
|
||||
}
|
||||
|
||||
Future<void> obstacleClose() async {
|
||||
if (!await _hasVibrator) return;
|
||||
Vibration.vibrate(pattern: [0, 300, 100, 300]);
|
||||
}
|
||||
|
||||
Future<void> obstacleMedium() async {
|
||||
if (!await _hasVibrator) return;
|
||||
Vibration.vibrate(duration: 150);
|
||||
}
|
||||
|
||||
Future<void> sosTriggered() async {
|
||||
if (!await _hasVibrator) return;
|
||||
Vibration.vibrate(pattern: [0, 1000, 200, 1000, 200, 1000]);
|
||||
}
|
||||
|
||||
Future<void> callIncoming() async {
|
||||
if (!await _hasVibrator) return;
|
||||
Vibration.vibrate(pattern: [0, 500, 500, 500, 500, 500, 500, 500]);
|
||||
}
|
||||
|
||||
Future<void> success() async {
|
||||
if (!await _hasVibrator) return;
|
||||
Vibration.vibrate(duration: 80);
|
||||
}
|
||||
|
||||
Future<void> stop() async => Vibration.cancel();
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
import 'package:speech_to_text/speech_to_text.dart';
|
||||
|
||||
class SttService {
|
||||
final SpeechToText _stt = SpeechToText();
|
||||
bool _available = false;
|
||||
bool _listening = false;
|
||||
Function(String)? onResult;
|
||||
|
||||
Future<bool> init() async {
|
||||
_available = await _stt.initialize(
|
||||
onError: (e) => _onError(e),
|
||||
onStatus: (s) => _onStatus(s),
|
||||
);
|
||||
return _available;
|
||||
}
|
||||
|
||||
Future<void> startListening() async {
|
||||
if (!_available || _listening) return;
|
||||
_listening = true;
|
||||
await _stt.listen(
|
||||
onResult: (result) {
|
||||
if (result.finalResult && result.recognizedWords.isNotEmpty) {
|
||||
onResult?.call(result.recognizedWords.toLowerCase().trim());
|
||||
}
|
||||
},
|
||||
listenFor: const Duration(seconds: 10),
|
||||
pauseFor: const Duration(seconds: 3),
|
||||
localeId: 'id_ID',
|
||||
cancelOnError: false,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> stopListening() async {
|
||||
_listening = false;
|
||||
await _stt.stop();
|
||||
}
|
||||
|
||||
bool get isListening => _listening;
|
||||
bool get isAvailable => _available;
|
||||
|
||||
void _onError(dynamic error) {
|
||||
_listening = false;
|
||||
// Auto-restart setelah error
|
||||
Future.delayed(const Duration(seconds: 1), startListening);
|
||||
}
|
||||
|
||||
void _onStatus(String status) {
|
||||
if (status == 'done' || status == 'notListening') {
|
||||
_listening = false;
|
||||
// Auto-restart agar selalu mendengarkan
|
||||
Future.delayed(const Duration(milliseconds: 500), startListening);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
import 'package:flutter_tts/flutter_tts.dart';
|
||||
|
||||
class TtsService {
|
||||
final FlutterTts _tts = FlutterTts();
|
||||
final List<String> _queue = [];
|
||||
bool _speaking = false;
|
||||
String _lastSpoken = '';
|
||||
|
||||
Future<void> init({String language = 'id-ID', double pitch = 1.0, double rate = 0.5}) async {
|
||||
await _tts.setLanguage(language);
|
||||
await _tts.setPitch(pitch);
|
||||
await _tts.setSpeechRate(rate);
|
||||
await _tts.setVolume(1.0);
|
||||
_tts.setCompletionHandler(() {
|
||||
_speaking = false;
|
||||
_processQueue();
|
||||
});
|
||||
}
|
||||
|
||||
/// Tambah ke antrian - tidak memotong yg sedang bicara
|
||||
void speak(String text) {
|
||||
if (text.isEmpty) return;
|
||||
_queue.add(text);
|
||||
if (!_speaking) _processQueue();
|
||||
}
|
||||
|
||||
/// Potong TTS sekarang dan langsung ucapkan ini - untuk obstacle alert
|
||||
Future<void> speakImmediate(String text) async {
|
||||
if (text.isEmpty) return;
|
||||
_queue.clear();
|
||||
await _tts.stop();
|
||||
_speaking = true;
|
||||
_lastSpoken = text;
|
||||
await _tts.speak(text);
|
||||
}
|
||||
|
||||
Future<void> stop() async {
|
||||
_queue.clear();
|
||||
_speaking = false;
|
||||
await _tts.stop();
|
||||
}
|
||||
|
||||
String get lastSpoken => _lastSpoken;
|
||||
bool get isSpeaking => _speaking;
|
||||
|
||||
Future<void> setLanguage(String lang) async => _tts.setLanguage(lang);
|
||||
Future<void> setPitch(double pitch) async => _tts.setPitch(pitch);
|
||||
Future<void> setRate(double rate) async => _tts.setSpeechRate(rate);
|
||||
|
||||
void repeatLast() {
|
||||
if (_lastSpoken.isNotEmpty) speak(_lastSpoken);
|
||||
}
|
||||
|
||||
void _processQueue() {
|
||||
if (_queue.isEmpty || _speaking) return;
|
||||
final text = _queue.removeAt(0);
|
||||
_speaking = true;
|
||||
_lastSpoken = text;
|
||||
_tts.speak(text);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'tts_service.dart';
|
||||
import 'stt_service.dart';
|
||||
|
||||
enum VoiceCommandKey {
|
||||
openWalkguide, startWalkguide, stopWalkguide,
|
||||
callGuardian, openNotification, readAllNotif,
|
||||
openSos, sendSos, whereAmI,
|
||||
openActivity, openNavigation, openSettings,
|
||||
repeatLast, stopTts,
|
||||
}
|
||||
|
||||
class VoiceCommand {
|
||||
final VoiceCommandKey key;
|
||||
final String phrase;
|
||||
final bool enabled;
|
||||
const VoiceCommand({required this.key, required this.phrase, required this.enabled});
|
||||
}
|
||||
|
||||
/// Callback yang dipanggil saat command terdeteksi
|
||||
/// Registered oleh router/screen yang relevan
|
||||
typedef CommandCallback = void Function(VoiceCommandKey key);
|
||||
|
||||
class VoiceCommandHandler {
|
||||
final SttService _stt;
|
||||
final TtsService _tts;
|
||||
|
||||
List<VoiceCommand> _commands = [];
|
||||
CommandCallback? onCommand;
|
||||
|
||||
VoiceCommandHandler(this._stt, this._tts);
|
||||
|
||||
void loadCommands(List<VoiceCommand> commands) {
|
||||
_commands = commands;
|
||||
_stt.onResult = _processText;
|
||||
}
|
||||
|
||||
void loadDefaultCommands() {
|
||||
_commands = const [
|
||||
VoiceCommand(key: VoiceCommandKey.openWalkguide, phrase: 'open walkguide', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.startWalkguide, phrase: 'start walkguide', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.stopWalkguide, phrase: 'stop walkguide', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.callGuardian, phrase: 'call guardian', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.openNotification, phrase: 'open notifications', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.readAllNotif, phrase: 'read all my notifications', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.openSos, phrase: 'open sos', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.sendSos, phrase: 'send sos', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.whereAmI, phrase: 'where am i', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.openActivity, phrase: 'open activity log', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.openNavigation, phrase: 'open navigation', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.openSettings, phrase: 'open settings', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.repeatLast, phrase: 'repeat', enabled: true),
|
||||
VoiceCommand(key: VoiceCommandKey.stopTts, phrase: 'stop', enabled: true),
|
||||
];
|
||||
_stt.onResult = _processText;
|
||||
}
|
||||
|
||||
void _processText(String text) {
|
||||
final lower = text.toLowerCase().trim();
|
||||
for (final cmd in _commands) {
|
||||
if (!cmd.enabled) continue;
|
||||
if (lower.contains(cmd.phrase.toLowerCase())) {
|
||||
_handleCommand(cmd.key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _handleCommand(VoiceCommandKey key) {
|
||||
onCommand?.call(key);
|
||||
// Built-in actions for TTS-only commands
|
||||
if (key == VoiceCommandKey.repeatLast) _tts.repeatLast();
|
||||
if (key == VoiceCommandKey.stopTts) _tts.stop();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
||||
class SecureStorage {
|
||||
static const _storage = FlutterSecureStorage(
|
||||
aOptions: AndroidOptions(encryptedSharedPreferences: true),
|
||||
);
|
||||
|
||||
static const _keyAccess = 'access_token';
|
||||
static const _keyRefresh = 'refresh_token';
|
||||
static const _keyRole = 'user_role';
|
||||
static const _keyUserId = 'user_id';
|
||||
static const _keyName = 'display_name';
|
||||
static const _keyUid = 'unique_user_id';
|
||||
|
||||
Future<void> saveTokens({
|
||||
required String accessToken,
|
||||
required String refreshToken,
|
||||
required String role,
|
||||
required String userId,
|
||||
String? displayName,
|
||||
String? uniqueUserId,
|
||||
}) async {
|
||||
await Future.wait([
|
||||
_storage.write(key: _keyAccess, value: accessToken),
|
||||
_storage.write(key: _keyRefresh, value: refreshToken),
|
||||
_storage.write(key: _keyRole, value: role),
|
||||
_storage.write(key: _keyUserId, value: userId),
|
||||
if (displayName != null) _storage.write(key: _keyName, value: displayName),
|
||||
if (uniqueUserId != null) _storage.write(key: _keyUid, value: uniqueUserId),
|
||||
]);
|
||||
}
|
||||
|
||||
Future<String?> getAccessToken() async => _storage.read(key: _keyAccess);
|
||||
Future<String?> getRefreshToken() async => _storage.read(key: _keyRefresh);
|
||||
Future<String?> getUserRole() async => _storage.read(key: _keyRole);
|
||||
Future<String?> getUserId() async => _storage.read(key: _keyUserId);
|
||||
Future<String?> getDisplayName() async => _storage.read(key: _keyName);
|
||||
Future<String?> getUniqueUserId() async => _storage.read(key: _keyUid);
|
||||
|
||||
Future<void> clearAll() async => _storage.deleteAll();
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../../core/storage/secure_storage.dart';
|
||||
import '../../../../core/services/tts_service.dart';
|
||||
import '../../../../injection_container.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
const SplashScreen({super.key});
|
||||
|
||||
@override
|
||||
State<SplashScreen> createState() => _SplashScreenState();
|
||||
}
|
||||
|
||||
class _SplashScreenState extends State<SplashScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_checkAuth();
|
||||
}
|
||||
|
||||
Future<void> _checkAuth() async {
|
||||
await Future.delayed(const Duration(milliseconds: 800));
|
||||
final storage = sl<SecureStorage>();
|
||||
final token = await storage.getAccessToken();
|
||||
final role = await storage.getUserRole();
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
if (token == null || role == null) {
|
||||
context.go('/login');
|
||||
return;
|
||||
}
|
||||
|
||||
final name = await storage.getDisplayName() ?? 'kembali';
|
||||
sl<TtsService>().speak('Selamat datang, $name');
|
||||
|
||||
if (role == 'ROLE_GUARDIAN') {
|
||||
context.go('/guardian/dashboard');
|
||||
} else {
|
||||
context.go('/user/walkguide');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF1A56DB),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 80, height: 80,
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.15), borderRadius: BorderRadius.circular(20)),
|
||||
child: const Icon(Icons.navigation_rounded, color: Colors.white, size: 44),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text('WalkGuide', style: GoogleFonts.outfit(fontSize: 32, fontWeight: FontWeight.w700, color: Colors.white)),
|
||||
const SizedBox(height: 8),
|
||||
Text('AI Navigation Assistant', style: GoogleFonts.inter(fontSize: 14, color: Colors.white60)),
|
||||
const SizedBox(height: 48),
|
||||
const CircularProgressIndicator(color: Colors.white54, strokeWidth: 2),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,165 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../../../../core/network/api_client.dart';
|
||||
import '../../../../core/storage/secure_storage.dart';
|
||||
import '../../../../core/services/tts_service.dart';
|
||||
import '../../../../injection_container.dart';
|
||||
|
||||
class RegisterScreen extends StatefulWidget {
|
||||
const RegisterScreen({super.key});
|
||||
@override
|
||||
State<RegisterScreen> createState() => _RegisterScreenState();
|
||||
}
|
||||
|
||||
class _RegisterScreenState extends State<RegisterScreen> {
|
||||
final _nameCtrl = TextEditingController();
|
||||
final _emailCtrl = TextEditingController();
|
||||
final _passCtrl = TextEditingController();
|
||||
String _selectedRole = '';
|
||||
bool _loading = false;
|
||||
|
||||
Future<void> _register() async {
|
||||
if (_selectedRole.isEmpty) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Pilih tipe akun dulu')));
|
||||
return;
|
||||
}
|
||||
setState(() => _loading = true);
|
||||
try {
|
||||
final res = await sl<ApiClient>().dio.post('/auth/register', data: {
|
||||
'email': _emailCtrl.text.trim(),
|
||||
'password': _passCtrl.text.trim(),
|
||||
'displayName': _nameCtrl.text.trim(),
|
||||
'role': _selectedRole,
|
||||
});
|
||||
if (res.statusCode == 200 && res.data['success'] == true) {
|
||||
final data = res.data['data'];
|
||||
await sl<SecureStorage>().saveTokens(
|
||||
accessToken: data['accessToken'],
|
||||
refreshToken: data['refreshToken'],
|
||||
role: data['role'],
|
||||
userId: data['userId'].toString(),
|
||||
displayName: data['displayName'],
|
||||
uniqueUserId: data['uniqueUserId'],
|
||||
);
|
||||
if (!mounted) return;
|
||||
final isUser = data['role'] == 'ROLE_USER';
|
||||
if (isUser) {
|
||||
final uid = data['uniqueUserId'] ?? '';
|
||||
sl<TtsService>().speak('Registrasi berhasil. ID kamu adalah ${uid.split('').join(' ')}. Bagikan ID ini ke Guardian kamu.');
|
||||
} else {
|
||||
sl<TtsService>().speak('Registrasi berhasil. Selamat datang, ${data['displayName']}');
|
||||
}
|
||||
context.go(isUser ? '/user/walkguide' : '/guardian/dashboard');
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
final msg = e.response?.data['message'] ?? 'Registrasi gagal';
|
||||
if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(msg), backgroundColor: Colors.redAccent));
|
||||
} finally {
|
||||
if (mounted) setState(() => _loading = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF1F5F9),
|
||||
body: Center(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 440),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.08), blurRadius: 40, offset: const Offset(0, 16))]),
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text('Buat Akun', style: GoogleFonts.outfit(fontSize: 26, fontWeight: FontWeight.w700)),
|
||||
const SizedBox(height: 6),
|
||||
Text('Pilih tipe akun kamu', style: GoogleFonts.inter(fontSize: 13, color: const Color(0xFF64748B))),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Role selector cards
|
||||
Row(children: [
|
||||
_roleCard('GUARDIAN', Icons.shield_outlined, 'Guardian', 'Saya akan membimbing seseorang'),
|
||||
const SizedBox(width: 12),
|
||||
_roleCard('USER', Icons.accessibility_new_rounded, 'User', 'Saya butuh bantuan navigasi'),
|
||||
]),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
_field('Nama Lengkap', _nameCtrl, false),
|
||||
const SizedBox(height: 14),
|
||||
_field('Email', _emailCtrl, false),
|
||||
const SizedBox(height: 14),
|
||||
_field('Password (min. 6 karakter)', _passCtrl, true),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
SizedBox(
|
||||
width: double.infinity, height: 44,
|
||||
child: ElevatedButton(
|
||||
onPressed: _loading ? null : _register,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF1A56DB),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
child: _loading
|
||||
? const SizedBox(width: 18, height: 18, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
|
||||
: Text('Daftar Sekarang', style: GoogleFonts.inter(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
Center(child: GestureDetector(
|
||||
onTap: () => context.go('/login'),
|
||||
child: Text('Sudah punya akun? Login', style: GoogleFonts.inter(fontSize: 12, color: const Color(0xFF1A56DB))),
|
||||
)),
|
||||
]),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _roleCard(String role, IconData icon, String title, String subtitle) {
|
||||
final selected = _selectedRole == role;
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => setState(() => _selectedRole = role),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? const Color(0xFFEFF6FF) : const Color(0xFFF8FAFC),
|
||||
border: Border.all(color: selected ? const Color(0xFF1A56DB) : const Color(0xFFE2E8F0), width: selected ? 2 : 1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(children: [
|
||||
Icon(icon, color: selected ? const Color(0xFF1A56DB) : const Color(0xFF94A3B8), size: 28),
|
||||
const SizedBox(height: 8),
|
||||
Text(title, style: GoogleFonts.inter(fontSize: 13, fontWeight: FontWeight.w600, color: selected ? const Color(0xFF1A56DB) : const Color(0xFF0F172A))),
|
||||
const SizedBox(height: 4),
|
||||
Text(subtitle, textAlign: TextAlign.center, style: GoogleFonts.inter(fontSize: 10, color: const Color(0xFF94A3B8))),
|
||||
]),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _field(String label, TextEditingController ctrl, bool isPass) {
|
||||
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(label, style: GoogleFonts.inter(fontSize: 12, color: const Color(0xFF64748B))),
|
||||
const SizedBox(height: 5),
|
||||
TextField(
|
||||
controller: ctrl,
|
||||
obscureText: isPass,
|
||||
style: GoogleFonts.inter(fontSize: 13),
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: Color(0xFFE2E8F0))),
|
||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: Color(0xFFE2E8F0))),
|
||||
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: Color(0xFF1A56DB), width: 2)),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../../core/storage/secure_storage.dart';
|
||||
import '../../../../core/services/tts_service.dart';
|
||||
import '../../../../injection_container.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
const SplashScreen({super.key});
|
||||
|
||||
@override
|
||||
State<SplashScreen> createState() => _SplashScreenState();
|
||||
}
|
||||
|
||||
class _SplashScreenState extends State<SplashScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_checkAuth();
|
||||
}
|
||||
|
||||
Future<void> _checkAuth() async {
|
||||
await Future.delayed(const Duration(milliseconds: 800));
|
||||
final storage = sl<SecureStorage>();
|
||||
final token = await storage.getAccessToken();
|
||||
final role = await storage.getUserRole();
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
if (token == null || role == null) {
|
||||
context.go('/login');
|
||||
return;
|
||||
}
|
||||
|
||||
final name = await storage.getDisplayName() ?? 'kembali';
|
||||
sl<TtsService>().speak('Selamat datang, $name');
|
||||
|
||||
if (role == 'ROLE_GUARDIAN') {
|
||||
context.go('/guardian/dashboard');
|
||||
} else {
|
||||
context.go('/user/walkguide');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF1A56DB),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 80, height: 80,
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.15), borderRadius: BorderRadius.circular(20)),
|
||||
child: const Icon(Icons.navigation_rounded, color: Colors.white, size: 44),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text('WalkGuide', style: GoogleFonts.outfit(fontSize: 32, fontWeight: FontWeight.w700, color: Colors.white)),
|
||||
const SizedBox(height: 8),
|
||||
Text('AI Navigation Assistant', style: GoogleFonts.inter(fontSize: 14, color: Colors.white60)),
|
||||
const SizedBox(height: 48),
|
||||
const CircularProgressIndicator(color: Colors.white54, strokeWidth: 2),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,184 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import '../../../../core/constants/app_constants.dart';
|
||||
import '../../../../injection_container.dart';
|
||||
import '../../../../core/network/api_client.dart';
|
||||
|
||||
class ServerConnectScreen extends StatefulWidget {
|
||||
const ServerConnectScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ServerConnectScreen> createState() => _ServerConnectScreenState();
|
||||
}
|
||||
|
||||
class _ServerConnectScreenState extends State<ServerConnectScreen> {
|
||||
final _urlCtrl = TextEditingController(text: 'http://202.46.28.160:8080');
|
||||
bool _testing = false;
|
||||
bool _connected = false;
|
||||
String? _errorMsg;
|
||||
String? _serverInfo;
|
||||
|
||||
Future<void> _testConnection() async {
|
||||
final url = _urlCtrl.text.trim();
|
||||
if (url.isEmpty) return;
|
||||
|
||||
setState(() { _testing = true; _connected = false; _errorMsg = null; _serverInfo = null; });
|
||||
|
||||
try {
|
||||
final tempDio = Dio(BaseOptions(
|
||||
connectTimeout: AppConstants.pingTimeout,
|
||||
receiveTimeout: AppConstants.pingTimeout,
|
||||
));
|
||||
final res = await tempDio.get('$url/api/v1/auth/ping');
|
||||
if (res.statusCode == 200 && res.data['success'] == true) {
|
||||
setState(() {
|
||||
_connected = true;
|
||||
_serverInfo = 'Server aktif — ${res.data['message'] ?? 'OK'}';
|
||||
});
|
||||
} else {
|
||||
setState(() => _errorMsg = 'Server merespons tapi tidak valid. Cek URL.');
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
String msg;
|
||||
if (e.type == DioExceptionType.connectionTimeout ||
|
||||
e.type == DioExceptionType.receiveTimeout) {
|
||||
msg = 'Koneksi timeout. Pastikan server berjalan dan URL benar.';
|
||||
} else if (e.type == DioExceptionType.connectionError) {
|
||||
msg = 'Tidak bisa terhubung. Cek URL dan pastikan HP di jaringan yang sama dengan server.';
|
||||
} else {
|
||||
msg = 'Error: ${e.message}';
|
||||
}
|
||||
setState(() => _errorMsg = msg);
|
||||
} catch (e) {
|
||||
setState(() => _errorMsg = 'Error tidak dikenal: $e');
|
||||
} finally {
|
||||
setState(() => _testing = false);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _continueToApp() async {
|
||||
final url = _urlCtrl.text.trim();
|
||||
await AppConstants.setServerUrl(url);
|
||||
await sl<ApiClient>().init(url);
|
||||
if (mounted) context.go('/splash');
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF1F5F9),
|
||||
body: Center(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 440),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.08), blurRadius: 40, offset: const Offset(0, 16))],
|
||||
),
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Logo
|
||||
Row(children: [
|
||||
Container(
|
||||
width: 40, height: 40,
|
||||
decoration: BoxDecoration(color: const Color(0xFF1A56DB), borderRadius: BorderRadius.circular(10)),
|
||||
child: const Icon(Icons.navigation_rounded, color: Colors.white, size: 22),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Text('WalkGuide', style: GoogleFonts.outfit(fontSize: 20, fontWeight: FontWeight.w700, color: const Color(0xFF0F172A))),
|
||||
]),
|
||||
const SizedBox(height: 28),
|
||||
Text('Connect to Server', style: GoogleFonts.outfit(fontSize: 26, fontWeight: FontWeight.w700, color: const Color(0xFF0F172A))),
|
||||
const SizedBox(height: 6),
|
||||
Text('Masukkan URL server yang diberikan oleh dosen/instructor.', style: GoogleFonts.inter(fontSize: 13, color: const Color(0xFF64748B))),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// URL Input
|
||||
Text('Server URL', style: GoogleFonts.inter(fontSize: 12, fontWeight: FontWeight.w500, color: const Color(0xFF64748B))),
|
||||
const SizedBox(height: 6),
|
||||
TextField(
|
||||
controller: _urlCtrl,
|
||||
keyboardType: TextInputType.url,
|
||||
style: GoogleFonts.inter(fontSize: 14, color: const Color(0xFF0F172A)),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'http://202.46.28.160:8080',
|
||||
hintStyle: GoogleFonts.inter(color: const Color(0xFFCBD5E1)),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10), borderSide: const BorderSide(color: Color(0xFFE2E8F0))),
|
||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(10), borderSide: const BorderSide(color: Color(0xFFE2E8F0))),
|
||||
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(10), borderSide: const BorderSide(color: Color(0xFF1A56DB), width: 2)),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
),
|
||||
onChanged: (_) => setState(() { _connected = false; _errorMsg = null; }),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Status
|
||||
if (_errorMsg != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(color: const Color(0xFFFEF2F2), borderRadius: BorderRadius.circular(8)),
|
||||
child: Row(children: [
|
||||
const Icon(Icons.error_outline, color: Color(0xFFDC2626), size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(_errorMsg!, style: GoogleFonts.inter(fontSize: 12, color: const Color(0xFFDC2626)))),
|
||||
]),
|
||||
),
|
||||
if (_connected && _serverInfo != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(color: const Color(0xFFF0FDF4), borderRadius: BorderRadius.circular(8)),
|
||||
child: Row(children: [
|
||||
const Icon(Icons.check_circle_outline, color: Color(0xFF16A34A), size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(_serverInfo!, style: GoogleFonts.inter(fontSize: 12, color: const Color(0xFF16A34A)))),
|
||||
]),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Test button
|
||||
SizedBox(
|
||||
width: double.infinity, height: 44,
|
||||
child: OutlinedButton(
|
||||
onPressed: _testing ? null : _testConnection,
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: Color(0xFF1A56DB)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
child: _testing
|
||||
? const SizedBox(width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: Text('Test Connection', style: GoogleFonts.inter(fontSize: 14, fontWeight: FontWeight.w500, color: const Color(0xFF1A56DB))),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// Continue button (only after successful test)
|
||||
if (_connected)
|
||||
SizedBox(
|
||||
width: double.infinity, height: 44,
|
||||
child: ElevatedButton(
|
||||
onPressed: _continueToApp,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF1A56DB),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
child: Text('Continue to App', style: GoogleFonts.inter(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.white)),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
Center(child: Text('v1.0.0 · For Testing Purposes', style: GoogleFonts.inter(fontSize: 11, color: const Color(0xFFCBD5E1)))),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../core/services/voice_command_handler.dart';
|
||||
import '../../core/services/stt_service.dart';
|
||||
import '../../core/services/tts_service.dart';
|
||||
import '../../injection_container.dart';
|
||||
|
||||
class UserShell extends StatefulWidget {
|
||||
final Widget child;
|
||||
const UserShell({super.key, required this.child});
|
||||
@override
|
||||
State<UserShell> createState() => _UserShellState();
|
||||
}
|
||||
|
||||
class _UserShellState extends State<UserShell> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_startVoiceListening();
|
||||
_setupVoiceCommands();
|
||||
}
|
||||
|
||||
void _startVoiceListening() {
|
||||
sl<SttService>().startListening();
|
||||
}
|
||||
|
||||
void _setupVoiceCommands() {
|
||||
sl<VoiceCommandHandler>().onCommand = (key) {
|
||||
if (!mounted) return;
|
||||
switch (key) {
|
||||
case VoiceCommandKey.openWalkguide:
|
||||
context.go('/user/walkguide');
|
||||
sl<TtsService>().speak('Walkguide menu opened');
|
||||
break;
|
||||
case VoiceCommandKey.openNotification:
|
||||
context.go('/user/notifications');
|
||||
sl<TtsService>().speak('Notifications opened');
|
||||
break;
|
||||
case VoiceCommandKey.openSos:
|
||||
context.go('/user/sos');
|
||||
sl<TtsService>().speak('SOS menu opened');
|
||||
break;
|
||||
case VoiceCommandKey.openActivity:
|
||||
context.go('/user/activity');
|
||||
sl<TtsService>().speak('Activity log opened');
|
||||
break;
|
||||
case VoiceCommandKey.openNavigation:
|
||||
context.go('/user/navigation');
|
||||
sl<TtsService>().speak('Navigation mode opened');
|
||||
break;
|
||||
case VoiceCommandKey.openSettings:
|
||||
context.go('/user/settings');
|
||||
sl<TtsService>().speak('Settings opened');
|
||||
break;
|
||||
case VoiceCommandKey.callGuardian:
|
||||
context.go('/user/call');
|
||||
break;
|
||||
case VoiceCommandKey.sendSos:
|
||||
case VoiceCommandKey.whereAmI:
|
||||
case VoiceCommandKey.startWalkguide:
|
||||
case VoiceCommandKey.stopWalkguide:
|
||||
case VoiceCommandKey.readAllNotif:
|
||||
// These are handled by individual screens
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
int _tabFromLocation(String location) {
|
||||
if (location.startsWith('/user/walkguide')) return 0;
|
||||
if (location.startsWith('/user/sos')) return 1;
|
||||
if (location.startsWith('/user/activity')) return 2;
|
||||
if (location.startsWith('/user/notifications')) return 3;
|
||||
if (location.startsWith('/user/navigation')) return 4;
|
||||
return 5;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final location = GoRouterState.of(context).matchedLocation;
|
||||
final currentTab = _tabFromLocation(location);
|
||||
|
||||
// Hide bottom nav during full-screen screens
|
||||
final hideNav = location.startsWith('/user/call') || location.startsWith('/user/pairing');
|
||||
|
||||
return Scaffold(
|
||||
body: widget.child,
|
||||
bottomNavigationBar: hideNav ? null : Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.08), blurRadius: 20, offset: const Offset(0, -4))],
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_navItem(context, 0, currentTab, Icons.remove_red_eye_outlined, Icons.remove_red_eye, 'Guide', '/user/walkguide'),
|
||||
_navItem(context, 1, currentTab, Icons.warning_amber_outlined, Icons.warning_amber, 'SOS', '/user/sos'),
|
||||
_navItem(context, 2, currentTab, Icons.list_alt_outlined, Icons.list_alt, 'Activity', '/user/activity'),
|
||||
_navItem(context, 3, currentTab, Icons.notifications_outlined, Icons.notifications, 'Notif', '/user/notifications'),
|
||||
_navItem(context, 4, currentTab, Icons.map_outlined, Icons.map, 'Navigate', '/user/navigation'),
|
||||
_navItem(context, 5, currentTab, Icons.settings_outlined, Icons.settings, 'Settings', '/user/settings'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _navItem(BuildContext ctx, int idx, int current, IconData icon, IconData activeIcon, String label, String route) {
|
||||
final active = idx == current;
|
||||
return GestureDetector(
|
||||
onTap: () => ctx.go(route),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: active ? const Color(0xFFEFF6FF) : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
Icon(active ? activeIcon : icon, size: 22, color: active ? const Color(0xFF1A56DB) : const Color(0xFF94A3B8)),
|
||||
const SizedBox(height: 3),
|
||||
Text(label, style: GoogleFonts.inter(fontSize: 10, fontWeight: active ? FontWeight.w600 : FontWeight.w400,
|
||||
color: active ? const Color(0xFF1A56DB) : const Color(0xFF94A3B8))),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,39 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:camera/camera.dart';
|
||||
import 'features/auth/presentation/login_screen.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'injection_container.dart';
|
||||
import 'app/app.dart';
|
||||
|
||||
// Variabel global buat nyimpen daftar kamera di HP
|
||||
List<CameraDescription> cameras = [];
|
||||
|
||||
Future<void> main() async {
|
||||
// Wajib dipanggil sebelum inisialisasi hardware
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// Ambil daftar kamera yang ada di HP
|
||||
// Init cameras
|
||||
try {
|
||||
cameras = await availableCameras();
|
||||
} catch (e) {
|
||||
debugPrint('Error inisialisasi kamera: $e');
|
||||
debugPrint('Camera init error: $e');
|
||||
}
|
||||
|
||||
// Init Firebase (skip jika belum setup google-services.json)
|
||||
try {
|
||||
await Firebase.initializeApp();
|
||||
} catch (e) {
|
||||
debugPrint('Firebase init skipped: $e');
|
||||
}
|
||||
|
||||
// Init GetIt dependencies
|
||||
await initDependencies();
|
||||
|
||||
runApp(const WalkGuideApp());
|
||||
}
|
||||
|
||||
class WalkGuideApp extends StatelessWidget {
|
||||
const WalkGuideApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Walk Guide',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF2563EB)),
|
||||
textTheme: GoogleFonts.interTextTheme(),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: const LoginScreen(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -7,9 +7,17 @@
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
||||
#include <record_linux/record_linux_plugin.h>
|
||||
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
|
||||
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) record_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "RecordLinuxPlugin");
|
||||
record_linux_plugin_register_with_registrar(record_linux_registrar);
|
||||
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
|
||||
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
|
||||
}
|
||||
|
||||
@ -4,9 +4,12 @@
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
flutter_secure_storage_linux
|
||||
record_linux
|
||||
sqlite3_flutter_libs
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
tflite_flutter
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
@ -5,10 +5,42 @@
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import flutter_secure_storage_darwin
|
||||
import agora_rtc_engine
|
||||
import audio_session
|
||||
import connectivity_plus
|
||||
import device_info_plus
|
||||
import firebase_core
|
||||
import firebase_messaging
|
||||
import flutter_local_notifications
|
||||
import flutter_secure_storage_macos
|
||||
import flutter_tts
|
||||
import geolocator_apple
|
||||
import iris_method_channel
|
||||
import just_audio
|
||||
import path_provider_foundation
|
||||
import record_darwin
|
||||
import shared_preferences_foundation
|
||||
import speech_to_text
|
||||
import sqflite_darwin
|
||||
import sqlite3_flutter_libs
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FlutterSecureStorageDarwinPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageDarwinPlugin"))
|
||||
AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin"))
|
||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
||||
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
|
||||
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
|
||||
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||
IrisMethodChannelPlugin.register(with: registry.registrar(forPlugin: "IrisMethodChannelPlugin"))
|
||||
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
RecordPlugin.register(with: registry.registrar(forPlugin: "RecordPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
SpeechToTextPlugin.register(with: registry.registrar(forPlugin: "SpeechToTextPlugin"))
|
||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,97 +1,103 @@
|
||||
name: walkguide_app
|
||||
description: "A new Flutter project."
|
||||
# The following line prevents the package from being accidentally published to
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
# The following defines the version and build number for your application.
|
||||
# A version number is three numbers separated by dots, like 1.2.43
|
||||
# followed by an optional build number separated by a +.
|
||||
# Both the version and the builder number may be overridden in flutter
|
||||
# build by specifying --build-name and --build-number, respectively.
|
||||
# In Android, build-name is used as versionName while build-number used as versionCode.
|
||||
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
description: "WalkGuide - AI Navigation for Visually Impaired"
|
||||
publish_to: 'none'
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.9.0
|
||||
sdk: ^3.4.0
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
||||
# dependencies can be manually updated by changing the version numbers below to
|
||||
# the latest version available on pub.dev. To see which dependencies have newer
|
||||
# versions available, run `flutter pub outdated`.
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
dio: ^5.9.2
|
||||
flutter_secure_storage: ^10.0.0
|
||||
google_fonts: ^8.0.2
|
||||
# State management
|
||||
flutter_bloc: ^8.1.6
|
||||
|
||||
# Navigation
|
||||
go_router: ^14.2.7
|
||||
|
||||
# Network
|
||||
dio: ^5.4.3+1
|
||||
|
||||
# Storage
|
||||
flutter_secure_storage: ^9.2.2
|
||||
shared_preferences: ^2.3.2
|
||||
drift: ^2.18.0
|
||||
sqlite3_flutter_libs: ^0.5.24
|
||||
path_provider: ^2.1.3
|
||||
path: ^1.9.0
|
||||
|
||||
# Firebase / FCM
|
||||
firebase_core: ^3.3.0
|
||||
firebase_messaging: ^15.1.0
|
||||
flutter_local_notifications: ^17.2.1+2
|
||||
|
||||
# Camera & AI
|
||||
camera: ^0.11.0+2
|
||||
tflite_flutter: ^0.10.4
|
||||
image: ^4.2.0
|
||||
|
||||
# Audio & TTS
|
||||
flutter_tts: ^4.0.2
|
||||
speech_to_text: ^7.0.0
|
||||
just_audio: ^0.9.40
|
||||
record: ^5.1.2
|
||||
|
||||
# Maps (OpenStreetMap - FREE)
|
||||
flutter_map: ^7.0.2
|
||||
latlong2: ^0.9.1
|
||||
|
||||
# Location
|
||||
geolocator: ^12.0.0
|
||||
|
||||
# Agora VoIP
|
||||
agora_rtc_engine: ^6.3.2
|
||||
|
||||
# Permissions
|
||||
permission_handler: ^11.3.1
|
||||
|
||||
# Haptic
|
||||
vibration: ^2.0.0
|
||||
|
||||
# Connectivity
|
||||
connectivity_plus: ^6.0.3
|
||||
|
||||
# Functional programming (Either)
|
||||
dartz: ^0.10.1
|
||||
camera: ^0.12.0+1
|
||||
animate_do: ^5.1.0
|
||||
|
||||
# DI
|
||||
get_it: ^8.0.2
|
||||
|
||||
# UI
|
||||
google_fonts: ^6.2.1
|
||||
flutter_animate: ^4.5.0
|
||||
cupertino_icons: ^1.0.8
|
||||
cached_network_image: ^3.3.1
|
||||
shimmer: ^3.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^4.0.0
|
||||
build_runner: ^2.4.11
|
||||
drift_dev: ^2.18.0
|
||||
integration_test:
|
||||
sdk: flutter
|
||||
mockito: ^5.4.4
|
||||
bloc_test: ^9.1.7
|
||||
|
||||
# The "flutter_lints" package below contains a set of recommended lints to
|
||||
# encourage good coding practices. The lint set provided by the package is
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^5.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
assets:
|
||||
- assets/images/
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/to/resolution-aware-images
|
||||
|
||||
# For details regarding adding assets from package dependencies, see
|
||||
# https://flutter.dev/to/asset-from-package
|
||||
|
||||
# To add custom fonts to your application, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts from package dependencies,
|
||||
# see https://flutter.dev/to/font-from-package
|
||||
- assets/models/
|
||||
fonts:
|
||||
- family: Inter
|
||||
fonts:
|
||||
- asset: assets/fonts/Inter-Regular.ttf
|
||||
- asset: assets/fonts/Inter-Medium.ttf
|
||||
weight: 500
|
||||
- asset: assets/fonts/Inter-SemiBold.ttf
|
||||
weight: 600
|
||||
- asset: assets/fonts/Inter-Bold.ttf
|
||||
weight: 700
|
||||
@ -6,9 +6,39 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <agora_rtc_engine/agora_rtc_engine_plugin.h>
|
||||
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||
#include <flutter_tts/flutter_tts_plugin.h>
|
||||
#include <geolocator_windows/geolocator_windows.h>
|
||||
#include <iris_method_channel/iris_method_channel_plugin_c_api.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <record_windows/record_windows_plugin_c_api.h>
|
||||
#include <speech_to_text_windows/speech_to_text_windows.h>
|
||||
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
AgoraRtcEnginePluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin"));
|
||||
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
||||
FirebaseCorePluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
|
||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||
FlutterTtsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FlutterTtsPlugin"));
|
||||
GeolocatorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||
IrisMethodChannelPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("IrisMethodChannelPluginCApi"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||
RecordWindowsPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("RecordWindowsPluginCApi"));
|
||||
SpeechToTextWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("SpeechToTextWindows"));
|
||||
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
|
||||
}
|
||||
|
||||
@ -3,10 +3,21 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
agora_rtc_engine
|
||||
connectivity_plus
|
||||
firebase_core
|
||||
flutter_secure_storage_windows
|
||||
flutter_tts
|
||||
geolocator_windows
|
||||
iris_method_channel
|
||||
permission_handler_windows
|
||||
record_windows
|
||||
speech_to_text_windows
|
||||
sqlite3_flutter_libs
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
tflite_flutter
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user