Add meaning widget

This commit is contained in:
Oystein Kristoffer Tveit 2020-07-16 14:08:51 +02:00
parent e254d128a3
commit a695c3f106
2 changed files with 30 additions and 1 deletions

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; 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; import 'package:unofficial_jisho_api/api.dart' as jisho;
import './grade.dart'; import './grade.dart';
import './header.dart'; import './header.dart';
import './jlpt_level.dart'; import './jlpt_level.dart';
import './meaning.dart';
import './radical.dart'; import './radical.dart';
import './rank.dart'; import './rank.dart';
import './stroke_order_gif.dart'; import './stroke_order_gif.dart';
@ -44,6 +44,7 @@ class KanjiResultCard extends StatelessWidget {
], ],
), ),
), ),
Meaning(_result.meaning),
_result.onyomi.length != 0 ? Onyomi(_result.onyomi) : SizedBox.shrink(), _result.onyomi.length != 0 ? Onyomi(_result.onyomi) : SizedBox.shrink(),
_result.kunyomi.length != 0 ? Kunyomi(_result.kunyomi) : SizedBox.shrink(), _result.kunyomi.length != 0 ? Kunyomi(_result.kunyomi) : SizedBox.shrink(),
IntrinsicHeight( IntrinsicHeight(

View File

@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
class Meaning extends StatelessWidget {
String _meaning;
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 5.0,
),
alignment: Alignment.centerLeft,
child: Wrap(
runSpacing: 10.0,
children: _meaning
.split(',')
.map((meaning) => Container(
margin: EdgeInsets.symmetric(horizontal: 10.0),
child: Text(meaning),
))
.toList(),
),
);
}
Meaning(this._meaning);
}