CustomSelector class
A customizable selector widget that fetches items from a Future and allows selection.
Example usage with defaultItem:
CustomSelector(
future: apiService.getCategories(),
label: 'Select Category',
itemDisplayProperty: (item) => item.name,
defaultItem: selectedCategory, // Pre-select an item
onSelect: (item) {
setState(() {
selectedCategory = item;
});
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- CustomSelector
Constructors
- CustomSelector.new({Key? key, required Future future, Widget? leading, required ValueSetter onSelect, required String label, bool showUpperLabel = true, bool showValueOnSide = true, double fontSize = 16, double valueFontSize = 14, double headerFontSize = 18, double listItemFontSize = 16, required String itemDisplayProperty(dynamic), String itemImageProperty(dynamic)?, Color? labelColor, bool imageHasTint = false, Color? headerStartColor, Color? headerEndColor, Color? primaryColor, Color? headerTitleColor, Color? backgroundColor, Color? bottomsheetBackground, Color? borderColor, double? borderRadius, Color? dividerColor, Widget? header, VoidCallback? onAdd, double marginBottom = SizeConfig.sidePadding, dynamic defaultItem})
-
const
Properties
- backgroundColor → Color?
-
final
- borderColor → Color?
-
final
- borderRadius → double?
-
final
- bottomsheetBackground → Color?
-
final
- defaultItem → dynamic
-
The default item to be selected when the widget is initialized.
If provided, this item will be displayed as selected immediately,
and the onSelect callback will be triggered after the first frame.
final
- dividerColor → Color?
-
final
- fontSize → double
-
final
- future → Future
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- header → Widget?
-
final
- headerEndColor → Color?
-
final
- headerFontSize → double
-
final
- headerStartColor → Color?
-
final
- headerTitleColor → Color?
-
final
- imageHasTint → bool
-
final
- itemDisplayProperty → String Function(dynamic)
-
final
- itemImageProperty → String Function(dynamic)?
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String
-
final
- labelColor → Color?
-
final
- leading → Widget?
-
final
- listItemFontSize → double
-
final
- marginBottom → double
-
final
- onAdd → VoidCallback?
-
final
- onSelect → ValueSetter
-
final
- primaryColor → Color?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showUpperLabel → bool
-
final
- showValueOnSide → bool
-
final
- valueFontSize → double
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< CustomSelector> -
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, int wrapWidth = 65}) → 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