mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
WIP: desktop loading order
This commit is contained in:
parent
8b7e222d41
commit
2082e87553
1 changed files with 50 additions and 43 deletions
|
@ -60,6 +60,7 @@ import 'package:stackwallet/utilities/theme/dark_colors.dart';
|
||||||
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:window_size/window_size.dart';
|
import 'package:window_size/window_size.dart';
|
||||||
|
|
||||||
final openedFromSWBFileStringStateProvider =
|
final openedFromSWBFileStringStateProvider =
|
||||||
|
@ -568,50 +569,56 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
_buildOutlineInputBorder(colorScheme.textFieldDefaultBG),
|
_buildOutlineInputBorder(colorScheme.textFieldDefaultBG),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
home: FutureBuilder(
|
home: ConditionalParent(
|
||||||
future: load(),
|
condition: Util.isDesktop,
|
||||||
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
|
builder: (child) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
return child;
|
||||||
// FlutterNativeSplash.remove();
|
|
||||||
if (Util.isDesktop &&
|
|
||||||
(_wallets.hasWallets || _desktopHasPassword)) {
|
|
||||||
String? startupWalletId;
|
|
||||||
if (ref.read(prefsChangeNotifierProvider).gotoWalletOnStartup) {
|
|
||||||
startupWalletId =
|
|
||||||
ref.read(prefsChangeNotifierProvider).startupWalletId;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DesktopLoginView(startupWalletId: startupWalletId);
|
|
||||||
} else if (!Util.isDesktop &&
|
|
||||||
(_wallets.hasWallets || _prefs.hasPin)) {
|
|
||||||
// return HomeView();
|
|
||||||
|
|
||||||
String? startupWalletId;
|
|
||||||
if (ref.read(prefsChangeNotifierProvider).gotoWalletOnStartup) {
|
|
||||||
startupWalletId =
|
|
||||||
ref.read(prefsChangeNotifierProvider).startupWalletId;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LockscreenView(
|
|
||||||
isInitialAppLogin: true,
|
|
||||||
routeOnSuccess: HomeView.routeName,
|
|
||||||
routeOnSuccessArguments: startupWalletId,
|
|
||||||
biometricsAuthenticationTitle: "Unlock Stack",
|
|
||||||
biometricsLocalizedReason:
|
|
||||||
"Unlock your stack wallet using biometrics",
|
|
||||||
biometricsCancelButtonString: "Cancel",
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return const IntroView();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// CURRENTLY DISABLED as cannot be animated
|
|
||||||
// technically not needed as FlutterNativeSplash will overlay
|
|
||||||
// anything returned here until the future completes but
|
|
||||||
// FutureBuilder requires you to return something
|
|
||||||
return const LoadingView();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: load(),
|
||||||
|
builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
// FlutterNativeSplash.remove();
|
||||||
|
if (Util.isDesktop &&
|
||||||
|
(_wallets.hasWallets || _desktopHasPassword)) {
|
||||||
|
String? startupWalletId;
|
||||||
|
if (ref.read(prefsChangeNotifierProvider).gotoWalletOnStartup) {
|
||||||
|
startupWalletId =
|
||||||
|
ref.read(prefsChangeNotifierProvider).startupWalletId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DesktopLoginView(startupWalletId: startupWalletId);
|
||||||
|
} else if (!Util.isDesktop &&
|
||||||
|
(_wallets.hasWallets || _prefs.hasPin)) {
|
||||||
|
// return HomeView();
|
||||||
|
|
||||||
|
String? startupWalletId;
|
||||||
|
if (ref.read(prefsChangeNotifierProvider).gotoWalletOnStartup) {
|
||||||
|
startupWalletId =
|
||||||
|
ref.read(prefsChangeNotifierProvider).startupWalletId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LockscreenView(
|
||||||
|
isInitialAppLogin: true,
|
||||||
|
routeOnSuccess: HomeView.routeName,
|
||||||
|
routeOnSuccessArguments: startupWalletId,
|
||||||
|
biometricsAuthenticationTitle: "Unlock Stack",
|
||||||
|
biometricsLocalizedReason:
|
||||||
|
"Unlock your stack wallet using biometrics",
|
||||||
|
biometricsCancelButtonString: "Cancel",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const IntroView();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// CURRENTLY DISABLED as cannot be animated
|
||||||
|
// technically not needed as FlutterNativeSplash will overlay
|
||||||
|
// anything returned here until the future completes but
|
||||||
|
// FutureBuilder requires you to return something
|
||||||
|
return const LoadingView();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue