feat: unified 1..9 words session narrative, dice input before reveal, dedicated results screen, and clean session history grouping
This commit is contained in:
+195
-195
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import '../models/history_entry_model.dart';
|
||||
import '../services/words_repository.dart';
|
||||
import '../widgets/gradient_star_badge.dart';
|
||||
import 'session_result_screen.dart';
|
||||
|
||||
class HistoryScreen extends StatefulWidget {
|
||||
const HistoryScreen({super.key});
|
||||
@@ -26,7 +27,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
],
|
||||
),
|
||||
content: const Text(
|
||||
'Все сохранённые записи гаданий, вопросов и AI-трактовок будут удалены.',
|
||||
'Все сохранённые сессии гаданий и AI-трактовки будут удалены.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
@@ -48,21 +49,27 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _copyEntry(HistoryEntry entry) {
|
||||
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}';
|
||||
void _copySession(OracleSession session) {
|
||||
final buf = StringBuffer();
|
||||
buf.writeln('✨ Оракул 999 — Запись Сессии ✨');
|
||||
buf.writeln('Дата: ${session.formattedDate}');
|
||||
if (session.question != null && session.question!.isNotEmpty) {
|
||||
buf.writeln('Вопрос: «${session.question}»');
|
||||
}
|
||||
buf.writeln('Знаков: ${session.words.length}\n');
|
||||
|
||||
if (entry.aiInterpretation != null && entry.aiInterpretation!.isNotEmpty) {
|
||||
text += '\n\n🤖 AI Трактовка (G4F):\n${entry.aiInterpretation}';
|
||||
for (int i = 0; i < session.words.length; i++) {
|
||||
final w = session.words[i];
|
||||
buf.writeln('🔮 Знак #${w.formattedSessionNumber}: ${w.word.toUpperCase()} (${w.partOfSpeech})');
|
||||
buf.writeln(' ${w.symbolicMeaning}\n');
|
||||
}
|
||||
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
if (session.aiInterpretation != null && session.aiInterpretation!.isNotEmpty) {
|
||||
buf.writeln('🤖 AI Трактовка (G4F):');
|
||||
buf.writeln(session.aiInterpretation);
|
||||
}
|
||||
|
||||
Clipboard.setData(ClipboardData(text: buf.toString()));
|
||||
HapticFeedback.lightImpact();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
@@ -70,7 +77,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
children: [
|
||||
GradientStar(size: 18),
|
||||
SizedBox(width: 10),
|
||||
Expanded(child: Text('Запись скопирована в буфер обмена')),
|
||||
Expanded(child: Text('Сессия скопирована в буфер обмена')),
|
||||
],
|
||||
),
|
||||
duration: const Duration(seconds: 2),
|
||||
@@ -84,7 +91,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
final historyList = _repo.history;
|
||||
final sessionsList = _repo.sessions;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -93,13 +100,13 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
GradientStar(size: 24),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
'История гаданий',
|
||||
'История сессий',
|
||||
style: TextStyle(fontWeight: FontWeight.w900),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
if (historyList.isNotEmpty)
|
||||
if (sessionsList.isNotEmpty)
|
||||
IconButton(
|
||||
tooltip: 'Очистить историю',
|
||||
icon: const Icon(Icons.delete_outline_rounded),
|
||||
@@ -107,7 +114,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
),
|
||||
],
|
||||
),
|
||||
body: historyList.isEmpty
|
||||
body: sessionsList.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -115,7 +122,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
const GradientStar(size: 48),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'История пока пуста',
|
||||
'История сессий пока пуста',
|
||||
style: theme.textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@@ -124,7 +131,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
||||
child: Text(
|
||||
'Задайте вопрос и бросьте жребий, чтобы получить ответ оракула и сохранить его здесь.',
|
||||
'Задайте вопрос, совершите броски и откройте знаки, чтобы сохранить сессию здесь.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
),
|
||||
@@ -134,207 +141,200 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
)
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||
itemCount: historyList.length,
|
||||
separatorBuilder: (_, _) => const SizedBox(height: 10),
|
||||
itemCount: sessionsList.length,
|
||||
separatorBuilder: (_, _) => const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) {
|
||||
final item = historyList[index];
|
||||
final session = sessionsList[index];
|
||||
|
||||
return Card(
|
||||
elevation: 3,
|
||||
elevation: 4,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: BorderSide(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.2),
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.25),
|
||||
),
|
||||
),
|
||||
color: isDark ? const Color(0xFF1B1D30) : theme.colorScheme.surface,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Top header: Timestamp and Reading type
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.access_time_rounded,
|
||||
size: 14,
|
||||
color: Color(0xFFFFD54F),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => SessionResultScreen(session: session),
|
||||
),
|
||||
).then((_) => setState(() {}));
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Top Header: Date, Words Count, Actions
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.access_time_rounded,
|
||||
size: 14,
|
||||
color: Color(0xFFFFD54F),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
session.formattedDate,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFFFFD54F),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2A2D4A),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'${session.words.length} ${session.words.length == 1 ? "знак" : (session.words.length < 5 ? "знака" : "знаков")}',
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Color(0xFFFFF9C4),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded, size: 16),
|
||||
tooltip: 'Скопировать',
|
||||
onPressed: () => _copySession(session),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_outline, size: 16),
|
||||
tooltip: 'Удалить',
|
||||
onPressed: () async {
|
||||
await _repo.deleteSession(session.id);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Question Box if present
|
||||
if (session.question != null && session.question!.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF22243C),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.help_outline_rounded, size: 14, color: Color(0xFFFFD54F)),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Вопрос: «${session.question}»',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.5,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Color(0xFFFFF9C4),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// Words Chips Row
|
||||
Wrap(
|
||||
spacing: 6,
|
||||
runSpacing: 6,
|
||||
children: session.words.map((w) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF131524) : theme.colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
item.formattedDate,
|
||||
child: Text(
|
||||
'#${w.formattedSessionNumber} ${w.word.toUpperCase()}',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFFFFD54F),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
// AI Interpretation Snippet if generated
|
||||
if (session.aiInterpretation != null && session.aiInterpretation!.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF2A2D4A),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
item.readingType,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Color(0xFFFFF9C4),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: const Color(0xFF261D3A),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFBA68C8).withValues(alpha: 0.4),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// 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}»',
|
||||
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: 4),
|
||||
Text(
|
||||
session.aiInterpretation!,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: Color(0xFFFFF9C4),
|
||||
height: 1.4,
|
||||
color: Color(0xFFF3E5F5),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
if (item.positionTitle != null) ...[
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
item.positionTitle!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 10),
|
||||
|
||||
// Word row with number badge
|
||||
Row(
|
||||
children: [
|
||||
GradientStarBadge(
|
||||
text: '#${item.formattedSessionNumber}',
|
||||
size: 14,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
item.word.toUpperCase(),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18,
|
||||
letterSpacing: 0.8,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.copy_rounded, size: 18),
|
||||
tooltip: 'Скопировать',
|
||||
onPressed: () => _copyEntry(item),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_outline, size: 18),
|
||||
tooltip: 'Удалить',
|
||||
onPressed: () async {
|
||||
await _repo.deleteHistoryEntry(item.id);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Base Meaning snippet
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark
|
||||
? const Color(0xFF131524)
|
||||
: theme.colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
item.symbolicMeaning,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
height: 1.4,
|
||||
color: isDark ? const Color(0xFFD4D6E6) : Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
+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,
|
||||
),
|
||||
|
||||
@@ -1,371 +0,0 @@
|
||||
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';
|
||||
import '../widgets/word_card_widget.dart';
|
||||
|
||||
class OracleSpreadScreen extends StatefulWidget {
|
||||
const OracleSpreadScreen({super.key});
|
||||
|
||||
@override
|
||||
State<OracleSpreadScreen> createState() => _OracleSpreadScreenState();
|
||||
}
|
||||
|
||||
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
|
||||
void initState() {
|
||||
super.initState();
|
||||
_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: 200));
|
||||
|
||||
final word = _repo.getRandomWord();
|
||||
String? histId;
|
||||
|
||||
if (saveHistory) {
|
||||
histId = DateTime.now().millisecondsSinceEpoch.toString();
|
||||
final question = _questionController.text.trim();
|
||||
final entry = HistoryEntry(
|
||||
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: 250));
|
||||
|
||||
final words = <WordItem>[];
|
||||
final titles = [
|
||||
'Истоки / Скрытая причина',
|
||||
'Настоящее / Вызов',
|
||||
'Совет / Исход',
|
||||
];
|
||||
|
||||
while (words.length < 3) {
|
||||
final w = _repo.getRandomWord();
|
||||
if (!words.any((item) => item.id == w.id)) {
|
||||
words.add(w);
|
||||
}
|
||||
}
|
||||
|
||||
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: histId,
|
||||
timestamp: DateTime.now(),
|
||||
word: words[i].word,
|
||||
sessionNumber: words[i].sessionNumber,
|
||||
partOfSpeech: words[i].partOfSpeech,
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Row(
|
||||
children: [
|
||||
GradientStar(size: 24),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
'Расклады Оракула',
|
||||
style: TextStyle(fontWeight: FontWeight.w900),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
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),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF1B1D30) : theme.colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() => _selectedMode = 0);
|
||||
if (_singleDraw == null) _performSingleDraw(saveHistory: false);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: _selectedMode == 0
|
||||
? const Color(0xFF2A2D4A)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: _selectedMode == 0
|
||||
? Border.all(color: const Color(0xFFFFD54F).withValues(alpha: 0.5))
|
||||
: null,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const GradientStar(size: 14),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'Жребий момента (1)',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _selectedMode == 0
|
||||
? const Color(0xFFFFF9C4)
|
||||
: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() => _selectedMode = 1);
|
||||
if (_triadDraw.isEmpty) _performTriadDraw();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: _selectedMode == 1
|
||||
? const Color(0xFF2A2D4A)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: _selectedMode == 1
|
||||
? Border.all(color: const Color(0xFFFFD54F).withValues(alpha: 0.5))
|
||||
: null,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const GradientStar(size: 14),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'Триада судьбы (3)',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _selectedMode == 1
|
||||
? const Color(0xFFFFF9C4)
|
||||
: theme.colorScheme.outline,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Action draw button
|
||||
FilledButton.icon(
|
||||
onPressed: _isGenerating
|
||||
? null
|
||||
: () {
|
||||
if (_selectedMode == 0) {
|
||||
_performSingleDraw(saveHistory: true);
|
||||
} else {
|
||||
_performTriadDraw();
|
||||
}
|
||||
},
|
||||
icon: const GradientStar(size: 20),
|
||||
label: Text(
|
||||
_selectedMode == 0 ? 'БРОСИТЬ ЖРЕБИЙ МОМЕНТА' : 'РАСКРЫТЬ ТРИАДУ СУДЬБЫ',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 0.8,
|
||||
),
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2A2D4A),
|
||||
foregroundColor: const Color(0xFFFFF9C4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
side: const BorderSide(
|
||||
color: Color(0xFFFFD54F),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
if (_isGenerating)
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(40.0),
|
||||
child: Column(
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFFFFD54F)),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'Синхронизация с полем оракула...',
|
||||
style: TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../models/history_entry_model.dart';
|
||||
import '../services/ai_oracle_service.dart';
|
||||
import '../services/words_repository.dart';
|
||||
import '../widgets/gradient_star_badge.dart';
|
||||
|
||||
class SessionResultScreen extends StatefulWidget {
|
||||
final OracleSession session;
|
||||
|
||||
const SessionResultScreen({
|
||||
super.key,
|
||||
required this.session,
|
||||
});
|
||||
|
||||
@override
|
||||
State<SessionResultScreen> createState() => _SessionResultScreenState();
|
||||
}
|
||||
|
||||
class _SessionResultScreenState extends State<SessionResultScreen> {
|
||||
final _aiService = AiOracleService();
|
||||
final _repo = WordsRepository();
|
||||
|
||||
late OracleSession _session;
|
||||
bool _isLoadingAi = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_session = widget.session;
|
||||
// Persist the session atomically
|
||||
_repo.saveSession(_session);
|
||||
}
|
||||
|
||||
Future<void> _fetchAiInterpretation() async {
|
||||
setState(() => _isLoadingAi = true);
|
||||
HapticFeedback.mediumImpact();
|
||||
|
||||
try {
|
||||
final result = await _aiService.interpretSession(
|
||||
words: _session.words,
|
||||
question: _session.question ?? '',
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
final updated = _session.copyWith(aiInterpretation: result);
|
||||
setState(() {
|
||||
_session = updated;
|
||||
_isLoadingAi = false;
|
||||
});
|
||||
await _repo.saveSession(updated);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
setState(() => _isLoadingAi = false);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Ошибка генерации: $e'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _copySessionToClipboard() {
|
||||
final buf = StringBuffer();
|
||||
buf.writeln('✨ Оракул 999 — Сессия Клеромантии ✨');
|
||||
buf.writeln('Дата: ${_session.formattedDate}');
|
||||
if (_session.question != null && _session.question!.isNotEmpty) {
|
||||
buf.writeln('Вопрос: «${_session.question}»');
|
||||
}
|
||||
buf.writeln('Знаков в цепочке: ${_session.words.length}\n');
|
||||
|
||||
for (int i = 0; i < _session.words.length; i++) {
|
||||
final w = _session.words[i];
|
||||
final pos = w.positionTitle != null ? ' (${w.positionTitle})' : '';
|
||||
buf.writeln('🔮 Знак #${w.formattedSessionNumber}: ${w.word.toUpperCase()}$pos');
|
||||
buf.writeln(' Аспект: ${w.partOfSpeech} • ${w.category}');
|
||||
buf.writeln(' Смысл: ${w.symbolicMeaning}\n');
|
||||
}
|
||||
|
||||
if (_session.aiInterpretation != null) {
|
||||
buf.writeln('🤖 AI Трактовка Оракула (G4F):');
|
||||
buf.writeln(_session.aiInterpretation);
|
||||
}
|
||||
|
||||
Clipboard.setData(ClipboardData(text: buf.toString()));
|
||||
HapticFeedback.lightImpact();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Row(
|
||||
children: [
|
||||
GradientStar(size: 18),
|
||||
SizedBox(width: 10),
|
||||
Expanded(child: Text('Вся сессия скопирована в буфер обмена')),
|
||||
],
|
||||
),
|
||||
duration: const Duration(seconds: 2),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Row(
|
||||
children: [
|
||||
const GradientStar(size: 22),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Знаки Сессии (${_session.words.length})',
|
||||
style: const TextStyle(fontWeight: FontWeight.w900),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
tooltip: 'Скопировать сессию',
|
||||
icon: const Icon(Icons.copy_rounded),
|
||||
onPressed: _copySessionToClipboard,
|
||||
),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// Question Banner
|
||||
if (_session.question != null && _session.question!.isNotEmpty) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF1E2138),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.help_outline_rounded, size: 18, color: Color(0xFFFFD54F)),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Вопрос: «${_session.question}»',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFFFFF9C4),
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
],
|
||||
|
||||
// AI Interpretation Box if generated or button
|
||||
if (_session.aiInterpretation != null) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [Color(0xFF2A1E4A), Color(0xFF191833)],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFBA68C8).withValues(alpha: 0.6),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Row(
|
||||
children: [
|
||||
Icon(Icons.psychology_rounded, size: 20, color: Color(0xFFE1BEE7)),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'AI ТРАКТОВКА ИСТОРИИ (G4F)',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 0.8,
|
||||
color: Color(0xFFE1BEE7),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh_rounded, size: 18, color: Color(0xFFE1BEE7)),
|
||||
tooltip: 'Перегенерировать',
|
||||
onPressed: _fetchAiInterpretation,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
_session.aiInterpretation!,
|
||||
style: const TextStyle(
|
||||
fontSize: 13.5,
|
||||
height: 1.5,
|
||||
color: Color(0xFFF3E5F5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
] else ...[
|
||||
FilledButton.icon(
|
||||
onPressed: _isLoadingAi ? null : _fetchAiInterpretation,
|
||||
icon: _isLoadingAi
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFFFFD54F)),
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.auto_awesome, size: 18, color: Color(0xFFE1BEE7)),
|
||||
label: Text(
|
||||
_isLoadingAi ? 'Синтез толкования...' : 'Синтезировать связную AI-трактовку (G4F)',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
color: Color(0xFFFFF9C4),
|
||||
),
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2A2145),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
side: const BorderSide(
|
||||
color: Color(0xFFBA68C8),
|
||||
width: 1.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
|
||||
// Word Cards List
|
||||
..._session.words.asMap().entries.map((entry) {
|
||||
final idx = entry.key;
|
||||
final w = entry.value;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 14),
|
||||
child: Card(
|
||||
elevation: 6,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: BorderSide(
|
||||
color: const Color(0xFFFFD54F).withValues(alpha: 0.25),
|
||||
),
|
||||
),
|
||||
color: isDark ? const Color(0xFF1B1D30) : theme.colorScheme.surface,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const GradientStar(size: 15),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'${idx + 1}. ЗНАК #${w.formattedSessionNumber}',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 13,
|
||||
color: Color(0xFFFFD54F),
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF262A48) : Colors.black12,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
w.partOfSpeech,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: isDark ? const Color(0xFFB0B7DE) : Colors.black87,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Center(
|
||||
child: Text(
|
||||
w.word.toUpperCase(),
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w900,
|
||||
letterSpacing: 1.5,
|
||||
color: Color(0xFFFFF9C4),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF131525) : theme.colorScheme.surfaceContainerLow,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Text(
|
||||
w.symbolicMeaning,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
height: 1.45,
|
||||
color: isDark ? const Color(0xFFD4D6E6) : Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user