2021-07-17 12:19:03 +02:00
|
|
|
|
2020-07-11 13:33:31 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:unofficial_jisho_api/api.dart' as jisho;
|
|
|
|
|
2021-07-17 12:19:03 +02:00
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/grade.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/header.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/jlpt_level.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/meaning.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/radical.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/rank.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/stroke_order_gif.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/onyomi.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/kunyomi.dart';
|
|
|
|
import 'package:jisho_study_tool/view/components/kanji/result/examples.dart';
|
2020-07-11 13:33:31 +02:00
|
|
|
|
|
|
|
class KanjiResultCard extends StatelessWidget {
|
2021-03-03 00:24:25 +01:00
|
|
|
final jisho.KanjiResult result;
|
2020-07-11 13:33:31 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2020-07-16 22:11:23 +02:00
|
|
|
return ListView(
|
2020-07-11 13:33:31 +02:00
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 30.0),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
Flexible(
|
|
|
|
flex: 1,
|
|
|
|
fit: FlexFit.tight,
|
|
|
|
child: Center(child: SizedBox()),
|
|
|
|
),
|
|
|
|
Flexible(
|
|
|
|
flex: 1,
|
|
|
|
fit: FlexFit.tight,
|
2021-03-03 00:24:25 +01:00
|
|
|
child: Center(child: Header(result.query)),
|
2020-07-11 13:33:31 +02:00
|
|
|
),
|
|
|
|
Flexible(
|
|
|
|
flex: 1,
|
|
|
|
fit: FlexFit.tight,
|
|
|
|
child: Center(
|
2021-03-03 00:24:25 +01:00
|
|
|
child: Radical(result.radical),
|
2020-07-11 13:33:31 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2021-03-03 00:24:25 +01:00
|
|
|
Meaning(result.meaning),
|
|
|
|
result.onyomi.length != 0 ? Onyomi(result.onyomi) : SizedBox.shrink(),
|
|
|
|
result.kunyomi.length != 0 ? Kunyomi(result.kunyomi) : SizedBox.shrink(),
|
2020-07-11 13:33:31 +02:00
|
|
|
IntrinsicHeight(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
2021-03-03 00:24:25 +01:00
|
|
|
StrokeOrderGif(result.strokeOrderGifUri),
|
2020-07-11 13:33:31 +02:00
|
|
|
Container(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text("JLPT: ", style: TextStyle(fontSize: 20.0)),
|
2021-03-03 00:24:25 +01:00
|
|
|
JlptLevel(result.jlptLevel ?? "⨉"),
|
2020-07-11 13:33:31 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text("Grade: ", style: TextStyle(fontSize: 20.0)),
|
2021-03-03 00:24:25 +01:00
|
|
|
Grade(result.taughtIn ?? "⨉"),
|
2020-07-11 13:33:31 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text("Rank: ", style: TextStyle(fontSize: 20.0)),
|
2021-03-03 00:24:25 +01:00
|
|
|
Rank(result.newspaperFrequencyRank ?? -1),
|
2020-07-11 13:33:31 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2021-03-03 00:24:25 +01:00
|
|
|
Examples(result.onyomiExamples, result.kunyomiExamples),
|
2020-07-11 13:33:31 +02:00
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-03-03 00:24:25 +01:00
|
|
|
KanjiResultCard(this.result);
|
2021-07-17 12:19:03 +02:00
|
|
|
}
|