bot_toast
bot_toast copied to clipboard
Margin of The showNotification is Blocking Clickable Widget Under It
Describe the bug The Clickable Widget can't be clicked because of the margin of the Notification/Snackbar. This issue similar like in this flutter snackbar issue
Reproduction code
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Scaffold demo',
home: MyHomePage(),
debugShowCheckedModeBanner: false,
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Test'),
centerTitle: true,
backgroundColor: Colors.lightBlueAccent,
actions: [
IconButton(
icon: const Icon(Icons.info),
tooltip: 'Show Snackbar',
onPressed: () {
BotToast.showNotification(
onlyOne: true,
crossPage: true,
enableKeyboardSafeArea: true,
dismissDirections: [
DismissDirection.up,
DismissDirection.horizontal,
],
duration: Duration(seconds: 6),
backgroundColor: Colors.tealAccent,
borderRadius: 8.0,
margin: EdgeInsets.fromLTRB(
50,
MediaQuery.of(context).size.height * 0.75,
50,
MediaQuery.of(context).size.height * 0.15,
),
title: (_) => Text('Try to tap button behind me'),
subtitle: (_) => const Text("The clickable widget behind the margin cant be tapped"),
);
},
),
],
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
icon: const Icon(Icons.notifications),
tooltip: 'Press me when notif appear',
onPressed: () {
print('this clickable?');
},
),
ElevatedButton(
child: Text('Open Snackbar'),
onPressed: () {
BotToast.showNotification(
onlyOne: true,
crossPage: true,
enableKeyboardSafeArea: true,
dismissDirections: [
DismissDirection.up,
DismissDirection.horizontal,
],
duration: Duration(seconds: 6),
backgroundColor: Colors.tealAccent,
borderRadius: 8.0,
margin: EdgeInsets.fromLTRB(
50,
MediaQuery.of(context).size.height * 0.75,
50,
MediaQuery.of(context).size.height * 0.15,
),
title: (_) => Text('Try to tap button behind me'),
subtitle: (_) => const Text(
"The clickable widget behind the margin cant be tapped"),
);
},
),
],
),
);
}
}
To Reproduce Steps to reproduce the behavior:
- Click the button Open Snackbar
- When notification / snackbar appear, try to click button "Open Snackbar" again or any clickable widget behind the margin area. The clickable widget can't be pressed.
Expected behavior The margin of notification / snackbar should not blocking the clickable widget
Screenshots You can check similiar screenshot/screen record in snackbar flutter issue
Flutter Version: 3.16.8
BotToast Version: 4.1.3
You can temporarily use the showCustomNotification method instead of the showNotification method, and avoid using the ListTile widget, as currently using ListTile will lead to this issue.
Using showCustomNotification
will give the same behavior, adding a margin or padding will still block the Clickable widget under it. But I didn't try with ListTile
since I have a custom widget already.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.