Jisho-Study-Tool/lib/components/search/search_results_body/parts/senses.dart

34 lines
868 B
Dart
Raw Permalink Normal View History

import 'package:collection/collection.dart';
2020-08-24 23:45:47 +02:00
import 'package:flutter/material.dart';
import 'package:unofficial_jisho_api/api.dart';
import 'sense/sense.dart';
2020-08-24 23:45:47 +02:00
class Senses extends StatelessWidget {
2021-03-03 00:24:25 +01:00
final List<JishoWordSense> senses;
final List<PhraseScrapeMeaning>? extraData;
2021-12-01 23:09:53 +01:00
const Senses({
required this.senses,
this.extraData,
2021-12-01 23:09:53 +01:00
Key? key,
}) : super(key: key);
2020-08-24 23:45:47 +02:00
List<Widget> get _senseWidgets => [
for (int i = 0; i < senses.length; i++)
Sense(
index: i,
sense: senses[i],
meaning: extraData?.firstWhereOrNull(
(m) => m.definition == senses[i].englishDefinitions.join('; '),
2021-12-01 23:09:53 +01:00
),
2021-07-17 12:19:03 +02:00
),
];
@override
Widget build(BuildContext context) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: _senseWidgets,
);
2020-08-24 23:45:47 +02:00
}