chore: show 'all done' message in practice activity bar for each activity type (#4212)
This commit is contained in:
parent
341c3ec125
commit
f9d3e5e473
2 changed files with 33 additions and 34 deletions
|
|
@ -48,6 +48,10 @@ class ReadingAssistanceInputBarState extends State<ReadingAssistanceInputBar> {
|
|||
return const SizedBox();
|
||||
// return ReactionsPicker(controller);
|
||||
} else {
|
||||
final activityType = overlayController.toolbarMode.associatedActivityType;
|
||||
final activityCompleted = activityType != null &&
|
||||
overlayController.isPracticeActivityDone(activityType);
|
||||
|
||||
switch (overlayController.toolbarMode) {
|
||||
case MessageMode.messageSpeechToText:
|
||||
case MessageMode.practiceActivity:
|
||||
|
|
@ -57,6 +61,7 @@ class ReadingAssistanceInputBarState extends State<ReadingAssistanceInputBar> {
|
|||
content = overlayController.isTotallyDone
|
||||
? Text(
|
||||
L10n.of(context).allDone,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
: Text(
|
||||
|
|
@ -80,19 +85,26 @@ class ReadingAssistanceInputBarState extends State<ReadingAssistanceInputBar> {
|
|||
case MessageMode.wordEmoji:
|
||||
case MessageMode.wordMeaning:
|
||||
case MessageMode.listening:
|
||||
if (target != null) {
|
||||
if (target == null || activityCompleted) {
|
||||
content = Text(
|
||||
L10n.of(context).allDone,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
textAlign: TextAlign.center,
|
||||
);
|
||||
} else {
|
||||
content = PracticeActivityCard(
|
||||
targetTokensAndActivityType: target,
|
||||
overlayController: overlayController,
|
||||
);
|
||||
} else {
|
||||
content = Text(
|
||||
L10n.of(context).allDone,
|
||||
textAlign: TextAlign.center,
|
||||
);
|
||||
}
|
||||
case MessageMode.wordMorph:
|
||||
if (target != null) {
|
||||
if (activityCompleted) {
|
||||
content = Text(
|
||||
L10n.of(context).allDone,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
textAlign: TextAlign.center,
|
||||
);
|
||||
} else if (target != null) {
|
||||
content = PracticeActivityCard(
|
||||
targetTokensAndActivityType: target,
|
||||
overlayController: overlayController,
|
||||
|
|
@ -123,20 +135,17 @@ class ReadingAssistanceInputBarState extends State<ReadingAssistanceInputBar> {
|
|||
child: Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
alignment: Alignment.center,
|
||||
constraints: BoxConstraints(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: minContentHeight,
|
||||
maxHeight: AppConfig.readingAssistanceInputBarHeight,
|
||||
maxWidth: overlayController.maxWidth,
|
||||
),
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(
|
||||
milliseconds: AppConfig.overlayAnimationDuration,
|
||||
),
|
||||
child: Scrollbar(
|
||||
thumbVisibility: true,
|
||||
child: Scrollbar(
|
||||
thumbVisibility: true,
|
||||
controller: _scrollController,
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
child: SizedBox(
|
||||
width: overlayController.maxWidth,
|
||||
child: barContent(context),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -344,29 +344,19 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
|
|||
|
||||
bool get isPracticeComplete => isTranslationUnlocked;
|
||||
|
||||
bool get isEmojiDone =>
|
||||
practiceSelection
|
||||
?.activities(ActivityTypeEnum.emoji)
|
||||
.every((a) => a.isComplete) ==
|
||||
bool isPracticeActivityDone(ActivityTypeEnum activityType) =>
|
||||
practiceSelection?.activities(activityType).every((a) => a.isComplete) ==
|
||||
true;
|
||||
|
||||
bool get isEmojiDone => isPracticeActivityDone(ActivityTypeEnum.emoji);
|
||||
|
||||
bool get isMeaningDone =>
|
||||
practiceSelection
|
||||
?.activities(ActivityTypeEnum.wordMeaning)
|
||||
.every((a) => a.isComplete) ==
|
||||
true;
|
||||
isPracticeActivityDone(ActivityTypeEnum.wordMeaning);
|
||||
|
||||
bool get isListeningDone =>
|
||||
practiceSelection
|
||||
?.activities(ActivityTypeEnum.wordFocusListening)
|
||||
.every((a) => a.isComplete) ==
|
||||
true;
|
||||
isPracticeActivityDone(ActivityTypeEnum.wordFocusListening);
|
||||
|
||||
bool get isMorphDone =>
|
||||
practiceSelection
|
||||
?.activities(ActivityTypeEnum.morphId)
|
||||
.every((a) => a.isComplete) ==
|
||||
true;
|
||||
bool get isMorphDone => isPracticeActivityDone(ActivityTypeEnum.morphId);
|
||||
|
||||
/// you have to complete one of the mode mini-games to unlock translation
|
||||
bool get isTranslationUnlocked =>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue