fix
Some checks are pending
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions

This commit is contained in:
Dmitry 2026-01-10 20:29:56 +03:00
parent 99100deb20
commit a71f265a8e
8 changed files with 174 additions and 150 deletions

View file

@ -37,6 +37,11 @@ class UserScopeContainer extends ChildScopeContainer<UserScopeParent>
implements UserScope { implements UserScope {
UserScopeContainer({required super.parent}); UserScopeContainer({required super.parent});
@override
List<Set<AsyncDep<dynamic>>> get initializeQueue => [
{purchaseEventBroadcasterDep},
];
// State Manager for user state // State Manager for user state
late final userStateManagerDep = dep(() => UserStateManager()); late final userStateManagerDep = dep(() => UserStateManager());

View file

@ -231,14 +231,31 @@ class GameSessionManager {
if (answer is! String) return false; if (answer is! String) return false;
// Remove spaces from answer // Remove spaces from answer
final answerNoSpaces = answer.replaceAll(' ', '').toLowerCase(); final answerNoSpaces = answer.replaceAll(' ', '');
final correctNoSpaces = question.correctAnswer.replaceAll(' ', '').toLowerCase();
// If lengths don't match, answer is wrong final template = question.template;
if (answerNoSpaces.length != correctNoSpaces.length) return false; final expectedAnswer = StringBuffer();
int answerLetterIndex = 0;
for (int i = 0; i < template.length && answerLetterIndex < answerNoSpaces.length; i++) {
final templateChar = template[i];
if (templateChar == '_' || templateChar == '|') {
// This is a slot - use the corresponding letter from correct answer
final correctChar = answerNoSpaces[answerLetterIndex];
if (templateChar == '|') {
// Uppercase slot - expect uppercase
expectedAnswer.write(correctChar.toUpperCase());
} else {
// Lowercase slot - expect lowercase
expectedAnswer.write(correctChar.toLowerCase());
}
answerLetterIndex++;
}
// Skip other characters in template (visible letters, spaces)
}
// Compare user answer with expected answer (case-sensitive for uppercase slots) // Compare user answer with expected answer (case-sensitive for uppercase slots)
return answerNoSpaces == question.correctAnswer; return answerNoSpaces.toLowerCase() == expectedAnswer.toString().toLowerCase();
} }
bool _validateMatch(MatchQuestion question, dynamic answer) { bool _validateMatch(MatchQuestion question, dynamic answer) {

View file

@ -825,7 +825,7 @@ class _CardSide extends StatelessWidget {
'Нет мнемоники', 'Нет мнемоники',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w700,
color: colorScheme.onSurface.withOpacity(0.38), color: colorScheme.onSurface.withOpacity(0.38),
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,

View file

@ -398,6 +398,8 @@ class _CardSide extends StatelessWidget {
return Hero( return Hero(
tag: 'card_${card.id}', tag: 'card_${card.id}',
child: Material(
color: Colors.transparent,
child: Container( child: Container(
width: cardWidth, width: cardWidth,
height: cardHeight, height: cardHeight,
@ -418,6 +420,7 @@ class _CardSide extends StatelessWidget {
child: isFront ? _buildFrontLayout() : _buildBackLayout(), child: isFront ? _buildFrontLayout() : _buildBackLayout(),
), ),
), ),
),
); );
} }
@ -622,7 +625,7 @@ class _CardSide extends StatelessWidget {
card.original!, card.original!,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w700,
color: colorScheme.onSurface, color: colorScheme.onSurface,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,

View file

@ -301,7 +301,7 @@ class AnswerOptions extends StatelessWidget {
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
style: Theme.of(context).textTheme.bodySmall!.copyWith( style: Theme.of(context).textTheme.bodySmall!.copyWith(
color: textColor, color: textColor,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal, fontWeight: FontWeight.bold,
), ),
child: Text( child: Text(
text, text,
@ -320,9 +320,7 @@ class AnswerOptions extends StatelessWidget {
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
style: Theme.of(context).textTheme.bodyLarge!.copyWith( style: Theme.of(context).textTheme.bodyLarge!.copyWith(
color: textColor, color: textColor,
fontWeight: isSelected || (isAnswerSubmitted && isCorrectOption) fontWeight: FontWeight.bold,
? FontWeight.w600
: FontWeight.normal,
fontSize: isSelected ? 17 : 16, fontSize: isSelected ? 17 : 16,
), ),
child: Text( child: Text(

View file

@ -142,7 +142,7 @@ class _InputLettersWidgetState extends State<InputLettersWidget> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
// Image display (if available) // Image display (if available)
if (widget.question.image != null) ...[ if (widget.question.image != null && false) ...[
SizedBox( SizedBox(
height: imageHeight, height: imageHeight,
child: Center( child: Center(

View file

@ -192,8 +192,8 @@ class _MatrixWidgetState extends State<MatrixWidget>
final targetPaddingH = 20.w; final targetPaddingH = 20.w;
final targetPaddingV = 16.h; final targetPaddingV = 16.h;
return Expanded( return Column(
child: Column( mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Expanded( Expanded(
@ -267,7 +267,6 @@ class _MatrixWidgetState extends State<MatrixWidget>
color: colorScheme.surface, color: colorScheme.surface,
borderRadius: BorderRadius.circular(24.r), borderRadius: BorderRadius.circular(24.r),
border: Border.all(color: colorScheme.primary, width: 3), border: Border.all(color: colorScheme.primary, width: 3),
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -291,7 +290,6 @@ class _MatrixWidgetState extends State<MatrixWidget>
), ),
), ),
], ],
),
); );
} }

View file

@ -85,6 +85,8 @@ class PackCardItem extends StatelessWidget {
}, },
child: Hero( child: Hero(
tag: 'card_${card.id}', tag: 'card_${card.id}',
child: Material(
color: Colors.transparent,
child: Container( child: Container(
key: ValueKey('$cardRootKeyPrefix${card.id}'), key: ValueKey('$cardRootKeyPrefix${card.id}'),
alignment: Alignment.center, alignment: Alignment.center,
@ -117,6 +119,7 @@ class PackCardItem extends StatelessWidget {
), ),
), ),
), ),
),
); );
}, },
); );