feat: initial release of Oracle 999 divination app

This commit is contained in:
Alma Alexyz
2026-08-31 12:35:13 +05:00
commit 28b85061b9
143 changed files with 16073 additions and 0 deletions
+298
View File
@@ -0,0 +1,298 @@
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();
int _selectedMode = 0; // 0 = Single Card (Жребий момента), 1 = Triad (3 карты)
WordItem? _singleDraw;
List<WordItem> _triadDraw = [];
bool _isGenerating = false;
@override
void initState() {
super.initState();
_singleDraw = _repo.getRandomWord();
}
Future<void> _performSingleDraw({bool saveHistory = true}) async {
setState(() => _isGenerating = true);
HapticFeedback.mediumImpact();
await Future.delayed(const Duration(milliseconds: 250));
final word = _repo.getRandomWord();
setState(() {
_singleDraw = word;
_isGenerating = false;
});
if (saveHistory) {
final entry = HistoryEntry(
id: DateTime.now().millisecondsSinceEpoch.toString(),
timestamp: DateTime.now(),
word: word.word,
sessionNumber: word.sessionNumber,
partOfSpeech: word.partOfSpeech,
symbolicMeaning: word.description,
readingType: 'Жребий момента (1 символ)',
);
await _repo.addHistoryEntry(entry);
}
}
Future<void> _performTriadDraw() async {
setState(() => _isGenerating = true);
HapticFeedback.heavyImpact();
await Future.delayed(const Duration(milliseconds: 300));
final words = <WordItem>[];
final titles = [
'Истоки / Скрытая причина',
'Настоящее / Вызов',
'Совет / Исход',
];
while (words.length < 3) {
final w = _repo.getRandomWord();
if (!words.any((item) => item.id == w.id)) {
words.add(w);
}
}
setState(() {
_triadDraw = words;
_isGenerating = false;
});
for (int i = 0; i < words.length; i++) {
final entry = HistoryEntry(
id: '${DateTime.now().millisecondsSinceEpoch}_$i',
timestamp: DateTime.now(),
word: words[i].word,
sessionNumber: words[i].sessionNumber,
partOfSpeech: words[i].partOfSpeech,
symbolicMeaning: words[i].description,
readingType: 'Триада судьбы',
positionTitle: titles[i],
);
await _repo.addHistoryEntry(entry);
}
}
@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: [
// 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(
word: _singleDraw!,
positionTitle: 'Символ момента',
onRandom: () => _performSingleDraw(saveHistory: true),
)
else if (_selectedMode == 1 && _triadDraw.isNotEmpty)
Column(
children: [
WordCardWidget(
word: _triadDraw[0],
positionTitle: '1. Истоки / Скрытая причина',
),
const SizedBox(height: 14),
WordCardWidget(
word: _triadDraw[1],
positionTitle: '2. Настоящее / Вызов',
),
const SizedBox(height: 14),
WordCardWidget(
word: _triadDraw[2],
positionTitle: '3. Совет / Исход',
),
],
),
const SizedBox(height: 24),
],
),
),
),
);
}
}