diff --git a/lib/features/devices/bloc/two_touch_bloc/two_touch_bloc.dart b/lib/features/devices/bloc/two_touch_bloc/two_touch_bloc.dart index 0a1857c..0f4c794 100644 --- a/lib/features/devices/bloc/two_touch_bloc/two_touch_bloc.dart +++ b/lib/features/devices/bloc/two_touch_bloc/two_touch_bloc.dart @@ -30,14 +30,14 @@ class TwoTouchBloc extends Bloc { relay_status_2: status.off, ); Timer? _timer; - + bool twoTouchGroup = false; List devicesList = []; List groupTwoTouchList = []; bool allSwitchesOn = true; bool toggleSchedule = true; List selectedDays = []; - + bool createSchedule = false; List listSchedule = []; diff --git a/lib/features/devices/model/device_category_model.dart b/lib/features/devices/model/device_category_model.dart index e391d3a..8ef4334 100644 --- a/lib/features/devices/model/device_category_model.dart +++ b/lib/features/devices/model/device_category_model.dart @@ -67,4 +67,7 @@ Map deviceTypeIconMap = { DeviceType.WH: Assets.waterHeaterIcon, DeviceType.DS: Assets.doorSensorIcon, DeviceType.Other: Assets.assetsIconsAC, + DeviceType.OneTouch: Assets.oneGang, + DeviceType.TowTouch: Assets.twoGang, + DeviceType.ThreeTouch: Assets.assetsIconsGang, }; diff --git a/lib/features/devices/model/device_model.dart b/lib/features/devices/model/device_model.dart index 866c51a..2374198 100644 --- a/lib/features/devices/model/device_model.dart +++ b/lib/features/devices/model/device_model.dart @@ -66,6 +66,12 @@ class DeviceModel { tempIcon = Assets.waterHeaterIcon; } else if (type == DeviceType.DS) { tempIcon = Assets.doorSensorIcon; + } else if (type == DeviceType.OneTouch) { + tempIcon = Assets.oneGang; + } else if (type == DeviceType.TowTouch) { + tempIcon = Assets.twoGang; + } else if (type == DeviceType.ThreeTouch) { + tempIcon = Assets.assetsIcons3GangSwitch; } else { tempIcon = Assets.assetsIconsLogo; } diff --git a/lib/features/devices/view/widgets/one_gang/one_gang_wizard.dart b/lib/features/devices/view/widgets/one_gang/one_gang_wizard.dart index 92013ed..e7b4fbc 100644 --- a/lib/features/devices/view/widgets/one_gang/one_gang_wizard.dart +++ b/lib/features/devices/view/widgets/one_gang/one_gang_wizard.dart @@ -19,28 +19,32 @@ class OneGangWizard extends StatelessWidget { List groupOneGangModel = []; return DefaultScaffold( + title: 'Lights', child: BlocProvider( - create: (context) => - OneGangBloc(switchCode: '', oneGangId: device?.uuid ?? '')..add(InitialWizardEvent()), - child: BlocBuilder( - builder: (context, state) { - bool allSwitchesOn = false; + create: (context) => + OneGangBloc(switchCode: '', oneGangId: device?.uuid ?? '') + ..add(InitialWizardEvent()), + child: BlocBuilder( + builder: (context, state) { + bool allSwitchesOn = false; - if (state is UpdateGroupState) { - groupOneGangModel = state.oneGangList; - allSwitchesOn = state.allSwitches; - } - return state is LoadingInitialState - ? const Center( - child: - DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), - ) - : OneGangList( - oneGangList: groupOneGangModel, - allSwitches: allSwitchesOn, - ); - }, - ), - )); + if (state is UpdateGroupState) { + groupOneGangModel = state.oneGangList; + allSwitchesOn = state.allSwitches; + } + return state is LoadingInitialState + ? const Center( + child: DefaultContainer( + width: 50, + height: 50, + child: CircularProgressIndicator()), + ) + : OneGangList( + oneGangList: groupOneGangModel, + allSwitches: allSwitchesOn, + ); + }, + ), + )); } } diff --git a/lib/features/devices/view/widgets/one_touch/one_touch_wizard.dart b/lib/features/devices/view/widgets/one_touch/one_touch_wizard.dart index e430183..f314b14 100644 --- a/lib/features/devices/view/widgets/one_touch/one_touch_wizard.dart +++ b/lib/features/devices/view/widgets/one_touch/one_touch_wizard.dart @@ -20,31 +20,32 @@ class OneTouchWizard extends StatelessWidget { List groupOneTouchModel = []; return DefaultScaffold( + title: 'Lights', child: BlocProvider( - create: (context) => - OneTouchBloc(switchCode: '', oneTouchId: device?.uuid ?? '') - ..add(InitialWizardEvent()), - child: BlocBuilder( - builder: (context, state) { - bool allSwitchesOn = false; + create: (context) => + OneTouchBloc(switchCode: '', oneTouchId: device?.uuid ?? '') + ..add(InitialWizardEvent()), + child: BlocBuilder( + builder: (context, state) { + bool allSwitchesOn = false; - if (state is UpdateGroupState) { - groupOneTouchModel = state.oneTouchList; - allSwitchesOn = state.allSwitches; - } - return state is LoadingInitialState - ? const Center( - child: DefaultContainer( - width: 50, - height: 50, - child: CircularProgressIndicator()), - ) - : OneTouchList( - oneTouchList: groupOneTouchModel, - allSwitches: allSwitchesOn, - ); - }, - ), - )); + if (state is UpdateGroupState) { + groupOneTouchModel = state.oneTouchList; + allSwitchesOn = state.allSwitches; + } + return state is LoadingInitialState + ? const Center( + child: DefaultContainer( + width: 50, + height: 50, + child: CircularProgressIndicator()), + ) + : OneTouchList( + oneTouchList: groupOneTouchModel, + allSwitches: allSwitchesOn, + ); + }, + ), + )); } } diff --git a/lib/features/devices/view/widgets/three_gang/three_gang_wizard.dart b/lib/features/devices/view/widgets/three_gang/three_gang_wizard.dart index 392ad20..a673734 100644 --- a/lib/features/devices/view/widgets/three_gang/three_gang_wizard.dart +++ b/lib/features/devices/view/widgets/three_gang/three_gang_wizard.dart @@ -17,29 +17,33 @@ class ThreeGangWizard extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultScaffold( + title: 'Lights', child: BlocProvider( - create: (context) => ThreeGangBloc(switchCode: '', threeGangId: device?.uuid ?? '') - ..add(InitialEvent(groupScreen: device != null ? false : true)), - child: BlocBuilder( - builder: (context, state) { - List groupThreeGangModel = []; - bool allSwitchesOn = false; + create: (context) => + ThreeGangBloc(switchCode: '', threeGangId: device?.uuid ?? '') + ..add(InitialEvent(groupScreen: device != null ? false : true)), + child: BlocBuilder( + builder: (context, state) { + List groupThreeGangModel = []; + bool allSwitchesOn = false; - if (state is UpdateGroupState) { - groupThreeGangModel = state.threeGangList; - allSwitchesOn = state.allSwitches; - } - return state is LoadingInitialState - ? const Center( - child: - DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), - ) - : ThreeGangList( - threeGangList: groupThreeGangModel, - allSwitches: allSwitchesOn, - ); - }, - ), - )); + if (state is UpdateGroupState) { + groupThreeGangModel = state.threeGangList; + allSwitchesOn = state.allSwitches; + } + return state is LoadingInitialState + ? const Center( + child: DefaultContainer( + width: 50, + height: 50, + child: CircularProgressIndicator()), + ) + : ThreeGangList( + threeGangList: groupThreeGangModel, + allSwitches: allSwitchesOn, + ); + }, + ), + )); } } diff --git a/lib/features/devices/view/widgets/three_touch/three_touch_wizard.dart b/lib/features/devices/view/widgets/three_touch/three_touch_wizard.dart index a100faf..9df741f 100644 --- a/lib/features/devices/view/widgets/three_touch/three_touch_wizard.dart +++ b/lib/features/devices/view/widgets/three_touch/three_touch_wizard.dart @@ -17,29 +17,34 @@ class ThreeTouchWizard extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultScaffold( + title: 'Lights', child: BlocProvider( - create: (context) => ThreeTouchBloc(switchCode: '', threeTouchId: device?.uuid ?? '') - ..add(InitialEvent(groupScreen: device != null ? false : true)), - child: BlocBuilder( - builder: (context, state) { - List groupThreeTouchModel = []; - bool allSwitchesOn = false; + create: (context) => + ThreeTouchBloc(switchCode: '', threeTouchId: device?.uuid ?? '') + ..add(InitialEvent(groupScreen: device != null ? false : true)), + child: BlocBuilder( + builder: (context, state) { + List groupThreeTouchModel = []; + bool allSwitchesOn = false; - if (state is UpdateGroupState) { - groupThreeTouchModel = state.threeTouchList; - allSwitchesOn = state.allSwitches; - } - return state is LoadingInitialState - ? const Center( - child: - DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), - ) - : ThreeTouchList( - threeTouchList: groupThreeTouchModel, - allSwitches: allSwitchesOn, - ); - }, - ), - )); + if (state is UpdateGroupState) { + groupThreeTouchModel = state.threeTouchList; + allSwitchesOn = state.allSwitches; + } + return state is LoadingInitialState + ? const Center( + child: DefaultContainer( + width: 50, + height: 50, + child: CircularProgressIndicator()), + ) + : + ThreeTouchList( + threeTouchList: groupThreeTouchModel, + allSwitches: allSwitchesOn, + ); + }, + ), + )); } } diff --git a/lib/features/devices/view/widgets/two_gang/two_gang_wizard.dart b/lib/features/devices/view/widgets/two_gang/two_gang_wizard.dart index 04055c5..7a46dd2 100644 --- a/lib/features/devices/view/widgets/two_gang/two_gang_wizard.dart +++ b/lib/features/devices/view/widgets/two_gang/two_gang_wizard.dart @@ -19,28 +19,32 @@ class TwoGangWizard extends StatelessWidget { List groupTwoGangModel = []; return DefaultScaffold( + title: 'Lights', child: BlocProvider( - create: (context) => - TwoGangBloc(switchCode: '', twoGangId: device?.uuid ?? '')..add(InitialWizardEvent()), - child: BlocBuilder( - builder: (context, state) { - bool allSwitchesOn = false; + create: (context) => + TwoGangBloc(switchCode: '', twoGangId: device?.uuid ?? '') + ..add(InitialWizardEvent()), + child: BlocBuilder( + builder: (context, state) { + bool allSwitchesOn = false; - if (state is UpdateGroupState) { - groupTwoGangModel = state.twoGangList; - allSwitchesOn = state.allSwitches; - } - return state is LoadingInitialState - ? const Center( - child: - DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), - ) - : TwoGangList( - twoGangList: groupTwoGangModel, - allSwitches: allSwitchesOn, - ); - }, - ), - )); + if (state is UpdateGroupState) { + groupTwoGangModel = state.twoGangList; + allSwitchesOn = state.allSwitches; + } + return state is LoadingInitialState + ? const Center( + child: DefaultContainer( + width: 50, + height: 50, + child: CircularProgressIndicator()), + ) + : TwoGangList( + twoGangList: groupTwoGangModel, + allSwitches: allSwitchesOn, + ); + }, + ), + )); } } diff --git a/lib/features/devices/view/widgets/two_touch/two_touch_wizard.dart b/lib/features/devices/view/widgets/two_touch/two_touch_wizard.dart index 287dfa0..6afa758 100644 --- a/lib/features/devices/view/widgets/two_touch/two_touch_wizard.dart +++ b/lib/features/devices/view/widgets/two_touch/two_touch_wizard.dart @@ -20,28 +20,32 @@ class TwoTouchWizard extends StatelessWidget { List groupTwoTouchModel = []; return DefaultScaffold( + title: 'Lights', child: BlocProvider( - create: (context) => - TwoTouchBloc(switchCode: '', twoTouchId: device?.uuid ?? '')..add(InitialWizardEvent()), - child: BlocBuilder( - builder: (context, state) { - bool allSwitchesOn = false; + create: (context) => + TwoTouchBloc(switchCode: '', twoTouchId: device?.uuid ?? '') + ..add(InitialWizardEvent()), + child: BlocBuilder( + builder: (context, state) { + bool allSwitchesOn = false; - if (state is UpdateGroupState) { - groupTwoTouchModel = state.twoTouchList; - allSwitchesOn = state.allSwitches; - } - return state is LoadingInitialState - ? const Center( - child: - DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), - ) - : TwoTouchList( - twoTouchList: groupTwoTouchModel, - allSwitches: allSwitchesOn, - ); - }, - ), - )); + if (state is UpdateGroupState) { + groupTwoTouchModel = state.twoTouchList; + allSwitchesOn = state.allSwitches; + } + return state is LoadingInitialState + ? const Center( + child: DefaultContainer( + width: 50, + height: 50, + child: CircularProgressIndicator()), + ) + : TwoTouchList( + twoTouchList: groupTwoTouchModel, + allSwitches: allSwitchesOn, + ); + }, + ), + )); } } diff --git a/lib/features/shared_widgets/devices_default_switch.dart b/lib/features/shared_widgets/devices_default_switch.dart index 54c88bb..f31fb50 100644 --- a/lib/features/shared_widgets/devices_default_switch.dart +++ b/lib/features/shared_widgets/devices_default_switch.dart @@ -4,7 +4,10 @@ import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; class DevicesDefaultSwitch extends StatelessWidget { const DevicesDefaultSwitch( - {super.key, required this.switchValue, required this.action, this.secondAction}); + {super.key, + required this.switchValue, + required this.action, + this.secondAction}); final bool switchValue; final Function action; @@ -22,7 +25,9 @@ class DevicesDefaultSwitch extends StatelessWidget { child: Container( height: 60, decoration: BoxDecoration( - color: switchValue ? ColorsManager.primaryColor : Colors.white, + color: switchValue + ? ColorsManager.switchButton.withOpacity(0.6) + : Colors.white, borderRadius: const BorderRadius.only( topLeft: Radius.circular(15), bottomLeft: Radius.circular(15), @@ -30,9 +35,10 @@ class DevicesDefaultSwitch extends StatelessWidget { ), child: Center( child: BodyMedium( + fontSize: 14, text: "ON", fontColor: switchValue ? Colors.white : null, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w700, ), ), ), @@ -50,7 +56,9 @@ class DevicesDefaultSwitch extends StatelessWidget { child: Container( height: 60, decoration: BoxDecoration( - color: switchValue ? Colors.white : ColorsManager.primaryColor, + color: switchValue + ? Colors.white + : ColorsManager.switchButton.withOpacity(0.6), borderRadius: const BorderRadius.only( topRight: Radius.circular(15), bottomRight: Radius.circular(15), @@ -58,9 +66,10 @@ class DevicesDefaultSwitch extends StatelessWidget { ), child: Center( child: BodyMedium( + fontSize: 14, text: "OFF", fontColor: switchValue ? null : Colors.white, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w700, ), ), ), diff --git a/lib/utils/resource_manager/color_manager.dart b/lib/utils/resource_manager/color_manager.dart index 4576c90..78e9a50 100644 --- a/lib/utils/resource_manager/color_manager.dart +++ b/lib/utils/resource_manager/color_manager.dart @@ -5,7 +5,8 @@ abstract class ColorsManager { static const Color switchOffColor = Color(0x7F8D99AE); static const Color primaryColor = Color(0xFF0030CB); static const Color secondaryTextColor = Color(0xFF848484); - static Color primaryColorWithOpacity = const Color(0xFF023DFE).withOpacity(0.6); + static Color primaryColorWithOpacity = + const Color(0xFF023DFE).withOpacity(0.6); static const Color onPrimaryColor = Colors.white; static const Color secondaryColor = Color(0xFF023DFE); static const Color onSecondaryColor = Color(0xFF023DFE); @@ -27,5 +28,5 @@ abstract class ColorsManager { static const Color red = Colors.red; static const Color graysColor = Color(0xffEBEBEB); static const Color textGray = Color(0xffD5D5D5); - + static const Color switchButton = Color(0xff023DFE); }