build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Build the widget.

Implementation

@override
Widget build(final BuildContext context) {
  final getSearchStringFunction = getSearchString;
  final getWidgetFunction = getWidget;
  return Cancel(
    child: SimpleScaffold(
      actions: actions,
      title: title,
      body: BuiltSearchableListView<T>(
        items: values,
        builder: (final context, final index) {
          final item = values[index];
          final listTile = ListTile(
            autofocus: item == value || (value == null && index == 0),
            selected: item == value,
            title: getWidgetFunction == null
                ? Text(item.toString())
                : getWidgetFunction(item),
            onTap: () {
              if (shouldPop) {
                Navigator.pop(context);
              }
              onDone(
                item,
              );
            },
          );
          final bindings = getCallbackShortcuts?.call(item);
          return SearchableListTile(
            searchString:
                getSearchStringFunction?.call(item) ?? item.toString(),
            child: bindings == null
                ? listTile
                : CallbackShortcuts(
                    bindings: bindings,
                    child: listTile,
                  ),
          );
        },
      ),
    ),
  );
}