You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SmartFit_Mobile/lib/view/profile/web/web_profile_view.dart

419 lines
16 KiB

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';
import 'package:smartfit_app_mobile/view/home/notification_view.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});
@override
State<WebProfileView> createState() => _WebProfileView();
}
class _WebProfileView extends State<WebProfileView> {
bool positive = false;
List accountArr = [
{
"image": "assets/img/p_personal.png",
"name": "Changer son pseudo",
"tag": "1"
},
{
"image": "assets/img/p_personal.png",
"name": "Changer son email",
"tag": "3"
},
{
"image": "assets/img/p_personal.png",
"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_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];
return SettingRow(
icon: iObj["image"]!,
title: iObj["name"]!,
onPressed: () {
if (iObj["tag"] == "1") {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeUsernameView(),
),
);
} else if (iObj["tag"] == "2") {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangePasswordView(),
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeEmailView(),
),
);
}
},
);
},
),
],
),
),
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<bool>(
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: () {
if (iObj["tag"] == "6") {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const PrivacyPolicyView(),
),
);
} else if (iObj["tag"] == "5") {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ContactUsView(),
),
);
} else {
// Autre logique si nécessaire pour d'autres éléments de la liste
}
},
);
},
)
],
),
)
],
),
),
),
);
}
}