openModalView method

  1. @override
Future<void> openModalView([
  1. Widget? startWidget
])
override

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() ?? '';
  if (_isConnected) {
    final connectedKeys =
        _allowedScreensWhenConnected.map((e) => e.toString()).toList();
    if (startWidget == null) {
      startWidget = const AccountPage();
    } else {
      if (!connectedKeys.contains(keyString)) {
        startWidget = const AccountPage();
      }
    }
  } else {
    final disconnectedKeys =
        _allowedScreensWhenDisconnected.map((e) => e.toString()).toList();
    if (startWidget != null && !disconnectedKeys.contains(keyString)) {
      startWidget = null;
    }
  }
  return _showModalView(startWidget: startWidget);
}