mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-11 15:47:44 +00:00
Fixed creating community
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:syncrow_web/common/search_bar.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/bloc/space_management_bloc.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/bloc/space_management_event.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/widgets/community_tile.dart';
|
||||
@ -30,14 +33,19 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _showCreateCommunityDialog() {
|
||||
void _showCreateCommunityDialog(BuildContext parentContext) {
|
||||
showDialog(
|
||||
context: context,
|
||||
context: parentContext,
|
||||
builder: (context) => CreateCommunityDialog(
|
||||
onCreateCommunity: (String communityName) {
|
||||
setState(() {
|
||||
// You can update the community list here when a new community is added
|
||||
});
|
||||
onCreateCommunity:
|
||||
(String communityName, String description, String regionId) {
|
||||
parentContext.read<SpaceManagementBloc>().add(
|
||||
CreateCommunityEvent(
|
||||
name: communityName,
|
||||
description: description,
|
||||
regionId: regionId,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
@ -122,7 +130,7 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: _showCreateCommunityDialog,
|
||||
onTap: () => _showCreateCommunityDialog(context),
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
|
Reference in New Issue
Block a user