Compare commits

..

14 Commits

15 changed files with 144 additions and 130 deletions

View File

@ -244,6 +244,7 @@ SOS
SwitchFunction(deviceId: uuid ?? '', deviceName: name ?? ''), SwitchFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
ModeFunction(deviceId: uuid ?? '', deviceName: name ?? ''), ModeFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
TempSetFunction(deviceId: uuid ?? '', deviceName: name ?? ''), TempSetFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
CurrentTempFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
LevelFunction(deviceId: uuid ?? '', deviceName: name ?? ''), LevelFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
ChildLockFunction(deviceId: uuid ?? '', deviceName: name ?? ''), ChildLockFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
]; ];

View File

@ -29,7 +29,7 @@ class TwoGangSwitchBloc extends Bloc<TwoGangSwitchEvent, TwoGangSwitchState> {
final status = final status =
await DevicesManagementApi().getDeviceStatus(event.deviceId); await DevicesManagementApi().getDeviceStatus(event.deviceId);
deviceStatus = TwoGangStatusModel.fromJson(event.deviceId, status.status); deviceStatus = TwoGangStatusModel.fromJson(event.deviceId, status.status);
_listenToChanges(emit); _listenToChanges(event.deviceId);
emit(TwoGangSwitchStatusLoaded(deviceStatus)); emit(TwoGangSwitchStatusLoaded(deviceStatus));
} catch (e) { } catch (e) {
emit(TwoGangSwitchError(e.toString())); emit(TwoGangSwitchError(e.toString()));

View File

@ -30,7 +30,7 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
var response = await DevicesManagementApi().getDeviceStatus(deviceId); var response = await DevicesManagementApi().getDeviceStatus(deviceId);
deviceStatus = WallSensorModel.fromJson(response.status); deviceStatus = WallSensorModel.fromJson(response.status);
emit(WallSensorUpdateState(wallSensorModel: deviceStatus)); emit(WallSensorUpdateState(wallSensorModel: deviceStatus));
_listenToChanges(emit); _listenToChanges(emit, deviceId);
} catch (e) { } catch (e) {
emit(WallSensorFailedState(error: e.toString())); emit(WallSensorFailedState(error: e.toString()));
return; return;
@ -52,7 +52,7 @@ class WallSensorBloc extends Bloc<WallSensorEvent, WallSensorState> {
} }
} }
_listenToChanges(Emitter<WallSensorState> emit) { _listenToChanges(Emitter<WallSensorState> emit, deviceId) {
try { try {
DatabaseReference ref = DatabaseReference ref =
FirebaseDatabase.instance.ref('device-status/$deviceId'); FirebaseDatabase.instance.ref('device-status/$deviceId');

View File

@ -41,6 +41,11 @@ class DeviceDialogHelper {
final deviceSelectedFunctions = final deviceSelectedFunctions =
routineBloc.state.selectedFunctions[data['uniqueCustomId']] ?? []; routineBloc.state.selectedFunctions[data['uniqueCustomId']] ?? [];
if (removeComparetors) {
//remove the current temp function in the 'if container'
functions.removeAt(3);
}
switch (productType) { switch (productType) {
case 'AC': case 'AC':
return ACHelper.showACFunctionsDialog(context, functions, data['device'], return ACHelper.showACFunctionsDialog(context, functions, data['device'],

View File

@ -151,3 +151,32 @@ class ChildLockFunction extends ACFunction {
), ),
]; ];
} }
class CurrentTempFunction extends ACFunction {
final int min;
final int max;
final int step;
CurrentTempFunction({required super.deviceId, required super.deviceName})
: min = -100,
max = 990,
step = 1,
super(
code: 'temp_current',
operationName: 'Current Temperature',
icon: Assets.currentTemp,
);
@override
List<ACOperationalValue> getOperationalValues() {
List<ACOperationalValue> values = [];
for (int temp = min; temp <= max; temp += step) {
values.add(ACOperationalValue(
icon: Assets.currentTemp,
description: "${temp / 10}°C",
value: temp,
));
}
return values;
}
}

View File

@ -329,8 +329,8 @@ class ACHelper {
) { ) {
return Slider( return Slider(
value: initialValue is int ? initialValue.toDouble() : 200.0, value: initialValue is int ? initialValue.toDouble() : 200.0,
min: 200, min: selectCode == 'temp_current' ? -100 : 200,
max: 300, max: selectCode == 'temp_current' ? 900 : 300,
divisions: 10, divisions: 10,
label: '${((initialValue ?? 160) / 10).toInt()}°C', label: '${((initialValue ?? 160) / 10).toInt()}°C',
onChanged: (value) { onChanged: (value) {

View File

@ -33,14 +33,13 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<SpaceTreeBloc, SpaceTreeState>( return BlocBuilder<SpaceTreeBloc, SpaceTreeState>(builder: (context, state) {
builder: (context, state) { List<CommunityModel> list = state.isSearching ? state.filteredCommunity : state.communityList;
List<CommunityModel> list =
state.isSearching ? state.filteredCommunity : state.communityList;
return Container( return Container(
height: MediaQuery.sizeOf(context).height, height: MediaQuery.sizeOf(context).height,
decoration: decoration: widget.isSide == true
widget.isSide == true ? subSectionContainerDecoration : null, ? subSectionContainerDecoration.copyWith(color: ColorsManager.whiteColors)
: const BoxDecoration(color: ColorsManager.whiteColors),
child: state is SpaceTreeLoadingState child: state is SpaceTreeLoadingState
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: Column( : Column(
@ -50,8 +49,7 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: ColorsManager.circleRolesBackground, color: ColorsManager.circleRolesBackground,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topRight: Radius.circular(20), topRight: Radius.circular(20), topLeft: Radius.circular(20)),
topLeft: Radius.circular(20)),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
@ -60,35 +58,27 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(Radius.circular(20)),
Radius.circular(20)), border: Border.all(color: ColorsManager.grayBorder)),
border: Border.all(
color: ColorsManager.grayBorder)),
child: TextFormField( child: TextFormField(
style: style: const TextStyle(color: Colors.black),
const TextStyle(color: Colors.black),
onChanged: (value) { onChanged: (value) {
context context.read<SpaceTreeBloc>().add(SearchQueryEvent(value));
.read<SpaceTreeBloc>()
.add(SearchQueryEvent(value));
}, },
decoration: textBoxDecoration(radios: 20)! decoration: textBoxDecoration(radios: 20)!.copyWith(
.copyWith(
fillColor: Colors.white, fillColor: Colors.white,
suffixIcon: Padding( suffixIcon: Padding(
padding: padding: const EdgeInsets.only(right: 16),
const EdgeInsets.only(right: 16),
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.textFieldSearch, Assets.textFieldSearch,
width: 24, width: 24,
height: 24, height: 24,
), ),
), ),
hintStyle: context.textTheme.bodyMedium hintStyle: context.textTheme.bodyMedium?.copyWith(
?.copyWith( fontWeight: FontWeight.w400,
fontWeight: FontWeight.w400, fontSize: 12,
fontSize: 12, color: ColorsManager.textGray),
color: ColorsManager.textGray),
), ),
), ),
), ),
@ -99,9 +89,7 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
) )
: CustomSearchBar( : CustomSearchBar(
onSearchChanged: (query) { onSearchChanged: (query) {
context context.read<SpaceTreeBloc>().add(SearchQueryEvent(query));
.read<SpaceTreeBloc>()
.add(SearchQueryEvent(query));
}, },
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -117,18 +105,14 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
? Center( ? Center(
child: Text( child: Text(
'No results found', 'No results found',
style: Theme.of(context) style: Theme.of(context).textTheme.bodySmall!.copyWith(
.textTheme
.bodySmall!
.copyWith(
color: ColorsManager.lightGrayColor, color: ColorsManager.lightGrayColor,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
), ),
) )
: Scrollbar( : Scrollbar(
scrollbarOrientation: scrollbarOrientation: ScrollbarOrientation.left,
ScrollbarOrientation.left,
thumbVisibility: true, thumbVisibility: true,
controller: _scrollController, controller: _scrollController,
child: Padding( child: Padding(
@ -138,39 +122,30 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
shrinkWrap: true, shrinkWrap: true,
children: list children: list
.map( .map(
(community) => (community) => CustomExpansionTileSpaceTree(
CustomExpansionTileSpaceTree(
title: community.name, title: community.name,
isSelected: state isSelected: state.selectedCommunities
.selectedCommunities
.contains(community.uuid), .contains(community.uuid),
isSoldCheck: state isSoldCheck: state.selectedCommunities
.selectedCommunities
.contains(community.uuid), .contains(community.uuid),
onExpansionChanged: () { onExpansionChanged: () {
context context
.read<SpaceTreeBloc>() .read<SpaceTreeBloc>()
.add(OnCommunityExpanded( .add(OnCommunityExpanded(community.uuid));
community.uuid));
}, },
isExpanded: state isExpanded: state.expandedCommunities
.expandedCommunities
.contains(community.uuid), .contains(community.uuid),
onItemSelected: () { onItemSelected: () {
context context.read<SpaceTreeBloc>().add(
.read<SpaceTreeBloc>() OnCommunitySelected(
.add(OnCommunitySelected( community.uuid, community.spaces));
community.uuid,
community.spaces));
widget.onSelect(); widget.onSelect();
}, },
children: children: community.spaces.map((space) {
community.spaces.map((space) {
return CustomExpansionTileSpaceTree( return CustomExpansionTileSpaceTree(
title: space.name, title: space.name,
isExpanded: state isExpanded:
.expandedSpaces state.expandedSpaces.contains(space.uuid),
.contains(space.uuid),
onItemSelected: () { onItemSelected: () {
context.read<SpaceTreeBloc>().add( context.read<SpaceTreeBloc>().add(
OnSpaceSelected(community, space.uuid ?? '', OnSpaceSelected(community, space.uuid ?? '',
@ -178,20 +153,14 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
widget.onSelect(); widget.onSelect();
}, },
onExpansionChanged: () { onExpansionChanged: () {
context context.read<SpaceTreeBloc>().add(
.read<SpaceTreeBloc>() OnSpaceExpanded(
.add(OnSpaceExpanded( community.uuid, space.uuid ?? ''));
community.uuid,
space.uuid ?? ''));
}, },
isSelected: state isSelected:
.selectedSpaces state.selectedSpaces.contains(space.uuid) ||
.contains( state.soldCheck.contains(space.uuid),
space.uuid) || isSoldCheck: state.soldCheck.contains(space.uuid),
state.soldCheck
.contains(space.uuid),
isSoldCheck: state.soldCheck
.contains(space.uuid),
children: _buildNestedSpaces( children: _buildNestedSpaces(
context, state, space, community), context, state, space, community),
); );
@ -279,8 +248,8 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
BuildContext context, SpaceTreeState state, SpaceModel space, CommunityModel community) { BuildContext context, SpaceTreeState state, SpaceModel space, CommunityModel community) {
return space.children.map((child) { return space.children.map((child) {
return CustomExpansionTileSpaceTree( return CustomExpansionTileSpaceTree(
isSelected: state.selectedSpaces.contains(child.uuid) || isSelected:
state.soldCheck.contains(child.uuid), state.selectedSpaces.contains(child.uuid) || state.soldCheck.contains(child.uuid),
isSoldCheck: state.soldCheck.contains(child.uuid), isSoldCheck: state.soldCheck.contains(child.uuid),
title: child.name, title: child.name,
isExpanded: state.expandedSpaces.contains(child.uuid), isExpanded: state.expandedSpaces.contains(child.uuid),

View File

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/common/bloc/project_manager.dart'; import 'package:syncrow_web/pages/common/bloc/project_manager.dart';
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart'; import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
@ -457,7 +458,8 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
emit(SpaceManagementLoading()); emit(SpaceManagementLoading());
try { try {
final updatedSpaces = await saveSpacesHierarchically(event.spaces, event.communityUuid); final updatedSpaces =
await saveSpacesHierarchically(event.context, event.spaces, event.communityUuid);
final allSpaces = await _fetchSpacesForCommunity(event.communityUuid); final allSpaces = await _fetchSpacesForCommunity(event.communityUuid);
@ -508,9 +510,14 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
} }
Future<List<SpaceModel>> saveSpacesHierarchically( Future<List<SpaceModel>> saveSpacesHierarchically(
List<SpaceModel> spaces, String communityUuid) async { BuildContext context, List<SpaceModel> spaces, String communityUuid) async {
final orderedSpaces = flattenHierarchy(spaces); final orderedSpaces = flattenHierarchy(spaces);
final projectUuid = await ProjectManager.getProjectUUID() ?? ''; final projectUuid = await ProjectManager.getProjectUUID() ?? '';
var spaceBloc = context.read<SpaceTreeBloc>();
List<CommunityModel> communities = spaceBloc.state.communityList;
CommunityModel? selectedCommunity = communities.firstWhere(
(community) => community.uuid == communityUuid,
);
final parentsToDelete = orderedSpaces.where((space) => final parentsToDelete = orderedSpaces.where((space) =>
space.status == SpaceStatus.deleted && space.status == SpaceStatus.deleted &&
@ -532,7 +539,13 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
if (space.uuid != null && space.uuid!.isNotEmpty) { if (space.uuid != null && space.uuid!.isNotEmpty) {
List<TagModelUpdate> tagUpdates = []; List<TagModelUpdate> tagUpdates = [];
final prevSpace = await _api.getSpace(communityUuid, space.uuid!, projectUuid); List<SpaceModel> matchedSpaces =
selectedCommunity.spaces.where((space) => space.uuid == space.uuid).toList();
if (matchedSpaces.isEmpty) continue;
final prevSpace = matchedSpaces[0];
final List<UpdateSubspaceTemplateModel> subspaceUpdates = []; final List<UpdateSubspaceTemplateModel> subspaceUpdates = [];
final List<SubspaceModel>? prevSubspaces = prevSpace?.subspaces; final List<SubspaceModel>? prevSubspaces = prevSpace?.subspaces;
final List<SubspaceModel>? newSubspaces = space.subspaces; final List<SubspaceModel>? newSubspaces = space.subspaces;
@ -609,6 +622,7 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
subspaces: subspaceUpdates, subspaces: subspaceUpdates,
tags: tagUpdates, tags: tagUpdates,
direction: space.incomingConnection?.direction, direction: space.incomingConnection?.direction,
spaceModelUuid: space.spaceModel?.uuid,
projectId: projectUuid); projectId: projectUuid);
} else { } else {
// Call create if the space does not have a UUID // Call create if the space does not have a UUID

View File

@ -58,14 +58,16 @@ class CreateSpaceEvent extends SpaceManagementEvent {
class SaveSpacesEvent extends SpaceManagementEvent { class SaveSpacesEvent extends SpaceManagementEvent {
final List<SpaceModel> spaces; final List<SpaceModel> spaces;
final String communityUuid; final String communityUuid;
final BuildContext context;
const SaveSpacesEvent({ const SaveSpacesEvent(
this.context, {
required this.spaces, required this.spaces,
required this.communityUuid, required this.communityUuid,
}); });
@override @override
List<Object> get props => [spaces, communityUuid]; List<Object> get props => [spaces, communityUuid, context];
} }
class UpdateSpacePositionEvent extends SpaceManagementEvent { class UpdateSpacePositionEvent extends SpaceManagementEvent {
@ -170,4 +172,4 @@ class UpdateSpaceModelCache extends SpaceManagementEvent {
class DeleteSpaceModelFromCache extends SpaceManagementEvent { class DeleteSpaceModelFromCache extends SpaceManagementEvent {
final String deletedUuid; final String deletedUuid;
DeleteSpaceModelFromCache(this.deletedUuid); DeleteSpaceModelFromCache(this.deletedUuid);
} }

View File

@ -460,6 +460,7 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
String communityUuid = widget.selectedCommunity!.uuid; String communityUuid = widget.selectedCommunity!.uuid;
context.read<SpaceManagementBloc>().add(SaveSpacesEvent( context.read<SpaceManagementBloc>().add(SaveSpacesEvent(
context,
spaces: spacesToSave, spaces: spacesToSave,
communityUuid: communityUuid, communityUuid: communityUuid,
)); ));

View File

@ -28,10 +28,11 @@ class LinkSpaceToModelBloc
try { try {
BuildContext context = NavigationService.navigatorKey.currentContext!; BuildContext context = NavigationService.navigatorKey.currentContext!;
var spaceBloc = context.read<SpaceTreeBloc>(); var spaceBloc = context.read<SpaceTreeBloc>();
spacesListIds.clear();
for (var communityId in spaceBloc.state.selectedCommunities) { for (var communityId in spaceBloc.state.selectedCommunities) {
List<String> spacesList = List<String> spacesList =
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? []; spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
spacesListIds = spacesList; spacesListIds.addAll(spacesList);
} }
hasSelectedSpaces = hasSelectedSpaces =
spaceBloc.state.selectedCommunities.any((communityId) { spaceBloc.state.selectedCommunities.any((communityId) {

View File

@ -18,8 +18,10 @@ import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dynamic_
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart'; import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart';
import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart'; import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
import 'package:syncrow_web/utils/string_utils.dart';
class SpaceModelCardWidget extends StatelessWidget { class SpaceModelCardWidget extends StatelessWidget with HelperResponsiveLayout {
final SpaceTemplateModel model; final SpaceTemplateModel model;
final BuildContext? pageContext; final BuildContext? pageContext;
final bool topActionsDisabled; final bool topActionsDisabled;
@ -76,14 +78,17 @@ class SpaceModelCardWidget extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Expanded(
model.modelName, child: Text(
style: Theme.of(context).textTheme.headlineMedium?.copyWith( StringUtils.capitalizeFirstLetter(model.modelName),
color: Colors.black, style: Theme.of(context).textTheme.headlineMedium?.copyWith(
fontWeight: FontWeight.bold, color: ColorsManager.blackColor,
), fontWeight: FontWeight.bold,
maxLines: 1, fontSize: isSmallScreenSize(context) ? 13 : 20,
overflow: TextOverflow.ellipsis, ),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
), ),
if (!topActionsDisabled) if (!topActionsDisabled)
Row( Row(
@ -95,15 +100,12 @@ class SpaceModelCardWidget extends StatelessWidget {
builder: (BuildContext dialogContext) { builder: (BuildContext dialogContext) {
return BlocProvider<LinkSpaceToModelBloc>( return BlocProvider<LinkSpaceToModelBloc>(
create: (_) => LinkSpaceToModelBloc(), create: (_) => LinkSpaceToModelBloc(),
child: BlocListener<LinkSpaceToModelBloc, child: BlocListener<LinkSpaceToModelBloc, LinkSpaceToModelState>(
LinkSpaceToModelState>(
listenWhen: (previous, current) { listenWhen: (previous, current) {
return previous != current; return previous != current;
}, },
listener: (context, state) { listener: (context, state) {
final _bloc = final _bloc = BlocProvider.of<LinkSpaceToModelBloc>(context);
BlocProvider.of<LinkSpaceToModelBloc>(
context);
if (state is SpaceModelLoading) { if (state is SpaceModelLoading) {
showDialog( showDialog(
context: context, context: context,
@ -111,19 +113,14 @@ class SpaceModelCardWidget extends StatelessWidget {
builder: (BuildContext context) { builder: (BuildContext context) {
return Dialog( return Dialog(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius: BorderRadius.circular(20)),
BorderRadius.circular(
20)),
elevation: 10, elevation: 10,
backgroundColor: Colors.white, backgroundColor: Colors.white,
child: Padding( child: Padding(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric( vertical: 30, horizontal: 50),
vertical: 30,
horizontal: 50),
child: Column( child: Column(
mainAxisSize: mainAxisSize: MainAxisSize.min,
MainAxisSize.min,
children: [ children: [
CustomLoadingIndicator(), CustomLoadingIndicator(),
], ],
@ -132,19 +129,14 @@ class SpaceModelCardWidget extends StatelessWidget {
); );
}, },
); );
} else if (state } else if (state is AlreadyHaveLinkedState) {
is AlreadyHaveLinkedState) {
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
showOverwriteDialog( showOverwriteDialog(context, _bloc, model);
context, _bloc, model); } else if (state is SpaceValidationSuccess) {
} else if (state
is SpaceValidationSuccess) {
_bloc.add(LinkSpaceModelEvent( _bloc.add(LinkSpaceModelEvent(
isOverWrite: false, isOverWrite: false, selectedSpaceMode: model.uuid));
selectedSpaceMode: model.uuid));
Future.delayed( Future.delayed(const Duration(seconds: 1), () {
const Duration(seconds: 1), () {
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
@ -152,29 +144,23 @@ class SpaceModelCardWidget extends StatelessWidget {
showDialog( showDialog(
context: context, context: context,
builder: builder: (BuildContext dialogContext) {
(BuildContext dialogContext) {
return const LinkingSuccessful(); return const LinkingSuccessful();
}, },
).then((v) { ).then((v) {
Future.delayed( Future.delayed(const Duration(seconds: 2), () {
const Duration(seconds: 2), () {
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
}); });
}); });
} else if (state } else if (state is SpaceModelLinkSuccess) {
is SpaceModelLinkSuccess) {
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (BuildContext builder: (BuildContext successDialogContext) {
successDialogContext) { Future.delayed(const Duration(seconds: 2), () {
Future.delayed( Navigator.of(successDialogContext).pop();
const Duration(seconds: 2), () {
Navigator.of(successDialogContext)
.pop();
}); });
return const LinkingSuccessful(); return const LinkingSuccessful();
@ -232,8 +218,7 @@ class SpaceModelCardWidget extends StatelessWidget {
), ),
), ),
), ),
if (productTagCount.isNotEmpty && if (productTagCount.isNotEmpty && model.subspaceModels != null)
model.subspaceModels != null)
Container( Container(
width: 1.0, width: 1.0,
color: ColorsManager.softGray, color: ColorsManager.softGray,

View File

@ -6,7 +6,6 @@ import 'package:syncrow_web/pages/routines/models/routine_details_model.dart';
import 'package:syncrow_web/pages/routines/models/routine_model.dart'; import 'package:syncrow_web/pages/routines/models/routine_model.dart';
import 'package:syncrow_web/services/api/http_service.dart'; import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart'; import 'package:syncrow_web/utils/constants/api_const.dart';
import 'package:syncrow_web/utils/constants/temp_const.dart';
class SceneApi { class SceneApi {
static final HTTPService _httpService = HTTPService(); static final HTTPService _httpService = HTTPService();

View File

@ -227,6 +227,7 @@ class CommunitySpaceManagementApi {
required Offset position, required Offset position,
List<TagModelUpdate>? tags, List<TagModelUpdate>? tags,
List<UpdateSubspaceTemplateModel>? subspaces, List<UpdateSubspaceTemplateModel>? subspaces,
String? spaceModelUuid,
required String projectId}) async { required String projectId}) async {
try { try {
final body = { final body = {
@ -238,6 +239,7 @@ class CommunitySpaceManagementApi {
'icon': icon, 'icon': icon,
'subspace': subspaces, 'subspace': subspaces,
'tags': tags, 'tags': tags,
'spaceModelUuid': spaceModelUuid,
}; };
if (parentId != null) { if (parentId != null) {
body['parentUuid'] = parentId; body['parentUuid'] = parentId;

View File

@ -0,0 +1,6 @@
class StringUtils {
static String capitalizeFirstLetter(String text) {
if (text.isEmpty) return text;
return text[0].toUpperCase() + text.substring(1);
}
}