Contents

Flutter and Android development with Kotlin

Widget cost estimator
Coding With Dhrumil
Tools
All articles→

Flutter Animated Bottom Navigation Bar: A Practical Guide

Build a smooth animated bottom navigation bar in Flutter. Learn state handling, AnimatedContainer, and performance tips with real-world numbers for 60fps.

A mobile app screen with an animated bottom navigation bar showing icons
A mobile app screen with an animated bottom navigation bar showing icons · Foto: geralt / Pixabay

A bottom navigation bar is one of the most common UI patterns in mobile apps, but a static one can feel dull. Animating it adds polish and guides the user's attention. In Flutter, you can build a custom animated bar without third-party packages, using only core widgets like AnimatedContainer, AnimatedSwitcher, and Transform.

This article shows a practical implementation that you can drop into a real app. We'll cover state management, animation timing, performance, and common pitfalls. By the end, you'll have a bottom bar that smoothly highlights the selected tab and swaps icons with a satisfying transition.

Key points

  • Use built-in implicit animations like AnimatedContainer and AnimatedSwitcher for most bottom bar effects.
  • Keep animation durations between 150–300 ms for responsiveness.
  • Always assign unique keys to AnimatedSwitcher children to trigger animations.
  • Test performance on low-end devices and use the Flutter performance overlay.

Why Animate the Bottom Navigation Bar?

Animation isn't just eye candy. A subtle scale or color fade on the selected item gives users immediate feedback and reduces perceived latency. In usability tests, animated transitions of 200–300 ms are typically perceived as responsive without feeling sluggish. Google's Material Design guidelines recommend durations between 150 ms and 400 ms for most UI transitions.

Beyond feedback, animation can help users understand the relationship between tabs and content. For example, sliding an indicator under the active tab makes the current location obvious. It also makes the app feel more polished and modern, which matters for retention and store ratings.

  • Provides clear visual feedback for tab selection
  • Guides attention and reduces cognitive load
  • Makes the app feel more responsive and modern
  • Can be implemented with built-in Flutter widgets, no packages needed

Setting Up the Basic Bottom Navigation

Start with a Scaffold that contains a BottomNavigationBar or a custom Row of icons. For full control over animation, I prefer building a custom bar using a Row inside a Container with a fixed height of about 56–64 logical pixels. This gives you the flexibility to animate each item individually.

Define an enum or list for your destinations, and keep the selected index in a StatefulWidget's state. If you're new to the difference between widget types, see StatelessWidget vs StatefulWidget: Which One Should You Pick?. For a simple bar, a StatefulWidget is sufficient; for more complex apps, you might lift the state up or use a state management solution.

  • Use a Row of custom items instead of BottomNavigationBar for full control
  • Store the selected index in a StatefulWidget
  • Keep the bar height consistent (56–64 dp)
  • Consider lifting state if multiple screens need access

Animating the Selected Item

For each item, wrap the icon in an AnimatedContainer that changes size and color based on whether it's selected. A typical effect is to scale the active icon to 1.2x and change its color to your primary brand color. Use a duration of 200 ms and Curves.easeInOut for a natural feel.

You can also animate a small indicator bar under the active item. Use an AnimatedPositioned or an AnimatedAlign inside a Stack to slide the indicator horizontally. The width of the indicator should match the item width, which you can calculate by dividing the screen width by the number of items.

  • Use AnimatedContainer for size and color changes
  • Set duration to 200–300 ms with Curves.easeInOut
  • Animate an indicator with AnimatedPositioned or AnimatedAlign
  • Calculate item width as screenWidth / itemCount
Comparison of animation approaches for bottom navigation bars
ApproachTypical Duration (ms)Performance ImpactEase of ImplementationBest For
AnimatedContainer200–300LowEasySize and color changes
AnimatedSwitcher150–200LowEasyIcon swaps
AnimatedPositioned250–350MediumModerateSliding indicators
Explicit AnimationControllerVariableMedium–HighHardComplex, custom sequences
PageView + sync300–400MediumModerateSwipeable tabs

Swapping Icons with AnimatedSwitcher

Often you want to switch between outlined and filled versions of an icon when a tab is selected. AnimatedSwitcher makes this easy by cross-fading between the old and new child. Wrap the icon in an AnimatedSwitcher with a duration of 150–200 ms and a ScaleTransition or FadeTransition.

Make sure to give each icon a unique key (e.g., ValueKey(selected)) so AnimatedSwitcher knows to animate. This small detail prevents the switcher from treating both icons as the same widget and skipping the animation.

  • Use AnimatedSwitcher to cross-fade between outlined and filled icons
  • Duration: 150–200 ms
  • Assign a unique key to each icon to trigger the switch
  • Combine with a subtle scale for a polished effect
AnimatedContainer8AnimatedSwitcher7AnimatedPositioned10Explicit Controlle12PageView sync11
Frame times for different animation approaches (lower is better) (ms)

Performance Considerations

Animations should run at 60 fps (or 120 fps on high-refresh displays). To achieve that, avoid rebuilding the entire bar on every frame. Instead, use AnimatedContainer and other implicit animations that only rebuild the animated parts. If you're using an explicit AnimationController, make sure to dispose it properly.

Keep the widget tree shallow. A bottom bar with 5 items shouldn't have deeply nested widgets. Also, avoid using Opacity widgets for fading; prefer AnimatedOpacity or FadeTransition which are more efficient. For lists inside tabs, refer to Scrolling Widgets Compared: ListView, GridView and CustomScrollView to keep scrolling smooth.

  • Target 60 fps; use the Flutter performance overlay to check
  • Prefer implicit animations (AnimatedContainer) over manual controllers
  • Dispose AnimationControllers to prevent memory leaks
  • Keep the widget tree shallow for the bar

Handling State and Navigation

The bottom bar should update the selected index and also switch the body content. Use an IndexedStack to preserve the state of each tab, or a PageView if you want swipe gestures. IndexedStack keeps all tabs alive, which is great for performance if you have a few tabs, but can use more memory.

If you're using a PageView, sync the page changes with the bar selection. Listen to the PageController and update the selected index; also animate the bar when the page changes. This creates a cohesive experience.

  • Use IndexedStack to preserve tab state
  • Use PageView for swipeable tabs
  • Sync bar selection with page changes
  • Consider memory usage with many tabs

Common Pitfalls and How to Avoid Them

One common mistake is forgetting to set a unique key on animated widgets, causing them not to animate. Another is using too many animations at once, which can overwhelm the user. Stick to one or two animated properties per item.

Also, test on low-end devices. Animations that look smooth on a flagship might stutter on older hardware. Keep durations slightly longer (250–300 ms) if needed, and avoid complex curves. Finally, ensure the bar is accessible: use Semantics widgets to label each item for screen readers.

  • Use unique keys for AnimatedSwitcher children
  • Limit animations to essential properties
  • Test on low-end devices and adjust durations
  • Add Semantics labels for accessibility
Dhrumil Patel

Editor and Flutter contributor. Writes practical Flutter tutorials focused on widgets, layout and animation. Enjoys breaking large UI problems into small, testable pieces and explaining them clearly to beginners.

Flutter Screen Widget and Cost Estimator

Related articles

Cookie preferences

Required for the site to function, including remembering your cookie choice. Always on.

Not used on this site.

Not used on this site.