Skip to content

Commit

Permalink
feat: show lemma under token, give lemma activity first if applicable (
Browse files Browse the repository at this point in the history
  • Loading branch information
ggurdin authored Jan 3, 2025
1 parent 317cf88 commit 14a1ae2
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 109 deletions.
3 changes: 2 additions & 1 deletion assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -4659,5 +4659,6 @@
"publicProfileTitle": "Allow my profile to be found in search",
"publicProfileDesc": "By enabling this option, I confirm that I am of legal age in my country of residence",
"clickWordsInstructions": "Click on individual words for more activities.",
"chooseBestDefinition": "Choose the best definition"
"chooseBestDefinition": "Choose the best definition",
"chooseBaseForm": "Choose the base form"
}
2 changes: 2 additions & 0 deletions lib/pangea/constants/morph_categories_and_labels.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ IconData getIconForMorphFeature(String feature) {
return Icons.swap_vert;
case 'definite':
return Icons.check_circle_outline;
case 'prepcase':
return Icons.location_on_outlined;
default:
debugger(when: kDebugMode);
return Icons.help_outline;
Expand Down
5 changes: 4 additions & 1 deletion lib/pangea/repo/practice/lemma_activity_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import 'package:fluffychat/pangea/models/practice_activities.dart/multiple_choic
import 'package:fluffychat/pangea/models/practice_activities.dart/practice_activity_model.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';

class LemmaActivityGenerator {
Future<MessageActivityResponse> get(
MessageActivityRequest req,
BuildContext context,
) async {
debugger(when: kDebugMode && req.targetTokens.length != 1);

Expand All @@ -26,7 +29,7 @@ class LemmaActivityGenerator {
tgtConstructs: [token.vocabConstructID],
langCode: req.userL2,
content: ActivityContent(
question: "",
question: L10n.of(context).chooseBaseForm,
choices: choices,
answers: [token.lemma.text],
spanDisplayDetails: null,
Expand Down
2 changes: 1 addition & 1 deletion lib/pangea/repo/practice/practice_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class PracticeGenerationController {
case ActivityTypeEnum.emoji:
return _emoji.get(req);
case ActivityTypeEnum.lemmaId:
return _lemma.get(req);
return _lemma.get(req, context);
case ActivityTypeEnum.morphId:
return _morph.get(req);
case ActivityTypeEnum.wordMeaning:
Expand Down
34 changes: 25 additions & 9 deletions lib/pangea/widgets/word_zoom/lemma_widget.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
import 'package:fluffychat/pangea/models/pangea_token_model.dart';
import 'package:fluffychat/pangea/widgets/practice_activity/word_zoom_activity_button.dart';
import 'package:flutter/material.dart';

class LemmaWidget extends StatelessWidget {
final PangeaToken token;
final VoidCallback onPressed;
final bool isSelected;

const LemmaWidget({
super.key,
required this.token,
required this.onPressed,
this.isSelected = false,
});

@override
Widget build(BuildContext context) {
return WordZoomActivityButton(
icon: Text(token.xpEmoji),
isSelected: isSelected,
onPressed: onPressed,
return Padding(
padding: const EdgeInsets.all(4.0),
child: Text("${token.lemma.text} ${token.xpEmoji}"),
);
}
}

// class LemmaWidget extends StatelessWidget {
// final PangeaToken token;
// final VoidCallback onPressed;
// final bool isSelected;

// const LemmaWidget({
// super.key,
// required this.token,
// required this.onPressed,
// this.isSelected = false,
// });

// @override
// Widget build(BuildContext context) {
// return WordZoomActivityButton(
// icon: Text(token.xpEmoji),
// isSelected: isSelected,
// onPressed: onPressed,
// );
// }
// }
Loading

0 comments on commit 14a1ae2

Please sign in to comment.