Saturday, March 2, 2024

Create polls in Flutter

Customizable Polls for Flutter.Simple, easy to use and highly customizable.

Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

  flutter_polls: ^0.0.5

Import it:

import 'package:flutter_polls/flutter_polls.dart';


Check out the example project in the example directory here: example on github

    pollId: '1',
    onVoted: (PollOption pollOption, int newTotalVotes) {
      print('Voted: ${}');
    pollOptionsSplashColor: Colors.white(),
    votedProgressColor: Colors.greyDark().withOpacity(0.3),
    votedBackgroundColor: Colors.grey().withOpacity(0.2),
    votesTextStyle: themeData.textTheme.subtitle1,
    votedCheckmark: Icon(
        height: 18,
        width: 18,
    pollTitle: Align(
    alignment: Alignment.centerLeft,
    child: AutoSizeText(
        style: TextStyle(
            fontSize: 20,
    pollOptions: poll['options'].map(
    (option) {
        return PollOption(
        id: option['id'],
        title: AutoSizeText(
            style: tTextStyle(
            fontSize: 20,
        votes: option['votes'],
    metaWidget: Row(
    children: [
        const SizedBox(width: 6),
        style: TextStyle(
            fontSize: 20,
        const SizedBox(
        width: 6,
        '2 weeks left',
        style: TextStyle(
            fontSize: 20,


pollIdStringThe poll id.
hasVotedboolWhether the user has voted.
userVotedOptionIdintThe user voted option id. If the user hasn’t voted, this will be null.
onVotedvoid Function(PollOption pollOption, int newTotalVotes)The callback when the user voted.
pollTitleWidgetThe poll title. Can be any widget.
pollOptionsListThe poll options. Each item is a map with the following keys: id, title, votes.
heightBetweenTitleAndOptionsdoubleThe height between the poll title and the poll options.
heightBetweenOptionsdoubleThe height between the poll options.
votesTextStringVotes text. Can be “Votes”, “Votos”, “Ibo” or whatever language. If not specified, “Votes” is used.
votesTextStyleTextStyleThe style of the votes text.
metaWidgetWidgetThe meta widget. Can be any widget.
createdByStringThe poll creator.
userToVoteStringThe user to vote.
pollStartDateDateTimeThe poll start date.
pollEndedboolIf the poll is closed.
pollOptionsHeightdoubleThe poll options height.
pollOptionsWidthdoubleThe poll options width.
pollOptionsBorderRadiusBorderRadiusThe poll options border radius.
pollOptionsBorderBoxBorderThe poll options border.
pollOptionsFillColorColorThe poll options fill color.
pollOptionsSplashColorColorThe poll options splash color.
votedPollOptionsRadiusRadiusThe voted poll options border radius.
votedBackgroundColorColorThe voted poll options background color.
votedProgressColorColorThe voted poll options progress color.
votedCheckmarkWidgetThe voted poll options checkmark.
votedPercentageTextStyleTextStyleThe voted poll options percentage text style.
votedAnimationDurationintThe voted poll options animation duration.