How can I have different sized Pages in a PageView?

821

I have successfully solved the problem. Now to my solution. I have built a second PageController that has a ViewPortFraction of 0.8. As soon as the second page is opened to 30%, the first controller is replaced by the second PageController and the second page is getting smaller.

Share:
821
Lars Henning
Author by

Lars Henning

Updated on December 19, 2022

Comments

  • Lars Henning
    Lars Henning over 1 year

    I have only been programming with Flutter for one and a half months and am still quite inexperienced. But I have a question that I couldn't find an answer to on the Internet. I need an app that mainly consists of a PageView. Unfortunately, with a PageView, all pages are always the same size. Is there any way to make the width of one page smaller or make the viewport fraction smaller for one page than for other pages?

    PageView.Custom may help us, but I haven't been able to find out whether PageView.Custom has this function or not. I tried to read me cleverly on the Internet, but couldn't find anything.

    If Pageview doesn't work, you have an alternative idea which widget I could use. My pageview has only two pages, but I need both the swipe function and the function "animatetopage ..."

    • mdeora
      mdeora about 4 years
      Instead of making the PageView size variable, you can make the contents of the PageView as per your requirement.
    • Lars Henning
      Lars Henning about 4 years
      How do you mean? The one page in the pageView must have a smaller width than the other. That is the only thing that matters. Not the content, but the pagewidth .... thanks for your quick reply
    • Samir N Ahmad
      Samir N Ahmad about 4 years
      Why don't you add an image or an illustration to make yourself clearer.But I think you can just specify the child widget's size of the PageView as @mdeora said... for example you can jsut use Container or SizedBox