fixed create space

This commit is contained in:
hannathkadher
2024-11-21 21:34:56 +04:00
parent b6998c055a
commit 82343e0634
2 changed files with 3 additions and 7 deletions

View File

@ -24,14 +24,12 @@ class CommunityStructureArea extends StatefulWidget {
final ValueChanged<SpaceModel?>? onSpaceSelected;
final List<SpaceModel> spaces;
final List<Connection> connections;
CommunityStructureArea({
this.selectedCommunity,
this.selectedSpace,
this.products,
required this.spaces,
required this.connections,
this.onSpaceSelected,
});
@ -76,7 +74,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
void didUpdateWidget(covariant CommunityStructureArea oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.spaces != widget.spaces || oldWidget.connections != widget.connections) {
if (oldWidget.spaces != widget.spaces) {
setState(() {
spaces = widget.spaces.isNotEmpty ? flattenSpaces(widget.spaces) : [];
connections = widget.spaces.isNotEmpty ? createConnections(widget.spaces) : [];
@ -93,8 +91,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
@override
Widget build(BuildContext context) {
final visibleSpaces = flattenSpaces(widget.spaces);
final visibleSpaces = flattenSpaces(spaces);
Size screenSize = MediaQuery.of(context).size;
return Expanded(
child: GestureDetector(
@ -277,7 +274,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
],
),
// Show "Save" button only if there are spaces
if (widget.spaces.isNotEmpty && widget.selectedCommunity != null)
if (spaces.isNotEmpty && widget.selectedCommunity != null)
Row(children: [
ElevatedButton.icon(
onPressed: () {

View File

@ -53,7 +53,6 @@ class _LoadedStateViewState extends State<LoadedSpaceView> {
selectedCommunity: widget.selectedCommunity,
selectedSpace: widget.selectedSpace,
spaces: widget.selectedCommunity?.spaces ?? [],
connections: const [],
products: widget.products,
onSpaceSelected: (SpaceModel? space) {
setState(() {