mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
@ -5,7 +5,6 @@ import 'package:syncrow_web/common/search_bar.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/space_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/view/community_tile.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/view/dialogs/create_community_dialog.dart';
|
||||
import 'package:syncrow_web/services/space_mana_api.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
import 'package:syncrow_web/utils/style.dart';
|
||||
@ -23,7 +22,6 @@ class SidebarWidget extends StatefulWidget {
|
||||
class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
String _searchQuery = ''; // Track search query
|
||||
Map<String, bool> _expandedTiles = {}; // Track expanded state for each UUID
|
||||
final CommunitySpaceManagementApi _api = CommunitySpaceManagementApi();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -55,27 +53,12 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => CreateCommunityDialog(
|
||||
onCreateCommunity: (String communityName) async {
|
||||
try {
|
||||
// Assuming regionId and description are provided statically or via dialog in future.
|
||||
String regionId = "42dc377a-1a39-4df9-b85a-b3817af88525";
|
||||
String description = "";
|
||||
onCreateCommunity: (String communityName) {
|
||||
setState(() {
|
||||
debugPrint("hello");
|
||||
|
||||
final newCommunity = await _api.createCommunity(
|
||||
communityName,
|
||||
description,
|
||||
regionId,
|
||||
);
|
||||
|
||||
if (newCommunity != null) {
|
||||
setState(() {
|
||||
// Add the newly created community to the communitySpaces map
|
||||
widget.communitySpaces[newCommunity.name] = [];
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Error creating community: $e');
|
||||
}
|
||||
// You can update the communitySpaces map here
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -2,6 +2,7 @@ import 'dart:ui_web';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:syncrow_web/common/custom_expansion_tile.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/add_space_button.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/community_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/model/space_model.dart';
|
||||
@ -9,6 +10,7 @@ import 'package:syncrow_web/pages/spaces_management/view/dialogs/create_space_di
|
||||
import 'package:syncrow_web/pages/spaces_management/view/sidebar_widget.dart';
|
||||
import 'package:syncrow_web/services/space_mana_api.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||
|
||||
class SpaceManagementPage extends StatefulWidget {
|
||||
@override
|
||||
@ -359,7 +361,6 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Model for storing space information
|
||||
|
Reference in New Issue
Block a user