import 'package:flutter/material.dart'; import 'package:animated_toggle_switch/animated_toggle_switch.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'; class MobileProfileView extends StatefulWidget { const MobileProfileView({super.key}); @override State createState() => _MobileProfileView(); } class _MobileProfileView extends State { bool positive = false; List accountArr = [ { "image": "assets/img/p_personal.png", "name": "Données personnelles", "tag": "1" }, ]; List otherArr = [ {"image": "assets/img/p_contact.png", "name": "Nous contacter", "tag": "5"}, { "image": "assets/img/p_privacy.png", "name": "Politique de confidentialité", "tag": "6" }, ]; @override Widget build(BuildContext context) { 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: [ 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( "Benjelloun Othmane", 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(), // ), // ); }, ), ) ], ), 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 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] as Map? ?? {}; return SettingRow( icon: iObj["image"].toString(), title: iObj["name"].toString(), onPressed: () {}, ); }, ) ], ), ), 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( "Pop-up Notification", style: TextStyle( color: TColor.black, fontSize: 12, ), ), ), CustomAnimatedToggleSwitch( current: positive, values: [false, true], spacing: 0.0, indicatorSize: 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: 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)) ], ), ), ); }, ), ]), ) ], ), ), 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: () {}, ); }, ) ], ), ) ], ), ), ), ); } }