I’m having trouble with my mobile web app made in Flutter for Telegram. The app keeps collapsing when I scroll down. It’s like the bottom sheet is closing on its own.
I fixed it for iOS by adding a script to stop the default touch behavior:
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, { passive: false });
But Android is still giving me headaches. I’ve tried everything I can think of:
- Messing with touchmove events
- Changing overflow settings
- Playing with relative positioning
- Other ways to turn off page scrolling
Nothing seems to work on Android. Any ideas on how to stop this collapsing issue when scrolling? It’s driving me crazy!
I’ve dealt with similar scrolling problems in Telegram Bot Web Apps. Have you considered using a SingleChildScrollView widget? It’s a simple yet effective solution that often resolves these issues.
Wrap your main content in a SingleChildScrollView and set the physics property to ClampingScrollPhysics(). This approach prevents the overscroll effect that might be causing the collapse.
Here’s a basic implementation:
SingleChildScrollView(
physics: ClampingScrollPhysics(),
child: YourMainContent(),
)
This method has worked well for me across both Android and iOS platforms. It’s worth a try if you haven’t explored this option yet. Let me know if it helps or if you need further assistance.
hey man, i feel ur pain. had similar probs w/ my bot. have u tried using a CustomScrollView? it lets u control scrolling better. wrap ur content in slivers and play with the physics. might solve ur android headache. worth a shot if nothin else worked
I’ve encountered a similar issue with Telegram Bot Web Apps on Android. One solution that worked for me was implementing a custom scroll behavior using GestureDetector. Instead of relying on the default scrolling, I wrapped my main content in a GestureDetector and manually handled the scroll events. This approach gave me more control over the scrolling behavior and prevented the collapse you’re experiencing.
Here’s a basic example of how I structured it:
GestureDetector(
onVerticalDragUpdate: (details) {
// Custom scroll logic here
},
child: Container(
// Your main content here
),
)
You might need to fine-tune the drag sensitivity and implement proper bounds checking, but this method effectively solved the collapsing issue for me on Android devices. Have you tried this approach or something similar? It might be worth giving it a shot if you haven’t already.