replace no more practice activities text with tooltip telling user to use language tools
This commit is contained in:
parent
d0eb98d141
commit
cf571c6a92
6 changed files with 30 additions and 11 deletions
|
|
@ -4499,5 +4499,6 @@
|
|||
"messageNotInTargetLang": "Message not in target language",
|
||||
"other": "Other",
|
||||
"botModeValidation": "Please select a chat mode",
|
||||
"clickBestOption": "Choose the best options to translate your message!"
|
||||
"clickBestOption": "Choose the best options to translate your message!",
|
||||
"unlockedLanguageTools": "You’ve unlocked the language tools for this message. Try them out by clicking below!"
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ enum InstructionsEnum {
|
|||
clickAgainToDeselect,
|
||||
missingVoice,
|
||||
clickBestOption,
|
||||
unlockedLanguageTools,
|
||||
}
|
||||
|
||||
extension InstructionsEnumExtension on InstructionsEnum {
|
||||
|
|
@ -37,6 +38,7 @@ extension InstructionsEnumExtension on InstructionsEnum {
|
|||
case InstructionsEnum.l1Translation:
|
||||
case InstructionsEnum.translationChoices:
|
||||
case InstructionsEnum.clickBestOption:
|
||||
case InstructionsEnum.unlockedLanguageTools:
|
||||
ErrorHandler.logError(
|
||||
e: Exception("No title for this instruction"),
|
||||
m: 'InstructionsEnumExtension.title',
|
||||
|
|
@ -73,6 +75,8 @@ extension InstructionsEnumExtension on InstructionsEnum {
|
|||
return l10n.voiceNotAvailable;
|
||||
case InstructionsEnum.clickBestOption:
|
||||
return l10n.clickBestOption;
|
||||
case InstructionsEnum.unlockedLanguageTools:
|
||||
return l10n.unlockedLanguageTools;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,6 +104,8 @@ extension InstructionsEnumExtension on InstructionsEnum {
|
|||
return instructionSettings.showedMissingVoice;
|
||||
case InstructionsEnum.clickBestOption:
|
||||
return instructionSettings.showedClickBestOption;
|
||||
case InstructionsEnum.unlockedLanguageTools:
|
||||
return instructionSettings.showedUnlockedLanguageTools;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@ class UserInstructions {
|
|||
bool showedTooltipInstructions;
|
||||
bool showedMissingVoice;
|
||||
bool showedClickBestOption;
|
||||
bool showedUnlockedLanguageTools;
|
||||
|
||||
bool showedSpeechToTextTooltip;
|
||||
bool showedL1TranslationTooltip;
|
||||
|
|
@ -204,6 +205,7 @@ class UserInstructions {
|
|||
this.showedClickAgainToDeselect = false,
|
||||
this.showedMissingVoice = false,
|
||||
this.showedClickBestOption = false,
|
||||
this.showedUnlockedLanguageTools = false,
|
||||
});
|
||||
|
||||
factory UserInstructions.fromJson(Map<String, dynamic> json) =>
|
||||
|
|
@ -227,6 +229,8 @@ class UserInstructions {
|
|||
json[InstructionsEnum.missingVoice.toString()] ?? false,
|
||||
showedClickBestOption:
|
||||
json[InstructionsEnum.clickBestOption.toString()] ?? false,
|
||||
showedUnlockedLanguageTools:
|
||||
json[InstructionsEnum.unlockedLanguageTools.toString()] ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
|
@ -246,6 +250,8 @@ class UserInstructions {
|
|||
showedClickAgainToDeselect;
|
||||
data[InstructionsEnum.missingVoice.toString()] = showedMissingVoice;
|
||||
data[InstructionsEnum.clickBestOption.toString()] = showedClickBestOption;
|
||||
data[InstructionsEnum.unlockedLanguageTools.toString()] =
|
||||
showedUnlockedLanguageTools;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ class InstructionsController {
|
|||
case InstructionsEnum.clickBestOption:
|
||||
profile.instructionSettings.showedClickBestOption = value;
|
||||
break;
|
||||
case InstructionsEnum.unlockedLanguageTools:
|
||||
profile.instructionSettings.showedUnlockedLanguageTools = value;
|
||||
break;
|
||||
}
|
||||
return profile;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_style.dart';
|
||||
import 'package:fluffychat/pangea/enum/instructions_enum.dart';
|
||||
import 'package:fluffychat/pangea/utils/inline_tooltip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StarAnimationWidget extends StatefulWidget {
|
||||
|
|
@ -66,9 +67,12 @@ class _StarAnimationWidgetState extends State<StarAnimationWidget>
|
|||
}
|
||||
|
||||
class GamifiedTextWidget extends StatelessWidget {
|
||||
final String userMessage;
|
||||
final VoidCallback onCloseTooltip;
|
||||
|
||||
const GamifiedTextWidget({super.key, required this.userMessage});
|
||||
const GamifiedTextWidget({
|
||||
required this.onCloseTooltip,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -79,11 +83,9 @@ class GamifiedTextWidget extends StatelessWidget {
|
|||
child: Column(
|
||||
children: [
|
||||
const StarAnimationWidget(),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
userMessage,
|
||||
style: BotStyle.text(context),
|
||||
textAlign: TextAlign.center,
|
||||
InlineTooltip(
|
||||
instructionsEnum: InstructionsEnum.unlockedLanguageTools,
|
||||
onClose: onCloseTooltip,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import 'package:fluffychat/pangea/widgets/practice_activity/no_more_practice_car
|
|||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
/// The wrapper for practice activity content.
|
||||
/// Handles the activities associated with a message,
|
||||
|
|
@ -382,11 +381,13 @@ class PracticeActivityCardState extends State<PracticeActivityCard> {
|
|||
}
|
||||
}
|
||||
|
||||
void _closeTooltip() => setState(() {});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!fetchingActivity && currentActivity == null) {
|
||||
return GamifiedTextWidget(
|
||||
userMessage: L10n.of(context)!.noActivitiesFound,
|
||||
onCloseTooltip: _closeTooltip,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue