diff --git a/lib/components/kanji/kanji_search_card.dart b/lib/components/kanji/kanji_search_card.dart deleted file mode 100644 index ad5ce76..0000000 --- a/lib/components/kanji/kanji_search_card.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:unofficial_jisho_api/api.dart'; - -class KanjiResultCard extends StatelessWidget { - final KanjiResult _result; - - @override - Widget build(BuildContext context) { - 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(this._result); -} diff --git a/lib/components/kanji/kanji_search_page.dart b/lib/components/kanji/kanji_search_page.dart new file mode 100644 index 0000000..e99b0a5 --- /dev/null +++ b/lib/components/kanji/kanji_search_page.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +import 'package:unofficial_jisho_api/api.dart'; + +class _Header extends StatelessWidget { + final String _kanji; + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.symmetric(vertical: 20.0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), color: Colors.blue), + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Text( + _kanji, + style: TextStyle(fontSize: 70.0, color: Colors.white), + ), + ), + ); + } + + _Header(this._kanji); +} + +class KanjiResultCard extends StatelessWidget { + final KanjiResult _result; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [_Header(_result.query)], + ), + ], + ); + } + + KanjiResultCard(this._result); +} diff --git a/lib/components/search/search_card.dart b/lib/components/search/search_card.dart index e69de29..383efc8 100644 --- a/lib/components/search/search_card.dart +++ b/lib/components/search/search_card.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; + +import 'package:unofficial_jisho_api/api.dart'; + +class SearchResultCard extends StatelessWidget { + final JishoResult _result; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: Container( + child: Center( + child: Text(_result.toJson().toString()), + ), + 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 + ) + ]), + ), + ), + ], + ); + } + + SearchResultCard(this._result); +} + diff --git a/lib/components/search_bar.dart b/lib/components/search_bar.dart index 6c2fb33..f7e916c 100644 --- a/lib/components/search_bar.dart +++ b/lib/components/search_bar.dart @@ -6,11 +6,15 @@ class SearchBar extends StatelessWidget { @override Widget build(BuildContext context) { - return TextField( - controller: TextEditingController(), - decoration: InputDecoration( - labelText: 'Search', - border: OutlineInputBorder() + return Container( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: TextField( + controller: TextEditingController(), + decoration: InputDecoration( + labelText: 'Search', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0) + ), ), ); } diff --git a/lib/main.dart b/lib/main.dart index 96d3a2a..479d717 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:jisho_study_tool/screens/kanji_search.dart'; +import 'package:jisho_study_tool/screens/log.dart'; +import 'package:jisho_study_tool/screens/search.dart'; void main() => runApp(MyApp()); @@ -86,15 +88,15 @@ class Page { List pages = [ Page( title: "Search", - content: Container(), + content: SearchView(), ), Page( title: "Kanji", - content: KanjiSearch(), + content: KanjiView(), ), Page( title: "Log", - content: Container(), + content: LogView(), ), Page( title: "Memorization", diff --git a/lib/screens/kanji_search.dart b/lib/screens/kanji_search.dart index 0413db4..5963b7f 100644 --- a/lib/screens/kanji_search.dart +++ b/lib/screens/kanji_search.dart @@ -1,12 +1,9 @@ import 'package:flutter/material.dart'; import 'package:jisho_study_tool/services/jisho_search.dart'; -class KanjiSearch extends StatelessWidget { +class KanjiView extends StatelessWidget { @override Widget build(BuildContext context) { - final kanjiCard = searchForKanji('谷'); - return Column( - children: [kanjiCard], - ); + return searchForKanji('谷'); } } diff --git a/lib/screens/log.dart b/lib/screens/log.dart index e69de29..2718588 100644 --- a/lib/screens/log.dart +++ b/lib/screens/log.dart @@ -0,0 +1,10 @@ +import 'package:flutter/material.dart'; + +class LogView extends StatelessWidget { + @override + Widget build(BuildContext context) { + return ListView.builder( + itemBuilder: (context, index) => ListTile(), + ); + } +} diff --git a/lib/screens/search.dart b/lib/screens/search.dart index e69de29..fbf9b9f 100644 --- a/lib/screens/search.dart +++ b/lib/screens/search.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; +import 'package:jisho_study_tool/components/search_bar.dart'; + +class SearchView extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SearchBar(), + ], + ); + } +} \ No newline at end of file diff --git a/lib/services/jisho_search.dart b/lib/services/jisho_search.dart index 95044f9..055c546 100644 --- a/lib/services/jisho_search.dart +++ b/lib/services/jisho_search.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:unofficial_jisho_api/api.dart' as jisho; -import 'package:jisho_study_tool/components/kanji/kanji_search_card.dart'; +import 'package:jisho_study_tool/components/kanji/kanji_search_page.dart'; Widget searchForKanji(String kanji) { return FutureBuilder( diff --git a/pubspec.lock b/pubspec.lock index b904e8c..5f2e93d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -95,6 +95,11 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" html: dependency: transitive description: @@ -158,6 +163,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0+1" + platform_detect: + dependency: transitive + description: + name: platform_detect + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" provider: dependency: transitive description: @@ -165,6 +184,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.3.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" sky_engine: dependency: transitive description: flutter @@ -226,6 +252,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.5.0" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+7" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.7" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" vector_math: dependency: transitive description: @@ -235,4 +296,4 @@ packages: version: "2.0.8" sdks: dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.16.0" + flutter: ">=1.16.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 26113cb..7b108ef 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,6 +25,7 @@ dependencies: # cupertino_icons: ^0.1.2 unofficial_jisho_api: ^1.1.0 flutter_bloc: ^5.0.1 + url_launcher: ^5.5.0 dev_dependencies: flutter_test: