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