You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.5 KiB
Dart
41 lines
1.5 KiB
Dart
import 'dart:developer';
|
|
|
|
import 'package:fluffychat/pangea/enum/activity_type_enum.dart';
|
|
import 'package:fluffychat/pangea/models/practice_activities.dart/message_activity_request.dart';
|
|
import 'package:fluffychat/pangea/models/practice_activities.dart/multiple_choice_activity_model.dart';
|
|
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);
|
|
|
|
final token = req.targetTokens.first;
|
|
final List<String> choices = await MatrixState
|
|
.pangeaController.getAnalytics.constructListModel
|
|
.lemmaActivityDistractors(token);
|
|
|
|
// TODO - modify MultipleChoiceActivity flow to allow no correct answer
|
|
return MessageActivityResponse(
|
|
activity: PracticeActivityModel(
|
|
activityType: ActivityTypeEnum.lemmaId,
|
|
targetTokens: [token],
|
|
tgtConstructs: [token.vocabConstructID],
|
|
langCode: req.userL2,
|
|
content: ActivityContent(
|
|
question: L10n.of(context).chooseBaseForm,
|
|
choices: choices,
|
|
answers: [token.lemma.text],
|
|
spanDisplayDetails: null,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|