Skip to content
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

Ability to use actions in js using ensemble object #1037

Merged
merged 14 commits into from
Dec 7, 2023
Merged

Conversation

nehal076
Copy link

@nehal076 nehal076 commented Dec 4, 2023

Closes #971

@kmahmood74
Copy link
Collaborator

@nehal076 once PR has been approved, please document here - https://github.com/EnsembleUI/ensemble_docs/tree/main/actions
and also create Ensemble Kitchen Sink examples. Enhance the existing page or create a new one if needed

lib/framework/action.dart Show resolved Hide resolved
lib/framework/data_context.dart Outdated Show resolved Hide resolved
bottomModalContext, scopeManager.dataContext.eval(payload));
}
return Future.value(null);
return Navigator.maybePop(context, scopeManager.dataContext.eval(payload));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this will only work for the simplest use case where the widget is defined directly in the same block. The context here can belong to a deeply nested widget - hence the reason we want to travel up to the root to dismiss the dialog.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay @vusters, actually ContextScopeWidget.getRootContext(context) was returning null, so the dialog was never dismissed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nehal076 figure out a solution that takes into account the fact that sometimes this could be deeply nested.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vusters we don't really travel up to the root, we were just checking the root and ignoring all other contexts and that is incorrect and did not work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vusters I've done this, if the rootContext is not null, it will use root context, else it will use the local context to dismiss the modal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this works even when called from deeply nested widget?

bottomModalContext, scopeManager.dataContext.eval(payload));
}
return Future.value(null);
return Navigator.maybePop(context, scopeManager.dataContext.eval(payload));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nehal076 figure out a solution that takes into account the fact that sometimes this could be deeply nested.

lib/framework/action.dart Outdated Show resolved Hide resolved
bottomModalContext, scopeManager.dataContext.eval(payload));
}
return Future.value(null);
return Navigator.maybePop(context, scopeManager.dataContext.eval(payload));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vusters we don't really travel up to the root, we were just checking the root and ignoring all other contexts and that is incorrect and did not work.

Copy link
Collaborator

@kmahmood74 kmahmood74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the unnecessary files like appdelegate, gradle, podfile

lib/action/bottom_modal_action.dart Outdated Show resolved Hide resolved
lib/action/action_invokable.dart Outdated Show resolved Hide resolved
bottomModalContext, scopeManager.dataContext.eval(payload));
}
return Future.value(null);
return Navigator.maybePop(context, scopeManager.dataContext.eval(payload));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this works even when called from deeply nested widget?

@kmahmood74 kmahmood74 merged commit 2b5d9b9 into main Dec 7, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to use actions in js using ensemble object
3 participants