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
c90fbc2fee
commit
0b7dd30505
@ -3,21 +3,38 @@ import 'package:flutter/material.dart';
|
||||
import 'package:unofficial_jisho_api/api.dart';
|
||||
|
||||
class KanjiResultCard extends StatelessWidget {
|
||||
|
||||
KanjiResult _result;
|
||||
final KanjiResult _result;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 100,
|
||||
width: 100,
|
||||
child: Center(child:Text(_result.query)),
|
||||
color: Colors.amber,
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Center(
|
||||
child: Text(_result.query),
|
||||
),
|
||||
height: 50.0,
|
||||
margin: EdgeInsets.symmetric(
|
||||
horizontal: 20.0,
|
||||
vertical: 20.0,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
color: Colors.white,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 1,
|
||||
offset: Offset(2, 2), // changes position of shadow
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
KanjiResultCard(KanjiResult result) {
|
||||
this._result = result;
|
||||
}
|
||||
|
||||
}
|
||||
KanjiResultCard(this._result);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ List<BottomNavigationBarItem> navBar = [
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
title: Text('Memorize'),
|
||||
icon: Icon(Icons.book)
|
||||
icon: Icon(Icons.local_offer)
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
title: Text('Settings'),
|
||||
|
@ -2,10 +2,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:jisho_study_tool/services/jisho_search.dart';
|
||||
|
||||
class KanjiSearch extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return searchForKanji('谷');
|
||||
final kanjiCard = searchForKanji('谷');
|
||||
return Column(
|
||||
children: [kanjiCard],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,15 +5,17 @@ import 'package:jisho_study_tool/components/kanjiSearch/kanji_search_card.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 CircularProgressIndicator();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
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(),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user