-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App freeze on transition in iOS when Get.snackbar is open and swipe right gesture executed #773
Comments
I can confirm this issue. I have it too for all my iOS devices. 😊 |
Yes I have it too ... |
Please, can you check the Flutter's snackbar also have the same problem? |
Try this: void main() {
runApp(GetMaterialApp(
home: Home(),
popGesture: true,
defaultTransition: Transition.cupertino,
));
} |
@eduardoflorence Thanks for your reply! I tried your solution, but the freeze still exists. |
@jonataslaw, I put an example below that is easier to reproduce. If you comment on the import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(
initialRoute: '/home',
defaultTransition: Transition.cupertino,
popGesture: true,
getPages: [
GetPage(name: '/home', page: () => Home()),
GetPage(name: '/my_new_page', page: () => MyNewPage()),
],
));
}
class Home extends StatelessWidget {
@override
Widget build(context) {
return Scaffold(
appBar: AppBar(title: Text("Start page")),
body: Center(
child: RaisedButton(
child: Text("Click button to go to next page"),
onPressed: () => Get.toNamed('/my_new_page'),
),
),
);
}
}
class MyNewPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('New Page'),
),
body: SnackBarPage(),
);
}
}
class SnackBarPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: ElevatedButton(
onPressed: () {
final snackBar = SnackBar(
content: Text('Yay! A SnackBar!'),
);
// Not freeze
// Scaffold.of(context).showSnackBar(snackBar);
// Freeze
Get.snackbar('title', 'message');
},
child: Text('Show SnackBar'),
),
);
}
} |
Every child of route since version 1.17 needs to be involved with an iOS motion detector. This will require some code refactor, but will likely be fixed in the next update. Thanks for the reproduction code, this will make my job a lot easier. |
me too. is there way to fix it? |
Get 3.25.4 Version still same issue . When it does woking ? |
any progress here? |
I suggest a solution. The solution is not perfect. but It's working for me. First Step
Get.snackbar(
title,
content,
snackbarStatus: (_) {
if (_ == SnackbarStatus.CLOSED || _ == SnackbarStatus.CLOSING) {
WidgetsBinding.instance.addPostFrameCallback((_) {
final dismissController = Get.find<DismissNavigationController>();
if (dismissController.isDismiss) Get.back();
dismissController.setDone();
});
}
}, Second Step
class DismissNavigationController extends GetxController {
bool _dismiss = false;
bool get isDismiss => _dismiss;
setDismiss() => _dismiss = true;
setDone() => _dismiss = false;
} Third Step
class DismissNavigationObserver extends NavigatorObserver {
@override
void didStartUserGesture(Route route, Route previousRoute) {
Get.find<DismissNavigationController>().setDismiss();
super.didStartUserGesture(route, previousRoute);
}
@override
void didPush(Route<dynamic> route, Route<dynamic> previousRoute) {
Get.find<DismissNavigationController>().setDone();
}
}
GetMaterialApp(
navigatorObservers: [
DismissNavigationObserver(),
],
.... Good Luck. |
I am also facing the same issue in flutter, when snackbar is open if i swipe back the ui getting freeze |
Any proper fix ? advanced thanks |
@LOCKEDFILE i tried your solution but its not working for me |
Any fix for this issue? |
I am also facing a related issue, when the snackbar is opened the cursor lags, IOS simulator, iPhone 13, after it disappears it works fine. |
The issue is almost 1 year old. |
Is this fixed in GetX 4.5.1 version? |
Fixed on latest version |
I have this same problem using the another_flushbar package that when you swipe and the screen gets stuck and it was said to have been fixed, using the flutter documentation I saw that it doesn't crash but when swiping the snack bar ends up going to the previous screen too and it does not close. Is there no way to close it? |
Describe the bug
When I use Get.toNamed() to new screen, then open snackbar on onTab() of a button, and while snackbar is showing using iOS native swipe right function the screen freezes while in transition.
**Reproduction code
example:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Get.Snackbar should be closed before transition
Screenshots
Flutter Version:
1.22.0 • channel stable
Getx Version:
get: '^3.15.0'
Describe on which device you found the bug:
all iOS devices
Minimal reproduce code
s.o.
The text was updated successfully, but these errors were encountered: