Jisho-Study-Tool/lib/components/kanji/kanji__search_page/kanji_search_page.dart

92 lines
2.8 KiB
Dart
Raw Normal View History

2020-07-11 13:33:31 +02:00
import 'package:flutter/material.dart';
import 'package:jisho_study_tool/components/kanji/kanji__search_page/examples.dart';
2020-07-11 13:33:31 +02:00
import 'package:unofficial_jisho_api/api.dart' as jisho;
import './grade.dart';
import './header.dart';
import './jlpt_level.dart';
2020-07-16 14:08:51 +02:00
import './meaning.dart';
2020-07-11 13:33:31 +02:00
import './radical.dart';
import './rank.dart';
import './stroke_order_gif.dart';
2020-07-14 15:39:31 +02:00
import './onyomi.dart';
import './kunyomi.dart';
2020-07-11 13:33:31 +02:00
class KanjiResultCard extends StatelessWidget {
final jisho.KanjiResult _result;
@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,
child: Center(child: Header(_result.query)),
),
Flexible(
flex: 1,
fit: FlexFit.tight,
child: Center(
child: Radical(_result.radical),
),
),
],
),
),
2020-07-16 14:08:51 +02:00
Meaning(_result.meaning),
2020-07-14 15:39:31 +02:00
_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: [
StrokeOrderGif(_result.strokeOrderGifUri),
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text("JLPT: ", style: TextStyle(fontSize: 20.0)),
JlptLevel(_result.jlptLevel ?? ""),
],
),
Row(
children: [
Text("Grade: ", style: TextStyle(fontSize: 20.0)),
Grade(_result.taughtIn ?? ""),
],
),
Row(
children: [
Text("Rank: ", style: TextStyle(fontSize: 20.0)),
Rank(_result.newspaperFrequencyRank ?? -1),
],
),
],
),
),
],
),
),
Examples(_result.onyomiExamples, _result.kunyomiExamples),
2020-07-11 13:33:31 +02:00
],
);
}
KanjiResultCard(this._result);
}