Poll Card

Loading preview

Starting the Flutter app

Poll with animated percentage bars after voting

Get the source

Add it to your project

Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.

First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.

How it works

_selected gates the UI: before voting, each option is an empty bar. A tap runs _vote, which records the choice and increments _votes, so results include your vote. InkWell then disables, percentages and a total appear, and each AnimatedContainer grows to its share of the LayoutBuilder width. The chosen option gets a check icon and a stronger tint. Votes live in local state and reset with the page.

Adapting it

  • Send the vote from _vote, and take the updated counts from your API.
  • Pass the question and _options in as parameters.
  • Allow changing a vote by decrementing the previous option first.