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

layoutPages horizontal question #223

Open
a13020796019 opened this issue Aug 15, 2024 · 0 comments
Open

layoutPages horizontal question #223

a13020796019 opened this issue Aug 15, 2024 · 0 comments

Comments

@a13020796019
Copy link

a13020796019 commented Aug 15, 2024

First of all, thank you for providing such an excellent plugin.
I have a problem with horizontal layout.
1.
The client's requirement is that when sliding horizontally to turn pages, the page should automatically go to the next page after turning halfway, otherwise it should stay on the current page.
The original effect is to stay in the current window.

> onHorizontalDragEnd: (details) {
> double screenWidth = MediaQuery.of(context).size.width;
> double dragDistance = _dragEndX - _dragStartX;
> if (dragDistance > screenWidth * 2 / 3) {
> print('previousPage $dragDistance');
> controller.goToPage(
> pageNumber: controller.pageNumber! - 1);
> } else if (dragDistance < screenWidth * 2 / 3) {
> print('nextPage $dragDistance');
> controller.goToPage(
> pageNumber: controller.pageNumber! + 1);
> } else {
> print('currentPage $dragDistance');
> 
> controller.goToPage(pageNumber: controller.pageNumber!);
> }
> },
> 

2.There is another problem. After the page is reduced to 1.0, it is not allowed to be reduced again.I tried changing constrained to true, but it caused other problems。This is how I currently do it。
But the effect is that it shrinks first and then restores. I haven't found a suitable solution.

                  onInteractionUpdate: (details) {
                    if (details.scale < 1.0) {
                      controller.setZoom(Offset.zero, 1.0);
                    }
                  },
@a13020796019 a13020796019 changed the title When Allow horizontal pages layoutPages horizontal question Aug 15, 2024
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

1 participant