open method
Opens the modal with the provided startState
.
If none is provided, the default state will be used based on platform.
Implementation
@override
Future<void> open({
required BuildContext context,
Widget? startWidget,
}) async {
_checkInitialized();
if (_isOpen) {
return;
}
_isOpen = true;
rebuildConnectionUri();
// Reset the explorer
explorerService.instance!.filterList(
query: '',
);
widgetStack.instance.clear();
this.context = context;
final bool bottomSheet = platformUtils.instance.isBottomSheet();
notifyListeners();
final WalletConnectModalTheme? theme =
WalletConnectModalTheme.maybeOf(context);
final Widget w = theme == null
? WalletConnectModalTheme(
data: WalletConnectModalThemeData.lightMode,
child: WalletConnectModal(
startWidget: startWidget,
),
)
: WalletConnectModal(
startWidget: startWidget,
);
final Widget root = WalletConnectModalProvider(
service: this,
child: w,
);
if (bottomSheet) {
await showModalBottomSheet(
// enableDrag: false,
backgroundColor: Colors.transparent,
isDismissible: false,
isScrollControlled: true,
enableDrag: false,
constraints: BoxConstraints(
minWidth: MediaQuery.of(context).size.width,
),
useSafeArea: true,
context: context,
builder: (context) {
return root;
},
);
} else {
await showDialog(
context: context,
builder: (context) {
return root;
},
);
}
_isOpen = false;
notifyListeners();
}