diff --git a/lib/components/kanjiSearch/kanji_search_card.dart b/lib/components/kanjiSearch/kanji_search_card.dart index 2b099f1..ad5ce76 100644 --- a/lib/components/kanjiSearch/kanji_search_card.dart +++ b/lib/components/kanjiSearch/kanji_search_card.dart @@ -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; - } - -} \ No newline at end of file + KanjiResultCard(this._result); +} diff --git a/lib/main.dart b/lib/main.dart index 738277d..c9f8585 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ List navBar = [ ), BottomNavigationBarItem( title: Text('Memorize'), - icon: Icon(Icons.book) + icon: Icon(Icons.local_offer) ), BottomNavigationBarItem( title: Text('Settings'), diff --git a/lib/screens/kanji_search.dart b/lib/screens/kanji_search.dart index c9d58b2..0413db4 100644 --- a/lib/screens/kanji_search.dart +++ b/lib/screens/kanji_search.dart @@ -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], + ); } - -} \ No newline at end of file +} diff --git a/lib/services/jisho_search.dart b/lib/services/jisho_search.dart index c0c2b1f..9004266 100644 --- a/lib/services/jisho_search.dart +++ b/lib/services/jisho_search.dart @@ -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 snapshot) { - if (snapshot.hasData) { - return KanjiResultCard(snapshot.data); - } else if (snapshot.hasError) { - throw 'ASYNC ERROR'; - } else { - return CircularProgressIndicator(); - } - } - ); -} \ No newline at end of file + future: jisho.searchForKanji(kanji), + builder: + (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.hasData) { + return KanjiResultCard(snapshot.data); + } else if (snapshot.hasError) { + throw 'ASYNC ERROR'; + } else { + return Center( + child: CircularProgressIndicator(), + ); + } + }); +}