Inquiry class

Inheritance

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 setterinherited
hashCode int
The hash code for this object.
no setterinherited
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 setterinherited
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.
finalinherited
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 setterinherited
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

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
inherited
builder(BuildContext context, InquiryViewModel viewModel, Widget? child) Widget
A function that builds the UI to be shown from the ViewModel - Required
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
getPercentString(double percent) String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDispose(InquiryViewModel viewModel) → void
Fires when the ViewModel is disposed
onModelReady(InquiryViewModel viewModel) → void
Fires when the ViewModel is first created or re-created
inherited
onViewModelReady(InquiryViewModel viewModel) → void
Fires when the ViewModel is first created or re-created
staticChildBuilder(BuildContext context) Widget?
A Function that builds UI for the static child that builds only once
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
viewModelBuilder(BuildContext context) InquiryViewModel
A builder that builds the ViewModel for this UI - Required

Operators

operator ==(Object other) bool
The equality operator.
inherited