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
|
2020-07-21 23:29:02 +02:00
|
|
|
}
|
|
|
|
|
2021-07-17 12:19:03 +02:00
|
|
|
class KanjiSearch extends KanjiState {
|
|
|
|
final KanjiSearchType type;
|
|
|
|
const KanjiSearch(this.type);
|
|
|
|
}
|
|
|
|
|
|
|
|
class KanjiSearchKeyboard extends KanjiSearch {
|
2020-07-21 23:29:02 +02:00
|
|
|
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 {
|
2020-07-21 23:29:02 +02:00
|
|
|
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
|
|
|
|
2020-07-21 23:29:02 +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;
|
|
|
|
|
2020-07-21 23:29:02 +02:00
|
|
|
const KanjiSearchError(this.message);
|
|
|
|
}
|