feat: session start screen, question context input, and G4F-style AI multi-provider fallback

This commit is contained in:
Alma Alexyz
2026-08-31 13:43:45 +05:00
parent c99e36e9ac
commit a24fdaee97
11 changed files with 857 additions and 99 deletions
+81 -4
View File
@@ -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),
),
),
],
),
),
],
],
),
),