From 908533dc9ed65b7d76ebcbae6472f533665a07e7 Mon Sep 17 00:00:00 2001 From: mohammad Date: Tue, 1 Oct 2024 16:33:11 +0300 Subject: [PATCH] tow touch and three touch --- .../three_touch/three_touch_screen.dart | 32 ++++++-- .../three_touch/two_touch_setting.dart | 80 ++++++++++++++++++- 2 files changed, 102 insertions(+), 10 deletions(-) diff --git a/lib/features/devices/view/widgets/three_touch/three_touch_screen.dart b/lib/features/devices/view/widgets/three_touch/three_touch_screen.dart index 098eb7c..82d2b4e 100644 --- a/lib/features/devices/view/widgets/three_touch/three_touch_screen.dart +++ b/lib/features/devices/view/widgets/three_touch/three_touch_screen.dart @@ -9,6 +9,8 @@ import 'package:syncrow_app/features/devices/model/three_touch_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/circular_button.dart'; import 'package:syncrow_app/features/devices/view/widgets/three_gang/gang_switch.dart'; import 'package:syncrow_app/features/devices/view/widgets/three_touch/schedule_screen.dart'; +import 'package:syncrow_app/features/devices/view/widgets/three_touch/two_touch_setting.dart'; +import 'package:syncrow_app/features/devices/view/widgets/two_touch/two_touch_setting.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; @@ -267,6 +269,7 @@ class ThreeTouchScreen extends StatelessWidget { // ), // ], // ), + const SizedBox( width: 20, ), @@ -286,6 +289,25 @@ class ThreeTouchScreen extends StatelessWidget { ))); }, ), + + const SizedBox( + width: 20, + ), + CircularButton( + device: device, + icons: Icons.access_time, + label: "Setting", + onTap: () { + Navigator.push( + context, + PageRouteBuilder( + pageBuilder: (context, animation1, + animation2) => + ThreeTouchSetting( + device: device, + ))); + }, + ), // Column( // mainAxisSize: MainAxisSize.min, // children: [ @@ -360,14 +382,8 @@ class ThreeTouchScreen extends StatelessWidget { icons: Icons.u_turn_left, label: "All Off", onTap: () { - Navigator.push( - context, - PageRouteBuilder( - pageBuilder: (context, animation1, - animation2) => - ScheduleScreen( - device: device!, - ))); + BlocProvider.of(context) + .add(AllOffEvent()); }, ), // Column( diff --git a/lib/features/devices/view/widgets/three_touch/two_touch_setting.dart b/lib/features/devices/view/widgets/three_touch/two_touch_setting.dart index ce05eca..aee4528 100644 --- a/lib/features/devices/view/widgets/three_touch/two_touch_setting.dart +++ b/lib/features/devices/view/widgets/three_touch/two_touch_setting.dart @@ -70,7 +70,7 @@ class ThreeTouchSetting extends StatelessWidget { builder: (context) { return RestartStatusDialog( initialSelectedLabel: - deviceStatus!.relay.value, + deviceStatus.relay.value, cancelTab: () { Navigator.of(context).pop(); }, @@ -368,6 +368,83 @@ class ThreeTouchSetting extends StatelessWidget { ], ), )), + const Divider( + color: ColorsManager.graysColor, + ), + Container( + padding: const EdgeInsets.only( + bottom: 10, top: 10), + child: InkWell( + onTap: () async { + twoTouchBloc.optionSelected = + 'relay_status_3'; + final result = await showDialog( + context: context, + builder: (context) { + return RestartStatusDialog( + initialSelectedLabel: deviceStatus + .relay_status_2.value, + cancelTab: () { + Navigator.of(context).pop(); + }, + confirmTab: () { + twoTouchBloc.add( + ChangeStatusEvent( + deviceId: device!.uuid!, + context: context)); + Navigator.of(context).pop(true); + }, + title: 'Restart Status 3', + label1: 'Power Off', + label2: 'Power On', + label3: 'Restart Memory', + onTapLabel1: (selected) { + twoTouchBloc.statusSelected = + selected; + }, + onTapLabel2: (selected) { + twoTouchBloc.statusSelected = + selected; + }, + onTapLabel3: (selected) { + twoTouchBloc.statusSelected = + selected; + }, + ); + }, + ); + if (result == true) { + // twoTouchBloc + // .add(const InitialEvent()); + } + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + const BodyLarge( + fontSize: 15, + text: 'Restart Status 3', + fontWeight: FontWeight.w400, + ), + Row( + children: [ + BodyMedium( + fontSize: 13, + text: twoTouchBloc.deviceStatus + .relay_status_1.value, + fontColor: + ColorsManager.textGray, + ), + const Icon( + Icons.keyboard_arrow_right, + color: ColorsManager.textGray, + ), + ], + ) + ], + ), + )), ], ), ), @@ -379,4 +456,3 @@ class ThreeTouchSetting extends StatelessWidget { )); } } -