How to disable or ignore background screen's touch events after loading an overlay? - flame

In flutter flame, after tapping on pause button on score overlay at the top, I pause the game engine, and display a little pause overlay window at the center of the screen, but score overlay which is visible in the background still is tappable. I want to disable all the touch events behind pause overlay window. I couldn't find a workaround using AbsorbPointer and IgnorePointer Widgets.
Disable underlying tap events behind active overlay?
or
Dismissing the overlay window by tapping outside of it?

There is some talk about this situation here.
What you could do is add a GestureDetector that covers the full screen in your overlay, something like this:
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
...
},
child: <<Your current overlay>>,
);

Related

Flutter Detect whether there is content behind AppBar whilst scrolling

Is there an easy way to detect when there is content behind a fixed container that is floating on top of a ScrollView.
In native iOS apps, the background of the TabBar and NavigationBar are only visible when there is actually content behind them. So the NavigationBar will fade in it's background as the user scrolls down.
Whilst this can be calculated to provide the scroll position of when to add opacity to the NavigationBar Background, it is much more complicated with any form of bottom bar as it would have to know the total length of the scroll window as well as calculate the bounce scroll offset at the top.
As much as all this can be calculated in theory, is there an easy way. A way of detecting when there is content behind another element.
You will need to pass a ScrollController to your scroll view and then listen to the scroll value and change the state of the appbar.
Example:
scrollController.addListener(() {
//Check offset value
if(scrollController.offset > 10) {
//Change transparency here
setState(() {
...
});
}
});
Adapting this to your use case it should work

Click gesturedetector and a covered pop-up window will appear. How can the gesture be transmitted to the pop-up window without raising the gesture?

In the OnTap of gesturedetector, use showmodal bottomsheet to pop up a window. At the same position of the button, there is a weight of gesturedetector. How can the gesturedetector in this pop-up window get the click event when the previous gesturedetector is not lifted

How to show emoji on button click that animates then disappears in flutter

So I'm developing this game called Tap Tap, and what is required is that when I click a button a like emoji should appear, animate to top then disappear, kinda like when like button is clicked in instagram, a heart appears.
How can I achieve something like this in flutter, I don't want anything fancy, just the emoji to show for like a second, animate then disappear.
you could try to animate the opacity and offset.
Wrap the emoji with an AnimatedOpacity widget and wrap that with a TransformWidget.

Slide view while touching button - IOS

I'm trying to implement a view that includes social buttons.In normal state, it will be partially hide and only the "Opciones" button and the upper line is shown. This view will be shown when user touches button "Opciones" (touch gesture), then it will unhide and be shown using sliding effect until the final position that is included in the attached image.
I'm wondering which kind of control and animation I have to use.
Many thanks.

custom slide to reveal toolbar

i want to do a custom toolbar, something like the slide to unlock of android phones. In idle state, the user can see a button of the bottom left of the page. the user would then tap it, drag towards the right. When the user reaches the right end, the toolbar will then 'lock'. Buttons would be located at the toolbar.
I'm think of using a customview and touchmoved functions, but what I don't know how is how to make the view move with the touch, and how to actually lock the bar.
Everytime you move your finger the touchmoved function is called. In the touchmoved function you have to redraw the whole view or just set a new frame for this view. It pretty simple as you already know how to detect touches and react on them.