56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rijig_mobile/core/guide.dart';
|
|
import 'package:rijig_mobile/core/router.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
class SplashScreen extends StatelessWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
_checkLoginStatus(context);
|
|
|
|
return Scaffold(
|
|
backgroundColor: whiteColor,
|
|
body: Stack(
|
|
children: [
|
|
Positioned(
|
|
bottom: 0,
|
|
left: 0,
|
|
right: 0,
|
|
child: Image.asset('assets/image/Go_Ride.png', height: 200),
|
|
),
|
|
Align(
|
|
alignment: Alignment.center,
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(bottom: 250.0),
|
|
child: Text(
|
|
'Rijig',
|
|
style: TextStyle(
|
|
fontSize: 36,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.blue,
|
|
fontFamily: 'Roboto',
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Future<void> _checkLoginStatus(BuildContext context) async {
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
bool isLoggedIn = prefs.getBool('isLoggedIn') ?? false;
|
|
|
|
await Future.delayed(Duration(seconds: 3));
|
|
|
|
if (isLoggedIn) {
|
|
router.go('/navigasi');
|
|
} else {
|
|
router.go('/onboarding');
|
|
}
|
|
}
|
|
}
|