buildDictionary method

Widget buildDictionary()

Build a dictionary showing the result with positioning. If the result is null, show nothing.

Implementation

Widget buildDictionary() {
  return Theme(
    data: appModel.overrideDictionaryTheme ?? theme,
    child: MultiValueListenableBuilder(
      valueListenables: [
        _popupPositionNotifier,
      ],
      builder: (context, result, _) {
        if (!_isSearchingNotifier.value &&
            _dictionaryResultNotifier.value == null) {
          return const SizedBox.shrink();
        }

        switch (_popupPositionNotifier.value) {
          case null:
            return const SizedBox.shrink();
          case JidoujishoPopupPosition.topHalf:
            return buildTopHalfDictionary();

          case JidoujishoPopupPosition.bottomHalf:
            return buildBottomHalfDictionary();

          case JidoujishoPopupPosition.leftHalf:
            return buildLeftHalfDictionary();

          case JidoujishoPopupPosition.rightHalf:
            return buildRightHalfDictionary();

          case JidoujishoPopupPosition.topThreeFourths:
            return buildTopThreeFourths();
        }
      },
    ),
  );
}