buildSearchResult method

Widget buildSearchResult()

Displays the dictionary entries.

Implementation

Widget buildSearchResult() {
  return ValueListenableBuilder(
    valueListenable: _dictionaryResultNotifier,
    builder: (_, __, ___) {
      if (_dictionaryResultNotifier.value == null) {
        return SizedBox(
          height: double.infinity,
          width: double.infinity,
          child: Card(
            color: appModel.overrideDictionaryColor
                    ?.withOpacity(dictionaryEntryOpacity) ??
                (Theme.of(context).brightness == Brightness.dark
                    ? Color.fromRGBO(16, 16, 16, dictionaryEntryOpacity)
                    : Color.fromRGBO(249, 249, 249, dictionaryEntryOpacity)),
            elevation: 0,
            shape: const RoundedRectangleBorder(),
            child: Column(
              children: [Container()],
            ),
          ),
        );
      }

      if (_dictionaryResultNotifier.value!.headings.isEmpty) {
        return buildNoSearchResultsPlaceholderMessage();
      }

      return DictionaryResultPage(
        cardColor: appModel.overrideDictionaryColor,
        opacity: dictionaryEntryOpacity,
        key: ValueKey(_dictionaryResultNotifier.value),
        onSearch: onSearch,
        onStash: onStash,
        onShare: onShare,
        result: _dictionaryResultNotifier.value!,
        spaceBeforeFirstResult: false,
      );
    },
  );
}