Skip to content

Add peek feature to PageView - #8539

Merged
abarth merged 1 commit into
flutter:masterfrom
abarth:page_peek
Mar 3, 2017
Merged

abarth merged 1 commit into
flutter:masterfrom
abarth:page_peek

Conversation

@abarth

@abarth abarth commented Mar 2, 2017

Copy link
Copy Markdown
Contributor

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

Fixes #8408

@abarth

abarth commented Mar 2, 2017

Copy link
Copy Markdown
Contributor Author

@HansMuller @Hixie

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Hixie commented Mar 2, 2017

Copy link
Copy Markdown
Contributor

I didn't verify the math, but LGTM.

@HansMuller HansMuller Mar 3, 2017 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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