Jisho-Study-Tool/lib/bloc/kanji/kanji_state.dart

43 lines
831 B
Dart
Raw Normal View History

2020-07-13 15:18:17 +02:00
import 'package:unofficial_jisho_api/api.dart';
2020-07-09 20:06:48 +02:00
2020-07-13 15:18:17 +02:00
abstract class KanjiState {
const KanjiState();
}
2020-07-09 20:06:48 +02:00
2021-07-17 12:19:03 +02:00
enum KanjiSearchType {
Initial,
Keyboard,
Drawing,
Radical,
Grade
}
2021-07-17 12:19:03 +02:00
class KanjiSearch extends KanjiState {
final KanjiSearchType type;
const KanjiSearch(this.type);
}
class KanjiSearchKeyboard extends KanjiSearch {
final List<String> kanjiSuggestions;
2021-07-17 12:19:03 +02:00
const KanjiSearchKeyboard(KanjiSearchType type, this.kanjiSuggestions) : super(type);
2020-07-13 15:18:17 +02:00
}
2020-07-09 20:06:48 +02:00
2020-07-13 15:18:17 +02:00
class KanjiSearchLoading extends KanjiState {
const KanjiSearchLoading();
2020-07-13 15:18:17 +02:00
}
2020-07-09 20:06:48 +02:00
2020-07-13 15:18:17 +02:00
class KanjiSearchFinished extends KanjiState {
final KanjiResult kanji;
2020-07-14 14:57:03 +02:00
final bool starred;
2020-07-09 20:06:48 +02:00
const KanjiSearchFinished({
2020-07-14 14:57:03 +02:00
this.kanji,
this.starred = false,
});
2020-07-13 15:18:17 +02:00
}
class KanjiSearchError extends KanjiState {
final String message;
const KanjiSearchError(this.message);
}