Getx: Get.isDialogOpen not working from dialog on click

Created on 18 Nov 2020  路  5Comments  路  Source: jonataslaw/getx

Describe the bug
Get.isDialogOpen not working from dialog confirm

[GETX] OPEN DIALOG: 468003272
[GETX] OPEN SNACKBAR null
[GETX] OPEN BOTTOMSHEET: 29701841
[GETX] CLOSE BOTTOMSHEET: 29701841
[GETX] CLOSE SNACKBAR null

**Reproduction code

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(initialRoute: '/', getPages: [
      GetPage(name: '/', page: () => HomePage()),
    ] //appRoutes,
        // home: HomePage(),
        );
  }
}

class HomePageController extends GetxController {}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetBuilder(
      init: HomePageController(),
      builder: (controller) => Scaffold(
        body: Center(
          child: RaisedButton(
            child: Text("open dialog"),
            onPressed: () {
              Get.defaultDialog(onConfirm: () {
                Get.snackbar("alert", "some stupid snack bar");
                Get.bottomSheet(Text('some stupid bottom sheet'));
                closeAllOverlays();
              });
            },
          ),
        ),
      ),
    );
  }

  closeAllOverlays() {
    Get.until((_) =>
        !Get.isSnackbarOpen && !Get.isDialogOpen && !Get.isBottomSheetOpen);
  }
}

To Reproduce
Steps to reproduce the behavior:

  1. open dialog
  2. tryng to close all active overlays

Expected behavior
ALL Overlays closed !

Flutter Version:
Flutter 1.22.3

Getx Version:
get: ^3.17.1

Describe on which device you found the bug:
emulator api 30 pixel 4

bug

Most helpful comment

I always update the package during the weekend, where I have more free time from work.
Today or tomorrow the update will be released

All 5 comments

Hi @ash2osh,
I did the test and it is working normal. bottomSheet opens and closes very quickly and does not cause an update on the screen.
Try this to prove:

Get.defaultDialog(onConfirm: () async {                  // async
  Get.snackbar("alert", "some stupid snack bar");
  Get.bottomSheet(Text('some stupid bottom sheet'));
  await Future.delayed(Duration(seconds: 3));            // await
  closeAllOverlays();
});

thank you for the reply
my problem is that the dialog is not closing
the other overlays are closing correctly
i debugged the closeAllOverlaysfunction and Get.isDialogOpen is producing false
is this the expected behavior from inside the dialog confirm function ??

I'm sorry, you are correct and this is a bug. I already found the solution and I will launch a PR for correction

this fixed is not on the 3.17.1 version
which time can you add this fixed on the release version ?

I always update the package during the weekend, where I have more free time from work.
Today or tomorrow the update will be released

Was this page helpful?
0 / 5 - 0 ratings