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

Question: Why portal #1

Closed
SebastienBtr opened this issue Aug 11, 2020 · 2 comments
Closed

Question: Why portal #1

SebastienBtr opened this issue Aug 11, 2020 · 2 comments

Comments

@SebastienBtr
Copy link

I was wondering why this package needs flutter_portal, which requires additional configuration from the user, wasn't it possible to use the native ModalBottomSheet?

showModalBottomSheet<void>(
  context: context,
  builder: (BuildContext context) {
     return Widget();
  },
);
@fayeed
Copy link
Owner

fayeed commented Aug 11, 2020

The reason for using this instead of just ModalBottomSheet is that the ListContainer needs to be either attached to the top or bottom of the Input. Using the ModalBottomSheet this would have not been possible.

Initial I just used CompositedTransformFollower & CompositedTransformTarget to show suggestions to the user, and it worked really great when the List was attached to the bottom of the TextField but when attached to the top it didn't work great, to correctly attached to the top I need to get the height of the OverlayEntry which was not possible as it is not been rendered.

So, finally decided to use the flutter_portal package, which resolved all the problems, one downside of the package is that you need to wrap your parent Widget with Portal if parent widget height is not enough the overflowed part of the widget will still be visible but won't be interactive, this exactly behaves how a Positioned widget would behave. The reason I decided to force the extra configuration on the user was that after wrapping the topmost container of flutter_mentions I saw the clipping behavior.

As for how this would be work in the context of dash_chat is that users won't need to do extra configurations since we would just wrap the ChatView widget with Portal widget.

@SebastienBtr
Copy link
Author

Thanks for the explanation :)

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

No branches or pull requests

2 participants