mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 08:37:56 +00:00
curtain changes
This commit is contained in:
@@ -27,7 +27,6 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
|
|||||||
Future<void> _onOpenCurtain(
|
Future<void> _onOpenCurtain(
|
||||||
OpenCurtain event,
|
OpenCurtain event,
|
||||||
Emitter<CurtainState> emit) async {
|
Emitter<CurtainState> emit) async {
|
||||||
// if (state is CurtainsOpening) return;
|
|
||||||
isMoving = true;
|
isMoving = true;
|
||||||
while (openPercentage < 100.0) {
|
while (openPercentage < 100.0) {
|
||||||
if (state is CurtainsClosing) {
|
if (state is CurtainsClosing) {
|
||||||
@@ -162,7 +161,6 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
|
|||||||
var response = await DevicesAPI.getDeviceStatus(curtainId);
|
var response = await DevicesAPI.getDeviceStatus(curtainId);
|
||||||
List<StatusModel> statusModelList = [];
|
List<StatusModel> statusModelList = [];
|
||||||
for (var status in response['status']) {
|
for (var status in response['status']) {
|
||||||
print(status);
|
|
||||||
statusModelList.add(StatusModel.fromJson(status));
|
statusModelList.add(StatusModel.fromJson(status));
|
||||||
}
|
}
|
||||||
// Get the open percentage from the response
|
// Get the open percentage from the response
|
||||||
|
|||||||
@@ -1,163 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
|
||||||
import 'package:syncrow_app/generated/assets.dart';
|
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
||||||
|
|
||||||
// class BlindsView extends StatelessWidget {
|
|
||||||
// const BlindsView({
|
|
||||||
// super.key,
|
|
||||||
// this.blind,
|
|
||||||
// });
|
|
||||||
// final DeviceModel? blind;
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return BlocProvider(
|
|
||||||
// create: (context) => DevicesCubit.getInstance(),
|
|
||||||
// child: BlocBuilder<DevicesCubit, DevicesState>(
|
|
||||||
// builder: (context, state) {
|
|
||||||
// return DefaultScaffold(
|
|
||||||
// title: blind?.name ?? 'Blinds',
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// Column(
|
|
||||||
// children: [
|
|
||||||
// Stack(
|
|
||||||
// alignment: Alignment.topCenter,
|
|
||||||
// children: [
|
|
||||||
// Container(
|
|
||||||
// height: 340,
|
|
||||||
// width: 365,
|
|
||||||
// decoration: const BoxDecoration(
|
|
||||||
// image: DecorationImage(
|
|
||||||
// image: AssetImage(
|
|
||||||
// Assets.assetsImagesWindow,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(top: 15, bottom: 10),
|
|
||||||
// child: AnimatedContainer(
|
|
||||||
// duration: const Duration(milliseconds: 200),
|
|
||||||
// curve: Curves.linear,
|
|
||||||
// height: DevicesCubit.get(context).blindWindowHight,
|
|
||||||
// width: 270,
|
|
||||||
// child: Stack(
|
|
||||||
// children: List.generate(
|
|
||||||
// 25,
|
|
||||||
// (index) {
|
|
||||||
// double spacing = DevicesCubit.get(context)
|
|
||||||
// .blindWindowHight /
|
|
||||||
// 24;
|
|
||||||
// double topPosition = index * spacing;
|
|
||||||
// return AnimatedPositioned(
|
|
||||||
// duration: const Duration(milliseconds: 200),
|
|
||||||
// curve: Curves.linear,
|
|
||||||
// top: topPosition,
|
|
||||||
// child: SizedBox(
|
|
||||||
// height: 10,
|
|
||||||
// width: 270,
|
|
||||||
// child: Image.asset(
|
|
||||||
// Assets.assetsImagesHorizintalBlade,
|
|
||||||
// fit: BoxFit.fill,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// const SizedBox(height: 80),
|
|
||||||
// Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
// children: [
|
|
||||||
// DecoratedBox(
|
|
||||||
// decoration:
|
|
||||||
// BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.grey.withOpacity(0.5),
|
|
||||||
// spreadRadius: 1,
|
|
||||||
// blurRadius: 5,
|
|
||||||
// offset: const Offset(3, 3),
|
|
||||||
// ),
|
|
||||||
// ]),
|
|
||||||
// child: InkWell(
|
|
||||||
// overlayColor:
|
|
||||||
// MaterialStateProperty.all(Colors.transparent),
|
|
||||||
// onTap: () {
|
|
||||||
// // DevicesCubit.get(context).setHight(false);
|
|
||||||
// DevicesCubit.get(context).openCurtain(
|
|
||||||
// blind?.productType! ?? DeviceType.Blind);
|
|
||||||
// },
|
|
||||||
// child: Image.asset(
|
|
||||||
// Assets.assetsImagesUp,
|
|
||||||
// width: 60,
|
|
||||||
// height: 60,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// DecoratedBox(
|
|
||||||
// decoration:
|
|
||||||
// BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.grey.withOpacity(0.5),
|
|
||||||
// spreadRadius: 1,
|
|
||||||
// blurRadius: 5,
|
|
||||||
// offset: const Offset(3, 3),
|
|
||||||
// ),
|
|
||||||
// ]),
|
|
||||||
// child: InkWell(
|
|
||||||
// overlayColor:
|
|
||||||
// MaterialStateProperty.all(Colors.transparent),
|
|
||||||
// onTap: () {
|
|
||||||
// DevicesCubit.get(context).pauseCurtain();
|
|
||||||
// },
|
|
||||||
// child: Image.asset(
|
|
||||||
// Assets.assetsImagesPause,
|
|
||||||
// width: 60,
|
|
||||||
// height: 60,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// DecoratedBox(
|
|
||||||
// decoration:
|
|
||||||
// BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.grey.withOpacity(0.5),
|
|
||||||
// spreadRadius: 1,
|
|
||||||
// blurRadius: 5,
|
|
||||||
// offset: const Offset(3, 3),
|
|
||||||
// ),
|
|
||||||
// ]),
|
|
||||||
// child: InkWell(
|
|
||||||
// overlayColor:
|
|
||||||
// MaterialStateProperty.all(Colors.transparent),
|
|
||||||
// onTap: () {
|
|
||||||
// DevicesCubit.get(context).closeCurtain(
|
|
||||||
// blind?.productType! ?? DeviceType.Blind);
|
|
||||||
// },
|
|
||||||
// child: Image.asset(
|
|
||||||
// Assets.assetsImagesDown,
|
|
||||||
// width: 60,
|
|
||||||
// height: 60,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
|
|
||||||
// import 'package:syncrow_app/generated2/assets.dart';
|
|
||||||
|
|
||||||
// class BlindsBottons extends StatelessWidget {
|
|
||||||
// const BlindsBottons({
|
|
||||||
// super.key,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
// children: [
|
|
||||||
// DecoratedBox(
|
|
||||||
// decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.grey.withOpacity(0.5),
|
|
||||||
// spreadRadius: 1,
|
|
||||||
// blurRadius: 5,
|
|
||||||
// offset: const Offset(3, 3),
|
|
||||||
// ),
|
|
||||||
// ]),
|
|
||||||
// child: InkWell(
|
|
||||||
// overlayColor: MaterialStateProperty.all(Colors.transparent),
|
|
||||||
// onTap: () {
|
|
||||||
// // DevicesCubit.get(context).setHight(false);
|
|
||||||
// DevicesCubit.get(context).closeCurtain();
|
|
||||||
// },
|
|
||||||
// child: Image.asset(
|
|
||||||
// Assets.assetsImagesUp,
|
|
||||||
// width: 60,
|
|
||||||
// height: 60,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// DecoratedBox(
|
|
||||||
// decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.grey.withOpacity(0.5),
|
|
||||||
// spreadRadius: 1,
|
|
||||||
// blurRadius: 5,
|
|
||||||
// offset: const Offset(3, 3),
|
|
||||||
// ),
|
|
||||||
// ]),
|
|
||||||
// child: InkWell(
|
|
||||||
// overlayColor: MaterialStateProperty.all(Colors.transparent),
|
|
||||||
// onTap: () {
|
|
||||||
// // DevicesCubit.get(context).setHight(false);
|
|
||||||
// },
|
|
||||||
// child: Image.asset(
|
|
||||||
// Assets.assetsImagesPause,
|
|
||||||
// width: 60,
|
|
||||||
// height: 60,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// DecoratedBox(
|
|
||||||
// decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.grey.withOpacity(0.5),
|
|
||||||
// spreadRadius: 1,
|
|
||||||
// blurRadius: 5,
|
|
||||||
// offset: const Offset(3, 3),
|
|
||||||
// ),
|
|
||||||
// ]),
|
|
||||||
// child: InkWell(
|
|
||||||
// overlayColor: MaterialStateProperty.all(Colors.transparent),
|
|
||||||
// onTap: () {
|
|
||||||
// // DevicesCubit.get(context).setHight(true);
|
|
||||||
// DevicesCubit.get(context).openCurtain();
|
|
||||||
// },
|
|
||||||
// child: Image.asset(
|
|
||||||
// Assets.assetsImagesDown,
|
|
||||||
// width: 60,
|
|
||||||
// height: 60,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
@@ -32,14 +32,12 @@ class DevicesAPI {
|
|||||||
static Future<Map<String, dynamic>> controlDevice(
|
static Future<Map<String, dynamic>> controlDevice(
|
||||||
DeviceControlModel controlModel, String deviceId) async {
|
DeviceControlModel controlModel, String deviceId) async {
|
||||||
try {
|
try {
|
||||||
print('controlDevice====${controlModel.toJson()}');
|
|
||||||
print('controlDevice====${deviceId}');
|
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
||||||
body: controlModel.toJson(),
|
body: controlModel.toJson(),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('json====${json}');
|
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -77,7 +75,6 @@ class DevicesAPI {
|
|||||||
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('getDeviceStatus=$json');
|
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -217,7 +214,6 @@ class DevicesAPI {
|
|||||||
"effectiveTime": effectiveTime,
|
"effectiveTime": effectiveTime,
|
||||||
"invalidTime": invalidTime,
|
"invalidTime": invalidTime,
|
||||||
};
|
};
|
||||||
print('createPassword =$body');
|
|
||||||
if (scheduleList != null) {
|
if (scheduleList != null) {
|
||||||
body["scheduleList"] = scheduleList.map((schedule) => schedule.toJson()).toList();
|
body["scheduleList"] = scheduleList.map((schedule) => schedule.toJson()).toList();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user