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-07-09 22:17:10 +02:00
parent 8dab9e5cb9
commit 1f0b3c24c2
11 changed files with 188 additions and 55 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)
),
),
);
}

View File

@ -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<Page> 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",

View File

@ -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('');
}
}

View File

@ -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(),
);
}
}

View File

@ -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(),
],
);
}
}

View File

@ -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(

View File

@ -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"

View File

@ -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: