diff --git a/assets/icons/four_scene_icon.svg b/assets/icons/four_scene_icon.svg new file mode 100644 index 0000000..414d952 --- /dev/null +++ b/assets/icons/four_scene_icon.svg @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/features/devices/bloc/6_scene_switch_bloc/6_scene_bloc.dart b/lib/features/devices/bloc/6_scene_switch_bloc/6_scene_bloc.dart index 1a9a224..9d4c3f4 100644 --- a/lib/features/devices/bloc/6_scene_switch_bloc/6_scene_bloc.dart +++ b/lib/features/devices/bloc/6_scene_switch_bloc/6_scene_bloc.dart @@ -268,7 +268,6 @@ class SixSceneBloc extends Bloc { void _onSearchFaq(SearchFaqEvent event, Emitter emit) { emit(SixSceneLoadingState()); - // Filter FAQ questions based on search query List _faqQuestions = faqQuestions.where((question) { return question.question .toLowerCase() 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 454036e..f500bed 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 @@ -8,7 +8,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_create_group.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'; @@ -34,7 +33,7 @@ class FourSceneSettings extends StatelessWidget { child: BlocProvider( create: (context) => FourSceneBloc(fourSceneId: device?.uuid ?? '') ..add(const FourSceneInitial()) - ..add(FourSceneInitialInfo()), + ..add(const FourSceneInitialInfo()), child: BlocBuilder( builder: (context, state) { final _bloc = BlocProvider.of(context); @@ -57,405 +56,392 @@ class FourSceneSettings extends StatelessWidget { height: 50, child: CircularProgressIndicator()), ) - : RefreshIndicator( - onRefresh: () async { - _bloc.add(const FourSceneInitial()); - }, - child: ListView( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - vertical: 10, - ), - child: InkWell( - onTap: () async { - bool val = await Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => FourSceneProfilePage( - device: device, - ), + : ListView( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 10, + ), + child: InkWell( + onTap: () async { + bool val = await Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => FourSceneProfilePage( + device: device, ), - ); - if (val == true) { - _bloc.add(FourSceneInitialInfo()); - } - }, - child: Stack( - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - const SizedBox(height: 20), - DefaultContainer( - borderRadius: const BorderRadius.all( - Radius.circular(30)), + ), + ); + if (val == true) { + _bloc.add(FourSceneInitialInfo()); + } + }, + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox(height: 20), + DefaultContainer( + borderRadius: const BorderRadius.all( + Radius.circular(30)), + child: Padding( + padding: const EdgeInsets.all(10.0), child: Padding( - padding: const EdgeInsets.all(10.0), - child: Padding( - padding: - const EdgeInsets.only(left: 90), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - BodyMedium( - text: _bloc.deviceInfo.name, - fontWeight: FontWeight.bold, - ), - const SizedBox( - height: 5, - ), - BodySmall( - text: _bloc - .deviceInfo - .subspace - .subspaceName), - ], - ), - const Icon(Icons.edit_sharp) - ], - ), + padding: + const EdgeInsets.only(left: 90), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + BodyMedium( + text: _bloc.deviceInfo.name, + fontWeight: FontWeight.bold, + ), + const SizedBox( + height: 5, + ), + BodySmall( + text: _bloc.deviceInfo + .subspace.subspaceName), + ], + ), + const Icon(Icons.edit_sharp) + ], ), ), ), - ], - ), - Positioned( - top: 0, - left: 20, - child: CircleAvatar( - radius: 43, + ), + ], + ), + Positioned( + top: 0, + left: 20, + child: CircleAvatar( + radius: 43, + backgroundColor: Colors.white, + child: CircleAvatar( + radius: 40, backgroundColor: Colors.white, child: CircleAvatar( radius: 40, - backgroundColor: Colors.white, - child: CircleAvatar( - radius: 40, - backgroundColor: - ColorsManager.backgroundColor, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.only( - top: 8), - child: SizedBox( - height: 70, - child: SvgPicture.asset( - Assets.fourSceneIcon, - fit: BoxFit.contain, - ), + backgroundColor: + ColorsManager.backgroundColor, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Padding( + padding: + const EdgeInsets.only(top: 8), + child: SizedBox( + height: 70, + child: SvgPicture.asset( + Assets.fourSceneIcon, + fit: BoxFit.contain, ), ), - ], - ), - ), - )), - ), - ], - ), - ), - ), - const SizedBox(height: 20), - const BodyMedium( - text: 'Device Management', - fontWeight: FontWeight.w700, - fontSize: 12, - fontColor: ColorsManager.grayColor, - ), - DefaultContainer( - child: Column( - children: [ - SettingWidget( - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => FourSceneInfoPage( - device: device!, - )), - ); - }, - text: 'Device Information', - icon: Assets.infoIcon, - ), - const Divider( - color: ColorsManager.dividerColor, - ), - SettingWidget( - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => - ShareFourScenePage( - device: device!)), - ); - }, - text: 'Tap-to Run and Automation', - icon: Assets.tapRunIcon, - ), - ], - ), - ), - const SizedBox(height: 20), - const BodyMedium( - text: 'Device Offline Notification', - fontWeight: FontWeight.w700, - fontSize: 12, - fontColor: ColorsManager.grayColor, - ), - DefaultContainer( - child: Column( - children: [ - SettingWidget( - onChanged: (p0) {}, - isNotification: true, - onTap: () {}, - text: 'Offline Notification', - icon: Assets.notificationIcon, - ), - ], - ), - ), - const SizedBox(height: 20), - const BodyMedium( - text: 'Others', - fontWeight: FontWeight.w700, - fontSize: 12, - fontColor: ColorsManager.grayColor, - ), - const SizedBox(height: 5), - DefaultContainer( - child: Column( - children: [ - SettingWidget( - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => - ShareFourScenePage( - device: device!)), - ); - }, - text: 'Share Device', - icon: Assets.shareIcon, - ), - const Divider( - color: ColorsManager.dividerColor, - ), - SettingWidget( - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => - FourSceneCreateGroup( - device: device!)), - ); - }, - text: 'Create Group', - icon: Assets.createGroupIcon, - ), - const Divider( - color: ColorsManager.dividerColor, - ), - SettingWidget( - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => - FaqFourScenePage(device: device!)), - ); - }, - text: 'Device FAQ', - icon: Assets.faqIcon, - ), - const Divider( - color: ColorsManager.dividerColor, - ), - SettingWidget( - onTapUpdate: () { - showDialog( - context: context, - builder: (context) { - return UpdateInfoDialog( - cancelTab: () { - Navigator.of(context).pop(); - }, - confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); - Navigator.of(context).pop(); - }, - ); - }, - ); - }, - isUpdate: true, - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => - const FourSceneUpdatePage()), - ); - }, - text: 'Device Update', - icon: Assets.updateIcon, - ), - ], - ), - ), - const SizedBox(height: 20), - InkWell( - onTap: () { - showModalBottomSheet( - context: context, - builder: (BuildContext context) { - return Container( - height: 200, - padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - const BodyMedium( - text: 'Remove Device', - fontWeight: FontWeight.w700, - fontSize: 16, - fontColor: ColorsManager.red, - ), - const SizedBox(height: 10), - const SizedBox( - width: 250, - child: Divider( - color: ColorsManager.dividerColor, + ), + ], ), ), - const SizedBox(height: 10), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - InkWell( - onTap: () { - showDialog( - context: context, - builder: (context) { - return DisconnectDeviceDialog( - cancelTab: () { - Navigator.of(context) - .pop(); - }, - confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); - Navigator.of(context) - .pop(); - }, - ); - }, - ); - }, - child: const BodyMedium( - text: 'Disconnect Device', - fontWeight: FontWeight.w400, - fontSize: 15, - fontColor: ColorsManager - .textPrimaryColor, - ), - ), - const Icon( - Icons.keyboard_arrow_right, - color: ColorsManager.textGray, - ) - ], - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - InkWell( - onTap: () { - showDialog( - context: context, - builder: (context) { - return DisconnectWipeData( - cancelTab: () { - Navigator.of(context) - .pop(); - }, - confirmTab: () { - // context - // .read< - // CreateSceneBloc>() - // .add(DeleteSceneEvent( - // sceneId: sceneId, - // unitUuid: HomeCubit - // .getInstance() - // .selectedSpace! - // .id!, - // )); - Navigator.of(context) - .pop(); - }, - ); - }, - ); - }, - child: const BodyMedium( - text: - 'Disconnect Device and Wipe Data', - fontWeight: FontWeight.w400, - fontSize: 15, - fontColor: ColorsManager - .textPrimaryColor, - ), - ), - const Icon( - Icons.keyboard_arrow_right, - color: ColorsManager.textGray, - ) - ], - ), - ], - ), + )), + ), + ], + ), + ), + ), + const SizedBox(height: 20), + const BodyMedium( + text: 'Device Management', + fontWeight: FontWeight.w700, + fontSize: 12, + fontColor: ColorsManager.grayColor, + ), + DefaultContainer( + child: Column( + children: [ + SettingWidget( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => FourSceneInfoPage( + device: device!, + )), ); }, - ); - }, - child: const Center( - child: BodyMedium( - text: 'Remove Device', - fontWeight: FontWeight.w400, - fontSize: 15, - fontColor: ColorsManager.red, + text: 'Device Information', + icon: Assets.infoIcon, ), + // const Divider( + // color: ColorsManager.dividerColor, + // ), + // SettingWidget( + // onTap: () { + // Navigator.of(context).push( + // MaterialPageRoute( + // builder: (context) => + // ShareFourScenePage( + // device: device!)), + // ); + // }, + // text: 'Tap-to Run and Automation', + // icon: Assets.tapRunIcon, + // ), + ], + ), + ), + const SizedBox(height: 20), + const BodyMedium( + text: 'Device Offline Notification', + fontWeight: FontWeight.w700, + fontSize: 12, + fontColor: ColorsManager.grayColor, + ), + DefaultContainer( + child: Column( + children: [ + SettingWidget( + onChanged: (p0) {}, + isNotification: true, + onTap: () {}, + text: 'Offline Notification', + icon: Assets.notificationIcon, + ), + ], + ), + ), + const SizedBox(height: 20), + const BodyMedium( + text: 'Others', + fontWeight: FontWeight.w700, + fontSize: 12, + fontColor: ColorsManager.grayColor, + ), + const SizedBox(height: 5), + DefaultContainer( + child: Column( + children: [ + SettingWidget( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => + ShareFourScenePage(device: device!)), + ); + }, + text: 'Share Device', + icon: Assets.shareIcon, + ), + // const Divider( + // color: ColorsManager.dividerColor, + // ), + // SettingWidget( + // onTap: () { + // Navigator.of(context).push( + // MaterialPageRoute( + // builder: (context) => + // FourSceneCreateGroup( + // device: device!)), + // ); + // }, + // text: 'Create Group', + // icon: Assets.createGroupIcon, + // ), + const Divider( + color: ColorsManager.dividerColor, + ), + SettingWidget( + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => + FaqFourScenePage(device: device!)), + ); + }, + text: 'Device FAQ', + icon: Assets.faqIcon, + ), + const Divider( + color: ColorsManager.dividerColor, + ), + SettingWidget( + onTapUpdate: () { + showDialog( + context: context, + builder: (context) { + return UpdateInfoDialog( + cancelTab: () { + Navigator.of(context).pop(); + }, + confirmTab: () { + // context + // .read< + // CreateSceneBloc>() + // .add(DeleteSceneEvent( + // sceneId: sceneId, + // unitUuid: HomeCubit + // .getInstance() + // .selectedSpace! + // .id!, + // )); + Navigator.of(context).pop(); + }, + ); + }, + ); + }, + isUpdate: true, + onTap: () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => + const FourSceneUpdatePage()), + ); + }, + text: 'Device Update', + icon: Assets.updateIcon, + ), + ], + ), + ), + const SizedBox(height: 20), + InkWell( + onTap: () { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return Container( + height: 200, + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const BodyMedium( + text: 'Remove Device', + fontWeight: FontWeight.w700, + fontSize: 16, + fontColor: ColorsManager.red, + ), + const SizedBox(height: 10), + const SizedBox( + width: 250, + child: Divider( + color: ColorsManager.dividerColor, + ), + ), + const SizedBox(height: 10), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + showDialog( + context: context, + builder: (context) { + return DisconnectDeviceDialog( + cancelTab: () { + Navigator.of(context).pop(); + }, + confirmTab: () { + // context + // .read< + // CreateSceneBloc>() + // .add(DeleteSceneEvent( + // sceneId: sceneId, + // unitUuid: HomeCubit + // .getInstance() + // .selectedSpace! + // .id!, + // )); + Navigator.of(context).pop(); + }, + ); + }, + ); + }, + child: const BodyMedium( + text: 'Disconnect Device', + fontWeight: FontWeight.w400, + fontSize: 15, + fontColor: + ColorsManager.textPrimaryColor, + ), + ), + const Icon( + Icons.keyboard_arrow_right, + color: ColorsManager.textGray, + ) + ], + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + showDialog( + context: context, + builder: (context) { + return DisconnectWipeData( + cancelTab: () { + Navigator.of(context).pop(); + }, + confirmTab: () { + // context + // .read< + // CreateSceneBloc>() + // .add(DeleteSceneEvent( + // sceneId: sceneId, + // unitUuid: HomeCubit + // .getInstance() + // .selectedSpace! + // .id!, + // )); + Navigator.of(context).pop(); + }, + ); + }, + ); + }, + child: const BodyMedium( + text: + 'Disconnect Device and Wipe Data', + fontWeight: FontWeight.w400, + fontSize: 15, + fontColor: + ColorsManager.textPrimaryColor, + ), + ), + const Icon( + Icons.keyboard_arrow_right, + color: ColorsManager.textGray, + ) + ], + ), + ], + ), + ); + }, + ); + }, + child: const Center( + child: BodyMedium( + text: 'Remove Device', + fontWeight: FontWeight.w400, + fontSize: 15, + fontColor: ColorsManager.red, ), ), - ], - ), + ), + ], ); }, ), @@ -495,7 +481,7 @@ class SettingWidget extends StatelessWidget { Expanded( flex: 2, child: Container( - padding: EdgeInsets.all(8), + padding: const EdgeInsets.all(8), decoration: const BoxDecoration( color: ColorsManager.primaryColor, borderRadius: BorderRadius.all(Radius.circular(20))), @@ -522,7 +508,7 @@ class SettingWidget extends StatelessWidget { isUpdate == true ? InkWell( onTap: onTapUpdate, - child: BodyMedium( + child: const BodyMedium( text: '1 Update Available', fontSize: 13, fontWeight: FontWeight.w400,