From fd06d9b55dabed9549a80d7d9ba59dc91fad41f7 Mon Sep 17 00:00:00 2001 From: Enzo Date: Thu, 30 Nov 2023 09:09:23 +0100 Subject: [PATCH] duplication profil --- .../container/profile/profile_compte.dart | 75 ++++ .../container/profile/profile_entete.dart | 69 ++++ .../container/profile/profile_info_user.dart | 38 ++ .../profile/profile_notification.dart | 117 +++++++ .../container/profile/profile_other.dart | 70 ++++ .../profile/mobile/mobile_profile_view.dart | 331 +----------------- lib/view/profile/web/web_profile_view.dart | 331 +----------------- 7 files changed, 389 insertions(+), 642 deletions(-) create mode 100644 lib/common_widget/container/profile/profile_compte.dart create mode 100644 lib/common_widget/container/profile/profile_entete.dart create mode 100644 lib/common_widget/container/profile/profile_info_user.dart create mode 100644 lib/common_widget/container/profile/profile_notification.dart create mode 100644 lib/common_widget/container/profile/profile_other.dart diff --git a/lib/common_widget/container/profile/profile_compte.dart b/lib/common_widget/container/profile/profile_compte.dart new file mode 100644 index 0000000..6b80f0f --- /dev/null +++ b/lib/common_widget/container/profile/profile_compte.dart @@ -0,0 +1,75 @@ +import 'package:flutter/material.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/common_widget/setting_row.dart'; +import 'package:smartfit_app_mobile/view/profile/change_email.dart'; +import 'package:smartfit_app_mobile/view/profile/change_password.dart'; +import 'package:smartfit_app_mobile/view/profile/change_username.dart'; + +class ProfileCompte extends StatelessWidget { + const ProfileCompte(this.accountArr, {super.key}); + + final List accountArr; + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + decoration: BoxDecoration( + color: TColor.white, + borderRadius: BorderRadius.circular(15), + boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 2)]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Compte", + style: TextStyle( + color: TColor.black, + fontSize: 16, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox( + height: 8, + ), + ListView.builder( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: accountArr.length, + itemBuilder: (context, index) { + var iObj = accountArr[index]; + return SettingRow( + icon: iObj["image"]!, + title: iObj["name"]!, + onPressed: () { + if (iObj["tag"] == "1") { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ChangeUsernameView(), + ), + ); + } else if (iObj["tag"] == "2") { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ChangePasswordView(), + ), + ); + } else { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ChangeEmailView(), + ), + ); + } + }, + ); + }, + ), + ], + ), + ); + } +} diff --git a/lib/common_widget/container/profile/profile_entete.dart b/lib/common_widget/container/profile/profile_entete.dart new file mode 100644 index 0000000..f7d7464 --- /dev/null +++ b/lib/common_widget/container/profile/profile_entete.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/common_widget/button/round_button.dart'; + +class ProfileEntete extends StatelessWidget { + const ProfileEntete(this.username, {super.key}); + + final String username; + + @override + Widget build(BuildContext context) { + return Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(30), + child: Image.asset( + "assets/img/u1.png", + width: 50, + height: 50, + fit: BoxFit.cover, + ), + ), + const SizedBox( + width: 15, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + username, + style: TextStyle( + color: TColor.black, + fontSize: 14, + fontWeight: FontWeight.w500, + ), + ), + Text( + "Course à pied", + style: TextStyle( + color: TColor.gray, + fontSize: 12, + ), + ) + ], + ), + ), + SizedBox( + width: 70, + height: 25, + child: RoundButton( + title: "Editer", + type: RoundButtonType.bgGradient, + fontSize: 12, + fontWeight: FontWeight.w400, + onPressed: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => const ActivityTrackerView(), + // ), + // ); + }, + ), + ) + ], + ); + } +} diff --git a/lib/common_widget/container/profile/profile_info_user.dart b/lib/common_widget/container/profile/profile_info_user.dart new file mode 100644 index 0000000..05f7f9a --- /dev/null +++ b/lib/common_widget/container/profile/profile_info_user.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:smartfit_app_mobile/common_widget/title_subtitle_cell.dart'; + +class ProfileInfoUser extends StatelessWidget { + const ProfileInfoUser({super.key}); + + @override + Widget build(BuildContext context) { + return const Row( + children: [ + Expanded( + child: TitleSubtitleCell( + title: "??? cm", + subtitle: "Taille", + ), + ), + SizedBox( + width: 15, + ), + Expanded( + child: TitleSubtitleCell( + title: "?? kg", + subtitle: "Poids", + ), + ), + SizedBox( + width: 15, + ), + Expanded( + child: TitleSubtitleCell( + title: "?? ans", + subtitle: "Age", + ), + ), + ], + ); + } +} diff --git a/lib/common_widget/container/profile/profile_notification.dart b/lib/common_widget/container/profile/profile_notification.dart new file mode 100644 index 0000000..b38a700 --- /dev/null +++ b/lib/common_widget/container/profile/profile_notification.dart @@ -0,0 +1,117 @@ +import 'package:animated_toggle_switch/animated_toggle_switch.dart'; +import 'package:flutter/material.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; + +class ProfileNotification extends StatefulWidget { + const ProfileNotification(this.positive, {Key? key}) : super(key: key); + + final bool positive; + + @override + State createState() => _ProfileNotification(); +} + +class _ProfileNotification extends State { + @override + Widget build(BuildContext context) { + bool check = widget.positive; + return Container( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + decoration: BoxDecoration( + color: TColor.white, + borderRadius: BorderRadius.circular(15), + boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 2)]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Notification", + style: TextStyle( + color: TColor.black, + fontSize: 16, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox( + height: 8, + ), + SizedBox( + height: 30, + child: + Row(crossAxisAlignment: CrossAxisAlignment.center, children: [ + Image.asset("assets/img/p_notification.png", + height: 15, width: 15, fit: BoxFit.contain), + const SizedBox( + width: 15, + ), + Expanded( + child: Text( + "Push Notifications", + style: TextStyle( + color: TColor.black, + fontSize: 12, + ), + ), + ), + CustomAnimatedToggleSwitch( + current: check, + values: const [false, true], + spacing: 0.0, + indicatorSize: const Size.square(25.0), + animationDuration: const Duration(milliseconds: 200), + animationCurve: Curves.linear, + onChanged: (b) => setState(() => check = b), + iconBuilder: (context, local, global) { + return const SizedBox(); + }, + cursors: const ToggleCursors( + defaultCursor: SystemMouseCursors.click), + onTap: (_) => setState(() => check = !check), + iconsTappable: false, + wrapperBuilder: (context, global, child) { + return Stack( + alignment: Alignment.center, + children: [ + Positioned( + left: 10.0, + right: 10.0, + height: 20.0, + child: DecoratedBox( + decoration: BoxDecoration( + gradient: + LinearGradient(colors: TColor.secondaryG), + borderRadius: + const BorderRadius.all(Radius.circular(50.0)), + ), + )), + child, + ], + ); + }, + foregroundIndicatorBuilder: (context, global) { + return SizedBox.fromSize( + size: const Size(5, 5), + child: DecoratedBox( + decoration: BoxDecoration( + color: TColor.white, + borderRadius: + const BorderRadius.all(Radius.circular(50.0)), + boxShadow: const [ + BoxShadow( + color: Colors.black38, + spreadRadius: 0.05, + blurRadius: 1.1, + offset: Offset(0.0, 0.8)) + ], + ), + ), + ); + }, + ), + ]), + ) + ], + ), + ); + } +} diff --git a/lib/common_widget/container/profile/profile_other.dart b/lib/common_widget/container/profile/profile_other.dart new file mode 100644 index 0000000..621ff22 --- /dev/null +++ b/lib/common_widget/container/profile/profile_other.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/common_widget/setting_row.dart'; +import 'package:smartfit_app_mobile/view/profile/contact_us_view.dart'; +import 'package:smartfit_app_mobile/view/profile/policy_view.dart'; + +class ProfileOther extends StatelessWidget { + const ProfileOther(this.otherArr, {super.key}); + + final List otherArr; + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15), + decoration: BoxDecoration( + color: TColor.white, + borderRadius: BorderRadius.circular(15), + boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 2)]), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Autre", + style: TextStyle( + color: TColor.black, + fontSize: 16, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox( + height: 8, + ), + ListView.builder( + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + shrinkWrap: true, + itemCount: otherArr.length, + itemBuilder: (context, index) { + var iObj = otherArr[index] as Map? ?? {}; + return SettingRow( + icon: iObj["image"].toString(), + title: iObj["name"].toString(), + onPressed: () { + if (iObj["tag"] == "6") { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const PrivacyPolicyView(), + ), + ); + } else if (iObj["tag"] == "5") { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const ContactUsView(), + ), + ); + } else { + // Autre logique si nécessaire pour d'autres éléments de la liste + } + }, + ); + }, + ) + ], + ), + ); + } +} diff --git a/lib/view/profile/mobile/mobile_profile_view.dart b/lib/view/profile/mobile/mobile_profile_view.dart index 97dbbf9..9af8768 100644 --- a/lib/view/profile/mobile/mobile_profile_view.dart +++ b/lib/view/profile/mobile/mobile_profile_view.dart @@ -1,16 +1,12 @@ +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_compte.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_entete.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_info_user.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_notification.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_other.dart'; import 'package:smartfit_app_mobile/modele/user.dart'; import 'package:flutter/material.dart'; -import 'package:animated_toggle_switch/animated_toggle_switch.dart'; import 'package:provider/provider.dart'; import 'package:smartfit_app_mobile/common/colo_extension.dart'; -import 'package:smartfit_app_mobile/common_widget/button/round_button.dart'; -import 'package:smartfit_app_mobile/common_widget/setting_row.dart'; -import 'package:smartfit_app_mobile/common_widget/title_subtitle_cell.dart'; -import 'package:smartfit_app_mobile/view/profile/change_password.dart'; -import 'package:smartfit_app_mobile/view/profile/change_email.dart'; -import 'package:smartfit_app_mobile/view/profile/change_username.dart'; -import 'package:smartfit_app_mobile/view/profile/contact_us_view.dart'; -import 'package:smartfit_app_mobile/view/profile/policy_view.dart'; class MobileProfileView extends StatefulWidget { const MobileProfileView({super.key}); @@ -91,330 +87,23 @@ class _MobileProfileView extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(30), - child: Image.asset( - "assets/img/u1.png", - width: 50, - height: 50, - fit: BoxFit.cover, - ), - ), - const SizedBox( - width: 15, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - username, - style: TextStyle( - color: TColor.black, - fontSize: 14, - fontWeight: FontWeight.w500, - ), - ), - Text( - "Course à pied", - style: TextStyle( - color: TColor.gray, - fontSize: 12, - ), - ) - ], - ), - ), - SizedBox( - width: 70, - height: 25, - child: RoundButton( - title: "Editer", - type: RoundButtonType.bgGradient, - fontSize: 12, - fontWeight: FontWeight.w400, - onPressed: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => const ActivityTrackerView(), - // ), - // ); - }, - ), - ) - ], - ), + ProfileEntete(username), const SizedBox( height: 15, ), - const Row( - children: [ - Expanded( - child: TitleSubtitleCell( - title: "??? cm", - subtitle: "Taille", - ), - ), - SizedBox( - width: 15, - ), - Expanded( - child: TitleSubtitleCell( - title: "?? kg", - subtitle: "Poids", - ), - ), - SizedBox( - width: 15, - ), - Expanded( - child: TitleSubtitleCell( - title: "?? ans", - subtitle: "Age", - ), - ), - ], - ), + const ProfileInfoUser(), const SizedBox( height: 25, ), - Container( - padding: - const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - decoration: BoxDecoration( - color: TColor.white, - borderRadius: BorderRadius.circular(15), - boxShadow: const [ - BoxShadow(color: Colors.black12, blurRadius: 2) - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Compte", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox( - height: 8, - ), - ListView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: accountArr.length, - itemBuilder: (context, index) { - var iObj = accountArr[index]; - return SettingRow( - icon: iObj["image"]!, - title: iObj["name"]!, - onPressed: () { - if (iObj["tag"] == "1") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const ChangeUsernameView(), - ), - ); - } else if (iObj["tag"] == "2") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const ChangePasswordView(), - ), - ); - } else { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ChangeEmailView(), - ), - ); - } - }, - ); - }, - ), - ], - ), - ), + ProfileCompte(accountArr), const SizedBox( height: 25, ), - Container( - padding: - const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - decoration: BoxDecoration( - color: TColor.white, - borderRadius: BorderRadius.circular(15), - boxShadow: const [ - BoxShadow(color: Colors.black12, blurRadius: 2) - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Notification", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox( - height: 8, - ), - SizedBox( - height: 30, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset("assets/img/p_notification.png", - height: 15, width: 15, fit: BoxFit.contain), - const SizedBox( - width: 15, - ), - Expanded( - child: Text( - "Push Notifications", - style: TextStyle( - color: TColor.black, - fontSize: 12, - ), - ), - ), - CustomAnimatedToggleSwitch( - current: positive, - values: const [false, true], - spacing: 0.0, - indicatorSize: const Size.square(25.0), - animationDuration: - const Duration(milliseconds: 200), - animationCurve: Curves.linear, - onChanged: (b) => setState(() => positive = b), - iconBuilder: (context, local, global) { - return const SizedBox(); - }, - cursors: const ToggleCursors( - defaultCursor: SystemMouseCursors.click), - onTap: (_) => - setState(() => positive = !positive), - iconsTappable: false, - wrapperBuilder: (context, global, child) { - return Stack( - alignment: Alignment.center, - children: [ - Positioned( - left: 10.0, - right: 10.0, - height: 20.0, - child: DecoratedBox( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: TColor.secondaryG), - borderRadius: - const BorderRadius.all( - Radius.circular(50.0)), - ), - )), - child, - ], - ); - }, - foregroundIndicatorBuilder: (context, global) { - return SizedBox.fromSize( - size: const Size(5, 5), - child: DecoratedBox( - decoration: BoxDecoration( - color: TColor.white, - borderRadius: const BorderRadius.all( - Radius.circular(50.0)), - boxShadow: const [ - BoxShadow( - color: Colors.black38, - spreadRadius: 0.05, - blurRadius: 1.1, - offset: Offset(0.0, 0.8)) - ], - ), - ), - ); - }, - ), - ]), - ) - ], - ), - ), + ProfileNotification(positive), const SizedBox( height: 25, ), - Container( - padding: - const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - decoration: BoxDecoration( - color: TColor.white, - borderRadius: BorderRadius.circular(15), - boxShadow: const [ - BoxShadow(color: Colors.black12, blurRadius: 2) - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Autre", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox( - height: 8, - ), - ListView.builder( - physics: const NeverScrollableScrollPhysics(), - padding: EdgeInsets.zero, - shrinkWrap: true, - itemCount: otherArr.length, - itemBuilder: (context, index) { - var iObj = otherArr[index] as Map? ?? {}; - return SettingRow( - icon: iObj["image"].toString(), - title: iObj["name"].toString(), - onPressed: () { - if (iObj["tag"] == "6") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const PrivacyPolicyView(), - ), - ); - } else if (iObj["tag"] == "5") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ContactUsView(), - ), - ); - } else { - // Autre logique si nécessaire pour d'autres éléments de la liste - } - }, - ); - }, - ) - ], - ), - ) + ProfileOther(otherArr) ], ), ), diff --git a/lib/view/profile/web/web_profile_view.dart b/lib/view/profile/web/web_profile_view.dart index 9b11d17..c3a239c 100644 --- a/lib/view/profile/web/web_profile_view.dart +++ b/lib/view/profile/web/web_profile_view.dart @@ -1,16 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:animated_toggle_switch/animated_toggle_switch.dart'; import 'package:provider/provider.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_compte.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_entete.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_info_user.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_notification.dart'; +import 'package:smartfit_app_mobile/common_widget/container/profile/profile_other.dart'; import 'package:smartfit_app_mobile/modele/user.dart'; import 'package:smartfit_app_mobile/common/colo_extension.dart'; -import 'package:smartfit_app_mobile/common_widget/button/round_button.dart'; -import 'package:smartfit_app_mobile/common_widget/setting_row.dart'; -import 'package:smartfit_app_mobile/common_widget/title_subtitle_cell.dart'; -import 'package:smartfit_app_mobile/view/profile/change_password.dart'; -import 'package:smartfit_app_mobile/view/profile/change_email.dart'; -import 'package:smartfit_app_mobile/view/profile/change_username.dart'; -import 'package:smartfit_app_mobile/view/profile/contact_us_view.dart'; -import 'package:smartfit_app_mobile/view/profile/policy_view.dart'; class WebProfileView extends StatefulWidget { const WebProfileView({super.key}); @@ -91,330 +87,23 @@ class _WebProfileView extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(30), - child: Image.asset( - "assets/img/u1.png", - width: 50, - height: 50, - fit: BoxFit.cover, - ), - ), - const SizedBox( - width: 15, - ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - username, - style: TextStyle( - color: TColor.black, - fontSize: 14, - fontWeight: FontWeight.w500, - ), - ), - Text( - "Course à pied", - style: TextStyle( - color: TColor.gray, - fontSize: 12, - ), - ) - ], - ), - ), - SizedBox( - width: 70, - height: 25, - child: RoundButton( - title: "Editer", - type: RoundButtonType.bgGradient, - fontSize: 12, - fontWeight: FontWeight.w400, - onPressed: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => const ActivityTrackerView(), - // ), - // ); - }, - ), - ) - ], - ), + ProfileEntete(username), const SizedBox( height: 15, ), - const Row( - children: [ - Expanded( - child: TitleSubtitleCell( - title: "??? cm", - subtitle: "Taille", - ), - ), - SizedBox( - width: 15, - ), - Expanded( - child: TitleSubtitleCell( - title: "?? kg", - subtitle: "Poids", - ), - ), - SizedBox( - width: 15, - ), - Expanded( - child: TitleSubtitleCell( - title: "?? ans", - subtitle: "Age", - ), - ), - ], - ), + const ProfileInfoUser(), const SizedBox( height: 25, ), - Container( - padding: - const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - decoration: BoxDecoration( - color: TColor.white, - borderRadius: BorderRadius.circular(15), - boxShadow: const [ - BoxShadow(color: Colors.black12, blurRadius: 2) - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Compte", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox( - height: 8, - ), - ListView.builder( - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: accountArr.length, - itemBuilder: (context, index) { - var iObj = accountArr[index]; - return SettingRow( - icon: iObj["image"]!, - title: iObj["name"]!, - onPressed: () { - if (iObj["tag"] == "1") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const ChangeUsernameView(), - ), - ); - } else if (iObj["tag"] == "2") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const ChangePasswordView(), - ), - ); - } else { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ChangeEmailView(), - ), - ); - } - }, - ); - }, - ), - ], - ), - ), + ProfileCompte(accountArr), const SizedBox( height: 25, ), - Container( - padding: - const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - decoration: BoxDecoration( - color: TColor.white, - borderRadius: BorderRadius.circular(15), - boxShadow: const [ - BoxShadow(color: Colors.black12, blurRadius: 2) - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Notification", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox( - height: 8, - ), - SizedBox( - height: 30, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset("assets/img/p_notification.png", - height: 15, width: 15, fit: BoxFit.contain), - const SizedBox( - width: 15, - ), - Expanded( - child: Text( - "Push Notifications", - style: TextStyle( - color: TColor.black, - fontSize: 12, - ), - ), - ), - CustomAnimatedToggleSwitch( - current: positive, - values: const [false, true], - spacing: 0.0, - indicatorSize: const Size.square(25.0), - animationDuration: - const Duration(milliseconds: 200), - animationCurve: Curves.linear, - onChanged: (b) => setState(() => positive = b), - iconBuilder: (context, local, global) { - return const SizedBox(); - }, - cursors: const ToggleCursors( - defaultCursor: SystemMouseCursors.click), - onTap: (_) => - setState(() => positive = !positive), - iconsTappable: false, - wrapperBuilder: (context, global, child) { - return Stack( - alignment: Alignment.center, - children: [ - Positioned( - left: 10.0, - right: 10.0, - height: 20.0, - child: DecoratedBox( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: TColor.secondaryG), - borderRadius: - const BorderRadius.all( - Radius.circular(50.0)), - ), - )), - child, - ], - ); - }, - foregroundIndicatorBuilder: (context, global) { - return SizedBox.fromSize( - size: const Size(5, 5), - child: DecoratedBox( - decoration: BoxDecoration( - color: TColor.white, - borderRadius: const BorderRadius.all( - Radius.circular(50.0)), - boxShadow: const [ - BoxShadow( - color: Colors.black38, - spreadRadius: 0.05, - blurRadius: 1.1, - offset: Offset(0.0, 0.8)) - ], - ), - ), - ); - }, - ), - ]), - ) - ], - ), - ), + ProfileNotification(positive), const SizedBox( height: 25, ), - Container( - padding: - const EdgeInsets.symmetric(vertical: 10, horizontal: 15), - decoration: BoxDecoration( - color: TColor.white, - borderRadius: BorderRadius.circular(15), - boxShadow: const [ - BoxShadow(color: Colors.black12, blurRadius: 2) - ]), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Autre", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox( - height: 8, - ), - ListView.builder( - physics: const NeverScrollableScrollPhysics(), - padding: EdgeInsets.zero, - shrinkWrap: true, - itemCount: otherArr.length, - itemBuilder: (context, index) { - var iObj = otherArr[index] as Map? ?? {}; - return SettingRow( - icon: iObj["image"].toString(), - title: iObj["name"].toString(), - onPressed: () { - if (iObj["tag"] == "6") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const PrivacyPolicyView(), - ), - ); - } else if (iObj["tag"] == "5") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const ContactUsView(), - ), - ); - } else { - // Autre logique si nécessaire pour d'autres éléments de la liste - } - }, - ); - }, - ) - ], - ), - ) + ProfileOther(otherArr) ], ), ),