PickerAdapter<T> class abstract

Abstract base class for picker data adapters.

PickerAdapter defines the interface that all picker data sources must implement. Different adapters provide different types of data and behaviors:

Custom Adapters

You can create custom adapters by extending this class:

class MyCustomAdapter extends PickerAdapter<MyDataType> {
  @override
  int getLength() => myData.length;
  
  @override
  int getMaxLevel() => 1;
  
  @override
  Widget buildItem(BuildContext context, int index) {
    return Text(myData[index].toString());
  }
  
  // ... implement other required methods
}

See also:

Implementers

Constructors

PickerAdapter.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
isLinkage bool
no setter
length int
Content length of current column
no setter
maxLevel int
no setter
picker Picker?
Reference to the picker widget using this adapter.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
text String
no setter

Methods

buildItem(BuildContext context, int index) Widget
Builds the widget for a specific item in the current column.
doSelect(int column, int index) → void
doShow() → void
getColumnFlex(int column) int
getIsLinkage() bool
getLength() int
Returns the number of items in the current column.
getMaxLevel() int
Returns the maximum number of columns (levels) this adapter supports.
getSelectedValues() List<T>
getText() String
initSelects() → void
Initializes the selected indices for all columns.
makeText(Widget? child, String? text, bool isSel) Widget
makeTextEx(Widget? child, String text, Widget? postfix, Widget? suffix, bool isSel) Widget
needUpdatePrev(int curIndex) bool
Need to update previous columns
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyDataChanged() → void
Notify adapter of data changes
setColumn(int index) → void
Sets the active column for subsequent operations.
toString() String
A string representation of this object.
override

Operators

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