搜索插件、代码仓与 APP 分类

flutter_polls 封面
插件详情v0.1.6

flutter_polls

适用于 Flutter 的可自定义投票。简单、易于使用且高度可定制。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1130
喜欢数
170
Pub 分数
150

安装插件

flutter pub add flutter_polls

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Flutter Polls 是一个可自定义的、易于使用的包,用于将交互式投票集成到 Flutter 应用程序中。专为社交媒体和社区驱动的应用设计,它允许开发者以最少的设置创建和显示投票。该包支持多种平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,确保广泛的兼容性。注重简洁性和灵活性,它能够自定义投票的外观、响应和互动方式。非常适合依赖用户反馈或通过投票实现用户参与的应用。

适合场景

  • 用户反馈收集
  • 社区参与功能
  • 交互式应用内容
  • 实时投票系统
  • 社交媒体集成
  • 游戏化用户互动

主要特点

  • 高度可定制的用户界面
  • 跨平台支持
  • 简单 API 集成
  • 实时响应跟踪
  • 支持多选和评分投票
  • 轻量且快速的性能

适合对象

  • 社交媒体应用
  • 教育平台
  • 调查工具
  • 活动策划应用
  • 社区论坛
  • 用户参与功能

使用建议

  • 需要自定义样式以实现高级设计
  • 有限的内置分析功能
  • 无服务器端持久化功能(开箱即用)
  • 依赖外部状态管理进行数据同步
  • 未针对大规模轮询系统优化

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter Polls

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

flutter_polls

Flutter Polls on pub.dev

Getting Started

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

dependencies:
  ...
  flutter_polls: ^0.1.6

Import it:

import 'package:flutter_polls/flutter_polls.dart';

Example

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

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

Parameters

Parameter Type Description
pollId String The poll id.
hasVoted bool Whether the user has voted.
userVotedOptionId String The user voted option id. If the user hasn't voted, this will be null.
onVoted void Function(PollOption pollOption, int newTotalVotes) The callback when the user voted.
pollTitle Widget The poll title. Can be any widget.
pollOptions List The poll options. Each item is a map with the following keys: id, title, votes.
heightBetweenTitleAndOptions double The height between the poll title and the poll options.
heightBetweenOptions double The height between the poll options.
votesText String Votes text. Can be "Votes", "Votos", "Ibo" or whatever language. If not specified, "Votes" is used.
votesTextStyle TextStyle The style of the votes text.
metaWidget Widget The meta widget. Can be any widget.
createdBy String The poll creator.
userToVote String The user to vote.
pollStartDate DateTime The poll start date.
pollEnded bool If the poll is closed.
pollOptionsHeight double The poll options height.
pollOptionsWidth double The poll options width.
pollOptionsBorderRadius BorderRadius The poll options border radius.
pollOptionsBorder BoxBorder The poll options border.
pollOptionsFillColor Color The poll options fill color.
pollOptionsSplashColor Color The poll options splash color.
votedPollOptionsRadius Radius The voted poll options border radius.
votedBackgroundColor Color The voted poll options background color.
votedProgressColor Color The voted poll options progress color.
voteInProgressColor Color The voted poll options background color when user has voted and its still in progress.
votedCheckmark Widget The voted poll options checkmark.
votedPercentageTextStyle TextStyle The voted poll options percentage text style.
votedAnimationDuration int The voted poll options animation duration.
loadingWidget Widget The loading widget when a user votes. Can be any widget.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。