Skip to content

Conversation

@abarth
Copy link
Contributor

@abarth abarth commented Mar 2, 2017

This feature lets you see a portion of the next and previous page in a
PageView.

Fixes #8408

@abarth
Copy link
Contributor Author

abarth commented Mar 2, 2017

@HansMuller @Hixie

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe assert > 0, <= 1.0 ?
(would it work with > 1.0?)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see, peek values are absolute pixels. This seems surprising, I would have expected it to be a fraction of the viewportMainAxisExtent.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it works either way. I don't know what our customers prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should test that this handles the main axis extent changing (without rebuilding) when the peek is non-zero.

@Hixie
Copy link
Contributor

Hixie commented Mar 2, 2017

I didn't verify the math, but LGTM.

Copy link
Contributor

@HansMuller HansMuller Mar 3, 2017

Choose a reason for hiding this comment

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

Another way to define this would have been been pageWidth as a percentage of the viewport's width. The default and the maximum would be 1.0.

On a wide screen, like a tablet, you might want to define the pageWidth with a small enough value so that the entire next/prev pages are visible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe that's better. I'll give that a try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that seems cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work if peek > viewportDimension / 4, i.e. if 3 or more pages are visible after the pageview has settled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add a test for that, but it should work in theory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That works. I also tested viewportFractions greater than one.

This feature lets you see a portion of the next and previous page in a
PageView.

Fixes flutter#8408
@abarth abarth merged commit 0403ed4 into flutter:master Mar 3, 2017
@abarth abarth deleted the page_peek branch March 3, 2017 05:09
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Would like to be able to peek next and previous pages in addition to current

4 participants