jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.44k stars 1.64k forks source link

[5.0 RC-3] Get.generalDialog does not return the data from Get.back #2716

Open jasonlaw opened 1 year ago

jasonlaw commented 1 year ago

ATTENTION: DO NOT USE THIS FIELD TO ASK SUPPORT QUESTIONS. USE THE PLATFORM CHANNELS FOR THIS. THIS SPACE IS DEDICATED ONLY FOR BUGS DESCRIPTION. Fill in the template. Issues that do not respect the model will be closed.

Describe the bug When using Get.generalDialog with user input, I use Get.back(result: response) to close and return the user input data. It was working before but now the response data always has null value.

Reproduction code NOTE: THIS IS MANDATORY, IF YOUR ISSUE DOES NOT CONTAIN IT, IT WILL BE CLOSED PRELIMINARY)

example:

   return Get.generalDialog<DialogResponse<T>>(
      barrierColor: barrierColor,
      transitionDuration: const Duration(milliseconds: 200),
      barrierDismissible: barrierDismissible,
      barrierLabel: barrierLabel,
      pageBuilder: (BuildContext buildContext, _, __) => SafeArea(
        key: const Key('dialog_view'),
        child: Builder(
          builder: (BuildContext context) => customDialogUI!(
            context,
            DialogRequest<R>(
              title: title,
              description: description,
              hasImage: hasImage,
              imageUrl: imageUrl,
              showIconInMainButton: showIconInMainButton,
              mainButtonTitle: mainButtonTitle,
              showIconInSecondaryButton: showIconInSecondaryButton,
              secondaryButtonTitle: secondaryButtonTitle,
              showIconInAdditionalButton: showIconInAdditionalButton,
              additionalButtonTitle: additionalButtonTitle,
              takesInput: takesInput,
              data: data,
              variant: variant,
            ),
            completeDialog,
          ),
        ),
      ),
    );

  /// Completes the dialog and passes the [response] to the caller
  void completeDialog(DialogResponse response) {
    Get.back(result: response);
  }

Flutter Version: 3.7.3

Getx Version: 5.0.0-release-candidate-3

Describe on which device you found the bug: Web - Chrome

jonataslaw commented 1 year ago

Dialogs depend on Navigator 1 too, but it's a route. This issue is related to the previous one (backwards compatibility), but will be fixed differently.

But I'm thinking of pushing them with Get.to under the hood. Thanks for the report.