pull/1/head
Enzo 2 years ago
parent fdad41c5e5
commit 043ca8eaba

@ -101,11 +101,21 @@ class RequestApi extends IDataStrategy {
@override
Future<Tuple2<bool, String>> postUser(
String email, String hash, String username) async {
final response = await http.post(Uri.parse('$urlApi/user'),
body: <String, String>{
"email": email,
"hash": hash,
"username": username
print(email);
print(hash);
print(username);
print(<String, String>{
"\"email\"": "\"$email\"",
"\"hash\"": "\"$hash\"",
"\"username\"": "\"$username\""
});
final response =
await http.post(Uri.parse('$urlApi/user'), body: <String, String>{
"\"email\"": "\"$email\"",
"\"hash\"": "\"$hash\"",
"\"username\"": "\"$username\""
});
if (response.statusCode == 200) {

@ -27,6 +27,8 @@ class Login {
}
void fillUser(BuildContext context, Map<String, dynamic> map, String token) {
print(map);
context.read<User>().email = map["email"];
context.read<User>().username = map["username"];
context.read<User>().token = token;

@ -1,3 +1,8 @@
import 'package:responsive_builder/responsive_builder.dart';
import 'package:smartfit_app_mobile/View/home/mobile/mobile_Activity_view.dart';
import 'package:smartfit_app_mobile/View/home/mobile/mobile_homeview.dart';
import 'package:smartfit_app_mobile/View/home/web/web_Activity_view.dart';
import 'package:smartfit_app_mobile/View/home/web/web_homeview.dart';
import 'package:smartfit_app_mobile/common_widget/steps.dart';
import 'package:smartfit_app_mobile/common_widget/graph.dart';
import 'package:smartfit_app_mobile/common_widget/info.dart' hide Stats;
@ -9,19 +14,9 @@ class Activity extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Column(
children: const [
Divider(height: 80),
Steps(),
Graph(),
Info(),
Divider(height: 30),
Stats(),
SizedBox(height: 30),
],
),
return ScreenTypeLayout.builder(
mobile: (_) => const MobileActivity(),
desktop: (_) => const WebActivity(),
);
}
}

@ -1,19 +0,0 @@
import 'package:smartfit_app_mobile/common/colo_extension.dart';
import 'package:flutter/material.dart';
class BlankView extends StatefulWidget {
const BlankView({super.key});
@override
State<BlankView> createState() => _BlankViewState();
}
class _BlankViewState extends State<BlankView> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: TColor.white,
);
}
}

@ -0,0 +1,27 @@
import 'package:smartfit_app_mobile/common_widget/steps.dart';
import 'package:smartfit_app_mobile/common_widget/graph.dart';
import 'package:smartfit_app_mobile/common_widget/info.dart' hide Stats;
import 'package:smartfit_app_mobile/common_widget/stats.dart';
import 'package:flutter/material.dart';
class MobileActivity extends StatelessWidget {
const MobileActivity({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Column(
children: const [
Divider(height: 80),
Steps(),
Graph(),
Info(),
Divider(height: 30),
Stats(),
SizedBox(height: 30),
],
),
);
}
}

@ -0,0 +1,27 @@
import 'package:smartfit_app_mobile/common_widget/steps.dart';
import 'package:smartfit_app_mobile/common_widget/graph.dart';
import 'package:smartfit_app_mobile/common_widget/info.dart' hide Stats;
import 'package:smartfit_app_mobile/common_widget/stats.dart';
import 'package:flutter/material.dart';
class WebActivity extends StatelessWidget {
const WebActivity({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Column(
children: const [
Divider(height: 80),
Steps(),
Graph(),
Info(),
Divider(height: 30),
Stats(),
SizedBox(height: 30),
],
),
);
}
}

@ -100,7 +100,7 @@ class _WebHomeView extends State<WebHomeView> {
style: TextStyle(color: TColor.gray, fontSize: 12),
),
Text(
user.email,
user.username,
style: TextStyle(
color: TColor.black,
fontSize: 20,

@ -20,10 +20,20 @@ class _MobileLoginView extends State<MobileLoginView> {
bool _obscureText = true;
bool _errorLogin = false;
String _msgError = "";
bool emailValidate = false;
bool passwordValidate = false;
final controllerTextEmail = TextEditingController();
final controllerTextPassword = TextEditingController();
@override
void initState() {
super.initState();
// Start listening to changes.
controllerTextEmail.addListener(checkEmail);
controllerTextPassword.addListener(checkPassword);
}
// Toggles the password show status
void _toggle() {
setState(() {
@ -38,6 +48,25 @@ class _MobileLoginView extends State<MobileLoginView> {
});
}
void checkEmail() {
if (!controllerTextEmail.text.contains("@") &&
!(controllerTextEmail.text.length > 6)) {
emailValidate = false;
// Faire un affichage
return;
} // Enlever l'affichage
emailValidate = true;
}
void checkPassword() {
if (!(controllerTextEmail.text.length >= 4)) {
passwordValidate = false;
//Faire un affichage
return;
} // Enlever l'affichage
passwordValidate = true;
}
@override
Widget build(BuildContext context) {
var media = MediaQuery.of(context).size;
@ -118,6 +147,11 @@ class _MobileLoginView extends State<MobileLoginView> {
RoundButton(
title: "Se connecter",
onPressed: () async {
if (!emailValidate || !passwordValidate) {
_printMsgError(
"Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result =
await util.checkLoginAndPassword(
controllerTextEmail.text,

@ -22,10 +22,23 @@ class _MobileSignUpView extends State<MobileSignUpView> {
bool _isCheck = false;
String _msgError = "";
bool emailValidate = false;
bool passwordValidate = false;
bool usernameValidate = false;
final controllerTextEmail = TextEditingController();
final controllerUsername = TextEditingController();
final controllerTextPassword = TextEditingController();
@override
void initState() {
super.initState();
// Start listening to changes.
controllerTextEmail.addListener(checkEmail);
controllerTextPassword.addListener(checkPassword);
controllerUsername.addListener(checkUsername);
}
// Toggles the password show status
void _toggle() {
setState(() {
@ -46,6 +59,33 @@ class _MobileSignUpView extends State<MobileSignUpView> {
});
}
void checkEmail() {
if (!controllerTextEmail.text.contains("@") &&
!(controllerTextEmail.text.length > 6)) {
emailValidate = false;
// Faire un affichage
return;
} // Enlever l'affichage
emailValidate = true;
}
void checkPassword() {
if (!(controllerTextEmail.text.length >= 4)) {
passwordValidate = false;
//Faire un affichage
return;
} // Enlever l'affichage
passwordValidate = true;
}
void checkUsername() {
if (controllerUsername.text.isEmpty) {
usernameValidate = false;
return;
}
usernameValidate = true;
}
@override
Widget build(BuildContext context) {
var media = MediaQuery.of(context).size;
@ -144,6 +184,14 @@ class _MobileSignUpView extends State<MobileSignUpView> {
RoundButton(
title: "Créer un compte",
onPressed: () async {
if (!emailValidate ||
!passwordValidate ||
!usernameValidate) {
_printMsgError(
"Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result = await util.createUser(
controllerTextEmail.text,
controllerUsername.text,

@ -21,10 +21,20 @@ class _WebLoginView extends State<WebLoginView> {
bool _obscureText = true;
bool _errorLogin = false;
String _msgError = "";
bool emailValidate = false;
bool passwordValidate = false;
final controllerTextEmail = TextEditingController();
final controllerTextPassword = TextEditingController();
@override
void initState() {
super.initState();
// Start listening to changes.
controllerTextEmail.addListener(checkEmail);
controllerTextPassword.addListener(checkPassword);
}
// Toggles the password show status
void _toggle() {
setState(() {
@ -39,6 +49,27 @@ class _WebLoginView extends State<WebLoginView> {
});
}
void checkEmail() {
/*
if (!controllerTextEmail.text.contains("@") &&
!(controllerTextEmail.text.length > 6)) {
emailValidate = false;
// Faire un affichage
return;
} // Enlever l'affichage*/
emailValidate = true;
}
void checkPassword() {
/*
if (!(controllerTextEmail.text.length >= 4)) {
passwordValidate = false;
//Faire un affichage
return;
} // Enlever l'affichage*/
passwordValidate = true;
}
@override
Widget build(BuildContext context) {
var media = MediaQuery.of(context).size;
@ -119,6 +150,11 @@ class _WebLoginView extends State<WebLoginView> {
RoundButton(
title: "Se connecter",
onPressed: () async {
if (!emailValidate || !passwordValidate) {
_printMsgError(
"Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result =
await util.checkLoginAndPassword(
controllerTextEmail.text,

@ -21,11 +21,23 @@ class _WebSignUpView extends State<WebSignUpView> {
bool _errorCreateUser = false;
bool _isCheck = false;
String _msgError = "";
bool emailValidate = false;
bool passwordValidate = false;
bool usernameValidate = false;
final controllerTextEmail = TextEditingController();
final controllerUsername = TextEditingController();
final controllerTextPassword = TextEditingController();
@override
void initState() {
super.initState();
// Start listening to changes.
controllerTextEmail.addListener(checkEmail);
controllerTextPassword.addListener(checkPassword);
controllerUsername.addListener(checkUsername);
}
// Toggles the password show status
void _toggle() {
setState(() {
@ -40,6 +52,33 @@ class _WebSignUpView extends State<WebSignUpView> {
});
}
void checkEmail() {
if (!controllerTextEmail.text.contains("@") &&
!(controllerTextEmail.text.length > 6)) {
emailValidate = false;
// Faire un affichage
return;
} // Enlever l'affichage
emailValidate = true;
}
void checkPassword() {
if (!(controllerTextEmail.text.length >= 4)) {
passwordValidate = false;
//Faire un affichage
return;
} // Enlever l'affichage
passwordValidate = true;
}
void checkUsername() {
if (controllerUsername.text.isEmpty) {
usernameValidate = false;
return;
}
usernameValidate = true;
}
void _check() {
setState(() {
_isCheck = !_isCheck;
@ -144,6 +183,13 @@ class _WebSignUpView extends State<WebSignUpView> {
RoundButton(
title: "Créer un compte",
onPressed: () async {
if (!emailValidate ||
!passwordValidate ||
!usernameValidate) {
_printMsgError(
"Les champs renseigné ne sont pas valide");
return;
}
Tuple2<bool, String> result = await util.createUser(
controllerTextEmail.text,
controllerUsername.text,

@ -0,0 +1,361 @@
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/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<MobileProfileView> createState() => _MobileProfileView();
}
class _MobileProfileView extends State<MobileProfileView> {
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<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: () {},
);
},
)
],
),
)
],
),
),
),
);
}
}

@ -1,10 +1,7 @@
import 'package:flutter/material.dart';
import '../../common/colo_extension.dart';
import '../../common_widget/round_button.dart';
import '../../common_widget/setting_row.dart';
import '../../common_widget/title_subtitle_cell.dart';
import 'package:animated_toggle_switch/animated_toggle_switch.dart';
import 'package:responsive_builder/responsive_builder.dart';
import 'package:smartfit_app_mobile/View/profile/mobile/mobile_profile_view.dart';
import 'package:smartfit_app_mobile/View/profile/web/web_profile_view.dart';
class ProfileView extends StatefulWidget {
const ProfileView({super.key});
@ -14,341 +11,11 @@ class ProfileView extends StatefulWidget {
}
class _ProfileViewState extends State<ProfileView> {
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<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: () {},
);
},
)
],
),
)
],
),
),
),
return ScreenTypeLayout.builder(
mobile: (_) => const MobileProfileView(),
desktop: (_) => const WebProfileView(),
);
}
}

@ -0,0 +1,361 @@
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/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 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": "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<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: () {},
);
},
)
],
),
)
],
),
),
),
);
}
}

@ -1,3 +1,4 @@
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
@ -12,7 +13,15 @@ class RoundTextField extends StatelessWidget {
final Widget? rigtIcon;
final bool obscureText;
final EdgeInsets? margin;
const RoundTextField({super.key, required this.hitText, required this.icon, this.controller, this.margin, this.keyboardType, this.obscureText = false , this.rigtIcon });
const RoundTextField(
{super.key,
required this.hitText,
required this.icon,
this.controller,
this.margin,
this.keyboardType,
this.obscureText = false,
this.rigtIcon});
@override
Widget build(BuildContext context) {

Loading…
Cancel
Save