mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-21 13:37:29 +01:00
Update
This commit is contained in:
parent
ac346eb25c
commit
f0d8aabe0f
@ -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('谷');
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user