Implicit Flutter Animations

Oct 4 2022 · Dart 2.17, Flutter 3.0, Visual Studio Code 1.7

Part 2: Implicit Animations in Action

06. Create a Custom PageView Animation

Episode complete

Play next episode

About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 05. Animate a Social Share Button Next episode: 07. Create a Card Flip Animation

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 06. Create a Custom PageView Animation

The student materials have been reviewed and are updated as of August 2022.

The updated material uses null safety and also deploys the use coding practises encouraged by the Flutter as per the Flutter lint rules and a few addons of practises that are considered good here at raywenderlich (see analysis_options.yaml in the material for more info).

Also, the value type passed in the builder parameter of TweenAnimationBuilder is explicitly mentioned otherwise dart assumes the value as generic datatype after the release of Flutter 2.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In this episode, we would be using implicit animations to affect how the offers slider animates. The offers slider is used inside the homescreen widget. Scroll to it then hold down the ctrl key then click on it to navigate to its file.

int _selectedIndex = 0;
onPageChanged: (index) {
    setState(() {
        _selectedIndex = index;
itemBuilder: (context, index) {
    final offer = offers[index];
    // New Code
    final scale = _selectedIndex == index ? 1.0 : 0.8;
    return TweenAnimationBuilder(
        duration: const Duration(milliseconds: 350),
        curve: Curves.ease,
        tween: Tween(begin: scale, end: scale),
        child: Item(offer: offer),
        builder: (context, value, child) {
            return Transform.scale(
                scale: value,
                child: child,
    children: <Widget>[
    for (int i = 0; i < offers.length; i++)
        if (i == _selectedIndex)
            const Indicator(isActive: true)
            const Indicator(isActive: false),
return AnimatedContainer(
    duration: const Duration(milliseconds: 350),