Comments (9)
https://stackoverflow.com/questions/49356664/how-to-override-the-back-button-in-flutter
from overlay_support.
the cost to implement back pressed for notification is too expensive, it need override Navigator
widget. so after consideration, I decided not to implement this feature.
from overlay_support.
are you sure we can implementing that with your introduced link?
overlay_support is not dialog
from overlay_support.
showOverlay((context, t) {
// ignore: missing_return
return Container(
color: Color.lerp(Colors.transparent, Colors.black54, t),
child: FractionalTranslation(
translation: Offset.lerp(const Offset(0, -1), const Offset(0, 0), t),
child: Column(
children: <Widget>[
DirectMessageNotification(
message: "xxxxxxxxxxx",
onReplay: () {
OverlaySupportEntry.of(context).dismiss();
},
key: ModalKey(const Object()),
),
],
),
),
);
}, duration: Duration.zero);
class DirectMessageNotification extends StatelessWidget {
final VoidCallback onReplay;
final String message;
final bool enableBottomLayer;
final bool enableHeaderLayer;
const DirectMessageNotification({Key key, this.onReplay, @required this.message, this.enableBottomLayer, this.enableHeaderLayer}) : super(key: key);
@override
Widget build(BuildContext context) {
double notificationHeight = MediaQuery.of(context).size.height * 0.500;
return SafeArea(
child: WillPopScope(
// ignore: missing_return
onWillPop: () {
if (onReplay != null) onReplay();
},
child: ,
),
);
}
}
from overlay_support.
onWillPop function need a return value to determine whether intercept back event.
from overlay_support.
@boyan01 i'm not sure to understand me, could you help me by code to know how can i do that? thanks
from overlay_support.
sorry for late, it seems that OverlaySupport
do not support this feature yet. because showOverlay is popup a OverlayEntry
on screen, and this OverlayEntry
do not belong to any Route
, so WillPopScope
is useless.
from overlay_support.
also, I have no ideas how to intercept BackEvent
on a Widget
that not belong to any Route
.
so if you want implement dismiss notification when back pressed, a Route
is necessary.
from overlay_support.
i think this library can help you to implementing that:
https://github.com/hey24sheep/backdrop_modal_route
from overlay_support.
Related Issues (20)
- add MaterialBanner api
- Overlay Support Plugin not working in InitState Method HOT 3
- how to Mention the key & how to dismiss the notification using key? HOT 1
- OverlaySupport.local is not used on showSimpleNotification HOT 2
- Add valid copyright information HOT 1
- WidgetsBinding.instance now is not nullable HOT 9
- showSimpleNotification is not showing in a modal HOT 2
- missleading error message
- Flutter 3 Support HOT 2
- error: The class 'WidgetsBinding' cannot be null HOT 3
- Dismissed or closed notification HOT 1
- Overlay is coming on top of Appbar HOT 2
- Switch to specific route when click on the Element HOT 2
- Make overlays and toasts clickthrough HOT 4
- Popups/Calendar is not coming over the overlay HOT 11
- How to open notifications from background tasks? OverlaySupport Not Initialized HOT 1
- Dismiss direction for showOverlayNotification HOT 1
- Add docs on OverlaySupport.local. HOT 3
- showOverlayNotification, builder is called multiple times HOT 1
- showOverlay seems doesn't care of a key and shows messages many times
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from overlay_support.