Inquiry class
Constructors
Inquiry ({Key ? key , Future <bool > onVoted (InquiryOption pollOption , int newTotalVotes )?, Widget ? titleWidget , String ? inquiryId , bool hasVoted = false , int ? userVotedOptionId , required List <InquiryOption > options , String ? votesText = 'Votes' , Widget ? metadataWidget , Widget ? loadingWidget , String ? voteButtonText , InquiryStyle style = const InquiryStyle() , bool disposable = true })
const
Properties
createNewViewModelOnInsert
→ bool
When set to true a new ViewModel will be constructed everytime the widget is inserted.
no setter
disposable
→ bool
When the inquiry is on a List or other kind of scrollable
that disposes his children it might be better to make it not disposable
as you might face the error that --"the ViewModel was used after being disposed"--
final
disposeViewModel
→ bool
Indicates if you want Provider to dispose the ViewModel when it's removed from the widget tree.
no setter
fireOnViewModelReadyOnce
→ bool
Indicates if you want to fire onViewModelReady only once or everytime this widget is inserted into
the widget tree.
no setter inherited
hashCode
→ int
The hash code for this object.
no setter inherited
hasVoted
→ bool
Checks if a user has already voted in this inquiry.
If this is set to true, the user can't vote
votedOptionId
must also be provided if this is set to true.
final
initialiseSpecialViewModelsOnce
→ bool
Indicates if you want to only initialise the FutureViewModel
or StreamViewModel
once or
every time it's inserted into the widget tree.
no setter inherited
inquiryId
→ String ?
The id of the inquiry.
This id is used to identify the inquiry
to check if a user has already voted in this inquiry.
final
key
→ Key ?
Controls how one widget replaces another widget in the tree.
final inherited
loadingWidget
→ Widget ?
Loading animation widget for InquiryOption when onVoted callback is invoked
Defaults to CircularProgressIndicator
Is visible until the onVoted execution is completed,
final
metadataWidget
→ Widget ?
metadataWidget is displayed at the bottom of the poll.
It can be any widget with an unbounded size.
example:
metadataWidget: Text('Created by: $createdBy')
final
onVoted
→ (Future <bool > Function(InquiryOption pollOption , int newTotalVotes ) ?)
An asynchronous callback for HTTP call feature
Called when the user select an option and hit vote.
The the option that the user voted for is passed as an argument.
If the callback returns true, the tapped InquiryOption is considered as right answer.
final
options
→ List <InquiryOption >
Data class format for the inquiry options.
The list can have any number of elements.
Pptions are displayed in the order they are in the list.
example:
final
reactive
→ bool
Indicates if the builder should be rebuilt when notifyListeners is called
no setter
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
style
→ InquiryStyle
The style for the Inquiry and InquiryOptions
Feel free to personalize the inquiry to your app designs
final
titleWidget
→ Widget ?
The title of the poll. Can be any widget with a bounded size.
final
userVotedOptionId
→ int ?
Id of the option if the user has voted on this inquiry.
It is ignored if hasVoted is set to false or not set at all.
final
voteButtonText
→ String ?
The text to show in the button to vote.
If not specified, the english word "Vote" is used.
final
votesText
→ String ?
The text that shows the amount of votes for each option.
If not specified, the english word "Votes" is used.
final