搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。