|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:collection/collection.dart';
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/pangea/analytics_details_popup/analytics_details_popup_content.dart';
|
|
|
|
|
@ -7,9 +8,9 @@ import 'package:fluffychat/pangea/analytics_misc/construct_use_model.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/constructs/construct_identifier.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/constructs/construct_level_enum.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/lemmas/lemma_emoji_row.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/morphs/get_grammar_copy.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/morphs/morph_features_enum.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/morphs/morph_icon.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/toolbar/widgets/practice_activity/word_audio_button.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/toolbar/widgets/practice_activity/word_text_with_audio_button.dart';
|
|
|
|
|
import 'package:fluffychat/pangea/toolbar/widgets/word_zoom/lemma_meaning_widget.dart';
|
|
|
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
|
|
|
|
@ -29,6 +30,18 @@ class VocabDetailsView extends StatelessWidget {
|
|
|
|
|
String? get _userL2 =>
|
|
|
|
|
MatrixState.pangeaController.languageController.userL2?.langCode;
|
|
|
|
|
|
|
|
|
|
List<String> get forms =>
|
|
|
|
|
MatrixState.pangeaController.getAnalytics.constructListModel
|
|
|
|
|
.getConstructUsesByLemma(_construct.lemma)
|
|
|
|
|
.map((e) => e.uses)
|
|
|
|
|
.expand((element) => element)
|
|
|
|
|
.map((e) => e.form?.toLowerCase())
|
|
|
|
|
.toSet()
|
|
|
|
|
.whereType<String>()
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
final double _iconSize = 24.0;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final Color textColor = (Theme.of(context).brightness != Brightness.light
|
|
|
|
|
@ -36,36 +49,50 @@ class VocabDetailsView extends StatelessWidget {
|
|
|
|
|
: _construct.lemmaCategory.darkColor(context));
|
|
|
|
|
|
|
|
|
|
return AnalyticsDetailsViewContent(
|
|
|
|
|
title: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
WordAudioButton(
|
|
|
|
|
text: _construct.lemma,
|
|
|
|
|
size: 24,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 4.0),
|
|
|
|
|
Text(
|
|
|
|
|
_construct.lemma,
|
|
|
|
|
style: Theme.of(context).textTheme.headlineLarge?.copyWith(
|
|
|
|
|
color: textColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
title: WordTextWithAudioButton(
|
|
|
|
|
text: _construct.lemma,
|
|
|
|
|
style: Theme.of(context).textTheme.headlineLarge?.copyWith(
|
|
|
|
|
color: textColor,
|
|
|
|
|
),
|
|
|
|
|
iconSize: _iconSize,
|
|
|
|
|
),
|
|
|
|
|
subtitle: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
subtitle: Column(
|
|
|
|
|
children: [
|
|
|
|
|
MorphIcon(
|
|
|
|
|
morphFeature: MorphFeaturesEnum.Pos,
|
|
|
|
|
morphTag: _construct.category,
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 4.0),
|
|
|
|
|
Text(
|
|
|
|
|
MorphFeaturesEnum.Pos.getDisplayCopy(context),
|
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
|
|
|
|
color: textColor,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
spacing: 8.0,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
getGrammarCopy(
|
|
|
|
|
category: "POS",
|
|
|
|
|
lemma: _construct.category,
|
|
|
|
|
context: context,
|
|
|
|
|
) ??
|
|
|
|
|
_construct.lemma,
|
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
|
|
|
|
color: textColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: _iconSize,
|
|
|
|
|
height: _iconSize,
|
|
|
|
|
child: MorphIcon(
|
|
|
|
|
morphFeature: MorphFeaturesEnum.Pos,
|
|
|
|
|
morphTag: _construct.category,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 16.0),
|
|
|
|
|
LemmaEmojiRow(
|
|
|
|
|
isSelected: false,
|
|
|
|
|
shouldShowEmojis: true,
|
|
|
|
|
cId: constructId,
|
|
|
|
|
onTapOverride: null,
|
|
|
|
|
emojiSetCallback: () {
|
|
|
|
|
debugPrint('Emoji set callback');
|
|
|
|
|
},
|
|
|
|
|
iconSize: _iconSize,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -74,20 +101,6 @@ class VocabDetailsView extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
spacing: 8.0,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
LemmaEmojiRow(
|
|
|
|
|
isSelected: false,
|
|
|
|
|
shouldShowEmojis: true,
|
|
|
|
|
cId: constructId,
|
|
|
|
|
onTapOverride: null,
|
|
|
|
|
emojiSetCallback: () {
|
|
|
|
|
debugPrint('Emoji set callback');
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Align(
|
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
|
child: _userL2 == null
|
|
|
|
|
@ -100,9 +113,9 @@ class VocabDetailsView extends StatelessWidget {
|
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
|
|
|
leading: TextSpan(
|
|
|
|
|
text: L10n.of(context).meaningSectionHeader,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -119,31 +132,26 @@ class VocabDetailsView extends StatelessWidget {
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
...MatrixState
|
|
|
|
|
.pangeaController.getAnalytics.constructListModel
|
|
|
|
|
.getConstructUsesByLemma(_construct.lemma)
|
|
|
|
|
.map((e) => e.uses)
|
|
|
|
|
.expand((element) => element)
|
|
|
|
|
.map((e) => e.form?.toLowerCase())
|
|
|
|
|
.toSet()
|
|
|
|
|
.whereType<String>()
|
|
|
|
|
.map(
|
|
|
|
|
(form) => WordTextWithAudioButton(
|
|
|
|
|
const SizedBox(width: 6.0),
|
|
|
|
|
...forms.mapIndexed(
|
|
|
|
|
(i, form) => Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
WordTextWithAudioButton(
|
|
|
|
|
text: form,
|
|
|
|
|
textSize: Theme.of(context)
|
|
|
|
|
.textTheme
|
|
|
|
|
.bodyMedium
|
|
|
|
|
?.fontSize ??
|
|
|
|
|
16,
|
|
|
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (i != forms.length - 1) const Text(", "),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
xpIcon: _construct.lemmaCategory.icon(12),
|
|
|
|
|
xpIcon: _construct.lemmaCategory.icon(_iconSize + 6.0),
|
|
|
|
|
constructId: constructId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|