buildPopover method

Widget buildPopover(
  1. BuildContext context
)

Implementation

Widget buildPopover(BuildContext context) {
  final theme = Theme.of(context);
  return TextFieldTapRegion(
    child: Data.inherit(
      data: this,
      child: ConstrainedBox(
        constraints: widget.popoverConstraints,
        child: OutlinedContainer(
          child: AnimatedBuilder(
              animation:
                  Listenable.merge([_suggestions, _selectedSuggestions]),
              builder: (context, child) {
                return ListView(
                    shrinkWrap: true,
                    padding: EdgeInsets.all(theme.scaling * 4),
                    children: [
                      for (int i = 0; i < _suggestions.value.length; i++)
                        SelectedButton(
                          style: const ButtonStyle.ghost(),
                          selectedStyle: const ButtonStyle.secondary(),
                          value: i == _selectedSuggestions.value,
                          onChanged: (value) {
                            if (value) {
                              widget.onSuggestionChoosen?.call(i);
                            }
                          },
                          child: widget.suggestionBuilder
                                  ?.call(context, _suggestions.value[i]) ??
                              Text(_suggestions.value[i].toString()),
                        ),
                    ]);
              }),
        ),
      ),
    ),
  );
}