fix: clean up splash screen - remove debug subnet text, fix font, add version label, reorder loading UI

This commit is contained in:
micko samawa 2026-06-29 13:58:49 +07:00
parent b0046d7dff
commit 4a5a2d0501
1 changed files with 109 additions and 74 deletions

View File

@ -264,7 +264,6 @@ 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() {
@ -291,12 +290,9 @@ class _SplashScreenState extends State<SplashScreen>
} }
Future<void> _checkAuth() async { Future<void> _checkAuth() async {
// 🔍 Auto-detect server IP dengan fallback ke konfigurasi default. // Auto-detect server IP (status callback ditelan, user hanya lihat "Sedang memuat...")
// Ini membantu APK tetap bisa konek saat IP LAN berubah.
await ServerDiscoveryService.discover( await ServerDiscoveryService.discover(
onStatus: (status) { onStatus: (_) {}, // Tidak tampilkan info teknis ke user
if (mounted) setState(() => _statusText = status);
},
).timeout( ).timeout(
const Duration(seconds: 8), const Duration(seconds: 8),
onTimeout: () { onTimeout: () {
@ -305,7 +301,6 @@ 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));
@ -335,12 +330,15 @@ class _SplashScreenState extends State<SplashScreen>
body: Container( body: Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topLeft, begin: Alignment.topCenter,
end: Alignment.bottomRight, end: Alignment.bottomCenter,
colors: [Color(0xFF1565C0), Color(0xFF0D47A1), Color(0xFF1A237E)], colors: [Color(0xFF1565C0), Color(0xFF1E88E5)],
), ),
), ),
child: Center( child: Stack(
children: [
// ==================== KONTEN UTAMA (TENGAH) ====================
Center(
child: FadeTransition( child: FadeTransition(
opacity: _fadeAnim, opacity: _fadeAnim,
child: ScaleTransition( child: ScaleTransition(
@ -348,69 +346,106 @@ class _SplashScreenState extends State<SplashScreen>
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
// Logo toga di dalam CircleAvatar putih
Container( Container(
padding: const EdgeInsets.all(28),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle, shape: BoxShape.circle,
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withOpacity(0.15), color: Colors.black.withValues(alpha: 0.15),
blurRadius: 30, blurRadius: 30,
offset: const Offset(0, 10), offset: const Offset(0, 10),
), ),
], ],
), ),
child: const Icon( child: const CircleAvatar(
Icons.school_rounded, radius: 50,
size: 64, backgroundColor: Colors.white,
child: Icon(
Icons.school,
size: 56,
color: Color(0xFF1565C0), color: Color(0xFF1565C0),
), ),
), ),
),
const SizedBox(height: 32), const SizedBox(height: 32),
// Nama aplikasi bold, non-italic, 28sp, putih
const Text( const Text(
'Kontrak Kampus', 'Kontrak Kampus',
style: TextStyle( style: TextStyle(
fontSize: 30, fontSize: 28,
fontWeight: FontWeight.w800, fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
color: Colors.white, color: Colors.white,
letterSpacing: 0.5, letterSpacing: 0.5,
), ),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
// Tagline kecil, putih transparan
Text( Text(
'Rekomendasi Kontrakan & Laundry untuk Mahasiswa', 'Rekomendasi Kontrakan & Laundry untuk Mahasiswa',
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: Colors.white.withOpacity(0.8), color: Colors.white.withValues(alpha: 0.8),
letterSpacing: 0.3, letterSpacing: 0.3,
), ),
), ),
const SizedBox(height: 48), 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( SizedBox(
width: 32, width: 32,
height: 32, height: 32,
child: CircularProgressIndicator( child: CircularProgressIndicator(
strokeWidth: 2.5, strokeWidth: 2.5,
valueColor: AlwaysStoppedAnimation<Color>( valueColor: AlwaysStoppedAnimation<Color>(
Colors.white.withOpacity(0.9), Colors.white.withValues(alpha: 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,
),
),
),
),
],
),
), ),
); );
} }
} }