|
|
@ -1,8 +1,8 @@ |
|
|
import 'package:bloc/bloc.dart'; |
|
|
import 'package:bloc/bloc.dart'; |
|
|
import 'package:flutter/cupertino.dart'; |
|
|
import 'package:flutter/cupertino.dart'; |
|
|
import 'package:go_router/go_router.dart'; |
|
|
import 'package:go_router/go_router.dart'; |
|
|
import 'package:hadi_hoda_flutter/common_ui/resources/my_assets.dart'; |
|
|
|
|
|
import 'package:hadi_hoda_flutter/core/routers/my_routes.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/routers/my_routes.dart'; |
|
|
|
|
|
import 'package:hadi_hoda_flutter/core/utils/pre_cache_image.dart'; |
|
|
import 'package:hadi_hoda_flutter/features/splash/presentation/bloc/splash_event.dart'; |
|
|
import 'package:hadi_hoda_flutter/features/splash/presentation/bloc/splash_event.dart'; |
|
|
import 'package:hadi_hoda_flutter/features/splash/presentation/bloc/splash_state.dart'; |
|
|
import 'package:hadi_hoda_flutter/features/splash/presentation/bloc/splash_state.dart'; |
|
|
|
|
|
|
|
|
@ -17,19 +17,9 @@ class SplashBloc extends Bloc<SplashEvent, SplashState> { |
|
|
/// ------------Controllers------------ |
|
|
/// ------------Controllers------------ |
|
|
|
|
|
|
|
|
/// ------------Functions------------ |
|
|
/// ------------Functions------------ |
|
|
Future<void> _precacheAllImages(BuildContext context) async { |
|
|
|
|
|
await Future.wait( |
|
|
|
|
|
MyAssets.images.map( |
|
|
|
|
|
(assetPath) => precacheImage(AssetImage(assetPath), context), |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Future<void> goToHomePage(BuildContext context) async { |
|
|
Future<void> goToHomePage(BuildContext context) async { |
|
|
if (context.mounted) { |
|
|
|
|
|
await _precacheAllImages(context); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await preCacheImages(); |
|
|
await Future.delayed( |
|
|
await Future.delayed( |
|
|
Duration(seconds: 2), |
|
|
Duration(seconds: 2), |
|
|
() { |
|
|
() { |
|
|
|