show<T extends Object> static method
- required BuildContext context,
- required List<
T> items, - required Widget itemBuilder(
- T data
- Widget buttonBuilder(
- int i,
- T data
- void onSelected(
- T
- GlobalKey<
State< ? buttonKey,StatefulWidget> > - Alignment alignment = Alignment.topCenter,
- Duration? debounce,
- double width = 260,
- EdgeInsets margin = EdgeInsets.zero,
- T? initial,
- void onPointerUp()? = _popNavigator,
Displays a Selector wrapped in a modal popup.
Implementation
static Future<T?> show<T extends Object>({
required BuildContext context,
required List<T> items,
required Widget Function(T data) itemBuilder,
Widget Function(int i, T data)? buttonBuilder,
void Function(T)? onSelected,
GlobalKey? buttonKey,
Alignment alignment = Alignment.topCenter,
Duration? debounce,
double width = 260,
EdgeInsets margin = EdgeInsets.zero,
T? initial,
void Function(BuildContext)? onPointerUp = _popNavigator,
}) {
final bool isMobile = context.isMobile;
Widget builder(BuildContext context) {
return Selector<T>(
debounce: debounce,
initial: initial,
items: items,
itemBuilder: itemBuilder,
buttonBuilder: buttonBuilder,
onSelected: onSelected,
buttonKey: buttonKey,
alignment: alignment,
width: width,
margin: margin,
isMobile: isMobile,
onPointerUp: onPointerUp,
);
}
final style = Theme.of(context).style;
return showDialog(
context: context,
barrierColor: style.colors.transparent,
useSafeArea: false,
builder: builder,
);
}