!! BIG CHANGE TO ASSETS GEN !!

changed the method of generating assets to be more declrative when it comes to names of the assets.

it now include the file path name e.g (asset in the path "assets/images/home-images/home.png" will be generated as this "String assetsImagesHomeImageshome = "path" ".

this will be very helpful in the future when we want to orgnize the assets dir.
This commit is contained in:
Mohammad Salameh
2024-05-07 12:26:12 +03:00
parent a9927e5821
commit fbe2f5fe53
46 changed files with 1694 additions and 527 deletions
+18 -12
View File
@@ -10,7 +10,7 @@ import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/status_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/curtains/curtain_list_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/gateway/gateway_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/lights/lights_view.dart';
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_interface.dart';
@@ -86,7 +86,7 @@ class DevicesCubit extends Cubit<DevicesState> {
case DeviceType.DoorLock:
return const DoorsListView();
case DeviceType.Curtain:
return const CurtainView();
return const CurtainListView();
// case DeviceType.ThreeGang:
// return const ThreeGangSwitchesView();
case DeviceType.Gateway:
@@ -389,11 +389,14 @@ class DevicesCubit extends Cubit<DevicesState> {
// }
//////////////////////////////////CURTAINS//////////////////////////////////////
double height = 310;
double curtainWidth = 270;
double curtainOpeningSpace = 195;
double blindWindowHight = 310;
double blindOpeningSpace = 245;
double _openPercentage = 0;
bool isMoving = false;
openCurtain() async {
openCurtain(DeviceType type) async {
if (state is CurtainsIsOpening) {
return;
}
@@ -401,7 +404,7 @@ class DevicesCubit extends Cubit<DevicesState> {
isMoving = true;
while (_openPercentage < 100.0) {
if (state is CurtainsIsClosing) {
// interrupted by the closing process
//listen to interruption by the closing process
pauseCurtain();
break;
}
@@ -411,22 +414,24 @@ class DevicesCubit extends Cubit<DevicesState> {
if (isMoving) {
await Future.delayed(const Duration(milliseconds: 200), () {
_openPercentage += 10.0;
height -= 24.5;
//25.5 is the 10% of the curtain opening space, its used to update the
// animated container of thecurtain
type == DeviceType.Curtain
? curtainWidth -= curtainOpeningSpace / 10
: blindWindowHight -= blindOpeningSpace / 10;
if (_openPercentage >= 100.0) {
print('done open');
pauseCurtain();
}
});
} else {
print('stopped open');
pauseCurtain();
break;
}
}
}
closeCurtain() async {
closeCurtain(DeviceType type) async {
if (state is CurtainsIsClosing) {
return;
}
@@ -444,15 +449,16 @@ class DevicesCubit extends Cubit<DevicesState> {
if (isMoving) {
await Future.delayed(const Duration(milliseconds: 200), () {
_openPercentage -= 10.0;
height += 24.5;
//25.5 is the 10% of the curtain opening space, its used to update the
type == DeviceType.Curtain
? curtainWidth += curtainOpeningSpace / 10
: blindWindowHight += 24.5;
if (_openPercentage <= 0.0) {
print('done close');
pauseCurtain();
}
});
} else {
print('stopped close');
pauseCurtain();
break;
}