2270 lemma missing and purple too dark (#2272)
* chore: make key unique in vocab details page, update example message background color * chore: ensure widget keys are unique
This commit is contained in:
parent
35aa5ced02
commit
07128e3c0a
9 changed files with 21 additions and 15 deletions
|
|
@ -55,6 +55,7 @@ class VocabDetailsView extends StatelessWidget {
|
|||
color: textColor,
|
||||
),
|
||||
iconSize: _iconSize,
|
||||
uniqueID: "${_construct.lemma}-${_construct.category}",
|
||||
),
|
||||
subtitle: Column(
|
||||
children: [
|
||||
|
|
@ -140,6 +141,7 @@ class VocabDetailsView extends StatelessWidget {
|
|||
WordTextWithAudioButton(
|
||||
text: form,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
uniqueID: "$form-${_construct.lemma}-$i",
|
||||
),
|
||||
if (i != forms.length - 1) const Text(", "),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ extension ConstructLevelEnumExt on ConstructLevelEnum {
|
|||
switch (this) {
|
||||
case ConstructLevelEnum.flowers:
|
||||
return Color.lerp(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
AppConfig.primaryColor,
|
||||
Colors.white,
|
||||
0.6,
|
||||
) ??
|
||||
Theme.of(context).colorScheme.primary;
|
||||
AppConfig.primaryColor;
|
||||
case ConstructLevelEnum.greens:
|
||||
return Color.lerp(AppConfig.success, Colors.white, 0.6) ??
|
||||
AppConfig.success;
|
||||
|
|
@ -32,11 +32,11 @@ extension ConstructLevelEnumExt on ConstructLevelEnum {
|
|||
switch (this) {
|
||||
case ConstructLevelEnum.flowers:
|
||||
return Color.lerp(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
AppConfig.primaryColor,
|
||||
Colors.white,
|
||||
0.3,
|
||||
) ??
|
||||
Theme.of(context).colorScheme.primary;
|
||||
AppConfig.primaryColor;
|
||||
case ConstructLevelEnum.greens:
|
||||
return Color.lerp(AppConfig.success, Colors.black, 0.3) ??
|
||||
AppConfig.success;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import 'package:fluffychat/pangea/practice_activities/practice_target.dart';
|
|||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
class PracticeSelection {
|
||||
late String _userL1;
|
||||
late String _userL2;
|
||||
final DateTime createdAt = DateTime.now();
|
||||
|
||||
|
|
@ -29,9 +28,6 @@ class PracticeSelection {
|
|||
String? userL1,
|
||||
String? userL2,
|
||||
}) {
|
||||
_userL1 = userL1 ??
|
||||
MatrixState.pangeaController.languageController.userL1?.langCode ??
|
||||
LanguageKeys.defaultLanguage;
|
||||
_userL2 = userL2 ??
|
||||
MatrixState.pangeaController.languageController.userL2?.langCode ??
|
||||
LanguageKeys.defaultLanguage;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ class PracticeTarget {
|
|||
}
|
||||
|
||||
return tokens.every(
|
||||
(t) => record.responses.any((res) => res.cId == t.vocabConstructID));
|
||||
(t) => record.responses.any((res) => res.cId == t.vocabConstructID),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,6 +230,7 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
|
|||
ActivityTypeEnum.wordFocusListening)
|
||||
WordAudioButton(
|
||||
text: practiceActivity.multipleChoiceContent!.answers.first,
|
||||
uniqueID: "audio-activity-${widget.event.eventId}",
|
||||
),
|
||||
if (practiceActivity.activityType ==
|
||||
ActivityTypeEnum.hiddenWordListening)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class WordAudioButton extends StatefulWidget {
|
|||
final double size;
|
||||
final bool isSelected;
|
||||
final double baseOpacity;
|
||||
final String uniqueID;
|
||||
|
||||
/// If defined, this callback will be called instead of the default one
|
||||
final void Function()? callbackOverride;
|
||||
|
|
@ -18,6 +19,7 @@ class WordAudioButton extends StatefulWidget {
|
|||
const WordAudioButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.uniqueID,
|
||||
this.size = 24,
|
||||
this.isSelected = false,
|
||||
this.baseOpacity = 1,
|
||||
|
|
@ -51,13 +53,13 @@ class WordAudioButtonState extends State<WordAudioButton> {
|
|||
Widget build(BuildContext context) {
|
||||
return CompositedTransformTarget(
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey('word-audio-butto${widget.text}')
|
||||
.layerLinkAndKey('word-audio-button-${widget.uniqueID}')
|
||||
.link,
|
||||
child: Opacity(
|
||||
opacity: !widget.isSelected ? widget.baseOpacity : 1,
|
||||
child: IconButton(
|
||||
key: MatrixState.pAnyState
|
||||
.layerLinkAndKey('word-audio-butto${widget.text}')
|
||||
.layerLinkAndKey('word-audio-button-${widget.uniqueID}')
|
||||
.key,
|
||||
icon: const Icon(Icons.volume_up),
|
||||
isSelected: _isPlaying,
|
||||
|
|
@ -82,7 +84,7 @@ class WordAudioButtonState extends State<WordAudioButton> {
|
|||
await tts.tryToSpeak(
|
||||
widget.text,
|
||||
context,
|
||||
targetID: 'word-audio-button',
|
||||
targetID: 'word-audio-button-${widget.uniqueID}',
|
||||
);
|
||||
} catch (e, s) {
|
||||
ErrorHandler.logError(
|
||||
|
|
|
|||
|
|
@ -8,12 +8,14 @@ import 'package:fluffychat/widgets/matrix.dart';
|
|||
|
||||
class WordTextWithAudioButton extends StatefulWidget {
|
||||
final String text;
|
||||
final String uniqueID;
|
||||
final TextStyle? style;
|
||||
final double? iconSize;
|
||||
|
||||
const WordTextWithAudioButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.uniqueID,
|
||||
this.style,
|
||||
this.iconSize,
|
||||
});
|
||||
|
|
@ -52,11 +54,11 @@ class WordAudioButtonState extends State<WordTextWithAudioButton> {
|
|||
Widget build(BuildContext context) {
|
||||
return CompositedTransformTarget(
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey('text-audio-button ${widget.text}')
|
||||
.layerLinkAndKey('text-audio-button-${widget.uniqueID}')
|
||||
.link,
|
||||
child: MouseRegion(
|
||||
key: MatrixState.pAnyState
|
||||
.layerLinkAndKey('text-audio-button ${widget.text}')
|
||||
.layerLinkAndKey('text-audio-button-${widget.uniqueID}')
|
||||
.key,
|
||||
cursor: SystemMouseCursors.click,
|
||||
onEnter: (event) => setState(() {}),
|
||||
|
|
@ -79,7 +81,7 @@ class WordAudioButtonState extends State<WordTextWithAudioButton> {
|
|||
await tts.tryToSpeak(
|
||||
widget.text,
|
||||
context,
|
||||
targetID: 'text-audio-button ${widget.text}',
|
||||
targetID: 'text-audio-button-${widget.uniqueID}',
|
||||
);
|
||||
} catch (e, s) {
|
||||
ErrorHandler.logError(
|
||||
|
|
|
|||
|
|
@ -198,6 +198,7 @@ class LemmaWidgetState extends State<LemmaWidget> {
|
|||
? () => widget.overlayController
|
||||
?.updateToolbarMode(MessageMode.listening)
|
||||
: null,
|
||||
uniqueID: "lemma-content-${widget.token.text.content}",
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ class WordZoomWidget extends StatelessWidget {
|
|||
? () => overlayController
|
||||
.updateToolbarMode(MessageMode.listening)
|
||||
: null,
|
||||
uniqueID: "word-zoom-audio-${_selectedToken.text.content}",
|
||||
),
|
||||
],
|
||||
..._selectedToken.morphsBasicallyEligibleForPracticeByPriority
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue