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 {
UserScopeContainer({required super.parent});
@override
List<Set<AsyncDep<dynamic>>> get initializeQueue => [
{purchaseEventBroadcasterDep},
];
// State Manager for user state
late final userStateManagerDep = dep(() => UserStateManager());

View file

@ -231,14 +231,31 @@ class GameSessionManager {
if (answer is! String) return false;
// Remove spaces from answer
final answerNoSpaces = answer.replaceAll(' ', '').toLowerCase();
final correctNoSpaces = question.correctAnswer.replaceAll(' ', '').toLowerCase();
final answerNoSpaces = answer.replaceAll(' ', '');
// If lengths don't match, answer is wrong
if (answerNoSpaces.length != correctNoSpaces.length) return false;
final template = question.template;
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)
return answerNoSpaces == question.correctAnswer;
return answerNoSpaces.toLowerCase() == expectedAnswer.toString().toLowerCase();
}
bool _validateMatch(MatchQuestion question, dynamic answer) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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