FormRatingBar<TValue> class
Widget to display & edit by number of stars by passing double.
Can be used to evaluate users and articles.
iconCount allows you to specify the number of icons. The icon widget itself can be specified with icon, and the design can be changed by specifying iconSize, activeColor, and inactiveColor. Also, if iconBuilder is specified, the icon can be created in a callback.
The minimum and maximum values can be specified with min and max.
You can specify whether to allow half stars with allowHalfRating.
Normally, the value can be changed by dragging, but tapOnlyMode allows the value to be specified only by tapping.
If showLabel is specified, the actual value can be displayed as a numerical value.
Place under the Form that gave FormController.key, or pass FormController to form.
When FormController is passed to form, onSaved must also be passed together. The contents of onSaved will be used to save the data.
Enter the initial value given by FormController.value in initialValue.
Each time the content is changed, onChanged is executed.
If FormController.validate is executed, validation and data saving are performed.
Only when emptyErrorText is specified, emptyErrorText will be displayed as an error if no characters are entered.
Other error checking is performed by specifying validator. If a string other than Null is returned in the callback, the string is displayed as an error statement. If Null is returned, it is processed as no error.
If enabled is false
, the text is deactivated.
If readOnly is set to true
, it will show enabled, but the value cannot be changed.
doubleを渡して星の数で表示&編集するためのウィジェット。
ユーザーや記事の評価に使用可能です。
iconCountを使用するとアイコンの数を指定できます。iconでアイコンウィジェットそのものを指定でき、iconSizeやactiveColor、inactiveColorを指定するとデザインを変更することができます。また、iconBuilderを指定するとコールバックでアイコンを作成可能です。
allowHalfRatingで半分の星を許可するかどうかを指定できます。
通常はドラッグで値を変更できますが、tapOnlyModeでタップのみで値を指定可能にします。
showLabelを指定すると実際の値を数値として表示することが可能です。
FormController.keyを与えたForm配下に配置、もしくはformにFormControllerを渡します。
formにFormControllerを渡した場合、一緒にonSavedも渡してください。データの保存はonSavedの内容が実行されます。
initialValueにFormController.valueから与えられた初期値を入力します。
内容が変更される度onChangedが実行されます。
FormController.validateが実行された場合、バリデーションとデータの保存を行ないます。
emptyErrorTextが指定されている時に限り、文字が入力されていない場合emptyErrorTextがエラーとして表示されます。
それ以外のエラーチェックはvalidatorを指定することで行ないます。 コールバック内でNull以外を返すようにするとその文字列がエラー文として表示されます。Nullの場合はエラーなしとして処理されます。
enabledがfalse
になるとテキストが非有効化されます。
readOnlyがtrue
になっている場合は、有効化の表示になりますが、値が変更できなくなります。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FormField<
double> - FormRatingBar
- Available Extensions
- Annotations
Constructors
-
FormRatingBar({FormController<
TValue> ? form, FormStyle? style, bool keepAlive = true, TextEditingController? controller, int iconCount = 5, double iconSize = 40.0, bool readOnly = false, void onChanged(double? value)?, Color? activeColor, Color? inactiveColor, double? min, double? max, Widget iconBuilder(BuildContext context, int index)?, bool allowHalfRating = true, bool tapOnlyMode = false, Axis direction = Axis.horizontal, bool showLabel = false, Widget? icon, String format = "0.#", Key? key, String? emptyErrorText, TValue onSaved(double value)?, String validator(double? value)?, num? initialValue, bool enabled = true}) - Widget to display & edit by number of stars by passing double.
- FormRatingBar.view(num initialValue, {Key? key, FormStyle? style, int iconCount = 5, double iconSize = 40.0, Color? activeColor, Color? inaciveColor, double? min, double? max, Widget itemBuilder(BuildContext context, int index)?, bool allowHalfRating = true, Axis direction = Axis.horizontal, bool showLabel = false, Widget? icon})
- Widget to display & edit by number of stars by passing double.
Properties
- activeColor → Color?
-
Specifies the color of the star when active.
final
- allowHalfRating → bool
-
You can specify whether to allow half stars.
final
- autovalidateMode → AutovalidateMode
-
Used to enable/disable this form field auto validation and update its
error text.
finalinherited
-
builder
→ FormFieldBuilder<
double> -
Function that returns the widget representing this form field. It is
passed the form field state as input, containing the current value and
validation state of this field.
finalinherited
- controller → TextEditingController?
-
Text field controller.
final
- direction → Axis
-
Specifies the orientation of the bar.
final
- emptyErrorText → String?
-
Error text. Only displayed if no characters are entered.
final
- enabled → bool
-
Whether the form is able to receive user input.
finalinherited
-
form
→ FormController<
TValue> ? -
Context for forms.
final
- format → String
-
Specify the format for text in showLabel and controller.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Widget?
-
Specify the widget for the icon.
final
- iconBuilder → (Widget Function(BuildContext context, int index)?)
-
Builder if you want to change the icon according to the value of
index
.final - iconCount → int
-
Specify the number of icons to be placed.
final
- iconSize → double
-
Specifies the size of the icon.
final
- inactiveColor → Color?
-
Specifies the color of the star when inactive.
final
- initialValue → double?
-
An optional value to initialize the form field to, or null otherwise.
finalinherited
- keepAlive → bool
-
If placed in a list, whether or not it should not be discarded on scrolling.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- max → double?
-
Specifies the maximum value.
final
- min → double?
-
Specifies the minimum value.
final
- onChanged → (void Function(double? value)?)
-
Callback to be executed each time the value is changed.
final
-
onSaved
→ FormFieldSetter<
double> ? -
An optional method to call with the final value when the form is saved via
FormState.save.
finalinherited
- readOnly → bool
-
If this is
true
, the form cannot be filled out and changed from its initial value.final - restorationId → String?
-
Restoration ID to save and restore the state of the form field.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLabel → bool
-
If specified, actual values can be displayed as numerical values.
final
- style → FormStyle?
-
Form Style.
final
- tapOnlyMode → bool
-
Normally, the value can be changed by dragging, but tapOnlyMode allows the value to be specified only by tapping.
final
-
validator
→ FormFieldValidator<
double> ? -
An optional method that validates an input. Returns an error string to
display if the input is invalid, or null otherwise.
finalinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → FormFieldState< double> -
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