feat: consolidate backend and docker-compose setup

This commit is contained in:
Rafhan Mazaya Fathurrahman committed 2026-06-30 21:09:08 +07:00
commit ff3753a745
306 files changed
+35450

No files matched your search

+87
View File
@@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../../config/app_config.dart';
import '../auth/auth_provider.dart';
class SplashScreen extends ConsumerStatefulWidget {
const SplashScreen({super.key});
@override
ConsumerState<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _fadeAnimation;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 2),
);
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(_controller);
_controller.forward().then((_) {
_checkAuthAndNavigate();
});
}
Future<void> _checkAuthAndNavigate() async {
// Wait an additional second for effect
await Future.delayed(const Duration(seconds: 1));
if (!mounted) return;
final isLoggedIn = await ref.read(authProvider.notifier).checkLoginState();
if (isLoggedIn) {
context.go('/camera');
} else {
context.go('/login');
}
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white, // Changed to white to seamlessly blend with the logo
body: Center(
child: FadeTransition(
opacity: _fadeAnimation,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/logo.png',
width: 150,
height: 150,
errorBuilder: (context, error, stackTrace) => const Icon(
Icons.storefront,
size: 100,
color: AppConfig.primaryColor // Changed fallback icon color
),
),
const SizedBox(height: 24),
Text(
AppConfig.appName,
style: AppConfig.h1.copyWith(color: AppConfig.primaryColor), // Red text
),
const SizedBox(height: 8),
Text(
'PT. Primafood International',
style: AppConfig.bodyMedium.copyWith(color: AppConfig.textSecondary), // Grey text
),
],
),
),
),
);
}
}