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