Polls class
- Inheritance
Constructors
-
Polls({Key? key, required List<
PollOption> children, required Map<String, int> ? voteData, required String? currentUser, required String? creatorID, Widget? question, int? userChoice, bool allowCreatorVote = false, PollCallBack? onVote, Color onVoteBorderColor = Colors.blue, Color voteCastedBorderColor = Colors.transparent, Color backgroundColor = Colors.blueGrey, Color? voteCastedBackgroundColor = Colors.grey, Color? onVoteBackgroundColor = Colors.blue, TextStyle? leadingPollStyle, TextStyle? pollStyle, Color? iconColor = Colors.black, Color? leadingBackgroundColor = Colors.blueGrey, double optionBarRadius = 16, double borderWidth = .25, double optionHeight = 35, double optionSpacing = 8}) -
Polls contruct by default get view for voting
const
-
Polls.castVote({Key? key, required List<
PollOption> children, required Widget? question, required PollCallBack? onVote, bool allowCreatorVote = false, Color onVoteBorderColor = Colors.blue, Color backgroundColor = Colors.grey, Color? voteCastedBackgroundColor = Colors.blueGrey, TextStyle? pollStyle, double optionBarRadius = 16, double borderWidth = .25, double optionHeight = 35, double optionSpacing = 8}) -
this creates view for users to cast votes
const
-
Polls.creator({Key? key, required List<
PollOption> children, required Widget? question, TextStyle? leadingPollStyle, TextStyle? pollStyle, Color backgroundColor = Colors.blue, Color? voteCastedBackgroundColor = Colors.grey, Color? leadingBackgroundColor = Colors.blueAccent, Color? onVoteBackgroundColor = Colors.blueGrey, bool allowCreatorVote = false, double optionBarRadius = 16, double borderWidth = .25, double optionHeight = 35, double optionSpacing = 8}) -
This creates view for the creator of the polls
const
-
Polls.viewPolls({Key? key, required List<
PollOption> children, required Widget? question, int? userChoice, TextStyle? leadingPollStyle, TextStyle? pollStyle, Color backgroundColor = Colors.blue, Color? voteCastedBackgroundColor = Colors.grey, Color? leadingBackgroundColor = Colors.blueAccent, Color? onVoteBackgroundColor = Colors.blueGrey, Color? iconColor = Colors.black, double optionBarRadius = 16, double borderWidth = .25, double optionHeight = 35, double optionSpacing = 8}) -
this creates view for see polls result
const
Properties
- allowCreatorVote → bool
-
This determines if the creator of the poll can vote or not
final
- backgroundColor → Color
-
final
- borderWidth → double
-
Width of the border for each option
final
-
children
→ List<
PollOption> -
This takes in poll options array
final
- creatorID → String?
-
final
- currentUser → String?
-
final
- getHighest → PollTotal?
-
This returns highest votes casted
final
- getTotal → PollTotal?
-
This returns total votes casted
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highest → double?
-
final
- iconColor → Color?
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leadingBackgroundColor → Color?
-
final
- leadingPollStyle → TextStyle?
-
final
- onVote → PollCallBack?
-
This call back returns user choice after voting
final
- onVoteBackgroundColor → Color?
-
final
- onVoteBorderColor → Color
-
Colors setting for polls widget
final
- optionBarRadius → double
-
Radius of each poll option
final
- optionHeight → double
-
Height of each option bar
final
- optionSpacing → double
-
Space between each option
final
- pollStyle → TextStyle?
-
Text Styles
final
- question → Widget?
-
The poll question visible above the poll options.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userChoice → int?
-
This is takes in current user choice
final
- viewType → PollsType?
-
This determines what type of view user should see
if its creator, or view requiring you to vote or view showing your vote
final
- voteCastedBackgroundColor → Color?
-
final
- voteCastedBorderColor → Color
-
final
-
voteData
→ Map<
String, int> ? -
This takes in vote data which should be a Map
with this, polls widget determines what type of view the user should see
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Polls> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
options(
{required String title, required double value}) → PollOption - Polls.option is used to set polls options