1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-21 13:37:29 +01:00

Add layout to yomi

This commit is contained in:
Oystein Kristoffer Tveit 2020-07-14 15:39:31 +02:00
parent 45119e2a34
commit 0bd4dad772
3 changed files with 69 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:jisho_study_tool/components/kanji/kanji__search_page/kunyomi.dart';
import 'package:unofficial_jisho_api/api.dart' as jisho;
@ -8,6 +9,8 @@ import './jlpt_level.dart';
import './radical.dart';
import './rank.dart';
import './stroke_order_gif.dart';
import './onyomi.dart';
import './kunyomi.dart';
class KanjiResultCard extends StatelessWidget {
final jisho.KanjiResult _result;
@ -41,6 +44,8 @@ class KanjiResultCard extends StatelessWidget {
],
),
),
_result.onyomi.length != 0 ? Onyomi(_result.onyomi) : SizedBox.shrink(),
_result.kunyomi.length != 0 ? Kunyomi(_result.kunyomi) : SizedBox.shrink(),
IntrinsicHeight(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,

View File

@ -1,10 +1,41 @@
import 'package:flutter/material.dart';
class Kunyomi extends StatelessWidget {
final List<String> _kunyomi;
@override
Widget build(BuildContext context) {
return Container(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 5.0,
),
child: Row(
children: _kunyomi.map((onyomi) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 10.0),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 10.0,
),
child: Text(
onyomi,
style: TextStyle(
fontSize: 20.0,
color: Colors.white,
),
),
decoration: BoxDecoration(
color: Colors.lightBlue,
borderRadius: BorderRadius.circular(10.0),
),
);
}).toList(),
),
),
);
}
}
Kunyomi(this._kunyomi);
}

View File

@ -1,10 +1,39 @@
import 'package:flutter/material.dart';
class Onyomi extends StatelessWidget {
final List<String> _onyomi;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 5.0,
),
child: Row(
children: _onyomi.map((onyomi) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 10.0),
padding: EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 10.0,
),
child: Text(
onyomi,
style: TextStyle(
fontSize: 20.0,
color: Colors.white,
),
),
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.circular(10.0),
),
);
}).toList(),
),
);
}
}
Onyomi(this._onyomi);
}