first week update
This commit is contained in:
parent
760bb2de66
commit
ff76abbbf6
@ -1,35 +1,36 @@
|
||||
package com.walkguide.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.walkguide.dto.ApiResponse;
|
||||
import com.walkguide.dto.AuthRequest;
|
||||
import com.walkguide.dto.AuthResponse;
|
||||
import com.walkguide.service.AuthService;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/auth") // Ini URL awalnya
|
||||
@RequestMapping("/api/auth")
|
||||
@RequiredArgsConstructor
|
||||
public class AuthController {
|
||||
|
||||
private final AuthService authService;
|
||||
|
||||
// Ini URL lengkapnya jadi POST http://localhost:8080/api/auth/login
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<?> login(@RequestBody AuthRequest request) {
|
||||
try {
|
||||
// Lempar kardus AuthRequest ke Service
|
||||
AuthResponse response = authService.login(request);
|
||||
// Kalau sukses, kirim status 200 OK + isinya
|
||||
return ResponseEntity.ok(response);
|
||||
} catch (RuntimeException e) {
|
||||
// Kalau gagal (password salah/email gak ada), kirim status 401 Unauthorized
|
||||
return ResponseEntity.status(401).body(e.getMessage());
|
||||
}
|
||||
public ResponseEntity<ApiResponse<Map<String, String>>> login(@Valid @RequestBody AuthRequest request) {
|
||||
|
||||
// Panggil service buat cek password dan bikin token
|
||||
Map<String, String> tokenData = authService.login(request);
|
||||
|
||||
// Bungkus pakai ApiResponse biar sesuai standar Dosen lu!
|
||||
ApiResponse<Map<String, String>> response = new ApiResponse<>(true, tokenData, "Login berhasil");
|
||||
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
}
|
||||
@ -1,36 +1,48 @@
|
||||
package com.walkguide.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.walkguide.dto.AuthRequest;
|
||||
import com.walkguide.dto.AuthResponse;
|
||||
import com.walkguide.entity.User;
|
||||
import com.walkguide.repository.UserRepository;
|
||||
import com.walkguide.security.JwtUtil;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AuthService {
|
||||
|
||||
private final UserRepository userRepository;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final JwtUtil jwtUtil;
|
||||
|
||||
// Wajib panggil BCrypt biar bisa baca password enkripsi dari database
|
||||
private final PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
|
||||
public AuthResponse login(AuthRequest request) {
|
||||
// 1. Cari user di database kampus lu berdasarkan email
|
||||
public Map<String, String> login(AuthRequest request) {
|
||||
// 1. Cari user di database
|
||||
User user = userRepository.findByEmail(request.getEmail())
|
||||
.orElseThrow(() -> new RuntimeException("Email tidak ditemukan!"));
|
||||
.orElseThrow(() -> new RuntimeException("Email tidak terdaftar"));
|
||||
|
||||
// 2. Cocokin password yang diketik sama password yang di-hash di database
|
||||
// 2. Cocokin password (yang diketik VS yang dienkripsi di database)
|
||||
if (!passwordEncoder.matches(request.getPassword(), user.getPassword())) {
|
||||
throw new RuntimeException("Password salah!");
|
||||
throw new RuntimeException("Password salah");
|
||||
}
|
||||
|
||||
// 3. Kalau email dan password bener, suruh JwtUtil cetak Token
|
||||
// 3. Kalau bener, bikin Token
|
||||
// Asumsi JwtUtil lu nerima parameter (email, role). Sesuaikan kalau beda!
|
||||
String token = jwtUtil.generateToken(user.getEmail(), user.getRole());
|
||||
|
||||
// 4. Bungkus token dan rolenya buat dikirim balik ke Flutter
|
||||
return new AuthResponse(token, user.getRole());
|
||||
|
||||
// 4. Balikin ke Controller dalam bentuk Map
|
||||
Map<String, String> data = new HashMap<>();
|
||||
data.put("token", token);
|
||||
data.put("role", user.getRole());
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -43,3 +43,6 @@
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
@ -1,21 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:animate_do/animate_do.dart';
|
||||
import '../../../core/secure_storage.dart';
|
||||
import '../../auth/presentation/login_screen.dart';
|
||||
|
||||
class GuardianDashboardScreen extends StatelessWidget {
|
||||
const GuardianDashboardScreen({super.key});
|
||||
|
||||
Future<void> _handleLogout(BuildContext context) async {
|
||||
await SecureStorage().deleteToken();
|
||||
if (context.mounted) {
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const LoginScreen()),
|
||||
(route) => false, // Bersihin tumpukan screen
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF8FAFC), // Warna background abu-abu sangat muda (modern)
|
||||
backgroundColor: const Color(0xFFF8FAFC),
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
title: Text('Guardian Command', style: GoogleFonts.outfit(color: const Color(0xFF0F172A), fontWeight: FontWeight.bold)),
|
||||
title: FadeInDown(
|
||||
child: Text('Guardian Command', style: GoogleFonts.outfit(color: const Color(0xFF0F172A), fontWeight: FontWeight.bold, fontSize: 24)),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.notifications_none_rounded, color: Color(0xFF0F172A)),
|
||||
onPressed: () {},
|
||||
FadeInDown(
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.logout_rounded, color: Color(0xFFDC2626)),
|
||||
tooltip: 'Logout',
|
||||
onPressed: () => _handleLogout(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -24,76 +43,93 @@ class GuardianDashboardScreen extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 1. KARTU STATUS USER (Hero Card)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(colors: [Color(0xFF2563EB), Color(0xFF1D4ED8)]),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: [
|
||||
BoxShadow(color: const Color(0xFF2563EB).withOpacity(0.3), blurRadius: 20, offset: const Offset(0, 10))
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: const BoxDecoration(color: Colors.white24, shape: BoxShape.circle),
|
||||
child: const CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundColor: Colors.white,
|
||||
child: Icon(Icons.person, size: 36, color: Color(0xFF2563EB)),
|
||||
// 1. KARTU STATUS USER
|
||||
FadeInUp(
|
||||
duration: const Duration(milliseconds: 600),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(colors: [Color(0xFF2563EB), Color(0xFF1D4ED8)]),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: [
|
||||
BoxShadow(color: const Color(0xFF2563EB).withValues(alpha: 0.3), blurRadius: 20, offset: const Offset(0, 10))
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: const BoxDecoration(color: Colors.white24, shape: BoxShape.circle),
|
||||
child: const CircleAvatar(
|
||||
radius: 30,
|
||||
backgroundColor: Colors.white,
|
||||
child: Icon(Icons.person, size: 36, color: Color(0xFF2563EB)),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('User Pantauan', style: GoogleFonts.inter(color: Colors.blue[100], fontSize: 14)),
|
||||
Text('Sedang Berjalan', style: GoogleFonts.outfit(color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.location_on, color: Colors.white70, size: 16),
|
||||
const SizedBox(width: 4),
|
||||
Text('Jl. Kenangan, SBY', style: GoogleFonts.inter(color: Colors.white70, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('User Pantauan', style: GoogleFonts.inter(color: Colors.blue[100], fontSize: 14)),
|
||||
Text('Sistem Aktif', style: GoogleFonts.outfit(color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold)),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.location_on, color: Colors.white70, size: 16),
|
||||
const SizedBox(width: 4),
|
||||
Text('Melacak lokasi...', style: GoogleFonts.inter(color: Colors.white70, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// 2. QUICK ACTIONS
|
||||
Text('Aksi Cepat', style: GoogleFonts.outfit(fontSize: 18, fontWeight: FontWeight.bold, color: const Color(0xFF0F172A))),
|
||||
FadeInUp(
|
||||
delay: const Duration(milliseconds: 200),
|
||||
child: Text('Aksi Cepat', style: GoogleFonts.outfit(fontSize: 18, fontWeight: FontWeight.bold, color: const Color(0xFF0F172A))),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
_buildQuickAction(Icons.videocam_outlined, 'Live View', const Color(0xFF10B981)),
|
||||
const SizedBox(width: 16),
|
||||
_buildQuickAction(Icons.phone_in_talk, 'Hubungi', const Color(0xFFF59E0B)),
|
||||
const SizedBox(width: 16),
|
||||
_buildQuickAction(Icons.settings_voice, 'Voice Conf', const Color(0xFF8B5CF6)),
|
||||
],
|
||||
FadeInUp(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: Row(
|
||||
children: [
|
||||
_buildQuickAction(Icons.videocam_outlined, 'Live View', const Color(0xFF10B981)),
|
||||
const SizedBox(width: 16),
|
||||
_buildQuickAction(Icons.phone_in_talk, 'Hubungi', const Color(0xFFF59E0B)),
|
||||
const SizedBox(width: 16),
|
||||
_buildQuickAction(Icons.settings_voice, 'Voice Conf', const Color(0xFF8B5CF6)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// 3. SETTINGAN DEVICE USER (Persiapan buat fitur shortcut lu)
|
||||
Text('Konfigurasi Perangkat', style: GoogleFonts.outfit(fontSize: 18, fontWeight: FontWeight.bold, color: const Color(0xFF0F172A))),
|
||||
// 3. SETTINGAN DEVICE USER
|
||||
FadeInUp(
|
||||
delay: const Duration(milliseconds: 400),
|
||||
child: Text('Konfigurasi Perangkat', style: GoogleFonts.outfit(fontSize: 18, fontWeight: FontWeight.bold, color: const Color(0xFF0F172A))),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildSettingTile(Icons.gamepad_outlined, 'Hardware Shortcuts', 'Atur fungsi tombol volume hp user'),
|
||||
_buildSettingTile(Icons.spatial_audio_outlined, 'Sensitivitas AI', 'Atur jarak deteksi rintangan'),
|
||||
FadeInUp(
|
||||
delay: const Duration(milliseconds: 500),
|
||||
child: _buildSettingTile(Icons.gamepad_outlined, 'Hardware Shortcuts', 'Atur fungsi tombol volume hp user'),
|
||||
),
|
||||
FadeInUp(
|
||||
delay: const Duration(milliseconds: 600),
|
||||
child: _buildSettingTile(Icons.spatial_audio_outlined, 'Sensitivitas AI', 'Atur jarak deteksi rintangan'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Widget bantuan buat Bikin Kotak Menu
|
||||
Widget _buildQuickAction(IconData icon, String label, Color color) {
|
||||
return Expanded(
|
||||
child: Container(
|
||||
@ -101,8 +137,8 @@ class GuardianDashboardScreen extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: Colors.grey.withOpacity(0.1)),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.02), blurRadius: 10)],
|
||||
border: Border.all(color: Colors.grey.withValues(alpha: 0.1)),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.02), blurRadius: 10, offset: const Offset(0, 4))],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@ -115,14 +151,14 @@ class GuardianDashboardScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// Widget bantuan buat Bikin List Setting
|
||||
Widget _buildSettingTile(IconData icon, String title, String subtitle) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.grey.withOpacity(0.1)),
|
||||
border: Border.all(color: Colors.grey.withValues(alpha: 0.1)),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withValues(alpha: 0.02), blurRadius: 8, offset: const Offset(0, 2))],
|
||||
),
|
||||
child: ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 8),
|
||||
@ -134,7 +170,7 @@ class GuardianDashboardScreen extends StatelessWidget {
|
||||
title: Text(title, style: GoogleFonts.inter(fontWeight: FontWeight.w600, color: const Color(0xFF0F172A))),
|
||||
subtitle: Text(subtitle, style: GoogleFonts.inter(fontSize: 13, color: const Color(0xFF64748B))),
|
||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16, color: Color(0xFFCBD5E1)),
|
||||
onTap: () {}, // Nanti kita arahin ke halaman setting
|
||||
onTap: () {},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,103 +1,167 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:animate_do/animate_do.dart';
|
||||
import '../../../core/secure_storage.dart';
|
||||
import '../../auth/presentation/login_screen.dart';
|
||||
import '../../../../main.dart'; // import global cameras
|
||||
|
||||
class UserDashboardScreen extends StatelessWidget {
|
||||
class UserDashboardScreen extends StatefulWidget {
|
||||
const UserDashboardScreen({super.key});
|
||||
|
||||
@override
|
||||
State<UserDashboardScreen> createState() => _UserDashboardScreenState();
|
||||
}
|
||||
|
||||
class _UserDashboardScreenState extends State<UserDashboardScreen> with SingleTickerProviderStateMixin {
|
||||
CameraController? _cameraController;
|
||||
late AnimationController _pulseController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initCamera();
|
||||
|
||||
// Setup animasi radar berdenyut
|
||||
_pulseController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(seconds: 2),
|
||||
)..repeat(reverse: true);
|
||||
}
|
||||
|
||||
Future<void> _initCamera() async {
|
||||
if (cameras.isEmpty) return;
|
||||
// Pakai kamera belakang (index 0)
|
||||
_cameraController = CameraController(cameras[0], ResolutionPreset.high, enableAudio: false);
|
||||
await _cameraController!.initialize();
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
Future<void> _handleLogout() async {
|
||||
await SecureStorage().deleteToken();
|
||||
if (mounted) {
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const LoginScreen()),
|
||||
(route) => false, // Hapus history back
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_cameraController?.dispose();
|
||||
_pulseController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black, // Background hitam buat area kamera
|
||||
backgroundColor: Colors.black,
|
||||
body: Stack(
|
||||
children: [
|
||||
// 1. AREA KAMERA FULL SCREEN (Placeholder)
|
||||
// 1. LIVE CAMERA FEED
|
||||
SizedBox.expand(
|
||||
child: _cameraController != null && _cameraController!.value.isInitialized
|
||||
? CameraPreview(_cameraController!)
|
||||
: const Center(child: CircularProgressIndicator(color: Colors.white)),
|
||||
),
|
||||
|
||||
// 2. EFEK RADAR SCANNING (Animasi Pulse)
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
color: Colors.grey[900],
|
||||
child: const Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.camera_alt_outlined, color: Colors.white54, size: 64),
|
||||
SizedBox(height: 16),
|
||||
Text('Kamera Aktif\nMemindai Rintangan...',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.white54, fontSize: 18),
|
||||
child: AnimatedBuilder(
|
||||
animation: _pulseController,
|
||||
builder: (context, child) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
const Color(0xFF10B981).withValues(alpha: 0.1 + (_pulseController.value * 0.15)),
|
||||
],
|
||||
stops: const [0.5, 1.0],
|
||||
radius: 1.5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// 2. OVERLAY INFORMASI ATAS
|
||||
// 3. OVERLAY STATUS & LOGOUT (Atas)
|
||||
Positioned(
|
||||
top: 60,
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.6),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: FadeInDown(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.spatial_audio_off, color: Colors.greenAccent, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
Text('Sistem Siap', style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.6),
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
border: Border.all(color: const Color(0xFF10B981).withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.spatial_audio_off, color: Color(0xFF10B981), size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text('Memindai Area...', style: GoogleFonts.inter(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Tombol Logout
|
||||
IconButton(
|
||||
onPressed: _handleLogout,
|
||||
icon: const Icon(Icons.power_settings_new, color: Colors.white, size: 28),
|
||||
tooltip: 'Keluar',
|
||||
style: IconButton.styleFrom(backgroundColor: Colors.redAccent.withValues(alpha: 0.8)),
|
||||
),
|
||||
const Icon(Icons.battery_4_bar, color: Colors.white),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 3. OVERLAY TOMBOL BAWAH (Gede & Kontras)
|
||||
// 4. OVERLAY TOMBOL BESAR (Bawah)
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: Row(
|
||||
children: [
|
||||
// Tombol Voice Command
|
||||
Expanded(
|
||||
child: Semantics(
|
||||
label: 'Tombol Perintah Suara',
|
||||
hint: 'Tekan dua kali untuk memberikan perintah suara',
|
||||
child: FadeInUp(
|
||||
delay: const Duration(milliseconds: 300),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2563EB), // Biru terang
|
||||
backgroundColor: const Color(0xFF2563EB).withValues(alpha: 0.9),
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
||||
elevation: 10,
|
||||
),
|
||||
child: const Icon(Icons.mic, size: 40, color: Colors.white),
|
||||
child: const Icon(Icons.mic, size: 48, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
// Tombol Call Guardian
|
||||
Expanded(
|
||||
child: Semantics(
|
||||
label: 'Panggil Pendamping',
|
||||
hint: 'Tekan dua kali untuk menelepon pendamping Anda',
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFDC2626), // Merah peringatan
|
||||
backgroundColor: const Color(0xFFDC2626).withValues(alpha: 0.9),
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
||||
elevation: 10,
|
||||
),
|
||||
child: const Icon(Icons.phone_in_talk, size: 40, color: Colors.white),
|
||||
child: const Icon(Icons.phone_in_talk, size: 48, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,8 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'features/home/presentation/login_screen.dart';
|
||||
import 'package:camera/camera.dart';
|
||||
import 'features/auth/presentation/login_screen.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
|
||||
try {
|
||||
cameras = await availableCameras();
|
||||
} catch (e) {
|
||||
debugPrint('Error inisialisasi kamera: $e');
|
||||
}
|
||||
|
||||
void main() {
|
||||
runApp(const WalkGuideApp());
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
animate_do:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: animate_do
|
||||
sha256: ddc9bde27df897088e02553f0aec44c614595de01fe357ffb257ecaf7d40c8fa
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -17,6 +25,46 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
camera:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: camera
|
||||
sha256: "034c38cb8014d29698dcae6d20276688a1bf74e6487dfeb274d70ea05d5f7777"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.0+1"
|
||||
camera_android_camerax:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_android_camerax
|
||||
sha256: b5064cf25a2787d122d0bf12e77c7b1033a2b983d0730e3091f770ee376efde5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
camera_avfoundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_avfoundation
|
||||
sha256: "90e4cc3fde331581a3b2d35d83be41dbb7393af0ab857eb27b732174289cb96d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.10.1"
|
||||
camera_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_platform_interface
|
||||
sha256: "7ac852d77699acee79f0d438b793feee26721841e50973576419ff5c6d95e9b7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.13.0"
|
||||
camera_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_web
|
||||
sha256: "57f49a635c8bf249d07fb95eb693d7e4dda6796dedb3777f9127fb54847beba7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.5+3"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -41,6 +89,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cross_file
|
||||
sha256: "28bb3ae56f117b5aec029d702a90f57d285cd975c3c5c281eaca38dbc47c5937"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.5+2"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -110,6 +166,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
flutter_plugin_android_lifecycle:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_plugin_android_lifecycle
|
||||
sha256: "38d1c268de9097ff59cf0e844ac38759fc78f76836d37edad06fa21e182055a0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.34"
|
||||
flutter_secure_storage:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -357,6 +421,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_transform
|
||||
sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -38,6 +38,8 @@ dependencies:
|
||||
flutter_secure_storage: ^10.0.0
|
||||
google_fonts: ^8.0.2
|
||||
dartz: ^0.10.1
|
||||
camera: ^0.12.0+1
|
||||
animate_do: ^5.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user