fix: Resolve compilation errors in Groups feature
This commit is contained in:
parent
6cba4e5c59
commit
f1ee925057
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../models/cluster.dart';
|
||||
import '../../models/group.dart';
|
||||
import '../../models/group.dart' as group_models;
|
||||
import '../../providers/api_provider.dart';
|
||||
import '../../services/api_service.dart';
|
||||
import '../../services/capsule_security_service.dart';
|
||||
|
|
@ -34,8 +34,8 @@ class _ClustersScreenState extends ConsumerState<ClustersScreen>
|
|||
String _selectedCategory = 'all';
|
||||
|
||||
// Groups system state
|
||||
List<Group> _myUserGroups = [];
|
||||
List<SuggestedGroup> _suggestedGroups = [];
|
||||
List<group_models.Group> _myUserGroups = [];
|
||||
List<group_models.SuggestedGroup> _suggestedGroups = [];
|
||||
bool _isGroupsLoading = false;
|
||||
bool _isSuggestedLoading = false;
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ class _ClustersScreenState extends ConsumerState<ClustersScreen>
|
|||
if (mounted) setState(() => _isSuggestedLoading = false);
|
||||
}
|
||||
|
||||
void _navigateToGroup(Group group) {
|
||||
void _navigateToGroup(group_models.Group group) {
|
||||
// TODO: Navigate to group detail screen
|
||||
if (kDebugMode) print('Navigate to group: ${group.name}');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -929,23 +929,6 @@ class ApiService {
|
|||
return (data['groups'] as List?)?.cast<Map<String, dynamic>>() ?? [];
|
||||
}
|
||||
|
||||
Future<void> joinGroup(String groupId) async {
|
||||
await _callGoApi('/capsules/$groupId/join', method: 'POST');
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> createGroup({
|
||||
required String name,
|
||||
String description = '',
|
||||
String privacy = 'public',
|
||||
String category = 'general',
|
||||
}) async {
|
||||
return await _callGoApi('/capsules/group', body: {
|
||||
'name': name,
|
||||
'description': description,
|
||||
'privacy': privacy,
|
||||
'category': category,
|
||||
});
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> createCapsule({
|
||||
required String name,
|
||||
|
|
@ -1033,9 +1016,6 @@ class ApiService {
|
|||
await _callGoApi('/capsules/$groupId/members/$memberId', method: 'PATCH', body: {'role': role});
|
||||
}
|
||||
|
||||
Future<void> leaveGroup(String groupId) async {
|
||||
await _callGoApi('/capsules/$groupId/leave', method: 'POST');
|
||||
}
|
||||
|
||||
Future<void> updateGroup(String groupId, {String? name, String? description, String? settings}) async {
|
||||
await _callGoApi('/capsules/$groupId', method: 'PATCH', body: {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../models/group.dart';
|
||||
import '../services/api_service.dart';
|
||||
import '../providers/api_provider.dart';
|
||||
import '../theme/app_theme.dart';
|
||||
import '../theme/tokens.dart';
|
||||
import '../utils/error_handler.dart';
|
||||
|
|
@ -247,7 +247,7 @@ class _GroupCardState extends ConsumerState<GroupCard> {
|
|||
widget.group.description,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: SojornColors.textSecondary,
|
||||
color: Colors.grey[600],
|
||||
height: 1.3,
|
||||
),
|
||||
maxLines: 2,
|
||||
|
|
@ -264,23 +264,23 @@ class _GroupCardState extends ConsumerState<GroupCard> {
|
|||
widget.group.memberCountText,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: SojornColors.textTertiary,
|
||||
color: Colors.grey[500],
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const Text(' • ', style: TextStyle(fontSize: 12, color: SojornColors.textTertiary)),
|
||||
const Text(' • ', style: TextStyle(fontSize: 12, color: Colors.grey[500])),
|
||||
Text(
|
||||
widget.group.postCountText,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: SojornColors.textTertiary,
|
||||
color: Colors.grey[500],
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
if (showReason && reason != null) ...[
|
||||
if (widget.showReason && widget.reason != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
|
|
@ -289,7 +289,7 @@ class _GroupCardState extends ConsumerState<GroupCard> {
|
|||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
reason!,
|
||||
widget.reason!,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.blue[700],
|
||||
|
|
@ -390,12 +390,12 @@ class CompactGroupCard extends StatelessWidget {
|
|||
group.memberCountText,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: SojornColors.textTertiary,
|
||||
color: Colors.grey[500],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (showReason && reason != null) ...[
|
||||
if (widget.showReason && widget.reason != null) ...[
|
||||
const SizedBox(height: 6),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
|
|
@ -404,7 +404,7 @@ class CompactGroupCard extends StatelessWidget {
|
|||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
reason!,
|
||||
widget.reason!,
|
||||
style: TextStyle(
|
||||
fontSize: 9,
|
||||
color: Colors.blue[700],
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class _GroupCreationModalState extends ConsumerState<GroupCreationModal> {
|
|||
name: _nameController.text.trim(),
|
||||
description: _descriptionController.text.trim(),
|
||||
category: _selectedCategory,
|
||||
isPrivate: _isPrivate,
|
||||
is_private: _isPrivate,
|
||||
avatarUrl: _avatarUrl,
|
||||
bannerUrl: _bannerUrl,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -361,6 +361,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.1"
|
||||
equatable:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: equatable
|
||||
sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.8"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ dependencies:
|
|||
intl: 0.19.0
|
||||
web_socket_channel: ^3.0.3
|
||||
device_info_plus: ^12.3.0
|
||||
equatable: ^2.0.8
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
Loading…
Reference in a new issue