mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-12 18:01:50 +01:00
22 lines
649 B
Dart
22 lines
649 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
|
|
|
import 'package:jisho_study_tool/components/kanji/kanji_search_page.dart';
|
|
|
|
Widget searchForKanji(String kanji) {
|
|
return FutureBuilder(
|
|
future: jisho.searchForKanji(kanji),
|
|
builder:
|
|
(BuildContext context, AsyncSnapshot<jisho.KanjiResult> snapshot) {
|
|
if (snapshot.hasData) {
|
|
return KanjiResultCard(snapshot.data);
|
|
} else if (snapshot.hasError) {
|
|
throw 'ASYNC ERROR';
|
|
} else {
|
|
return Center(
|
|
child: CircularProgressIndicator(),
|
|
);
|
|
}
|
|
});
|
|
}
|