openModalView method
Opens the modal with the provided startWidget
(if any).
If none is provided, the default state will be used based on platform.
Implementation
@override
Future<void> openModalView([Widget? startWidget]) {
final keyString = startWidget?.key?.toString() ?? '';
final smartAccounts = _currentSession?.sessionSmartAccounts;
final isMagic = _currentSession?.sessionService.isMagic == true;
final embeddedWallet = isMagic || (smartAccounts ?? []).isNotEmpty;
if (_isConnected) {
final connectedKeys = _allowedScreensWhenConnected
.map((e) => e.toString())
.toList();
if (startWidget == null) {
startWidget = embeddedWallet
? const WalletFeaturesPage()
: const AccountPage();
} else {
if (!connectedKeys.contains(keyString)) {
startWidget = embeddedWallet
? const WalletFeaturesPage()
: const AccountPage();
}
}
} else {
final disconnectedKeys = _allowedScreensWhenDisconnected
.map((e) => e.toString())
.toList();
if (startWidget != null && !disconnectedKeys.contains(keyString)) {
startWidget = null;
}
}
return _showModalView(startWidget: startWidget);
}