From 9ac826500830e48633316c90d4eb2a821726feb4 Mon Sep 17 00:00:00 2001 From: Enzo Date: Thu, 30 Nov 2023 10:11:55 +0100 Subject: [PATCH] duplication profil --- .../profile_view_allplatforme.dart | 89 +++++++++++++++++++ .../profile/mobile/mobile_profile_view.dart | 73 +-------------- lib/view/profile/web/web_profile_view.dart | 85 +++--------------- 3 files changed, 101 insertions(+), 146 deletions(-) create mode 100644 lib/view/profile/all_platforme/profile_view_allplatforme.dart diff --git a/lib/view/profile/all_platforme/profile_view_allplatforme.dart b/lib/view/profile/all_platforme/profile_view_allplatforme.dart new file mode 100644 index 0000000..0aab244 --- /dev/null +++ b/lib/view/profile/all_platforme/profile_view_allplatforme.dart @@ -0,0 +1,89 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:smartfit_app_mobile/common/colo_extension.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'; + +class ProfileViewAllPlatforme extends StatefulWidget { + const ProfileViewAllPlatforme(this.positive, this.accountArr, this.otherArr, + {super.key}); + final bool positive; + final List accountArr; + final List otherArr; + + @override + State createState() => _ProfileViewAllPlatforme(); +} + +class _ProfileViewAllPlatforme extends State { + @override + Widget build(BuildContext context) { + String username = context.watch().username; + + return Scaffold( + appBar: AppBar( + backgroundColor: TColor.white, + centerTitle: true, + elevation: 0, + leadingWidth: 0, + title: Text( + "Profile", + style: TextStyle( + color: TColor.black, fontSize: 16, fontWeight: FontWeight.w700), + ), + actions: [ + InkWell( + onTap: () {}, + child: Container( + margin: const EdgeInsets.all(8), + height: 20, + width: 20, + alignment: Alignment.center, + decoration: BoxDecoration( + color: TColor.lightGray, + borderRadius: BorderRadius.circular(10)), + child: Image.asset( + "assets/img/more_btn.png", + width: 15, + height: 15, + fit: BoxFit.contain, + ), + ), + ) + ], + ), + backgroundColor: TColor.white, + body: SingleChildScrollView( + child: Container( + padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 25), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ProfileEntete(username), + const SizedBox( + height: 15, + ), + const ProfileInfoUser(), + const SizedBox( + height: 25, + ), + ProfileCompte(widget.accountArr), + const SizedBox( + height: 25, + ), + ProfileNotification(widget.positive), + const SizedBox( + height: 25, + ), + ProfileOther(widget.otherArr) + ], + ), + ), + ), + ); + } +} diff --git a/lib/view/profile/mobile/mobile_profile_view.dart b/lib/view/profile/mobile/mobile_profile_view.dart index 9af8768..430eab2 100644 --- a/lib/view/profile/mobile/mobile_profile_view.dart +++ b/lib/view/profile/mobile/mobile_profile_view.dart @@ -1,12 +1,5 @@ -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:provider/provider.dart'; -import 'package:smartfit_app_mobile/common/colo_extension.dart'; +import 'package:smartfit_app_mobile/view/profile/all_platforme/profile_view_allplatforme.dart'; class MobileProfileView extends StatefulWidget { const MobileProfileView({super.key}); @@ -46,68 +39,6 @@ class _MobileProfileView extends State { ]; @override Widget build(BuildContext context) { - String username = context.watch().username; - - return Scaffold( - appBar: AppBar( - backgroundColor: TColor.white, - centerTitle: true, - elevation: 0, - leadingWidth: 0, - title: Text( - "Profile", - style: TextStyle( - color: TColor.black, fontSize: 16, fontWeight: FontWeight.w700), - ), - actions: [ - InkWell( - onTap: () {}, - child: Container( - margin: const EdgeInsets.all(8), - height: 20, - width: 20, - alignment: Alignment.center, - decoration: BoxDecoration( - color: TColor.lightGray, - borderRadius: BorderRadius.circular(10)), - child: Image.asset( - "assets/img/more_btn.png", - width: 15, - height: 15, - fit: BoxFit.contain, - ), - ), - ) - ], - ), - backgroundColor: TColor.white, - body: SingleChildScrollView( - child: Container( - padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 25), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ProfileEntete(username), - const SizedBox( - height: 15, - ), - const ProfileInfoUser(), - const SizedBox( - height: 25, - ), - ProfileCompte(accountArr), - const SizedBox( - height: 25, - ), - ProfileNotification(positive), - const SizedBox( - height: 25, - ), - ProfileOther(otherArr) - ], - ), - ), - ), - ); + return ProfileViewAllPlatforme(positive, accountArr, otherArr); } } diff --git a/lib/view/profile/web/web_profile_view.dart b/lib/view/profile/web/web_profile_view.dart index c3a239c..bb0b39b 100644 --- a/lib/view/profile/web/web_profile_view.dart +++ b/lib/view/profile/web/web_profile_view.dart @@ -1,12 +1,5 @@ import 'package:flutter/material.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/view/profile/all_platforme/profile_view_allplatforme.dart'; class WebProfileView extends StatefulWidget { const WebProfileView({super.key}); @@ -21,23 +14,27 @@ class _WebProfileView extends State { List accountArr = [ { "image": "assets/img/p_personal.png", - "name": "Changer son pseudo", + "name": "Changer son pseudo ", "tag": "1" }, { "image": "assets/img/p_personal.png", - "name": "Changer son email", + "name": "Changer son email ", "tag": "3" }, { "image": "assets/img/p_personal.png", - "name": "Changer son mot de passe", + "name": "Changer son mot de passe ", "tag": "2" }, ]; List otherArr = [ - {"image": "assets/img/p_contact.png", "name": "Nous contacter", "tag": "5"}, + { + "image": "assets/img/p_contact.png", + "name": "Nous contacter !!", + "tag": "5" + }, { "image": "assets/img/p_privacy.png", "name": "Politique de confidentialité", @@ -46,68 +43,6 @@ class _WebProfileView extends State { ]; @override Widget build(BuildContext context) { - String username = context.watch().username; - - return Scaffold( - appBar: AppBar( - backgroundColor: TColor.white, - centerTitle: true, - elevation: 0, - leadingWidth: 0, - title: Text( - "Profile", - style: TextStyle( - color: TColor.black, fontSize: 16, fontWeight: FontWeight.w700), - ), - actions: [ - InkWell( - onTap: () {}, - child: Container( - margin: const EdgeInsets.all(8), - height: 20, - width: 20, - alignment: Alignment.center, - decoration: BoxDecoration( - color: TColor.lightGray, - borderRadius: BorderRadius.circular(10)), - child: Image.asset( - "assets/img/more_btn.png", - width: 15, - height: 15, - fit: BoxFit.contain, - ), - ), - ) - ], - ), - backgroundColor: TColor.white, - body: SingleChildScrollView( - child: Container( - padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 25), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - ProfileEntete(username), - const SizedBox( - height: 15, - ), - const ProfileInfoUser(), - const SizedBox( - height: 25, - ), - ProfileCompte(accountArr), - const SizedBox( - height: 25, - ), - ProfileNotification(positive), - const SizedBox( - height: 25, - ), - ProfileOther(otherArr) - ], - ), - ), - ), - ); + return ProfileViewAllPlatforme(positive, accountArr, otherArr); } }