getCurrentSentence method

JidoujishoTextSelection getCurrentSentence()

Get the sentence to be used by the SentenceField upon card creation.

Implementation

JidoujishoTextSelection getCurrentSentence() {
  if (isMediaOpen) {
    return _currentMediaSource!.currentSentence;
  } else {
    MediaType mediaType = mediaTypes.values.toList()[currentHomeTabIndex];
    if (mediaType is DictionaryMediaType) {
      return JidoujishoTextSelection(
        text: '',
      );
    } else {
      return (_currentMediaSource ??
              (getCurrentSourceForMediaType(mediaType: mediaType)))
          .currentSentence;
    }
  }
}