From 6920d9129e4ccc735f74e823b7557f6118cdb758 Mon Sep 17 00:00:00 2001 From: mohammad Date: Thu, 14 Nov 2024 10:14:28 +0300 Subject: [PATCH] sos --- assets/icons/edit_name_sos_icon.svg | 4 ++ .../sos/sos_setting/sos_profile_page.dart | 18 +++--- .../view/widgets/sos/sos_settings.dart | 58 +++++++++++++------ lib/generated/assets.dart | 1 + 4 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 assets/icons/edit_name_sos_icon.svg diff --git a/assets/icons/edit_name_sos_icon.svg b/assets/icons/edit_name_sos_icon.svg new file mode 100644 index 0000000..c9e6a9e --- /dev/null +++ b/assets/icons/edit_name_sos_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/lib/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart b/lib/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart index a9c9cba..57bdfe4 100644 --- a/lib/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart +++ b/lib/features/devices/view/widgets/sos/sos_setting/sos_profile_page.dart @@ -80,7 +80,7 @@ class SosProfilePage extends StatelessWidget { child: TextFormField( maxLength: 30, style: const TextStyle( - color: Colors.black, + color: ColorsManager.textPrimaryColor, ), textAlign: TextAlign.center, focusNode: sensor.focusNode, @@ -99,17 +99,21 @@ class SosProfilePage extends StatelessWidget { ), ), const SizedBox(width: 5), + //editNameSosIcon InkWell( onTap: () { sensor .add(const ChangeNameEvent(value: true)); }, - child: const Padding( - padding: EdgeInsets.symmetric(horizontal: 10), - child: Icon( - Icons.edit_outlined, - size: 20, - color: ColorsManager.textPrimaryColor, + child: Padding( + padding: + const EdgeInsets.symmetric(horizontal: 5), + child: SvgPicture.asset( + height: 18, + width: 18, + Assets.editNameSosIcon, + fit: BoxFit.contain, + color: ColorsManager.grayButtonColors, ), ), ), diff --git a/lib/features/devices/view/widgets/sos/sos_settings.dart b/lib/features/devices/view/widgets/sos/sos_settings.dart index b7b834d..be27f9f 100644 --- a/lib/features/devices/view/widgets/sos/sos_settings.dart +++ b/lib/features/devices/view/widgets/sos/sos_settings.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -100,7 +101,10 @@ class SosSettings extends StatelessWidget { text: "Room: Syncrow"), ], ), - Icon(Icons.edit_sharp) + Icon( + Icons.edit_outlined, + color: ColorsManager.grayColor, + ), ], ), ), @@ -157,10 +161,16 @@ class SosSettings extends StatelessWidget { fontColor: ColorsManager.grayColor, ), DefaultContainer( - child: SettingWidget( - onTap: () {}, - text: 'Offline Notification', - icon: Assets.notificationIcon, + child: Column( + children: [ + SettingWidget( + onChanged: (p0) {}, + isNotification: true, + onTap: () {}, + text: 'Offline Notification', + icon: Assets.notificationIcon, + ), + ], ), ), const SizedBox(height: 20), @@ -390,15 +400,19 @@ class SosSettings extends StatelessWidget { class SettingWidget extends StatelessWidget { final String? text; final bool? isUpdate; + 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.isUpdate, + this.onChanged, + this.isNotification = false, this.onTapUpdate}); @override @@ -412,23 +426,24 @@ class SettingWidget extends StatelessWidget { child: Row( children: [ Expanded( + flex: 2, child: Container( - padding: EdgeInsets.all(10), + padding: EdgeInsets.all(8), decoration: const BoxDecoration( color: ColorsManager.primaryColor, - borderRadius: BorderRadius.all(Radius.circular(50))), + borderRadius: BorderRadius.all(Radius.circular(20))), child: SvgPicture.asset( icon!, - fit: BoxFit.fill, - height: 25, + fit: BoxFit.none, + height: 30, ), ), ), const SizedBox( - width: 10, + width: 8, ), Expanded( - flex: isUpdate == true ? 3 : 6, + flex: isUpdate == true ? 5 : 10, child: BodyMedium( text: text!, fontSize: 15, @@ -447,12 +462,21 @@ class SettingWidget extends StatelessWidget { fontColor: ColorsManager.blueColor, ), ) - : const SizedBox(), - const Icon( - Icons.arrow_forward_ios, - color: ColorsManager.graysColor, - size: 20, - ) + : SizedBox(), + isNotification == false + ? const Icon( + Icons.arrow_forward_ios, + color: ColorsManager.graysColor, + size: 20, + ) + : Transform.scale( + scale: .8, + child: CupertinoSwitch( + value: true, + onChanged: onChanged, + applyTheme: true, + ), + ), ], ), ); diff --git a/lib/generated/assets.dart b/lib/generated/assets.dart index 490d9a7..2d0d47e 100644 --- a/lib/generated/assets.dart +++ b/lib/generated/assets.dart @@ -1107,6 +1107,7 @@ class Assets { static const String emptyUpdateIcon = "assets/icons/empty_update_icon.svg"; static const String checkUpdateIcon = "assets/icons/check_update_icon.svg"; static const String sosDevice = "assets/icons/sos_device.svg"; + static const String editNameSosIcon = "assets/icons/edit_name_sos_icon.svg"; }