mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
fixed create space
This commit is contained in:
@ -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: () {
|
||||
|
@ -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(() {
|
||||
|
Reference in New Issue
Block a user