feat: Add Nanaxe server with Docker, GitHub Actions CI/CD, and auto-deployment

- Add complete server infrastructure with Gitea, API, PostgreSQL
- Implement Obsidian-compatible markdown mindmap converter
- Add Flutter service for server synchronization
- Configure GitHub Actions for automated build and deploy
- Add production docker-compose with health checks
- Include VPS setup and deployment scripts
- Add comprehensive deployment documentation
This commit is contained in:
2026-04-19 22:18:25 +05:00
parent 52aea9ac87
commit f1e0f6b5ef
56 changed files with 8892 additions and 397 deletions
+237
View File
@@ -0,0 +1,237 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class ProfileScreen extends ConsumerStatefulWidget {
const ProfileScreen({super.key});
@override
ConsumerState<ProfileScreen> createState() => _ProfileScreenState();
}
class _ProfileScreenState extends ConsumerState<ProfileScreen> {
bool _isEditing = false;
final _nameController = TextEditingController();
String? _photoUrl;
bool _isLoading = true;
@override
void initState() {
super.initState();
_loadProfile();
}
Future<void> _loadProfile() async {
final user = FirebaseAuth.instance.currentUser;
if (user != null) {
_nameController.text = user.displayName ?? '';
_photoUrl = user.photoURL;
}
setState(() => _isLoading = false);
}
Future<void> _saveProfile() async {
final user = FirebaseAuth.instance.currentUser;
if (user != null) {
await user.updateDisplayName(_nameController.text);
await FirebaseFirestore.instance
.collection('users')
.doc(user.uid)
.update({
'displayName': _nameController.text,
'updatedAt': Timestamp.now(),
});
setState(() => _isEditing = false);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('✅ Профиль сохранён'),
backgroundColor: Colors.green,
),
);
}
}
}
@override
Widget build(BuildContext context) {
if (_isLoading) {
return const Scaffold(
body: Center(child: CircularProgressIndicator()),
);
}
final user = FirebaseAuth.instance.currentUser;
return Scaffold(
appBar: AppBar(
title: const Text('Профиль'),
actions: [
IconButton(
icon: Icon(_isEditing ? Icons.check : Icons.edit),
onPressed: () {
if (_isEditing) {
_saveProfile();
} else {
setState(() => _isEditing = true);
}
},
tooltip: _isEditing ? 'Сохранить' : 'Редактировать',
),
],
),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
// Аватар
Center(
child: Stack(
children: [
CircleAvatar(
radius: 60,
backgroundColor: Colors.blue,
backgroundImage: _photoUrl != null
? NetworkImage(_photoUrl!)
: null,
child: _photoUrl == null
? Text(
user?.displayName?.substring(0, 1).toUpperCase() ??
'U',
style: const TextStyle(
fontSize: 40,
color: Colors.white,
fontWeight: FontWeight.bold,
),
)
: null,
),
if (_isEditing)
Positioned(
bottom: 0,
right: 0,
child: Container(
padding: const EdgeInsets.all(4),
decoration: const BoxDecoration(
color: Colors.blue,
shape: BoxShape.circle,
),
child: const Icon(
Icons.camera_alt,
color: Colors.white,
size: 20,
),
),
),
],
),
),
const SizedBox(height: 24),
// Имя
TextField(
controller: _nameController,
enabled: _isEditing,
decoration: const InputDecoration(
labelText: 'Имя',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.person),
),
),
const SizedBox(height: 16),
// Email
ListTile(
leading: const Icon(Icons.email),
title: const Text('Email'),
subtitle: Text(user?.email ?? 'Не указан'),
enabled: false,
),
// UID
ListTile(
leading: const Icon(Icons.fingerprint),
title: const Text('User ID'),
subtitle: Text(user?.uid ?? 'Неизвестно'),
enabled: false,
),
const Divider(height: 32),
// Статистика
_buildStatCard(
'Статистика',
[
_buildStatRow('Задач создано', '12'),
_buildStatRow('Mind-карт', '5'),
_buildStatRow('Будильников', '3'),
_buildStatRow('Дней в приложении', '30'),
],
),
const SizedBox(height: 24),
// Кнопка выхода
OutlinedButton.icon(
onPressed: () async {
await FirebaseAuth.instance.signOut();
},
icon: const Icon(Icons.logout, color: Colors.red),
label: const Text('Выйти', style: TextStyle(color: Colors.red)),
),
],
),
);
}
Widget _buildStatCard(String title, List<Widget> children) {
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 8,
offset: const Offset(0, 2),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
...children,
],
),
);
}
Widget _buildStatRow(String label, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label, style: TextStyle(color: Colors.grey[600])),
Text(
value,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
],
),
);
}
}