Closed – Is it possible to have nextPage() animation in less than 1 second?

Issue

I am creating a PageView section and it has around 5 – 10 children. I tried to make buttons to control the page flow. But I found the duration of the animation is a bit awkward.

IconButton(
    icon: const Icon(Icons.arrow_back_ios_new_rounded),
    onPressed: () {
        pageController.previousPage(
            duration: Duration(seconds:1), 
            curve: Curves.easeIn
        );
    }
)

The smallest unit in Duration class is seconds and I found 1 second is still too long for me.
Is there any way to further shorten the duration of the animation? Thanks.

Edit:
In flutter it actually has a smaller unit called milliSeconds.

Solution

you can put it this way

pageController.previousPage(
        duration: Duration(milliseconds: 200), 
        curve: Curves.easeIn
    );

now it would take 0.2 secs to go next page

Answered By – Ardeshir ojan

Answer Checked By – Senaida (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.