Compare commits
No commits in common. "be4a5766690fae111bd883c6b1297d60ed78fc40" and "ca476cb8e689de01712f0decabfe23cef7cc3dc5" have entirely different histories.
be4a576669
...
ca476cb8e6
|
|
@ -29,10 +29,9 @@ protected static function boot()
|
||||||
*/
|
*/
|
||||||
public static function syncKontrakanStatus($kontrakanId)
|
public static function syncKontrakanStatus($kontrakanId)
|
||||||
{
|
{
|
||||||
// Cek apakah ada booking checked_in (sewa)
|
// Cek apakah ada booking checked_in
|
||||||
$hasCheckedIn = static::where('kontrakan_id', $kontrakanId)
|
$hasCheckedIn = static::where('kontrakan_id', $kontrakanId)
|
||||||
->where('status', self::STATUS_CHECKED_IN)
|
->where('status', self::STATUS_CHECKED_IN)
|
||||||
->where('jenis_pengajuan', 'sewa')
|
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($hasCheckedIn) {
|
if ($hasCheckedIn) {
|
||||||
|
|
@ -40,10 +39,9 @@ public static function syncKontrakanStatus($kontrakanId)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cek apakah ada booking confirmed atau pending (sewa)
|
// Cek apakah ada booking confirmed atau pending
|
||||||
$hasActiveOrPending = static::where('kontrakan_id', $kontrakanId)
|
$hasActiveOrPending = static::where('kontrakan_id', $kontrakanId)
|
||||||
->whereIn('status', [self::STATUS_CONFIRMED, self::STATUS_PENDING])
|
->whereIn('status', [self::STATUS_CONFIRMED, self::STATUS_PENDING])
|
||||||
->where('jenis_pengajuan', 'sewa')
|
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($hasActiveOrPending) {
|
if ($hasActiveOrPending) {
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@
|
||||||
</div>
|
</div>
|
||||||
@if($booking->jam_survei)
|
@if($booking->jam_survei)
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
<i class="bi bi-clock me-1"></i>Pukul {{ date('H.i', strtotime($booking->jam_survei)) }} WIB
|
<i class="bi bi-clock me-1"></i>Pukul {{ $booking->jam_survei }} WIB
|
||||||
</small>
|
</small>
|
||||||
@endif
|
@endif
|
||||||
<br>
|
<br>
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ class="rounded me-3" style="width: 120px; height: 90px; object-fit: cover;">
|
||||||
</div>
|
</div>
|
||||||
@if($booking->jam_survei)
|
@if($booking->jam_survei)
|
||||||
<div class="fw-semibold mt-1">
|
<div class="fw-semibold mt-1">
|
||||||
<i class="bi bi-clock me-1 text-success"></i>Pukul {{ date('H.i', strtotime($booking->jam_survei)) }} WIB
|
<i class="bi bi-clock me-1 text-success"></i>Pukul {{ $booking->jam_survei }} WIB
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<span class="badge bg-success mt-1">Survei</span>
|
<span class="badge bg-success mt-1">Survei</span>
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
|
||||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="Kontrak Kampus"
|
android:label="Kontrak Kampus"
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||||
late AnimationController _animController;
|
late AnimationController _animController;
|
||||||
late Animation<double> _fadeAnim;
|
late Animation<double> _fadeAnim;
|
||||||
late Animation<double> _scaleAnim;
|
late Animation<double> _scaleAnim;
|
||||||
|
String _statusText = 'Memulai aplikasi...';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -290,9 +291,12 @@ class _SplashScreenState extends State<SplashScreen>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _checkAuth() async {
|
Future<void> _checkAuth() async {
|
||||||
// Auto-detect server IP (status callback ditelan, user hanya lihat "Sedang memuat...")
|
// 🔍 Auto-detect server IP dengan fallback ke konfigurasi default.
|
||||||
|
// Ini membantu APK tetap bisa konek saat IP LAN berubah.
|
||||||
await ServerDiscoveryService.discover(
|
await ServerDiscoveryService.discover(
|
||||||
onStatus: (_) {}, // Tidak tampilkan info teknis ke user
|
onStatus: (status) {
|
||||||
|
if (mounted) setState(() => _statusText = status);
|
||||||
|
},
|
||||||
).timeout(
|
).timeout(
|
||||||
const Duration(seconds: 8),
|
const Duration(seconds: 8),
|
||||||
onTimeout: () {
|
onTimeout: () {
|
||||||
|
|
@ -301,6 +305,7 @@ class _SplashScreenState extends State<SplashScreen>
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (mounted) setState(() => _statusText = 'Memeriksa sesi...');
|
||||||
await _authService.loadToken();
|
await _authService.loadToken();
|
||||||
await Future.delayed(const Duration(milliseconds: 400));
|
await Future.delayed(const Duration(milliseconds: 400));
|
||||||
|
|
||||||
|
|
@ -314,7 +319,13 @@ class _SplashScreenState extends State<SplashScreen>
|
||||||
|
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (_) => destination),
|
PageRouteBuilder(
|
||||||
|
pageBuilder: (_, __, ___) => destination,
|
||||||
|
transitionsBuilder: (_, animation, __, child) {
|
||||||
|
return FadeTransition(opacity: animation, child: child);
|
||||||
|
},
|
||||||
|
transitionDuration: const Duration(milliseconds: 500),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -324,122 +335,82 @@ class _SplashScreenState extends State<SplashScreen>
|
||||||
body: Container(
|
body: Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topLeft,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomRight,
|
||||||
colors: [Color(0xFF1565C0), Color(0xFF1E88E5)],
|
colors: [Color(0xFF1565C0), Color(0xFF0D47A1), Color(0xFF1A237E)],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Center(
|
||||||
children: [
|
child: FadeTransition(
|
||||||
// ==================== KONTEN UTAMA (TENGAH) ====================
|
opacity: _fadeAnim,
|
||||||
Center(
|
child: ScaleTransition(
|
||||||
child: FadeTransition(
|
scale: _scaleAnim,
|
||||||
opacity: _fadeAnim,
|
child: Column(
|
||||||
child: ScaleTransition(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
scale: _scaleAnim,
|
children: [
|
||||||
child: Column(
|
Container(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
padding: const EdgeInsets.all(28),
|
||||||
children: [
|
decoration: BoxDecoration(
|
||||||
// Logo toga di dalam CircleAvatar putih
|
color: Colors.white,
|
||||||
Container(
|
shape: BoxShape.circle,
|
||||||
decoration: BoxDecoration(
|
boxShadow: [
|
||||||
shape: BoxShape.circle,
|
BoxShadow(
|
||||||
boxShadow: [
|
color: Colors.black.withOpacity(0.15),
|
||||||
BoxShadow(
|
blurRadius: 30,
|
||||||
color: Colors.black.withValues(alpha: 0.15),
|
offset: const Offset(0, 10),
|
||||||
blurRadius: 30,
|
|
||||||
offset: const Offset(0, 10),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: const CircleAvatar(
|
],
|
||||||
radius: 50,
|
),
|
||||||
backgroundColor: Colors.white,
|
child: const Icon(
|
||||||
child: Icon(
|
Icons.school_rounded,
|
||||||
Icons.school,
|
size: 64,
|
||||||
size: 56,
|
color: Color(0xFF1565C0),
|
||||||
color: Color(0xFF1565C0),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 32),
|
|
||||||
|
|
||||||
// Nama aplikasi — bold, non-italic, 28sp, putih
|
|
||||||
const Text(
|
|
||||||
'Kontrak Kampus',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 28,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontStyle: FontStyle.normal,
|
|
||||||
color: Colors.white,
|
|
||||||
letterSpacing: 0.5,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
|
|
||||||
// Tagline — kecil, putih transparan
|
|
||||||
Text(
|
|
||||||
'Rekomendasi Kontrakan & Laundry untuk Mahasiswa',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
color: Colors.white.withValues(alpha: 0.8),
|
|
||||||
letterSpacing: 0.3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 48),
|
|
||||||
|
|
||||||
// Teks loading ramah user
|
|
||||||
Text(
|
|
||||||
'Sedang memuat...',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 13,
|
|
||||||
color: Colors.white.withValues(alpha: 0.7),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
|
|
||||||
// Loading indicator di bawah teks loading
|
|
||||||
SizedBox(
|
|
||||||
width: 32,
|
|
||||||
height: 32,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 2.5,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
Colors.white.withValues(alpha: 0.9),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 32),
|
||||||
|
const Text(
|
||||||
|
'Kontrak Kampus',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 30,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
color: Colors.white,
|
||||||
|
letterSpacing: 0.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Rekomendasi Kontrakan & Laundry untuk Mahasiswa',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.white.withOpacity(0.8),
|
||||||
|
letterSpacing: 0.3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 48),
|
||||||
|
SizedBox(
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2.5,
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
|
Colors.white.withOpacity(0.9),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
_statusText,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: Colors.white.withOpacity(0.7),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
// ==================== VERSI APP (BAWAH TENGAH) ====================
|
|
||||||
Positioned(
|
|
||||||
bottom: 32,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'v1.0.0',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.white.withValues(alpha: 0.5),
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -291,26 +291,7 @@ class Laundry {
|
||||||
|
|
||||||
double get jarak => jarakKampus; // alias for jarak field
|
double get jarak => jarakKampus; // alias for jarak field
|
||||||
double get rating => avgRating ?? 0.0;
|
double get rating => avgRating ?? 0.0;
|
||||||
// Format jam secara umum menjadi format ramah pengguna (contoh: "3 hari", "10 jam")
|
String get estimasiSelesai => '$waktuProses jam';
|
||||||
static String formatJam(int jam) {
|
|
||||||
if (jam >= 24) {
|
|
||||||
final hari = jam ~/ 24;
|
|
||||||
final sisaJam = jam % 24;
|
|
||||||
if (sisaJam == 0) {
|
|
||||||
return '$hari hari';
|
|
||||||
} else {
|
|
||||||
return '$hari hari $sisaJam jam';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return '$jam jam';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format waktu proses sesuai jenis layanan
|
|
||||||
String formattedWaktuProsesFor(String? jenisLayanan) {
|
|
||||||
return formatJam(waktuProsesFor(jenisLayanan));
|
|
||||||
}
|
|
||||||
|
|
||||||
String get estimasiSelesai => formatJam(waktuProses);
|
|
||||||
|
|
||||||
// Check if currently open
|
// Check if currently open
|
||||||
bool get isOpen {
|
bool get isOpen {
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,7 @@ class _FavoritesScreenState extends State<FavoritesScreen>
|
||||||
children: [
|
children: [
|
||||||
_buildInfoChip(
|
_buildInfoChip(
|
||||||
Icons.schedule_rounded,
|
Icons.schedule_rounded,
|
||||||
'${laundry.estimasiSelesai} proses',
|
'${laundry.waktuProses}h proses',
|
||||||
const Color(0xFF00897B),
|
const Color(0xFF00897B),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
|
|
|
||||||
|
|
@ -1378,7 +1378,7 @@ class _ImprovedHomeScreenState extends State<ImprovedHomeScreen> {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 3),
|
const SizedBox(width: 3),
|
||||||
Text(
|
Text(
|
||||||
laundry.estimasiSelesai,
|
'${laundry.waktuProses}h',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ class _LaundryDetailScreenState extends State<LaundryDetailScreen> {
|
||||||
),
|
),
|
||||||
_buildHeaderChip(
|
_buildHeaderChip(
|
||||||
icon: Icons.schedule_rounded,
|
icon: Icons.schedule_rounded,
|
||||||
label: widget.laundry.formattedWaktuProsesFor(widget.selectedJenisLayanan),
|
label: '${widget.laundry.waktuProsesFor(widget.selectedJenisLayanan)} jam',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -347,7 +347,7 @@ class _LaundryDetailScreenState extends State<LaundryDetailScreen> {
|
||||||
_buildInfoRow(
|
_buildInfoRow(
|
||||||
Icons.schedule,
|
Icons.schedule,
|
||||||
'Kecepatan Layanan',
|
'Kecepatan Layanan',
|
||||||
widget.laundry.formattedWaktuProsesFor(widget.selectedJenisLayanan),
|
'${widget.laundry.waktuProsesFor(widget.selectedJenisLayanan)} jam',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -366,17 +366,15 @@ class _LaundryDetailScreenState extends State<LaundryDetailScreen> {
|
||||||
widget.laundry.formattedHargaFor("harian"),
|
widget.laundry.formattedHargaFor("harian"),
|
||||||
Icons.scale,
|
Icons.scale,
|
||||||
const Color(0xFF00897B),
|
const Color(0xFF00897B),
|
||||||
duration: widget.laundry.formattedWaktuProsesFor("harian"),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
],
|
],
|
||||||
if (widget.laundry.hargaJam > 0)
|
if (widget.laundry.hargaJam > 0)
|
||||||
_buildPriceCard(
|
_buildPriceCard(
|
||||||
'Laundry Express (Jam)',
|
'Laundry Express (Jam/Satuan)',
|
||||||
widget.laundry.formattedHargaFor("jam"),
|
widget.laundry.formattedHargaFor("jam"),
|
||||||
Icons.flash_on,
|
Icons.flash_on,
|
||||||
const Color(0xFFFF9800),
|
const Color(0xFFFF9800),
|
||||||
duration: widget.laundry.formattedWaktuProsesFor("jam"),
|
|
||||||
),
|
),
|
||||||
if (widget.laundry.hargaHarian == 0 && widget.laundry.hargaJam == 0)
|
if (widget.laundry.hargaHarian == 0 && widget.laundry.hargaJam == 0)
|
||||||
_buildPriceCard(
|
_buildPriceCard(
|
||||||
|
|
@ -384,7 +382,6 @@ class _LaundryDetailScreenState extends State<LaundryDetailScreen> {
|
||||||
widget.laundry.formattedHargaKiloan,
|
widget.laundry.formattedHargaKiloan,
|
||||||
Icons.scale,
|
Icons.scale,
|
||||||
const Color(0xFF00897B),
|
const Color(0xFF00897B),
|
||||||
duration: widget.laundry.formattedWaktuProsesFor("harian"),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -814,9 +811,8 @@ class _LaundryDetailScreenState extends State<LaundryDetailScreen> {
|
||||||
String title,
|
String title,
|
||||||
String price,
|
String price,
|
||||||
IconData icon,
|
IconData icon,
|
||||||
Color color, {
|
Color color,
|
||||||
String? duration,
|
) {
|
||||||
}) {
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
@ -843,17 +839,6 @@ class _LaundryDetailScreenState extends State<LaundryDetailScreen> {
|
||||||
title,
|
title,
|
||||||
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
|
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
|
||||||
),
|
),
|
||||||
if (duration != null && duration.isNotEmpty) ...[
|
|
||||||
const SizedBox(height: 2),
|
|
||||||
Text(
|
|
||||||
'Estimasi selesai: $duration',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.grey[600],
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text(
|
Text(
|
||||||
price,
|
price,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import 'dart:io';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
|
||||||
import '../services/auth_service.dart';
|
import '../services/auth_service.dart';
|
||||||
import '../services/favorite_service.dart';
|
import '../services/favorite_service.dart';
|
||||||
import '../services/booking_service.dart';
|
import '../services/booking_service.dart';
|
||||||
|
|
@ -27,7 +25,6 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||||
bool _isLoading = true;
|
bool _isLoading = true;
|
||||||
int _totalFavorites = 0;
|
int _totalFavorites = 0;
|
||||||
int _totalBookings = 0;
|
int _totalBookings = 0;
|
||||||
File? _profileImage;
|
|
||||||
|
|
||||||
late AnimationController _animController;
|
late AnimationController _animController;
|
||||||
late Animation<double> _fadeAnim;
|
late Animation<double> _fadeAnim;
|
||||||
|
|
@ -114,115 +111,6 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||||
return '${months[date.month]} ${date.year}';
|
return '${months[date.month]} ${date.year}';
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _pickProfileImage() async {
|
|
||||||
final source = await showModalBottomSheet<ImageSource>(
|
|
||||||
context: context,
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
|
||||||
),
|
|
||||||
builder: (context) => SafeArea(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 40,
|
|
||||||
height: 4,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.grey.shade300,
|
|
||||||
borderRadius: BorderRadius.circular(2),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
const Text(
|
|
||||||
'Pilih Sumber Foto',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
color: Color(0xFF1A1A2E),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
ListTile(
|
|
||||||
leading: Container(
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFF1565C0).withValues(alpha: 0.1),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: const Icon(Icons.camera_alt_rounded,
|
|
||||||
color: Color(0xFF1565C0)),
|
|
||||||
),
|
|
||||||
title: const Text('Kamera',
|
|
||||||
style: TextStyle(fontWeight: FontWeight.w600)),
|
|
||||||
subtitle: const Text('Ambil foto baru'),
|
|
||||||
onTap: () => Navigator.pop(context, ImageSource.camera),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
leading: Container(
|
|
||||||
padding: const EdgeInsets.all(10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFF00897B).withValues(alpha: 0.1),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: const Icon(Icons.photo_library_rounded,
|
|
||||||
color: Color(0xFF00897B)),
|
|
||||||
),
|
|
||||||
title: const Text('Galeri',
|
|
||||||
style: TextStyle(fontWeight: FontWeight.w600)),
|
|
||||||
subtitle: const Text('Pilih dari galeri'),
|
|
||||||
onTap: () => Navigator.pop(context, ImageSource.gallery),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (source == null) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
final picker = ImagePicker();
|
|
||||||
final pickedFile = await picker.pickImage(
|
|
||||||
source: source,
|
|
||||||
maxWidth: 512,
|
|
||||||
maxHeight: 512,
|
|
||||||
imageQuality: 85,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pickedFile != null && mounted) {
|
|
||||||
setState(() {
|
|
||||||
_profileImage = File(pickedFile.path);
|
|
||||||
});
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: const Text('Foto profil berhasil diperbarui'),
|
|
||||||
backgroundColor: const Color(0xFF00897B),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (!mounted) return;
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text('Gagal memilih foto: $e'),
|
|
||||||
backgroundColor: Colors.red,
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|
@ -293,26 +181,6 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
_buildMenuItem(
|
|
||||||
icon: Icons.notifications_outlined,
|
|
||||||
iconColor: const Color(0xFFFF8F00),
|
|
||||||
iconBg: const Color(0xFFFF8F00),
|
|
||||||
title: 'Pengaturan Notifikasi',
|
|
||||||
subtitle: 'Atur preferensi notifikasi',
|
|
||||||
onTap: () {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: const Text('Fitur pengaturan notifikasi akan segera hadir'),
|
|
||||||
backgroundColor: const Color(0xFF1565C0),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
|
|
@ -374,46 +242,6 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||||
subtitle: 'Informasi & versi aplikasi',
|
subtitle: 'Informasi & versi aplikasi',
|
||||||
onTap: _showAboutDialog,
|
onTap: _showAboutDialog,
|
||||||
),
|
),
|
||||||
_buildMenuItem(
|
|
||||||
icon: Icons.help_outline_rounded,
|
|
||||||
iconColor: const Color(0xFF0288D1),
|
|
||||||
iconBg: const Color(0xFF0288D1),
|
|
||||||
title: 'Bantuan & FAQ',
|
|
||||||
subtitle: 'Pertanyaan umum & panduan',
|
|
||||||
onTap: () {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: const Text('Fitur bantuan & FAQ akan segera hadir'),
|
|
||||||
backgroundColor: const Color(0xFF1565C0),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
_buildMenuItem(
|
|
||||||
icon: Icons.privacy_tip_outlined,
|
|
||||||
iconColor: const Color(0xFF5E35B1),
|
|
||||||
iconBg: const Color(0xFF5E35B1),
|
|
||||||
title: 'Kebijakan Privasi',
|
|
||||||
subtitle: 'Syarat & ketentuan privasi',
|
|
||||||
onTap: () {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: const Text('Fitur kebijakan privasi akan segera hadir'),
|
|
||||||
backgroundColor: const Color(0xFF1565C0),
|
|
||||||
behavior: SnackBarBehavior.floating,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
|
|
@ -515,78 +343,42 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||||
// Avatar + Info
|
// Avatar + Info
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
// Avatar with shadow, gradient ring, and camera button
|
// Avatar with shadow and gradient ring
|
||||||
Stack(
|
Container(
|
||||||
children: [
|
decoration: BoxDecoration(
|
||||||
Container(
|
shape: BoxShape.circle,
|
||||||
decoration: BoxDecoration(
|
boxShadow: [
|
||||||
shape: BoxShape.circle,
|
BoxShadow(
|
||||||
boxShadow: [
|
color: Colors.black.withValues(alpha: 0.2),
|
||||||
BoxShadow(
|
blurRadius: 16,
|
||||||
color: Colors.black.withValues(alpha: 0.2),
|
offset: const Offset(0, 6),
|
||||||
blurRadius: 16,
|
|
||||||
offset: const Offset(0, 6),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
child: Container(
|
],
|
||||||
padding: const EdgeInsets.all(3),
|
),
|
||||||
decoration: const BoxDecoration(
|
child: Container(
|
||||||
shape: BoxShape.circle,
|
padding: const EdgeInsets.all(3),
|
||||||
gradient: LinearGradient(
|
decoration: const BoxDecoration(
|
||||||
colors: [Colors.white, Color(0xFFBBDEFB)],
|
shape: BoxShape.circle,
|
||||||
begin: Alignment.topLeft,
|
gradient: LinearGradient(
|
||||||
end: Alignment.bottomRight,
|
colors: [Colors.white, Color(0xFFBBDEFB)],
|
||||||
),
|
begin: Alignment.topLeft,
|
||||||
),
|
end: Alignment.bottomRight,
|
||||||
child: CircleAvatar(
|
),
|
||||||
radius: 40,
|
),
|
||||||
backgroundColor: const Color(0xFF0D47A1),
|
child: CircleAvatar(
|
||||||
backgroundImage: _profileImage != null
|
radius: 40,
|
||||||
? FileImage(_profileImage!)
|
backgroundColor: const Color(0xFF0D47A1),
|
||||||
: null,
|
child: Text(
|
||||||
child: _profileImage == null
|
_getInitials(_currentUser?.name ?? ''),
|
||||||
? Text(
|
style: const TextStyle(
|
||||||
_getInitials(_currentUser?.name ?? ''),
|
fontSize: 28,
|
||||||
style: const TextStyle(
|
fontWeight: FontWeight.w800,
|
||||||
fontSize: 28,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.w800,
|
letterSpacing: 1,
|
||||||
color: Colors.white,
|
|
||||||
letterSpacing: 1,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
),
|
||||||
bottom: 0,
|
|
||||||
right: 0,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: _pickProfileImage,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(6),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFF1565C0),
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
border: Border.all(color: Colors.white, width: 2),
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.black.withValues(alpha: 0.2),
|
|
||||||
blurRadius: 4,
|
|
||||||
offset: const Offset(0, 2),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: const Icon(
|
|
||||||
Icons.camera_alt_rounded,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 16,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 18),
|
const SizedBox(width: 18),
|
||||||
|
|
||||||
|
|
@ -905,26 +697,33 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||||
|
|
||||||
// ==================== LOGOUT ====================
|
// ==================== LOGOUT ====================
|
||||||
Widget _buildLogoutButton() {
|
Widget _buildLogoutButton() {
|
||||||
return SizedBox(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 54,
|
height: 54,
|
||||||
child: ElevatedButton.icon(
|
decoration: BoxDecoration(
|
||||||
onPressed: _handleLogout,
|
borderRadius: BorderRadius.circular(16),
|
||||||
icon: const Icon(Icons.logout_rounded, size: 20),
|
border: Border.all(color: Colors.red.shade200, width: 1.5),
|
||||||
label: const Text(
|
),
|
||||||
'Keluar dari Akun',
|
child: Material(
|
||||||
style: TextStyle(
|
color: Colors.red.shade50.withValues(alpha: 0.5),
|
||||||
fontSize: 15,
|
borderRadius: BorderRadius.circular(16),
|
||||||
fontWeight: FontWeight.w700,
|
child: InkWell(
|
||||||
),
|
onTap: _handleLogout,
|
||||||
),
|
borderRadius: BorderRadius.circular(16),
|
||||||
style: ElevatedButton.styleFrom(
|
child: Row(
|
||||||
backgroundColor: Colors.red,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
foregroundColor: Colors.white,
|
children: [
|
||||||
elevation: 2,
|
Icon(Icons.logout_rounded, color: Colors.red.shade600, size: 20),
|
||||||
shadowColor: Colors.red.withValues(alpha: 0.3),
|
const SizedBox(width: 10),
|
||||||
shape: RoundedRectangleBorder(
|
Text(
|
||||||
borderRadius: BorderRadius.circular(16),
|
'Keluar dari Akun',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: Colors.red.shade600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1060,7 +1060,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
laundry.estimasiSelesai,
|
'${laundry.waktuProses} jam',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: Colors.grey[600],
|
color: Colors.grey[600],
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,7 @@ class LaundryCard extends StatelessWidget {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => LaundryDetailScreen(
|
builder: (context) => LaundryDetailScreen(laundry: laundry),
|
||||||
laundry: laundry,
|
|
||||||
selectedJenisLayanan: selectedJenisLayanan,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
@ -239,7 +236,7 @@ class LaundryCard extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
laundry.formattedWaktuProsesFor(selectedJenisLayanan),
|
'${laundry.waktuProsesFor(selectedJenisLayanan)}h',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue