In Flutter using package web3modal_flutter, I am opening the bottom sheet for wallet selection. When closing the bottom sheet the package pops the route where I am currently on instead of closing the bottom sheet.
@RoutePage()
class CreateWalletQuickFundPage extends StatelessWidget {
const CreateWalletQuickFundPage({super.key});
@override
Widget build(BuildContext context) {
final userBloc = context.read<UserBloc>();
return PageWrapper(
cubit: ConnectWalletCubit(context.read<UserBloc>()),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 32),
child: Column(
children: [
const SizedBox(height: 32),
BlocBuilder<UserBloc, UserState>(
builder: (context, state) {
return WalletQrCode(wallet: state.selectedWallet!);
},
),
const SizedBox(height: 32),
Text(
context.l10n.welcomeToYourNewWallet,
style: context.typography.heading2,
textAlign: TextAlign.center,
),
const SizedBox(height: 14),
ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 290),
child: Text(
context.l10n.thisIsYourPersonalBankVaultForTokens,
style: context.typography.text14,
textAlign: TextAlign.center,
),
),
const SizedBox(height: 50),
BlocBuilder<ConnectWalletCubit, ConnectWalletState>(
builder: (context, state) {
final connectWalletCubit = context.read<ConnectWalletCubit>();
return Button(
onTap: () async {
await connectWalletCubit.w3mService.openModal(context);
},
text: context.l10n.fundYourWallet,
activeColor: context.colors.moonGreen,
);
},
),
],
),
),
);
}
}
bottom sheet with route closed
When I call the same function for opening the bottom sheet on a dialog, it works as it should. But I don't see and difference.
When pressing the "X" button on the bottoms sheet the package calls the Navigator.pop(context) with the context provided in await connectWalletCubit.w3mService.openModal(context); My guess is it is something wrong with the context provided, but am not sure since everything in code seems right.
If i create my own bottom sheet like this which is using the same context it also work like it should, so I don't get it
showBottomSheet(
context: context,
builder: (context) =>
const SelectNetworkBottomSheet(),
);