Skip to content

Commit

Permalink
Merge pull request #239 from hypha-dao/bugfix/loading_animation_layou…
Browse files Browse the repository at this point in the history
…t_fix

Bugfix/loading animation layout fix
  • Loading branch information
n13 authored Aug 23, 2023
2 parents f273096 + caf8b25 commit d2ca343
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
32 changes: 20 additions & 12 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get/get.dart';
import 'package:get/get.dart' as Get;
import 'package:get_it/get_it.dart';
import 'package:hypha_wallet/core/crypto/seeds_esr/scan_qr_code_result_data.dart';
import 'package:hypha_wallet/core/error_handler/model/hypha_error.dart';
Expand Down Expand Up @@ -67,10 +67,18 @@ class HyphaAppView extends StatelessWidget {
LogHelper.d('Auth Bloc Listener unknown');
break;
case Authenticated _:
Get.offAll(() => const SplashPage());
Get.Get.offAll(
() => const SplashPage(),
duration: const Duration(milliseconds: 500),
transition: Get.Transition.fadeIn,
);
break;
case UnAuthenticated _:
Get.offAll(() => const SplashPage());
Get.Get.offAll(
() => const SplashPage(),
duration: const Duration(milliseconds: 500),
transition: Get.Transition.fadeIn,
);
break;
}
},
Expand All @@ -79,7 +87,7 @@ class HyphaAppView extends StatelessWidget {
listenWhen: (previous, current) => previous.command != current.command,
listener: (context, state) {
state.command?.when(
navigateToCreateAccount: () => Get.offAll(() => const OnboardingPageWithLink()),
navigateToCreateAccount: () => Get.Get.offAll(() => const OnboardingPageWithLink()),
navigateToSignTransaction: (ScanQrCodeResultData data) {
_showSignTransactionBottomSheet(data);
});
Expand Down Expand Up @@ -109,7 +117,7 @@ class HyphaAppView extends StatelessWidget {
words,
privateKey,
) async {
unawaited(Get.bottomSheet(
unawaited(Get.Get.bottomSheet(
FractionallySizedBox(
heightFactor: 0.95,
child: HyphaConfirmationPage(
Expand All @@ -118,13 +126,13 @@ class HyphaAppView extends StatelessWidget {
image: image,
rationale: rationale,
primaryButtonCallback: () {
Get.off(state.hasWords ? SaveWordsPage(words) : SaveKeyPage(privateKey));
Get.Get.off(state.hasWords ? SaveWordsPage(words) : SaveKeyPage(privateKey));
context.read<SettingsBloc>().add(const SettingsEvent.onSecureAccountTapped());
},
primaryButtonText: mainButtonText,
secondaryButtonText: 'Close',
secondaryButtonCallback: () {
Get.back();
Get.Get.back();
},
),
),
Expand All @@ -150,7 +158,7 @@ class HyphaAppView extends StatelessWidget {
/// NOTHING FOR NOW
},
showReLoginDialog: () {
Get.defaultDialog(
Get.Get.defaultDialog(
title: 'Something went wrong.',
middleText: 'Please authenticate again.',
cancel: const Text('Login'),
Expand All @@ -165,14 +173,14 @@ class HyphaAppView extends StatelessWidget {
// TODO(gguij): handle connection error
},
showErrorDialog: (HyphaError hyphaError) {
Get.defaultDialog(
Get.Get.defaultDialog(
title: hyphaError.message,
cancel: hyphaError.actionText?.let((it) => Text(it)),
onCancel: hyphaError.action?.call(),
);
},
showErrorMessage: (message) {
Get.showSnackbar(GetSnackBar(message: message, duration: const Duration(seconds: 3)));
Get.Get.showSnackbar(Get.GetSnackBar(message: message, duration: const Duration(seconds: 3)));
},
);

Expand All @@ -183,7 +191,7 @@ class HyphaAppView extends StatelessWidget {
child: BlocBuilder<SettingsBloc, SettingsState>(
buildWhen: (previous, current) => previous.themeMode != current.themeMode,
builder: (context, state) {
return GetMaterialApp(
return Get.GetMaterialApp(
title: 'Hypha Wallet',
darkTheme: HyphaTheme.darkTheme,
theme: HyphaTheme.lightTheme,
Expand All @@ -197,7 +205,7 @@ class HyphaAppView extends StatelessWidget {
}

void _showSignTransactionBottomSheet(ScanQrCodeResultData data) {
Get.bottomSheet(
Get.Get.bottomSheet(
FractionallySizedBox(
heightFactor: UIConstants.bottomSheetHeightFraction,
child: SignTransactionPage(qrCodeData: data),
Expand Down
1 change: 1 addition & 0 deletions lib/design/background/hypha_page_background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class HyphaPageBackground extends StatelessWidget {

return DecoratedBox(
decoration: BoxDecoration(
color: const Color.fromRGBO(5, 15, 33, 1.0),
gradient: withGradient
? context.isDarkTheme
? HyphaColors.gradientBlack
Expand Down
12 changes: 10 additions & 2 deletions lib/ui/splash/splash_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,19 @@ 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(),
transition: Transition.downToUp,
duration: const Duration(milliseconds: 500),
);
}
} else {
if (Get.currentRoute != '/OnboardingPage') {
Get.offAll(() => const OnboardingPage());
Get.offAll(
() => const OnboardingPage(),
transition: Transition.downToUp,
duration: const Duration(milliseconds: 500),
);
}
}
});
Expand Down

0 comments on commit d2ca343

Please sign in to comment.