feat: session start screen, question context input, and G4F-style AI multi-provider fallback
This commit is contained in:
@@ -26,7 +26,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
],
|
||||
),
|
||||
content: const Text(
|
||||
'Все сохранённые записи гаданий и жребиев с датами будут удалены.',
|
||||
'Все сохранённые записи гаданий, вопросов и AI-трактовок будут удалены.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
@@ -49,14 +49,19 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
}
|
||||
|
||||
void _copyEntry(HistoryEntry entry) {
|
||||
final text =
|
||||
var text =
|
||||
'✨ Оракул 999 — Запись из Истории ✨\n'
|
||||
'Время: ${entry.formattedDate}\n'
|
||||
'${entry.question != null && entry.question!.isNotEmpty ? "Вопрос: «${entry.question}»\n" : ""}'
|
||||
'Тип: ${entry.readingType}${entry.positionTitle != null ? ' (${entry.positionTitle})' : ''}\n'
|
||||
'Знак №${entry.formattedSessionNumber}: ${entry.word.toUpperCase()}\n'
|
||||
'Часть речи: ${entry.partOfSpeech}\n\n'
|
||||
'🔮 Толкование:\n${entry.symbolicMeaning}';
|
||||
|
||||
if (entry.aiInterpretation != null && entry.aiInterpretation!.isNotEmpty) {
|
||||
text += '\n\n🤖 AI Трактовка (G4F):\n${entry.aiInterpretation}';
|
||||
}
|
||||
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
HapticFeedback.lightImpact();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -119,7 +124,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
||||
child: Text(
|
||||
'Совершите жребий или сохраните выпавший символ, и он появится здесь с точной датой и временем.',
|
||||
'Задайте вопрос и бросьте жребий, чтобы получить ответ оракула и сохранить его здесь.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
),
|
||||
@@ -188,6 +193,34 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
],
|
||||
),
|
||||
|
||||
// Question snippet if present
|
||||
if (item.question != null && item.question!.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF22243C),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.help_outline_rounded, size: 14, color: Color(0xFFFFD54F)),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Вопрос: «${item.question}»',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Color(0xFFFFF9C4),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
if (item.positionTitle != null) ...[
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
@@ -238,7 +271,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Meaning snippet
|
||||
// Base Meaning snippet
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
@@ -257,6 +290,50 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// AI Interpretation snippet if present
|
||||
if (item.aiInterpretation != null && item.aiInterpretation!.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF261D3A),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFBA68C8).withValues(alpha: 0.4),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Row(
|
||||
children: [
|
||||
Icon(Icons.psychology_rounded, size: 14, color: Color(0xFFE1BEE7)),
|
||||
SizedBox(width: 6),
|
||||
Text(
|
||||
'AI Трактовка (G4F)',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFFE1BEE7),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
item.aiInterpretation!,
|
||||
style: const TextStyle(
|
||||
fontSize: 12.5,
|
||||
height: 1.45,
|
||||
color: Color(0xFFF3E5F5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../models/history_entry_model.dart';
|
||||
import '../models/word_model.dart';
|
||||
import '../services/words_repository.dart';
|
||||
import '../widgets/gradient_star_badge.dart';
|
||||
@@ -15,16 +16,18 @@ class HomeSearchScreen extends StatefulWidget {
|
||||
class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
final _repo = WordsRepository();
|
||||
final _searchController = TextEditingController();
|
||||
final _questionController = TextEditingController();
|
||||
final _focusNode = FocusNode();
|
||||
|
||||
WordItem? _currentWord;
|
||||
String? _activeHistoryId;
|
||||
List<WordItem> _searchResults = [];
|
||||
bool _showKeypad = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_currentWord = _repo.getWordBySessionNumber(0) ?? _repo.allWords.first;
|
||||
// Do NOT show word by default until user interacts or starts a session
|
||||
_searchController.addListener(_onSearchChanged);
|
||||
}
|
||||
|
||||
@@ -32,6 +35,7 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
void dispose() {
|
||||
_searchController.removeListener(_onSearchChanged);
|
||||
_searchController.dispose();
|
||||
_questionController.dispose();
|
||||
_focusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -49,14 +53,33 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
setState(() {
|
||||
_searchResults = results;
|
||||
if (results.isNotEmpty) {
|
||||
_currentWord = results.first;
|
||||
_setWord(results.first, recordHistory: true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _setWord(WordItem word, {bool updateText = false}) {
|
||||
Future<void> _setWord(WordItem word, {bool updateText = false, 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: 'Жребий номера',
|
||||
question: question.isNotEmpty ? question : null,
|
||||
);
|
||||
await _repo.addHistoryEntry(entry);
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_currentWord = word;
|
||||
_activeHistoryId = newHistId ?? _activeHistoryId;
|
||||
if (updateText) {
|
||||
_searchController.text = word.sessionNumber.toString();
|
||||
}
|
||||
@@ -101,28 +124,35 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _startNewSessionDraw() {
|
||||
final rnd = _repo.getRandomWord();
|
||||
_setWord(rnd, updateText: true, recordHistory: true);
|
||||
}
|
||||
|
||||
void _resetToWelcome() {
|
||||
setState(() {
|
||||
_currentWord = null;
|
||||
_searchController.clear();
|
||||
_searchResults = [];
|
||||
});
|
||||
}
|
||||
|
||||
void _goToNext() {
|
||||
if (_currentWord == null) return;
|
||||
final next = _repo.getNextWord(_currentWord!.sessionNumber);
|
||||
_setWord(next, updateText: true);
|
||||
_setWord(next, updateText: true, recordHistory: false);
|
||||
}
|
||||
|
||||
void _goToPrevious() {
|
||||
if (_currentWord == null) return;
|
||||
final prev = _repo.getPreviousWord(_currentWord!.sessionNumber);
|
||||
_setWord(prev, updateText: true);
|
||||
}
|
||||
|
||||
void _goToRandom() {
|
||||
final rnd = _repo.getRandomWord();
|
||||
_setWord(rnd, updateText: true);
|
||||
_setWord(prev, updateText: true, recordHistory: false);
|
||||
}
|
||||
|
||||
void _reshuffleSession() {
|
||||
_repo.reshuffleSessionNumbers();
|
||||
final first = _repo.getWordBySessionNumber(0) ?? _repo.allWords.first;
|
||||
setState(() {
|
||||
_currentWord = first;
|
||||
_currentWord = null;
|
||||
_searchController.clear();
|
||||
_searchResults = [];
|
||||
});
|
||||
@@ -155,11 +185,11 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Row(
|
||||
title: const Row(
|
||||
children: [
|
||||
const GradientStar(size: 24),
|
||||
const SizedBox(width: 10),
|
||||
const Text(
|
||||
GradientStar(size: 24),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
'Оракул 999',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
@@ -170,23 +200,24 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
if (_currentWord != null)
|
||||
IconButton(
|
||||
tooltip: 'Новый вопрос / Сброс',
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
onPressed: _resetToWelcome,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Перетасовать числа сессии (#000..#999)',
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
tooltip: 'Перетасовать числа (#000..#999)',
|
||||
icon: const Icon(Icons.shuffle_rounded),
|
||||
onPressed: _reshuffleSession,
|
||||
),
|
||||
IconButton(
|
||||
tooltip: _showKeypad ? 'Скрыть цифровую панель' : 'Показать цифровую панель',
|
||||
tooltip: _showKeypad ? 'Скрыть панель' : 'Показать панель',
|
||||
icon: Icon(_showKeypad ? Icons.dialpad_outlined : Icons.dialpad),
|
||||
onPressed: () {
|
||||
setState(() => _showKeypad = !_showKeypad);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Случайный жребий',
|
||||
icon: const Icon(Icons.shuffle_rounded),
|
||||
onPressed: _goToRandom,
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
@@ -195,6 +226,45 @@ 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),
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// Search & Number Input Bar
|
||||
TextField(
|
||||
controller: _searchController,
|
||||
@@ -242,7 +312,7 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
),
|
||||
),
|
||||
|
||||
// Search matches dropdown list if query produced text matches
|
||||
// Search matches dropdown list
|
||||
if (_searchResults.length > 1 && _searchController.text.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
@@ -287,7 +357,7 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
_setWord(item, updateText: false);
|
||||
_setWord(item, updateText: false, recordHistory: true);
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -297,8 +367,85 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
|
||||
const SizedBox(height: 14),
|
||||
|
||||
// Main Sacred Word Card Display
|
||||
if (_currentWord != null)
|
||||
// Welcome Idle State OR Active Word Card
|
||||
if (_currentWord == null) ...[
|
||||
// Welcome Initiation Card
|
||||
Container(
|
||||
padding: const EdgeInsets.all(22),
|
||||
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,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.1),
|
||||
blurRadius: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const GradientStar(size: 44),
|
||||
const SizedBox(height: 14),
|
||||
const Text(
|
||||
'СВЯЩЕННЫЙ ЖРЕБИЙ ОРАКУЛА',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 1.0,
|
||||
color: Color(0xFFFFF9C4),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'Сформулируйте в мыслях или запишите сверху ваш вопрос, затем нажмите кнопку или наберите номер от 000 до 999 для раскрытия символического ключа.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
height: 1.45,
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.85),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 18),
|
||||
FilledButton.icon(
|
||||
onPressed: _startNewSessionDraw,
|
||||
icon: const GradientStar(size: 20),
|
||||
label: const Text(
|
||||
'НАЧАТЬ СЕССИЮ / БРОСИТЬ ЖРЕБИЙ',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2A2D4A),
|
||||
foregroundColor: const Color(0xFFFFF9C4),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
side: const BorderSide(
|
||||
color: Color(0xFFFFD54F),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
// Main Sacred Word Card Display
|
||||
AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (child, animation) {
|
||||
@@ -316,26 +463,18 @@ class _HomeSearchScreenState extends State<HomeSearchScreen> {
|
||||
child: WordCardWidget(
|
||||
key: ValueKey('${_currentWord!.id}_${_currentWord!.sessionNumber}'),
|
||||
word: _currentWord!,
|
||||
question: _questionController.text.trim(),
|
||||
historyEntryId: _activeHistoryId,
|
||||
onNext: _goToNext,
|
||||
onPrevious: _goToPrevious,
|
||||
onRandom: _goToRandom,
|
||||
),
|
||||
)
|
||||
else
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32.0),
|
||||
child: Text(
|
||||
'Символ с таким номером не найден.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: theme.colorScheme.error),
|
||||
),
|
||||
onRandom: _startNewSessionDraw,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 14),
|
||||
|
||||
// Interactive Numeric Keypad (1..9, C, 0, ⌫)
|
||||
// Interactive Numeric Keypad
|
||||
if (_showKeypad) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
||||
@@ -15,10 +15,13 @@ class OracleSpreadScreen extends StatefulWidget {
|
||||
|
||||
class _OracleSpreadScreenState extends State<OracleSpreadScreen> {
|
||||
final _repo = WordsRepository();
|
||||
final _questionController = TextEditingController();
|
||||
int _selectedMode = 0; // 0 = Single Card (Жребий момента), 1 = Triad (3 карты)
|
||||
|
||||
WordItem? _singleDraw;
|
||||
String? _singleHistoryId;
|
||||
List<WordItem> _triadDraw = [];
|
||||
List<String> _triadHistoryIds = [];
|
||||
bool _isGenerating = false;
|
||||
|
||||
@override
|
||||
@@ -27,35 +30,47 @@ class _OracleSpreadScreenState extends State<OracleSpreadScreen> {
|
||||
_singleDraw = _repo.getRandomWord();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_questionController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _performSingleDraw({bool saveHistory = true}) async {
|
||||
setState(() => _isGenerating = true);
|
||||
HapticFeedback.mediumImpact();
|
||||
await Future.delayed(const Duration(milliseconds: 250));
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
|
||||
final word = _repo.getRandomWord();
|
||||
setState(() {
|
||||
_singleDraw = word;
|
||||
_isGenerating = false;
|
||||
});
|
||||
String? histId;
|
||||
|
||||
if (saveHistory) {
|
||||
histId = DateTime.now().millisecondsSinceEpoch.toString();
|
||||
final question = _questionController.text.trim();
|
||||
final entry = HistoryEntry(
|
||||
id: DateTime.now().millisecondsSinceEpoch.toString(),
|
||||
id: histId,
|
||||
timestamp: DateTime.now(),
|
||||
word: word.word,
|
||||
sessionNumber: word.sessionNumber,
|
||||
partOfSpeech: word.partOfSpeech,
|
||||
symbolicMeaning: word.description,
|
||||
readingType: 'Жребий момента (1 символ)',
|
||||
question: question.isNotEmpty ? question : null,
|
||||
);
|
||||
await _repo.addHistoryEntry(entry);
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_singleDraw = word;
|
||||
_singleHistoryId = histId ?? _singleHistoryId;
|
||||
_isGenerating = false;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _performTriadDraw() async {
|
||||
setState(() => _isGenerating = true);
|
||||
HapticFeedback.heavyImpact();
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
await Future.delayed(const Duration(milliseconds: 250));
|
||||
|
||||
final words = <WordItem>[];
|
||||
final titles = [
|
||||
@@ -71,14 +86,14 @@ class _OracleSpreadScreenState extends State<OracleSpreadScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_triadDraw = words;
|
||||
_isGenerating = false;
|
||||
});
|
||||
final question = _questionController.text.trim();
|
||||
final ids = <String>[];
|
||||
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
final histId = '${DateTime.now().millisecondsSinceEpoch}_$i';
|
||||
ids.add(histId);
|
||||
final entry = HistoryEntry(
|
||||
id: '${DateTime.now().millisecondsSinceEpoch}_$i',
|
||||
id: histId,
|
||||
timestamp: DateTime.now(),
|
||||
word: words[i].word,
|
||||
sessionNumber: words[i].sessionNumber,
|
||||
@@ -86,9 +101,16 @@ class _OracleSpreadScreenState extends State<OracleSpreadScreen> {
|
||||
symbolicMeaning: words[i].description,
|
||||
readingType: 'Триада судьбы',
|
||||
positionTitle: titles[i],
|
||||
question: question.isNotEmpty ? question : null,
|
||||
);
|
||||
await _repo.addHistoryEntry(entry);
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_triadDraw = words;
|
||||
_triadHistoryIds = ids;
|
||||
_isGenerating = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -115,6 +137,45 @@ class _OracleSpreadScreenState extends State<OracleSpreadScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// Question Input
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Mode Selector (1 символ / Триада 3 символа)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
@@ -264,26 +325,38 @@ class _OracleSpreadScreenState extends State<OracleSpreadScreen> {
|
||||
)
|
||||
else if (_selectedMode == 0 && _singleDraw != null)
|
||||
WordCardWidget(
|
||||
key: ValueKey('${_singleDraw!.id}_${_singleDraw!.sessionNumber}'),
|
||||
word: _singleDraw!,
|
||||
positionTitle: 'Символ момента',
|
||||
question: _questionController.text.trim(),
|
||||
historyEntryId: _singleHistoryId,
|
||||
onRandom: () => _performSingleDraw(saveHistory: true),
|
||||
)
|
||||
else if (_selectedMode == 1 && _triadDraw.isNotEmpty)
|
||||
Column(
|
||||
children: [
|
||||
WordCardWidget(
|
||||
key: ValueKey('triad_0_${_triadDraw[0].id}_${_triadDraw[0].sessionNumber}'),
|
||||
word: _triadDraw[0],
|
||||
positionTitle: '1. Истоки / Скрытая причина',
|
||||
question: _questionController.text.trim(),
|
||||
historyEntryId: _triadHistoryIds.isNotEmpty ? _triadHistoryIds[0] : null,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
WordCardWidget(
|
||||
key: ValueKey('triad_1_${_triadDraw[1].id}_${_triadDraw[1].sessionNumber}'),
|
||||
word: _triadDraw[1],
|
||||
positionTitle: '2. Настоящее / Вызов',
|
||||
question: _questionController.text.trim(),
|
||||
historyEntryId: _triadHistoryIds.length > 1 ? _triadHistoryIds[1] : null,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
WordCardWidget(
|
||||
key: ValueKey('triad_2_${_triadDraw[2].id}_${_triadDraw[2].sessionNumber}'),
|
||||
word: _triadDraw[2],
|
||||
positionTitle: '3. Совет / Исход',
|
||||
question: _questionController.text.trim(),
|
||||
historyEntryId: _triadHistoryIds.length > 2 ? _triadHistoryIds[2] : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user