mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
fixed create space
This commit is contained in:
@ -24,14 +24,12 @@ class CommunityStructureArea extends StatefulWidget {
|
|||||||
final ValueChanged<SpaceModel?>? onSpaceSelected;
|
final ValueChanged<SpaceModel?>? onSpaceSelected;
|
||||||
|
|
||||||
final List<SpaceModel> spaces;
|
final List<SpaceModel> spaces;
|
||||||
final List<Connection> connections;
|
|
||||||
|
|
||||||
CommunityStructureArea({
|
CommunityStructureArea({
|
||||||
this.selectedCommunity,
|
this.selectedCommunity,
|
||||||
this.selectedSpace,
|
this.selectedSpace,
|
||||||
this.products,
|
this.products,
|
||||||
required this.spaces,
|
required this.spaces,
|
||||||
required this.connections,
|
|
||||||
this.onSpaceSelected,
|
this.onSpaceSelected,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -76,7 +74,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
|||||||
void didUpdateWidget(covariant CommunityStructureArea oldWidget) {
|
void didUpdateWidget(covariant CommunityStructureArea oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
|
|
||||||
if (oldWidget.spaces != widget.spaces || oldWidget.connections != widget.connections) {
|
if (oldWidget.spaces != widget.spaces) {
|
||||||
setState(() {
|
setState(() {
|
||||||
spaces = widget.spaces.isNotEmpty ? flattenSpaces(widget.spaces) : [];
|
spaces = widget.spaces.isNotEmpty ? flattenSpaces(widget.spaces) : [];
|
||||||
connections = widget.spaces.isNotEmpty ? createConnections(widget.spaces) : [];
|
connections = widget.spaces.isNotEmpty ? createConnections(widget.spaces) : [];
|
||||||
@ -93,8 +91,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final visibleSpaces = flattenSpaces(widget.spaces);
|
final visibleSpaces = flattenSpaces(spaces);
|
||||||
|
|
||||||
Size screenSize = MediaQuery.of(context).size;
|
Size screenSize = MediaQuery.of(context).size;
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@ -277,7 +274,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
// Show "Save" button only if there are spaces
|
// Show "Save" button only if there are spaces
|
||||||
if (widget.spaces.isNotEmpty && widget.selectedCommunity != null)
|
if (spaces.isNotEmpty && widget.selectedCommunity != null)
|
||||||
Row(children: [
|
Row(children: [
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
@ -53,7 +53,6 @@ class _LoadedStateViewState extends State<LoadedSpaceView> {
|
|||||||
selectedCommunity: widget.selectedCommunity,
|
selectedCommunity: widget.selectedCommunity,
|
||||||
selectedSpace: widget.selectedSpace,
|
selectedSpace: widget.selectedSpace,
|
||||||
spaces: widget.selectedCommunity?.spaces ?? [],
|
spaces: widget.selectedCommunity?.spaces ?? [],
|
||||||
connections: const [],
|
|
||||||
products: widget.products,
|
products: widget.products,
|
||||||
onSpaceSelected: (SpaceModel? space) {
|
onSpaceSelected: (SpaceModel? space) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
Reference in New Issue
Block a user