Fix compilation errors
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../providers/auth_provider.dart';
|
||||
import '../models/user_model.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../providers/auth_provider.dart';
|
||||
import '../../models/user_model.dart';
|
||||
|
||||
class AdminScreen extends ConsumerWidget {
|
||||
const AdminScreen({super.key});
|
||||
@@ -116,9 +117,8 @@ class AdminScreen extends ConsumerWidget {
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundImage: user?.photoUrl != null
|
||||
? NetworkImage(user!.photoUrl!)
|
||||
: null,
|
||||
backgroundImage:
|
||||
user?.photoUrl != null ? NetworkImage(user!.photoUrl!) : null,
|
||||
child: user?.photoUrl == null
|
||||
? const Icon(Icons.person, size: 40)
|
||||
: null,
|
||||
@@ -136,7 +136,8 @@ class AdminScreen extends ConsumerWidget {
|
||||
const SizedBox(height: 12),
|
||||
if (user?.isAdmin ?? false)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.purple.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -149,7 +150,8 @@ class AdminScreen extends ConsumerWidget {
|
||||
const SizedBox(width: 4),
|
||||
const Text(
|
||||
'Администратор',
|
||||
style: TextStyle(color: Colors.purple, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
color: Colors.purple, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../core/notification_service.dart';
|
||||
import '../../core/notification_service.dart';
|
||||
|
||||
class NotificationsSettingsScreen extends ConsumerStatefulWidget {
|
||||
const NotificationsSettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<NotificationsSettingsScreen> createState() => _NotificationsSettingsScreenState();
|
||||
ConsumerState<NotificationsSettingsScreen> createState() =>
|
||||
_NotificationsSettingsScreenState();
|
||||
}
|
||||
|
||||
class _NotificationsSettingsScreenState extends ConsumerState<NotificationsSettingsScreen> {
|
||||
class _NotificationsSettingsScreenState
|
||||
extends ConsumerState<NotificationsSettingsScreen> {
|
||||
bool _taskNotifications = true;
|
||||
bool _deadlineReminders = true;
|
||||
bool _taskAssigned = true;
|
||||
bool _dailySummary = false;
|
||||
Time _dailySummaryTime = const Time(9, 0);
|
||||
TimeOfDay _dailySummaryTime = const TimeOfDay(hour: 9, minute: 0);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -79,13 +81,14 @@ class _NotificationsSettingsScreenState extends ConsumerState<NotificationsSetti
|
||||
if (_dailySummary)
|
||||
ListTile(
|
||||
title: const Text('Время сводки'),
|
||||
subtitle: Text('${_dailySummaryTime.hour.toString().padLeft(2, '0')}:${_dailySummaryTime.minute.toString().padLeft(2, '0')}'),
|
||||
subtitle: Text(
|
||||
'${_dailySummaryTime.hour.toString().padLeft(2, '0')}:${_dailySummaryTime.minute.toString().padLeft(2, '0')}'),
|
||||
trailing: const Icon(Icons.access_time),
|
||||
onTap: () => _selectDailySummaryTime(),
|
||||
),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.test_build, color: Colors.blue),
|
||||
leading: const Icon(Icons.info_outline, color: Colors.blue),
|
||||
title: const Text('Тестовое уведомление'),
|
||||
subtitle: const Text('Проверьте работу уведомлений'),
|
||||
onTap: _showTestNotification,
|
||||
@@ -115,7 +118,7 @@ class _NotificationsSettingsScreenState extends ConsumerState<NotificationsSetti
|
||||
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
_dailySummaryTime = Time(picked.hour, picked.minute);
|
||||
_dailySummaryTime = picked;
|
||||
});
|
||||
_scheduleDailySummary();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import '../providers/auth_provider.dart';
|
||||
import '../models/project_model.dart';
|
||||
import '../../providers/auth_provider.dart';
|
||||
import '../../models/project_model.dart';
|
||||
|
||||
class ProjectsManagementScreen extends ConsumerStatefulWidget {
|
||||
const ProjectsManagementScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<ProjectsManagementScreen> createState() => _ProjectsManagementScreenState();
|
||||
ConsumerState<ProjectsManagementScreen> createState() =>
|
||||
_ProjectsManagementScreenState();
|
||||
}
|
||||
|
||||
class _ProjectsManagementScreenState extends ConsumerState<ProjectsManagementScreen> {
|
||||
class _ProjectsManagementScreenState
|
||||
extends ConsumerState<ProjectsManagementScreen> {
|
||||
final _nameController = TextEditingController();
|
||||
final _descriptionController = TextEditingController();
|
||||
bool _isCreating = false;
|
||||
@@ -87,14 +90,24 @@ class _ProjectsManagementScreenState extends ConsumerState<ProjectsManagementScr
|
||||
}
|
||||
|
||||
String _getRandomColor() {
|
||||
final colors = ['#2196F3', '#4CAF50', '#FF9800', '#E91E63', '#9C27B0', '#00BCD4'];
|
||||
final colors = [
|
||||
'#2196F3',
|
||||
'#4CAF50',
|
||||
'#FF9800',
|
||||
'#E91E63',
|
||||
'#9C27B0',
|
||||
'#00BCD4'
|
||||
];
|
||||
return colors[DateTime.now().millisecond % colors.length];
|
||||
}
|
||||
|
||||
Future<void> _deleteProject(String projectId) async {
|
||||
try {
|
||||
await FirebaseFirestore.instance.collection('projects').doc(projectId).delete();
|
||||
|
||||
await FirebaseFirestore.instance
|
||||
.collection('projects')
|
||||
.doc(projectId)
|
||||
.delete();
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('✅ Проект удалён')),
|
||||
);
|
||||
@@ -195,7 +208,8 @@ class _ProjectsManagementScreenState extends ConsumerState<ProjectsManagementScr
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(Icons.folder_outline, size: 48, color: Colors.grey),
|
||||
const Icon(Icons.folder_outline,
|
||||
size: 48, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'Нет проектов',
|
||||
@@ -212,9 +226,11 @@ class _ProjectsManagementScreenState extends ConsumerState<ProjectsManagementScr
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: projects.length,
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||
separatorBuilder: (context, index) =>
|
||||
const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) {
|
||||
final projectData = projects[index].data() as Map<String, dynamic>;
|
||||
final projectData =
|
||||
projects[index].data() as Map<String, dynamic>;
|
||||
final projectId = projects[index].id;
|
||||
final project = ProjectModel.fromFirestore(projects[index]);
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import '../providers/auth_provider.dart';
|
||||
import '../models/user_model.dart';
|
||||
import '../../providers/auth_provider.dart';
|
||||
import '../../models/user_model.dart';
|
||||
|
||||
class TeamManagementScreen extends ConsumerStatefulWidget {
|
||||
const TeamManagementScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<TeamManagementScreen> createState() => _TeamManagementScreenState();
|
||||
ConsumerState<TeamManagementScreen> createState() =>
|
||||
_TeamManagementScreenState();
|
||||
}
|
||||
|
||||
class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
@@ -80,7 +82,8 @@ class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _changeUserRole(String userId, String teamId, UserRole newRole) async {
|
||||
Future<void> _changeUserRole(
|
||||
String userId, String teamId, UserRole newRole) async {
|
||||
try {
|
||||
await FirebaseFirestore.instance
|
||||
.collection('teams')
|
||||
@@ -101,10 +104,7 @@ class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
|
||||
Future<void> _removeMember(String userId, String teamId) async {
|
||||
try {
|
||||
await FirebaseFirestore.instance
|
||||
.collection('teams')
|
||||
.doc(teamId)
|
||||
.update({
|
||||
await FirebaseFirestore.instance.collection('teams').doc(teamId).update({
|
||||
'memberIds': FieldValue.arrayRemove([userId]),
|
||||
});
|
||||
|
||||
@@ -200,7 +200,8 @@ class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(Icons.people_outline, size: 48, color: Colors.grey),
|
||||
const Icon(Icons.people_outline,
|
||||
size: 48, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'Нет команд',
|
||||
@@ -217,7 +218,8 @@ class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: teams.length,
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||
separatorBuilder: (context, index) =>
|
||||
const SizedBox(height: 12),
|
||||
itemBuilder: (context, index) {
|
||||
final team = teams[index].data() as Map<String, dynamic>;
|
||||
final teamId = teams[index].id;
|
||||
@@ -228,7 +230,8 @@ class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
name: team['name'] ?? 'Без названия',
|
||||
memberCount: (team['memberIds'] as List?)?.length ?? 0,
|
||||
isOwner: isOwner,
|
||||
onRemove: isOwner ? null : () => _removeMember(user!.id, teamId),
|
||||
onRemove:
|
||||
isOwner ? null : () => _removeMember(user!.id, teamId),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -279,9 +282,8 @@ class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
backgroundImage: user.photoUrl != null
|
||||
? NetworkImage(user.photoUrl!)
|
||||
: null,
|
||||
child: user.photoUrl == null
|
||||
? const Icon(Icons.person)
|
||||
: null,
|
||||
child:
|
||||
user.photoUrl == null ? const Icon(Icons.person) : null,
|
||||
),
|
||||
title: Text(user.displayName ?? 'Без имени'),
|
||||
subtitle: Text(user.email),
|
||||
@@ -289,7 +291,8 @@ class _TeamManagementScreenState extends ConsumerState<TeamManagementScreen> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: user.isAdmin
|
||||
? Colors.purple.withOpacity(0.2)
|
||||
|
||||
Reference in New Issue
Block a user