1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-21 13:37:29 +01:00
This commit is contained in:
Oystein Kristoffer Tveit 2020-06-30 16:27:19 +02:00
parent ac346eb25c
commit f0d8aabe0f
2 changed files with 10 additions and 15 deletions

View File

@ -1,20 +1,11 @@
import 'package:flutter/material.dart';
import 'package:jisho_study_tool/components/kanjiSearch/kanji_search_card.dart';
import 'package:jisho_study_tool/services/jisho_search.dart';
class KanjiSearch extends StatefulWidget {
class KanjiSearch extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [searchKanji('')],
);
}
@override
State<StatefulWidget> createState() {
// TODO: implement createState
throw UnimplementedError();
return searchForKanji('');
}
}

View File

@ -1,9 +1,13 @@
import 'package:flutter/material.dart';
import 'package:unofficial_jisho_api/api.dart';
import 'package:unofficial_jisho_api/api.dart' as jisho;
import 'package:jisho_study_tool/components/kanjiSearch/kanji_search_card.dart';
Future<Widget> searchKanji(String kanji) async {
KanjiResult result = await searchForKanji(kanji);
return KanjiResultCard(result);
Widget searchForKanji(String kanji) {
return FutureBuilder(
future: jisho.searchForKanji(kanji),
builder: (BuildContext context, AsyncSnapshot<jisho.KanjiResult> snapshot) {
return KanjiResultCard(snapshot.data);
}
);
}