feat: unified 1..9 words session narrative, dice input before reveal, dedicated results screen, and clean session history grouping
This commit is contained in:
+307
-205
@@ -6,7 +6,7 @@ import '../services/words_repository.dart';
|
||||
import '../widgets/cleromancy_dialog.dart';
|
||||
import '../widgets/d10_dice_roller_widget.dart';
|
||||
import '../widgets/gradient_star_badge.dart';
|
||||
import '../widgets/word_card_widget.dart';
|
||||
import 'session_result_screen.dart';
|
||||
|
||||
class HomeSearchScreen extends StatefulWidget {
|
||||
const HomeSearchScreen({super.key});
|
||||
@@ -18,44 +18,54 @@ class HomeSearchScreen extends StatefulWidget {
|
||||
class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
final _repo = WordsRepository();
|
||||
final _questionController = TextEditingController();
|
||||
final _countController = TextEditingController(text: '1');
|
||||
final _diceRollerKey = GlobalKey<D10DiceRollerWidgetState>();
|
||||
|
||||
WordItem? _currentWord;
|
||||
String? _activeHistoryId;
|
||||
int _wordsCount = 1; // 1 to 9 words in the session
|
||||
int _activeWordIndex = 0; // 0.._wordsCount-1
|
||||
List<String> _wordsDigits = ['']; // 3-digit strings for each word
|
||||
bool _showKeypad = true;
|
||||
String _currentDigits = ''; // Tracks 0..3 digits input: e.g. "", "7", "74", "742"
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_countController.addListener(_onCountChanged);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_countController.removeListener(_onCountChanged);
|
||||
_countController.dispose();
|
||||
_questionController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _setWord(WordItem word, {bool recordHistory = true}) async {
|
||||
final question = _questionController.text.trim();
|
||||
String? newHistId;
|
||||
|
||||
if (recordHistory) {
|
||||
newHistId = DateTime.now().millisecondsSinceEpoch.toString();
|
||||
final entry = HistoryEntry(
|
||||
id: newHistId,
|
||||
timestamp: DateTime.now(),
|
||||
word: word.word,
|
||||
sessionNumber: word.sessionNumber,
|
||||
partOfSpeech: word.partOfSpeech,
|
||||
symbolicMeaning: word.description,
|
||||
readingType: 'Клеромантия (3× d10)',
|
||||
question: question.isNotEmpty ? question : null,
|
||||
);
|
||||
await _repo.addHistoryEntry(entry);
|
||||
void _onCountChanged() {
|
||||
final text = _countController.text.trim();
|
||||
final count = int.tryParse(text);
|
||||
if (count != null && count >= 1 && count <= 9) {
|
||||
if (count != _wordsCount) {
|
||||
setState(() {
|
||||
_wordsCount = count;
|
||||
_adjustDigitsList();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_currentWord = word;
|
||||
_activeHistoryId = newHistId ?? _activeHistoryId;
|
||||
_currentDigits = word.formattedSessionNumber;
|
||||
});
|
||||
HapticFeedback.selectionClick();
|
||||
void _adjustDigitsList() {
|
||||
final current = List<String>.from(_wordsDigits);
|
||||
if (current.length < _wordsCount) {
|
||||
while (current.length < _wordsCount) {
|
||||
current.add('');
|
||||
}
|
||||
} else if (current.length > _wordsCount) {
|
||||
current.removeRange(_wordsCount, current.length);
|
||||
}
|
||||
_wordsDigits = current;
|
||||
if (_activeWordIndex >= _wordsCount) {
|
||||
_activeWordIndex = _wordsCount - 1;
|
||||
}
|
||||
}
|
||||
|
||||
void _onKeypadTap(String val) {
|
||||
@@ -63,74 +73,118 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
|
||||
if (val == 'C') {
|
||||
setState(() {
|
||||
_currentDigits = '';
|
||||
_wordsDigits[_activeWordIndex] = '';
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (val == '⌫') {
|
||||
if (_currentDigits.isNotEmpty) {
|
||||
final current = _wordsDigits[_activeWordIndex];
|
||||
if (current.isNotEmpty) {
|
||||
setState(() {
|
||||
_currentDigits = _currentDigits.substring(0, _currentDigits.length - 1);
|
||||
_wordsDigits[_activeWordIndex] = current.substring(0, current.length - 1);
|
||||
});
|
||||
} else if (_activeWordIndex > 0) {
|
||||
setState(() {
|
||||
_activeWordIndex--;
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Append digit up to 3 digits (1st d10, 2nd d10, 3rd d10)
|
||||
// Append digit to current active word (up to 3 digits)
|
||||
final current = _wordsDigits[_activeWordIndex];
|
||||
String newDigits;
|
||||
if (_currentDigits.length >= 3) {
|
||||
if (current.length >= 3) {
|
||||
newDigits = val;
|
||||
} else {
|
||||
newDigits = _currentDigits + val;
|
||||
newDigits = current + val;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_currentDigits = newDigits;
|
||||
_wordsDigits[_activeWordIndex] = newDigits;
|
||||
});
|
||||
|
||||
// Only resolve word when all 3 digits are provided!
|
||||
if (newDigits.length == 3) {
|
||||
final num = int.tryParse(newDigits);
|
||||
if (num != null && num <= 999) {
|
||||
final word = _repo.getWordBySessionNumber(num);
|
||||
if (word != null) {
|
||||
_setWord(word, recordHistory: true);
|
||||
// If 3 digits filled and more words remain, auto-advance to next word!
|
||||
if (newDigits.length == 3 && _activeWordIndex < _wordsCount - 1) {
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_activeWordIndex++;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _onVirtualRollCompleted(int finalNumber) {
|
||||
final word = _repo.getWordBySessionNumber(finalNumber);
|
||||
if (word != null) {
|
||||
_setWord(word, recordHistory: true);
|
||||
final formatted = finalNumber.toString().padLeft(3, '0');
|
||||
setState(() {
|
||||
_wordsDigits[_activeWordIndex] = formatted;
|
||||
});
|
||||
|
||||
// Advance to next word if not last
|
||||
if (_activeWordIndex < _wordsCount - 1) {
|
||||
Future.delayed(const Duration(milliseconds: 200), () {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_activeWordIndex++;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _resetToWelcome() {
|
||||
bool get _isSessionReady {
|
||||
if (_wordsDigits.length != _wordsCount) return false;
|
||||
return _wordsDigits.every((d) => d.length == 3);
|
||||
}
|
||||
|
||||
void _openSessionResults() {
|
||||
final sessionWords = <SessionWord>[];
|
||||
for (int i = 0; i < _wordsCount; i++) {
|
||||
final digits = _wordsDigits[i];
|
||||
final num = int.tryParse(digits) ?? 0;
|
||||
final wordItem = _repo.getWordBySessionNumber(num) ??
|
||||
WordItem(
|
||||
id: num,
|
||||
word: 'Символ #$digits',
|
||||
partOfSpeech: 'знак',
|
||||
frequency: 0,
|
||||
category: 'Символ',
|
||||
description: 'Сакральный знак под номером $digits',
|
||||
);
|
||||
|
||||
sessionWords.add(SessionWord.fromWordItem(wordItem));
|
||||
}
|
||||
|
||||
final question = _questionController.text.trim();
|
||||
final session = OracleSession(
|
||||
id: DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
timestamp: DateTime.now(),
|
||||
question: question.isNotEmpty ? question : null,
|
||||
wordsCount: _wordsCount,
|
||||
words: sessionWords,
|
||||
);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => SessionResultScreen(session: session),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _resetSession() {
|
||||
setState(() {
|
||||
_currentWord = null;
|
||||
_currentDigits = '';
|
||||
_activeHistoryId = null;
|
||||
_activeWordIndex = 0;
|
||||
_wordsDigits = List.filled(_wordsCount, '');
|
||||
});
|
||||
}
|
||||
|
||||
void _goToNext() {
|
||||
if (_currentWord == null) return;
|
||||
final next = _repo.getNextWord(_currentWord!.sessionNumber);
|
||||
_setWord(next, recordHistory: false);
|
||||
}
|
||||
|
||||
void _goToPrevious() {
|
||||
if (_currentWord == null) return;
|
||||
final prev = _repo.getPreviousWord(_currentWord!.sessionNumber);
|
||||
_setWord(prev, recordHistory: false);
|
||||
}
|
||||
|
||||
void _reshuffleSession() {
|
||||
void _reshuffleMatrix() {
|
||||
_repo.reshuffleSessionNumbers();
|
||||
_resetToWelcome();
|
||||
_resetSession();
|
||||
HapticFeedback.heavyImpact();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
@@ -157,6 +211,8 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
final currentActiveDigits =
|
||||
_activeWordIndex < _wordsDigits.length ? _wordsDigits[_activeWordIndex] : '';
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -180,16 +236,15 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
icon: const Icon(Icons.help_outline_rounded, color: Color(0xFFFFD54F)),
|
||||
onPressed: () => CleromancyGuideDialog.show(context),
|
||||
),
|
||||
if (_currentWord != null)
|
||||
IconButton(
|
||||
tooltip: 'Новый вопрос / Сброс',
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
onPressed: _resetToWelcome,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Очистить броски',
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
onPressed: _resetSession,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Перетасовать матрицу (#000..#999)',
|
||||
icon: const Icon(Icons.shuffle_rounded),
|
||||
onPressed: _reshuffleSession,
|
||||
onPressed: _reshuffleMatrix,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: _showKeypad ? 'Скрыть панель' : 'Показать панель',
|
||||
@@ -206,49 +261,161 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// Question Input Field
|
||||
TextField(
|
||||
controller: _questionController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Ваш вопрос или намерение (необязательно)',
|
||||
hintText: 'Например: В чем корень текущей ситуации?',
|
||||
prefixIcon: const Icon(Icons.help_outline_rounded, color: Color(0xFFFFD54F), size: 20),
|
||||
suffixIcon: _questionController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear, size: 18),
|
||||
onPressed: () => _questionController.clear(),
|
||||
)
|
||||
: null,
|
||||
filled: true,
|
||||
fillColor: isDark ? const Color(0xFF17192C) : theme.colorScheme.surfaceContainerHigh,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.25),
|
||||
// Row: Question & Words count selector (1..9)
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Question Input
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _questionController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Ваш вопрос или контекст',
|
||||
hintText: 'В чем корень ситуации?',
|
||||
prefixIcon: const Icon(Icons.help_outline_rounded, color: Color(0xFFFFD54F), size: 20),
|
||||
suffixIcon: _questionController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear, size: 18),
|
||||
onPressed: () => _questionController.clear(),
|
||||
)
|
||||
: null,
|
||||
filled: true,
|
||||
fillColor: isDark ? const Color(0xFF17192C) : theme.colorScheme.surfaceContainerHigh,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.25),
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFFFFD54F),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.2),
|
||||
|
||||
const SizedBox(width: 10),
|
||||
|
||||
// Words Count Input Box (1..9)
|
||||
Container(
|
||||
width: 78,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF17192C) : theme.colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.4),
|
||||
),
|
||||
),
|
||||
child: TextField(
|
||||
controller: _countController,
|
||||
keyboardType: TextInputType.number,
|
||||
textAlign: TextAlign.center,
|
||||
maxLength: 1,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFFFFF9C4),
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
counterText: '',
|
||||
labelText: 'Слов',
|
||||
labelStyle: TextStyle(fontSize: 11, color: Color(0xFFFFD54F)),
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 6, horizontal: 8),
|
||||
),
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFFFFD54F),
|
||||
width: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// D10 Dice Roller Slots Widget (Clean & without prefilled junk)
|
||||
// Multi-Word Slots Progress Indicator (if > 1 word)
|
||||
if (_wordsCount > 1) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF151829) : theme.colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: List.generate(_wordsCount, (i) {
|
||||
final isSelected = i == _activeWordIndex;
|
||||
final digits = i < _wordsDigits.length ? _wordsDigits[i] : '';
|
||||
final isFilled = digits.length == 3;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 6),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() => _activeWordIndex = i);
|
||||
HapticFeedback.selectionClick();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? const Color(0xFF2A2D4A)
|
||||
: (isFilled ? const Color(0xFF1E2138) : Colors.transparent),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? const Color(0xFFFFD54F)
|
||||
: (isFilled ? const Color(0xFFFFD54F).withValues(alpha: 0.4) : Colors.white12),
|
||||
width: isSelected ? 1.5 : 1.0,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Слово ${i + 1}: ',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
color: isSelected ? const Color(0xFFFFF9C4) : theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
isFilled ? '#$digits' : (digits.isEmpty ? '• • •' : '$digits..'),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: isFilled ? const Color(0xFFFFD54F) : Colors.white54,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
|
||||
// D10 Dice Roller Slots Widget (Purely for rolling/entering faces before opening word)
|
||||
D10DiceRollerWidget(
|
||||
key: _diceRollerKey,
|
||||
digits: _currentDigits,
|
||||
digits: currentActiveDigits,
|
||||
isRolling: false,
|
||||
onRollPressed: () {},
|
||||
onRollCompleted: _onVirtualRollCompleted,
|
||||
@@ -256,105 +423,42 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
|
||||
const SizedBox(height: 14),
|
||||
|
||||
// Welcome Idle State OR Active Word Card
|
||||
if (_currentWord == null) ...[
|
||||
// Welcome Initiation Card
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
const Color(0xFF1F223B),
|
||||
const Color(0xFF131526),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.35),
|
||||
width: 1.2,
|
||||
// Button to open the Result Screen when ready
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: FilledButton.icon(
|
||||
onPressed: _isSessionReady ? _openSessionResults : null,
|
||||
icon: const Icon(Icons.visibility_rounded, size: 20),
|
||||
label: Text(
|
||||
_isSessionReady
|
||||
? '🔮 ОТКРЫТЬ ЗНАКИ И ТРАКТОВКУ ($_wordsCount ${_wordsCount == 1 ? "знак" : (_wordsCount < 5 ? "знака" : "знаков")})'
|
||||
: 'Заполните броски (Слово ${_activeWordIndex + 1} из $_wordsCount)',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 0.6,
|
||||
fontSize: 13.5,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const GradientStar(size: 38),
|
||||
const SizedBox(height: 12),
|
||||
const Text(
|
||||
'СВЯЩЕННЫЙ ЖРЕБИЙ КЛЕРОМАНТИИ',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 0.8,
|
||||
color: Color(0xFFFFF9C4),
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2A2D4A),
|
||||
foregroundColor: const Color(0xFFFFF9C4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
side: BorderSide(
|
||||
color: _isSessionReady
|
||||
? const Color(0xFFFFD54F)
|
||||
: const Color(0xFFFFD54F).withValues(alpha: 0.3),
|
||||
width: 1.5,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Сформулируйте вопрос, затем совершите 3 броска кубика d10 кнопкой выше или наберите 3 выпавших грани на панели.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
height: 1.4,
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.85),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () => CleromancyGuideDialog.show(context),
|
||||
icon: const Icon(Icons.menu_book_rounded, size: 16, color: Color(0xFFFFD54F)),
|
||||
label: const Text(
|
||||
'Инструкция по броскам d10',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFFFD54F),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12.5,
|
||||
),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: const BorderSide(color: Color(0xFFFFD54F), width: 1),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
// Main Sacred Word Card Display
|
||||
AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (child, animation) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: SlideTransition(
|
||||
position: Tween<Offset>(
|
||||
begin: const Offset(0.0, 0.04),
|
||||
end: Offset.zero,
|
||||
).animate(animation),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: WordCardWidget(
|
||||
key: ValueKey('${_currentWord!.id}_${_currentWord!.sessionNumber}'),
|
||||
word: _currentWord!,
|
||||
question: _questionController.text.trim(),
|
||||
historyEntryId: _activeHistoryId,
|
||||
onNext: _goToNext,
|
||||
onPrevious: _goToPrevious,
|
||||
onRandom: () {
|
||||
_diceRollerKey.currentState?.triggerRollAnimation();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 14),
|
||||
|
||||
// Interactive Numeric Keypad (Directly maps to 3 d10 dice slots)
|
||||
// Interactive Numeric Keypad (Directly inputs to active d10 word slots)
|
||||
if (_showKeypad) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
@@ -372,13 +476,13 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Row(
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.casino_outlined, size: 15, color: Color(0xFFFFD54F)),
|
||||
SizedBox(width: 6),
|
||||
const Icon(Icons.casino_outlined, size: 15, color: Color(0xFFFFD54F)),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'Ввод граней d10:',
|
||||
style: TextStyle(
|
||||
'Ввод граней (Слово ${_activeWordIndex + 1} из $_wordsCount):',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0xFFFFD54F),
|
||||
@@ -387,15 +491,13 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
],
|
||||
),
|
||||
Text(
|
||||
_currentDigits.isEmpty
|
||||
? 'Ожидание 3 цифр'
|
||||
: (_currentDigits.length == 3
|
||||
? 'Код: #$_currentDigits'
|
||||
: 'Введено: ${_currentDigits.length} из 3'),
|
||||
currentActiveDigits.length == 3
|
||||
? 'Код: #$currentActiveDigits'
|
||||
: 'Введено: ${currentActiveDigits.length} из 3',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _currentDigits.length == 3
|
||||
color: currentActiveDigits.length == 3
|
||||
? const Color(0xFFFFD54F)
|
||||
: theme.colorScheme.outline,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user