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

Add a factory constructor for customizing snap behavior #21

Closed
fujidaiti opened this issue Apr 22, 2023 · 1 comment
Closed

Add a factory constructor for customizing snap behavior #21

fujidaiti opened this issue Apr 22, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@fujidaiti
Copy link
Owner

fujidaiti commented Apr 22, 2023

If we want to add an additional snap position of the viewport offset, we would typically write code as follows, but it's a bit verbose.

const peekOffset = ViewportOffset.fractional(0.5);
controller = ExprollablePageController(
  initialViewportOffset: peekOffset,
  maxViewportOffset: peekOffset,
  snapViewportOffsets: [
    ViewportOffset.expanded,
    ViewportOffset.shrunk,
    peekOffset,
  ],
);

It would be nice to have a factory constructor of ExprollablePageController for simplicity like:

const peekOffset = ViewportOffset.fractional(0.5);
controller = ExprollablePageController.withAdditionalSnapOffsets(
  initialViewportOffset: peekOffset,
  additionalSnapViewportOffsets: [ peekOffset ],
);
@fujidaiti fujidaiti self-assigned this Apr 22, 2023
@fujidaiti fujidaiti added the enhancement New feature or request label Apr 22, 2023
@fujidaiti
Copy link
Owner Author

fujidaiti commented Apr 28, 2023

Close this issue as it has been implemented and will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant