Fix jlpt level
This commit is contained in:
parent
c88193cfb2
commit
57f7fbf258
|
@ -47,6 +47,13 @@ class _SearchResultCardState extends State<SearchResultCard> {
|
||||||
widget.result.attribution.jmnedict ||
|
widget.result.attribution.jmnedict ||
|
||||||
(widget.result.attribution.dbpedia != null);
|
(widget.result.attribution.dbpedia != null);
|
||||||
|
|
||||||
|
String? get jlptLevel {
|
||||||
|
if (widget.result.jlpt.isEmpty) return null;
|
||||||
|
final jlpt = List.from(widget.result.jlpt);
|
||||||
|
jlpt.sort();
|
||||||
|
return jlpt.last;
|
||||||
|
}
|
||||||
|
|
||||||
Widget get _header => IntrinsicWidth(
|
Widget get _header => IntrinsicWidth(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
@ -60,11 +67,7 @@ class _SearchResultCardState extends State<SearchResultCard> {
|
||||||
orElse: () => '',
|
orElse: () => '',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// TODO: find the lowest level in the list.
|
JLPTBadge(jlptLevel: jlptLevel),
|
||||||
JLPTBadge(
|
|
||||||
jlptLevel:
|
|
||||||
widget.result.jlpt.isEmpty ? null : widget.result.jlpt[0],
|
|
||||||
),
|
|
||||||
CommonBadge(isCommon: widget.result.isCommon ?? false)
|
CommonBadge(isCommon: widget.result.isCommon ?? false)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -83,22 +86,18 @@ class _SearchResultCardState extends State<SearchResultCard> {
|
||||||
AudioPlayer(audio: extendedData.audio.first),
|
AudioPlayer(audio: extendedData.audio.first),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
],
|
],
|
||||||
|
|
||||||
Senses(
|
Senses(
|
||||||
senses: widget.result.senses,
|
senses: widget.result.senses,
|
||||||
extraData: extendedData?.meanings,
|
extraData: extendedData?.meanings,
|
||||||
),
|
),
|
||||||
|
|
||||||
if (widget.otherForms.isNotEmpty) ...[
|
if (widget.otherForms.isNotEmpty) ...[
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
OtherForms(forms: widget.otherForms),
|
OtherForms(forms: widget.otherForms),
|
||||||
],
|
],
|
||||||
|
|
||||||
if (extendedData != null && extendedData.notes.isNotEmpty) ...[
|
if (extendedData != null && extendedData.notes.isNotEmpty) ...[
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Notes(notes: extendedData.notes),
|
Notes(notes: extendedData.notes),
|
||||||
],
|
],
|
||||||
|
|
||||||
if (links.isNotEmpty || hasAttribution) ...[
|
if (links.isNotEmpty || hasAttribution) ...[
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Links(
|
Links(
|
||||||
|
|
Loading…
Reference in New Issue