Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix splash screen issue #235

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ class HyphaAppView extends StatelessWidget {
LogHelper.d('Auth Bloc Listener unknown');
break;
case Authenticated _:
Get.offAll(() => const HyphaBottomNavigation());
Get.offAll(() => const SplashPage());
break;
case UnAuthenticated _:
Get.offAll(() => const OnboardingPage());
Get.offAll(() => const SplashPage());
break;
}
},
Expand Down
9 changes: 6 additions & 3 deletions lib/ui/splash/splash_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_it/get_it.dart';
import 'package:hypha_wallet/core/network/repository/auth_repository.dart';
import 'package:hypha_wallet/design/hypha_colors.dart';
import 'package:hypha_wallet/ui/bottom_navigation/hypha_bottom_navigation.dart';
import 'package:hypha_wallet/ui/onboarding/onboarding_page.dart';
import 'package:lottie/lottie.dart';
Expand All @@ -26,7 +27,7 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin {

@override
void dispose() {
_controller.dispose(); // you need this
_controller.dispose();
super.dispose();
}

Expand All @@ -35,9 +36,11 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin {
return Scaffold(
extendBodyBehindAppBar: true,
body: Lottie.asset(
fit: BoxFit.fill,
'assets/animations/hypha_splash.json',
controller: _controller,
height: MediaQuery.of(context).size.height * 1,
width: MediaQuery.of(context).size.width * 1,
animate: true,
onLoaded: (composition) {
_controller
Expand All @@ -46,11 +49,11 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin {
final userAuthData = GetIt.I.get<AuthRepository>().currentAuthStatus;
if (userAuthData is Authenticated) {
if (Get.currentRoute != '/HyphaBottomNavigation') {
Get.offAll(const HyphaBottomNavigation());
Get.offAll(() => const HyphaBottomNavigation());
}
} else {
if (Get.currentRoute != '/OnboardingPage') {
Get.offAll(const OnboardingPage());
Get.offAll(() => const OnboardingPage());
}
}
});
Expand Down
Loading