SP-1189-Fix tapping ok and nothing happening bug by taking the action out of the widget.

This commit is contained in:
Faris Armoush
2025-04-15 14:38:06 +03:00
parent 7dcaa20da1
commit 1bfab8cc76
7 changed files with 297 additions and 192 deletions

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
@ -107,6 +109,11 @@ class _LoadedSpaceViewState extends State<LoadedSpaceView> {
selectedSpaceUuid: widget.selectedSpace?.uuid ??
widget.selectedCommunity?.uuid ??
'',
onCreateCommunity: (name, description) {
context.read<SpaceManagementBloc>().add(
CreateCommunityEvent(name, description, context),
);
},
),
CommunityStructureArea(
selectedCommunity: widget.selectedCommunity,

View File

@ -16,9 +16,11 @@ import 'package:syncrow_web/utils/style.dart';
class SidebarWidget extends StatefulWidget {
final List<CommunityModel> communities;
final String? selectedSpaceUuid;
final void Function(String name, String description) onCreateCommunity;
const SidebarWidget({
required this.communities,
required this.onCreateCommunity,
this.selectedSpaceUuid,
super.key,
});
@ -195,11 +197,7 @@ class _SidebarWidgetState extends State<SidebarWidget> {
builder: (context) => CreateCommunityDialog(
isEditMode: false,
existingCommunityNames: widget.communities.map((e) => e.name).toList(),
onCreateCommunity: (name, description) {
context.read<SpaceManagementBloc>().add(
CreateCommunityEvent(name, description, context),
);
},
onCreateCommunity: widget.onCreateCommunity,
),
);
}