fix: Final compilation errors - update API calls to use new Groups system
This commit is contained in:
parent
6217cb2ffd
commit
d01be18b12
|
|
@ -12,6 +12,7 @@ import '../../models/beacon.dart';
|
|||
import '../../models/cluster.dart';
|
||||
import '../../models/board_entry.dart';
|
||||
import '../../models/local_intel.dart';
|
||||
import '../../models/group.dart';
|
||||
import '../../services/api_service.dart';
|
||||
import '../../services/auth_service.dart';
|
||||
import '../../services/local_intel_service.dart';
|
||||
|
|
@ -2418,7 +2419,7 @@ class _CreateGroupInline extends StatefulWidget {
|
|||
class _CreateGroupInlineState extends State<_CreateGroupInline> {
|
||||
final _nameCtrl = TextEditingController();
|
||||
final _descCtrl = TextEditingController();
|
||||
String _privacy = 'public';
|
||||
bool _privacy = false;
|
||||
GroupCategory _category = GroupCategory.general;
|
||||
bool _submitting = false;
|
||||
|
||||
|
|
@ -2429,11 +2430,12 @@ class _CreateGroupInlineState extends State<_CreateGroupInline> {
|
|||
if (_nameCtrl.text.trim().isEmpty) return;
|
||||
setState(() => _submitting = true);
|
||||
try {
|
||||
await ApiService.instance.createGroup(
|
||||
final api = ref.read(apiServiceProvider);
|
||||
await api.createGroup(
|
||||
name: _nameCtrl.text.trim(),
|
||||
description: _descCtrl.text.trim(),
|
||||
is_private: _privacy,
|
||||
category: _category.value,
|
||||
category: GroupCategory.fromString(_category.value),
|
||||
isPrivate: _privacy,
|
||||
);
|
||||
widget.onCreated();
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -741,7 +741,7 @@ class _CreateGroupForm extends StatefulWidget {
|
|||
class _CreateGroupFormState extends State<_CreateGroupForm> {
|
||||
final _nameCtrl = TextEditingController();
|
||||
final _descCtrl = TextEditingController();
|
||||
String _privacy = 'public';
|
||||
bool _privacy = false;
|
||||
bool _submitting = false;
|
||||
|
||||
@override
|
||||
|
|
@ -751,10 +751,12 @@ class _CreateGroupFormState extends State<_CreateGroupForm> {
|
|||
if (_nameCtrl.text.trim().isEmpty) return;
|
||||
setState(() => _submitting = true);
|
||||
try {
|
||||
await ApiService.instance.createGroup(
|
||||
final api = ref.read(apiServiceProvider);
|
||||
await api.createGroup(
|
||||
name: _nameCtrl.text.trim(),
|
||||
description: _descCtrl.text.trim(),
|
||||
is_private: _privacy,
|
||||
category: group_models.GroupCategory.general,
|
||||
isPrivate: _privacy,
|
||||
);
|
||||
widget.onCreated();
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ class _GroupCardState extends ConsumerState<GroupCard> {
|
|||
],
|
||||
),
|
||||
|
||||
if (showReason && reason != null) ...[
|
||||
if (widget.showReason && widget.reason != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
|
|
@ -395,7 +395,7 @@ class CompactGroupCard extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
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],
|
||||
|
|
|
|||
Loading…
Reference in a new issue