selectionOverlayBuilder property
A function that returns a widget that is overlaid on the picker to highlight the currently selected entry.
If unspecified, it defaults to a CupertinoPickerDefaultSelectionOverlay which is a gray rounded rectangle overlay in iOS 14 style.
If the selection overlay builder returns null, no overlay will be drawn.
{@tool snippet}
This example shows how to recreate the default selection overlay with selectionOverlayBuilder.
PersianCupertinoDatePicker(
onDateTimeChanged: (Jalali newDateTime) {},
mode: PersianCupertinoDatePickerMode.date,
initialDateTime: Jalali(2018, 9, 15),
selectionOverlayBuilder: (
BuildContext context, {
required int selectedIndex,
required int columnCount,
}) {
if (selectedIndex == 0) {
return const CupertinoPickerDefaultSelectionOverlay(
capEndEdge: false,
);
} else if (selectedIndex == columnCount - 1) {
return const CupertinoPickerDefaultSelectionOverlay(
capStartEdge: false,
);
}
return const CupertinoPickerDefaultSelectionOverlay(
capStartEdge: false,
capEndEdge: false,
);
},
)
{@end-tool}
Implementation
final SelectionOverlayBuilder? selectionOverlayBuilder;