diff --git a/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_delete_dialog.dart b/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_delete_dialog.dart index 67c62e2..e69de29 100644 --- a/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_delete_dialog.dart +++ b/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_delete_dialog.dart @@ -1,227 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; -import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; - -class DisconnectDeviceDialog extends StatelessWidget { - final Function()? cancelTab; - final Function()? confirmTab; - - const DisconnectDeviceDialog({ - super.key, - required this.cancelTab, - required this.confirmTab, - }); - - @override - Widget build(BuildContext context) { - return AlertDialog( - contentPadding: EdgeInsets.zero, - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 10, - ), - const BodyLarge( - text: 'Disconnect Device', - fontWeight: FontWeight.w700, - fontColor: ColorsManager.red, - fontSize: 16, - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 15), - child: Divider( - color: ColorsManager.textGray, - ), - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), - child: Column( - children: [ - Center( - child: Text( - 'This will disconnect your device from this Application')), - ], - ), - ), - Row( - children: [ - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - right: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: SizedBox( - child: InkWell( - onTap: cancelTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Cancel', - style: TextStyle( - color: ColorsManager.textGray, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ), - ), - ), - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - left: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: InkWell( - onTap: confirmTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Disconnect', - style: TextStyle( - color: ColorsManager.red, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - )), - )) - ], - ) - ], - ), - ); - } -} - -class DisconnectWipeData extends StatelessWidget { - final Function()? cancelTab; - final Function()? confirmTab; - - const DisconnectWipeData({ - super.key, - required this.cancelTab, - required this.confirmTab, - }); - - @override - Widget build(BuildContext context) { - return AlertDialog( - contentPadding: EdgeInsets.zero, - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 10, - ), - const BodyLarge( - text: 'Disconnect and Wipe Data', - fontWeight: FontWeight.w700, - fontColor: ColorsManager.red, - fontSize: 16, - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 15), - child: Divider( - color: ColorsManager.textGray, - ), - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), - child: Column( - children: [ - Center( - child: Text( - 'This will disconnect your device from this Application and wipe all the data')), - ], - ), - ), - Row( - children: [ - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - right: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: SizedBox( - child: InkWell( - onTap: cancelTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Cancel', - style: TextStyle( - color: ColorsManager.textGray, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ), - ), - ), - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - left: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: InkWell( - onTap: confirmTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Disconnect', - style: TextStyle( - color: ColorsManager.red, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - )), - )) - ], - ) - ], - ), - ); - } -} diff --git a/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_settings.dart b/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_settings.dart index 60495e4..5b90a37 100644 --- a/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_settings.dart +++ b/lib/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_settings.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -9,13 +8,14 @@ import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/six_scene_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/6_scene_setting/faq_six_scene_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/6_scene_setting/share_six_scene_page.dart'; -import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_delete_dialog.dart'; import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_info_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_profile_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_update_dialog.dart'; import 'package:syncrow_app/features/devices/view/widgets/6_scene_switch/6_scene_setting/six_scene_update_page.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; +import 'package:syncrow_app/features/shared_widgets/delete_device_dialogs.dart'; +import 'package:syncrow_app/features/shared_widgets/setting_widget.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/generated/assets.dart'; @@ -271,16 +271,6 @@ class SixSceneSettings extends StatelessWidget { Navigator.of(context).pop(); }, confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); Navigator.of(context).pop(); }, ); @@ -341,16 +331,6 @@ class SixSceneSettings extends StatelessWidget { Navigator.of(context).pop(); }, confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); Navigator.of(context).pop(); }, ); @@ -431,91 +411,3 @@ class SixSceneSettings extends StatelessWidget { ); } } - -class SettingWidget extends StatelessWidget { - final String? text; - final bool? isUpdate; - final bool? value; - final bool? isNotification; - final String? icon; - final Function()? onTap; - final Function()? onTapUpdate; - final Function(bool)? onChanged; - const SettingWidget( - {super.key, - this.text, - this.icon, - this.onTap, - this.value, - this.isUpdate, - this.onChanged, - this.isNotification = false, - this.onTapUpdate}); - - @override - Widget build(BuildContext context) { - return InkWell( - onTap: onTap, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - children: [ - Expanded( - flex: 2, - child: Container( - padding: EdgeInsets.all(8), - decoration: const BoxDecoration( - color: ColorsManager.primaryColor, - borderRadius: BorderRadius.all(Radius.circular(20))), - child: SvgPicture.asset( - icon!, - fit: BoxFit.none, - height: 30, - ), - ), - ), - const SizedBox( - width: 8, - ), - Expanded( - flex: isUpdate == true ? 5 : 10, - child: BodyMedium( - text: text!, - fontSize: 15, - fontWeight: FontWeight.w400, - )), - ], - ), - ), - isUpdate == true - ? InkWell( - onTap: onTapUpdate, - child: BodyMedium( - text: '1 Update Available', - fontSize: 13, - fontWeight: FontWeight.w400, - fontColor: ColorsManager.blueColor, - ), - ) - : SizedBox(), - isNotification == false - ? const Icon( - Icons.arrow_forward_ios, - color: ColorsManager.graysColor, - size: 20, - ) - : Transform.scale( - scale: .8, - child: CupertinoSwitch( - value: value!, - onChanged: onChanged, - applyTheme: true, - ), - ), - ], - ), - ); - } -} diff --git a/lib/features/devices/view/widgets/four_scene_switch/four_scene_screen.dart b/lib/features/devices/view/widgets/four_scene_switch/four_scene_screen.dart index 224e30b..30d6ddd 100644 --- a/lib/features/devices/view/widgets/four_scene_switch/four_scene_screen.dart +++ b/lib/features/devices/view/widgets/four_scene_switch/four_scene_screen.dart @@ -1,6 +1,4 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_bloc.dart'; diff --git a/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_delete_dialog.dart b/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_delete_dialog.dart index 67c62e2..e69de29 100644 --- a/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_delete_dialog.dart +++ b/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_delete_dialog.dart @@ -1,227 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; -import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; - -class DisconnectDeviceDialog extends StatelessWidget { - final Function()? cancelTab; - final Function()? confirmTab; - - const DisconnectDeviceDialog({ - super.key, - required this.cancelTab, - required this.confirmTab, - }); - - @override - Widget build(BuildContext context) { - return AlertDialog( - contentPadding: EdgeInsets.zero, - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 10, - ), - const BodyLarge( - text: 'Disconnect Device', - fontWeight: FontWeight.w700, - fontColor: ColorsManager.red, - fontSize: 16, - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 15), - child: Divider( - color: ColorsManager.textGray, - ), - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), - child: Column( - children: [ - Center( - child: Text( - 'This will disconnect your device from this Application')), - ], - ), - ), - Row( - children: [ - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - right: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: SizedBox( - child: InkWell( - onTap: cancelTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Cancel', - style: TextStyle( - color: ColorsManager.textGray, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ), - ), - ), - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - left: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: InkWell( - onTap: confirmTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Disconnect', - style: TextStyle( - color: ColorsManager.red, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - )), - )) - ], - ) - ], - ), - ); - } -} - -class DisconnectWipeData extends StatelessWidget { - final Function()? cancelTab; - final Function()? confirmTab; - - const DisconnectWipeData({ - super.key, - required this.cancelTab, - required this.confirmTab, - }); - - @override - Widget build(BuildContext context) { - return AlertDialog( - contentPadding: EdgeInsets.zero, - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 10, - ), - const BodyLarge( - text: 'Disconnect and Wipe Data', - fontWeight: FontWeight.w700, - fontColor: ColorsManager.red, - fontSize: 16, - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 15), - child: Divider( - color: ColorsManager.textGray, - ), - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), - child: Column( - children: [ - Center( - child: Text( - 'This will disconnect your device from this Application and wipe all the data')), - ], - ), - ), - Row( - children: [ - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - right: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: SizedBox( - child: InkWell( - onTap: cancelTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Cancel', - style: TextStyle( - color: ColorsManager.textGray, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ), - ), - ), - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - left: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: InkWell( - onTap: confirmTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Disconnect', - style: TextStyle( - color: ColorsManager.red, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - )), - )) - ], - ) - ], - ), - ); - } -} diff --git a/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_settings.dart b/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_settings.dart index 33ab7ec..a6cea79 100644 --- a/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_settings.dart +++ b/lib/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_settings.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -8,7 +7,6 @@ import 'package:syncrow_app/features/devices/bloc/four_scene_bloc/four_scene_sta import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/four_scene_model.dart'; import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/faq_four_scene_page.dart'; -import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_delete_dialog.dart'; import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_info_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_profile_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/four_scene_update_dialog.dart'; @@ -16,6 +14,8 @@ import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four import 'package:syncrow_app/features/devices/view/widgets/four_scene_switch/four_scene_setting/share_four_scene_page.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; +import 'package:syncrow_app/features/shared_widgets/delete_device_dialogs.dart'; +import 'package:syncrow_app/features/shared_widgets/setting_widget.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/generated/assets.dart'; @@ -72,7 +72,7 @@ class FourSceneSettings extends StatelessWidget { ), ); if (val == true) { - _bloc.add(FourSceneInitialInfo()); + _bloc.add(const FourSceneInitialInfo()); } }, child: Stack( @@ -285,16 +285,6 @@ class FourSceneSettings extends StatelessWidget { Navigator.of(context).pop(); }, confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); Navigator.of(context).pop(); }, ); @@ -355,16 +345,6 @@ class FourSceneSettings extends StatelessWidget { Navigator.of(context).pop(); }, confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); Navigator.of(context).pop(); }, ); @@ -387,8 +367,7 @@ class FourSceneSettings extends StatelessWidget { ), const SizedBox(height: 20), Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment:MainAxisAlignment.spaceBetween, children: [ InkWell( onTap: () { @@ -445,91 +424,3 @@ class FourSceneSettings extends StatelessWidget { ); } } - -class SettingWidget extends StatelessWidget { - final String? text; - final bool? isUpdate; - final bool? value; - final bool? isNotification; - final String? icon; - final Function()? onTap; - final Function()? onTapUpdate; - final Function(bool)? onChanged; - const SettingWidget( - {super.key, - this.text, - this.icon, - this.value, - this.onTap, - this.isUpdate, - this.onChanged, - this.isNotification = false, - this.onTapUpdate}); - - @override - Widget build(BuildContext context) { - return InkWell( - onTap: onTap, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - children: [ - Expanded( - flex: 2, - child: Container( - padding: const EdgeInsets.all(8), - decoration: const BoxDecoration( - color: ColorsManager.primaryColor, - borderRadius: BorderRadius.all(Radius.circular(20))), - child: SvgPicture.asset( - icon!, - fit: BoxFit.none, - height: 30, - ), - ), - ), - const SizedBox( - width: 8, - ), - Expanded( - flex: isUpdate == true ? 5 : 10, - child: BodyMedium( - text: text!, - fontSize: 15, - fontWeight: FontWeight.w400, - )), - ], - ), - ), - isUpdate == true - ? InkWell( - onTap: onTapUpdate, - child: const BodyMedium( - text: '1 Update Available', - fontSize: 13, - fontWeight: FontWeight.w400, - fontColor: ColorsManager.blueColor, - ), - ) - : SizedBox(), - isNotification == false - ? const Icon( - Icons.arrow_forward_ios, - color: ColorsManager.graysColor, - size: 20, - ) - : Transform.scale( - scale: .8, - child: CupertinoSwitch( - value: value!, - onChanged: onChanged, - applyTheme: true, - ), - ), - ], - ), - ); - } -} diff --git a/lib/features/devices/view/widgets/sos/sos_setting/delete_dialog.dart b/lib/features/devices/view/widgets/sos/sos_setting/delete_dialog.dart index 67c62e2..e69de29 100644 --- a/lib/features/devices/view/widgets/sos/sos_setting/delete_dialog.dart +++ b/lib/features/devices/view/widgets/sos/sos_setting/delete_dialog.dart @@ -1,227 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; -import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; - -class DisconnectDeviceDialog extends StatelessWidget { - final Function()? cancelTab; - final Function()? confirmTab; - - const DisconnectDeviceDialog({ - super.key, - required this.cancelTab, - required this.confirmTab, - }); - - @override - Widget build(BuildContext context) { - return AlertDialog( - contentPadding: EdgeInsets.zero, - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 10, - ), - const BodyLarge( - text: 'Disconnect Device', - fontWeight: FontWeight.w700, - fontColor: ColorsManager.red, - fontSize: 16, - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 15), - child: Divider( - color: ColorsManager.textGray, - ), - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), - child: Column( - children: [ - Center( - child: Text( - 'This will disconnect your device from this Application')), - ], - ), - ), - Row( - children: [ - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - right: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: SizedBox( - child: InkWell( - onTap: cancelTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Cancel', - style: TextStyle( - color: ColorsManager.textGray, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ), - ), - ), - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - left: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: InkWell( - onTap: confirmTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Disconnect', - style: TextStyle( - color: ColorsManager.red, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - )), - )) - ], - ) - ], - ), - ); - } -} - -class DisconnectWipeData extends StatelessWidget { - final Function()? cancelTab; - final Function()? confirmTab; - - const DisconnectWipeData({ - super.key, - required this.cancelTab, - required this.confirmTab, - }); - - @override - Widget build(BuildContext context) { - return AlertDialog( - contentPadding: EdgeInsets.zero, - content: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const SizedBox( - height: 10, - ), - const BodyLarge( - text: 'Disconnect and Wipe Data', - fontWeight: FontWeight.w700, - fontColor: ColorsManager.red, - fontSize: 16, - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 15), - child: Divider( - color: ColorsManager.textGray, - ), - ), - const Padding( - padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), - child: Column( - children: [ - Center( - child: Text( - 'This will disconnect your device from this Application and wipe all the data')), - ], - ), - ), - Row( - children: [ - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - right: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: SizedBox( - child: InkWell( - onTap: cancelTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Cancel', - style: TextStyle( - color: ColorsManager.textGray, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ), - ), - ), - Expanded( - child: Container( - decoration: const BoxDecoration( - border: Border( - left: BorderSide( - color: ColorsManager.textGray, - width: 0.5, - ), - top: BorderSide( - color: ColorsManager.textGray, - width: 1.0, - ), - )), - child: InkWell( - onTap: confirmTab, - child: const Padding( - padding: EdgeInsets.all(15), - child: Center( - child: Text( - 'Disconnect', - style: TextStyle( - color: ColorsManager.red, - fontSize: 14, - fontWeight: FontWeight.w400), - ), - ), - )), - )) - ], - ) - ], - ), - ); - } -} diff --git a/lib/features/devices/view/widgets/sos/sos_settings.dart b/lib/features/devices/view/widgets/sos/sos_settings.dart index 17dbf46..0a41e67 100644 --- a/lib/features/devices/view/widgets/sos/sos_settings.dart +++ b/lib/features/devices/view/widgets/sos/sos_settings.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -7,7 +6,6 @@ import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_event.dart'; import 'package:syncrow_app/features/devices/bloc/sos_bloc/sos_state.dart'; import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/sos_model.dart'; -import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/delete_dialog.dart'; import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/faq_sos_page.dart'; import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/share_sos_page.dart'; @@ -16,6 +14,8 @@ import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/sos_up import 'package:syncrow_app/features/devices/view/widgets/sos/sos_setting/update_dialog_sos.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; +import 'package:syncrow_app/features/shared_widgets/delete_device_dialogs.dart'; +import 'package:syncrow_app/features/shared_widgets/setting_widget.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/generated/assets.dart'; @@ -235,16 +235,6 @@ class SosSettings extends StatelessWidget { Navigator.of(context).pop(); }, confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); Navigator.of(context).pop(); }, ); @@ -305,16 +295,6 @@ class SosSettings extends StatelessWidget { Navigator.of(context).pop(); }, confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); Navigator.of(context).pop(); }, ); @@ -395,91 +375,3 @@ class SosSettings extends StatelessWidget { ); } } - -class SettingWidget extends StatelessWidget { - final String? text; - final bool? isUpdate; - final bool? value; - final bool? isNotification; - final String? icon; - final Function()? onTap; - final Function()? onTapUpdate; - final Function(bool)? onChanged; - const SettingWidget( - {super.key, - this.text, - this.icon, - this.value, - this.onTap, - this.isUpdate, - this.onChanged, - this.isNotification = false, - this.onTapUpdate}); - - @override - Widget build(BuildContext context) { - return InkWell( - onTap: onTap, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - children: [ - Expanded( - flex: 2, - child: Container( - padding: EdgeInsets.all(8), - decoration: const BoxDecoration( - color: ColorsManager.primaryColor, - borderRadius: BorderRadius.all(Radius.circular(20))), - child: SvgPicture.asset( - icon!, - fit: BoxFit.none, - height: 30, - ), - ), - ), - const SizedBox( - width: 8, - ), - Expanded( - flex: isUpdate == true ? 5 : 10, - child: BodyMedium( - text: text!, - fontSize: 15, - fontWeight: FontWeight.w400, - )), - ], - ), - ), - isUpdate == true - ? InkWell( - onTap: onTapUpdate, - child: const BodyMedium( - text: '1 Update Available', - fontSize: 13, - fontWeight: FontWeight.w400, - fontColor: ColorsManager.blueColor, - ), - ) - : SizedBox(), - isNotification == false - ? const Icon( - Icons.arrow_forward_ios, - color: ColorsManager.graysColor, - size: 20, - ) - : Transform.scale( - scale: .8, - child: CupertinoSwitch( - value: value!, - onChanged: onChanged, - applyTheme: true, - ), - ), - ], - ), - ); - } -} diff --git a/lib/features/shared_widgets/delete_device_dialogs.dart b/lib/features/shared_widgets/delete_device_dialogs.dart new file mode 100644 index 0000000..67c62e2 --- /dev/null +++ b/lib/features/shared_widgets/delete_device_dialogs.dart @@ -0,0 +1,227 @@ +import 'package:flutter/material.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; +import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; + +class DisconnectDeviceDialog extends StatelessWidget { + final Function()? cancelTab; + final Function()? confirmTab; + + const DisconnectDeviceDialog({ + super.key, + required this.cancelTab, + required this.confirmTab, + }); + + @override + Widget build(BuildContext context) { + return AlertDialog( + contentPadding: EdgeInsets.zero, + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox( + height: 10, + ), + const BodyLarge( + text: 'Disconnect Device', + fontWeight: FontWeight.w700, + fontColor: ColorsManager.red, + fontSize: 16, + ), + const Padding( + padding: EdgeInsets.only(left: 15, right: 15), + child: Divider( + color: ColorsManager.textGray, + ), + ), + const Padding( + padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), + child: Column( + children: [ + Center( + child: Text( + 'This will disconnect your device from this Application')), + ], + ), + ), + Row( + children: [ + Expanded( + child: Container( + decoration: const BoxDecoration( + border: Border( + right: BorderSide( + color: ColorsManager.textGray, + width: 0.5, + ), + top: BorderSide( + color: ColorsManager.textGray, + width: 1.0, + ), + )), + child: SizedBox( + child: InkWell( + onTap: cancelTab, + child: const Padding( + padding: EdgeInsets.all(15), + child: Center( + child: Text( + 'Cancel', + style: TextStyle( + color: ColorsManager.textGray, + fontSize: 14, + fontWeight: FontWeight.w400), + ), + ), + ), + ), + ), + ), + ), + Expanded( + child: Container( + decoration: const BoxDecoration( + border: Border( + left: BorderSide( + color: ColorsManager.textGray, + width: 0.5, + ), + top: BorderSide( + color: ColorsManager.textGray, + width: 1.0, + ), + )), + child: InkWell( + onTap: confirmTab, + child: const Padding( + padding: EdgeInsets.all(15), + child: Center( + child: Text( + 'Disconnect', + style: TextStyle( + color: ColorsManager.red, + fontSize: 14, + fontWeight: FontWeight.w400), + ), + ), + )), + )) + ], + ) + ], + ), + ); + } +} + +class DisconnectWipeData extends StatelessWidget { + final Function()? cancelTab; + final Function()? confirmTab; + + const DisconnectWipeData({ + super.key, + required this.cancelTab, + required this.confirmTab, + }); + + @override + Widget build(BuildContext context) { + return AlertDialog( + contentPadding: EdgeInsets.zero, + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox( + height: 10, + ), + const BodyLarge( + text: 'Disconnect and Wipe Data', + fontWeight: FontWeight.w700, + fontColor: ColorsManager.red, + fontSize: 16, + ), + const Padding( + padding: EdgeInsets.only(left: 15, right: 15), + child: Divider( + color: ColorsManager.textGray, + ), + ), + const Padding( + padding: EdgeInsets.only(left: 15, right: 20, top: 15, bottom: 20), + child: Column( + children: [ + Center( + child: Text( + 'This will disconnect your device from this Application and wipe all the data')), + ], + ), + ), + Row( + children: [ + Expanded( + child: Container( + decoration: const BoxDecoration( + border: Border( + right: BorderSide( + color: ColorsManager.textGray, + width: 0.5, + ), + top: BorderSide( + color: ColorsManager.textGray, + width: 1.0, + ), + )), + child: SizedBox( + child: InkWell( + onTap: cancelTab, + child: const Padding( + padding: EdgeInsets.all(15), + child: Center( + child: Text( + 'Cancel', + style: TextStyle( + color: ColorsManager.textGray, + fontSize: 14, + fontWeight: FontWeight.w400), + ), + ), + ), + ), + ), + ), + ), + Expanded( + child: Container( + decoration: const BoxDecoration( + border: Border( + left: BorderSide( + color: ColorsManager.textGray, + width: 0.5, + ), + top: BorderSide( + color: ColorsManager.textGray, + width: 1.0, + ), + )), + child: InkWell( + onTap: confirmTab, + child: const Padding( + padding: EdgeInsets.all(15), + child: Center( + child: Text( + 'Disconnect', + style: TextStyle( + color: ColorsManager.red, + fontSize: 14, + fontWeight: FontWeight.w400), + ), + ), + )), + )) + ], + ) + ], + ), + ); + } +} diff --git a/lib/features/shared_widgets/setting_widget.dart b/lib/features/shared_widgets/setting_widget.dart new file mode 100644 index 0000000..066ec6f --- /dev/null +++ b/lib/features/shared_widgets/setting_widget.dart @@ -0,0 +1,94 @@ + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart'; +import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; + +class SettingWidget extends StatelessWidget { + final String? text; + final bool? isUpdate; + final bool? value; + final bool? isNotification; + final String? icon; + final Function()? onTap; + final Function()? onTapUpdate; + final Function(bool)? onChanged; + const SettingWidget( + {super.key, + this.text, + this.icon, + this.value, + this.onTap, + this.isUpdate, + this.onChanged, + this.isNotification = false, + this.onTapUpdate}); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Row( + children: [ + Expanded( + flex: 2, + child: Container( + padding: const EdgeInsets.all(8), + decoration: const BoxDecoration( + color: ColorsManager.primaryColor, + borderRadius: BorderRadius.all(Radius.circular(20))), + child: SvgPicture.asset( + icon!, + fit: BoxFit.none, + height: 30, + ), + ), + ), + const SizedBox( + width: 8, + ), + Expanded( + flex: isUpdate == true ? 5 : 10, + child: BodyMedium( + text: text!, + fontSize: 15, + fontWeight: FontWeight.w400, + )), + ], + ), + ), + isUpdate == true + ? InkWell( + onTap: onTapUpdate, + child: const BodyMedium( + text: '1 Update Available', + fontSize: 13, + fontWeight: FontWeight.w400, + fontColor: ColorsManager.blueColor, + ), + ) + : const SizedBox(), + isNotification == false + ? const Icon( + Icons.arrow_forward_ios, + color: ColorsManager.graysColor, + size: 20, + ) + : Transform.scale( + scale: .8, + child: CupertinoSwitch( + value: value!, + onChanged: onChanged, + applyTheme: true, + ), + ), + ], + ), + ); + } +}