feat: Implement the onboarding flow with new screens, assets, and updated splash screen navigation logic.
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
@@ -33,11 +34,20 @@ class _SplashScreenState extends State<SplashScreen>
|
||||
|
||||
_controller.forward();
|
||||
|
||||
_navigationTimer = Timer(const Duration(seconds: 3), () {
|
||||
if (mounted) {
|
||||
context.go('/home');
|
||||
}
|
||||
});
|
||||
_navigationTimer = Timer(const Duration(seconds: 3), _navigate);
|
||||
}
|
||||
|
||||
Future<void> _navigate() async {
|
||||
if (!mounted) return;
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final onboardingCompleted = prefs.getBool('onboarding_completed') ?? false;
|
||||
|
||||
if (!mounted) return;
|
||||
if (onboardingCompleted) {
|
||||
context.go('/home');
|
||||
} else {
|
||||
context.go('/onboarding');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user