'What is the default Curve behavior for PageView in Flutter?
The PageController
of a PageView
has a function animateToPage
which allows to define the curve effect during page swipe.
Future<void> animateToPage(
int page, {
@required Duration duration,
@required Curve curve,
})
I need to match it's behavior with that of the default swipe transition of PageView.
Any help?
Solution 1:[1]
As mentioned by @pskink in the comments, the default PageView
transition animation relies on the physics applied by the user's gesture. Depending on the user's swipe, it's then translated to the page's transition animation.
On the other hand, PageController
's animateToPage
relies on the duration set and curve. To emulate a smooth swipe, you can use Curves.ease
as previously mentioned.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Martijn Pieters |