mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-03-11 00:11:43 +00:00
Compare commits
3 Commits
e871708398
...
feat/chang
| Author | SHA1 | Date | |
|---|---|---|---|
| 22789234fe | |||
| 8393ec353a | |||
| 0b45d61b25 |
@ -332,7 +332,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
||||
title: title.toString(),
|
||||
sensor: ceilingSensor,
|
||||
value: model.sensitivity,
|
||||
min: 0,
|
||||
min: 1,
|
||||
max: 10,
|
||||
));
|
||||
if (result != null) {
|
||||
|
||||
@ -51,7 +51,8 @@ class ManageUnitBloc extends Bloc<ManageUnitEvent, ManageUnitState> {
|
||||
spaceUuid: event.unit.id,
|
||||
roomId: event.roomId,
|
||||
projectId: project?.uuid ?? TempConst.projectIdDev);
|
||||
allDevices = await HomeManagementAPI.fetchDevicesByUserId();
|
||||
allDevices = await HomeManagementAPI.fetchDevices(
|
||||
project?.uuid ?? TempConst.projectIdDev);
|
||||
|
||||
List<String> allDevicesIds = [];
|
||||
|
||||
|
||||
@ -28,8 +28,7 @@ class AssignDeviceView extends StatelessWidget {
|
||||
listener: (context, state) {
|
||||
if (state is FetchDeviceByRoomIdState) {
|
||||
if (state.allDevices.isEmpty) {
|
||||
CustomSnackBar.displaySnackBar(
|
||||
'You do not have the permission to assign devices');
|
||||
CustomSnackBar.displaySnackBar('You do not have the devices');
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,85 +16,74 @@ class ManageHomeView extends StatelessWidget {
|
||||
var spaces = HomeCubit.getInstance().spaces;
|
||||
return DefaultScaffold(
|
||||
title: 'Manage Your Home',
|
||||
child: spaces == null
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
child: spaces.isEmpty
|
||||
? const Center(
|
||||
child: BodyMedium(text: 'No spaces found'),
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
DefaultContainer(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 25,
|
||||
vertical: 20,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: List.generate(
|
||||
spaces.length,
|
||||
(index) {
|
||||
if (index == spaces.length - 1) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CustomPageRoute(
|
||||
builder: (context) => HomeSettingsView(
|
||||
space: spaces[index],
|
||||
)));
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
BodyMedium(text: StringHelpers.toTitleCase(spaces[index].name)),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: ColorsManager.greyColor,
|
||||
size: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
//TODO refactor the routing to use named routes
|
||||
// Navigator.of(context).pushNamed(
|
||||
// '/home_settings',
|
||||
// arguments: spaces[index],
|
||||
// );
|
||||
: DefaultContainer(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
|
||||
child: ListView.builder(
|
||||
itemCount: spaces.length,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == spaces.length - 1) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(CustomPageRoute(
|
||||
builder: (context) => HomeSettingsView(
|
||||
space: spaces[index],
|
||||
)));
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
BodyMedium(text: StringHelpers.toTitleCase(spaces[index].name)),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: ColorsManager.greyColor,
|
||||
size: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
//TODO refactor the routing to use named routes
|
||||
// Navigator.of(context).pushNamed(
|
||||
// '/home_settings',
|
||||
// arguments: spaces[index],
|
||||
// );
|
||||
|
||||
Navigator.of(context).push(CustomPageRoute(
|
||||
builder: (context) => HomeSettingsView(
|
||||
space: spaces[index],
|
||||
)));
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
Navigator.of(context).push(CustomPageRoute(
|
||||
builder: (context) => HomeSettingsView(
|
||||
space: spaces[index],
|
||||
)));
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
BodyMedium(text: HomeCubit.getInstance().spaces![index].name),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: ColorsManager.greyColor,
|
||||
size: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 15),
|
||||
height: 1,
|
||||
BodyMedium(text: HomeCubit.getInstance().spaces[index].name),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: ColorsManager.greyColor,
|
||||
),
|
||||
size: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 15),
|
||||
height: 1,
|
||||
color: ColorsManager.greyColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +88,8 @@ abstract class ApiEndpoints {
|
||||
//SPACE Module
|
||||
//GET
|
||||
static const String userSpaces = '/user/{userUuid}/spaces';
|
||||
static const String devices = '/projects/{projectUuid}/devices';
|
||||
|
||||
static const String spaceDevices =
|
||||
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices';
|
||||
|
||||
|
||||
@ -27,7 +27,23 @@ class HomeManagementAPI {
|
||||
return list;
|
||||
}
|
||||
|
||||
static Future<List<DeviceModel>> fetchDevicesByUnitId(String projectUuid) async {
|
||||
static Future<List<DeviceModel>> fetchDevices(projectUuid) async {
|
||||
List<DeviceModel> list = [];
|
||||
|
||||
await _httpService.get(
|
||||
path: ApiEndpoints.devices.replaceAll("{projectUuid}", projectUuid),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
json.forEach((value) {
|
||||
list.add(DeviceModel.fromJson(value));
|
||||
});
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static Future<List<DeviceModel>> fetchDevicesByUnitId(
|
||||
String projectUuid) async {
|
||||
List<DeviceModel> list = [];
|
||||
|
||||
try {
|
||||
@ -62,8 +78,12 @@ class HomeManagementAPI {
|
||||
return list;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> assignDeviceToRoom(String communityId,
|
||||
String spaceId, String subSpaceId, String deviceId, String projectId) async {
|
||||
static Future<Map<String, dynamic>> assignDeviceToRoom(
|
||||
String communityId,
|
||||
String spaceId,
|
||||
String subSpaceId,
|
||||
String deviceId,
|
||||
String projectId) async {
|
||||
try {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.assignDeviceToRoom
|
||||
@ -82,8 +102,12 @@ class HomeManagementAPI {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> unAssignDeviceToRoom(String communityId,
|
||||
String spaceId, String subSpaceId, String deviceId, String projectId) async {
|
||||
static Future<Map<String, dynamic>> unAssignDeviceToRoom(
|
||||
String communityId,
|
||||
String spaceId,
|
||||
String subSpaceId,
|
||||
String deviceId,
|
||||
String projectId) async {
|
||||
try {
|
||||
final response = await _httpService.delete(
|
||||
path: ApiEndpoints.assignDeviceToRoom
|
||||
|
||||
@ -5,7 +5,7 @@ description: This is the mobile application project, developed with Flutter for
|
||||
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
||||
publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 1.0.27+64
|
||||
version: 1.0.30+1
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.6 <4.0.0"
|
||||
|
||||
Reference in New Issue
Block a user