curtain changes

This commit is contained in:
mohammad
2024-09-02 15:04:16 +03:00
parent bf944a6121
commit ea3bc4b5e1
4 changed files with 1 additions and 253 deletions

View File

@ -27,7 +27,6 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
Future<void> _onOpenCurtain(
OpenCurtain event,
Emitter<CurtainState> emit) async {
// if (state is CurtainsOpening) return;
isMoving = true;
while (openPercentage < 100.0) {
if (state is CurtainsClosing) {
@ -162,7 +161,6 @@ class CurtainBloc extends Bloc<CurtainEvent, CurtainState> {
var response = await DevicesAPI.getDeviceStatus(curtainId);
List<StatusModel> statusModelList = [];
for (var status in response['status']) {
print(status);
statusModelList.add(StatusModel.fromJson(status));
}
// Get the open percentage from the response

View File

@ -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,
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// ],
// ),
// );
// },
// ),
// );
// }
// }

View File

@ -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,
// ),
// ),
// ),
// ],
// );
// }
// }

View File

@ -32,14 +32,12 @@ class DevicesAPI {
static Future<Map<String, dynamic>> controlDevice(
DeviceControlModel controlModel, String deviceId) async {
try {
print('controlDevice====${controlModel.toJson()}');
print('controlDevice====${deviceId}');
final response = await _httpService.post(
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
body: controlModel.toJson(),
showServerMessage: false,
expectedResponseModel: (json) {
print('json====${json}');
return json;
},
);
@ -77,7 +75,6 @@ class DevicesAPI {
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
print('getDeviceStatus=$json');
return json;
},
);
@ -217,7 +214,6 @@ class DevicesAPI {
"effectiveTime": effectiveTime,
"invalidTime": invalidTime,
};
print('createPassword =$body');
if (scheduleList != null) {
body["scheduleList"] = scheduleList.map((schedule) => schedule.toJson()).toList();
}