commit
76b32e69ff
@ -0,0 +1,81 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:smartfit_app_mobile/common_widget/container/workout_row.dart';
|
||||
import 'package:smartfit_app_mobile/modele/user.dart';
|
||||
import 'package:smartfit_app_mobile/modele/utile/list_activity/list_activity_utile.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class ListActivity extends StatefulWidget {
|
||||
const ListActivity({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ListActivity> createState() => _ListActivity();
|
||||
}
|
||||
|
||||
class _ListActivity extends State<ListActivity> {
|
||||
final ListActivityUtile _utile = ListActivityUtile();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: Provider.of<User>(context, listen: true).listActivity.length,
|
||||
itemBuilder: (context, index) {
|
||||
var activityObj =
|
||||
Provider.of<User>(context, listen: true).listActivity[index];
|
||||
var activityMap = activityObj.toMap();
|
||||
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: WorkoutRow(
|
||||
wObj: activityMap,
|
||||
onDelete: () async {
|
||||
if (await _utile.deleteFileOnBDD(
|
||||
Provider.of<User>(context, listen: false).token,
|
||||
activityObj.fileUuid)) {
|
||||
if (!Provider.of<User>(context, listen: false)
|
||||
.managerSelectedActivity
|
||||
.fileNotSelected(activityObj.fileUuid)) {
|
||||
Provider.of<User>(context, listen: false)
|
||||
.managerSelectedActivity
|
||||
.removeSelectedActivity(activityObj.fileUuid);
|
||||
}
|
||||
Provider.of<User>(context, listen: false)
|
||||
.removeActivity(activityObj);
|
||||
}
|
||||
},
|
||||
onClick: () async {
|
||||
if (!Provider.of<User>(context, listen: false)
|
||||
.managerSelectedActivity
|
||||
.fileNotSelected(activityObj.fileUuid)) {
|
||||
Provider.of<User>(context, listen: false)
|
||||
.managerSelectedActivity
|
||||
.removeSelectedActivity(activityObj.fileUuid);
|
||||
return;
|
||||
}
|
||||
|
||||
Tuple2<bool, String> result =
|
||||
await _utile.getContentActivity(context, activityObj);
|
||||
if (!result.item1) {
|
||||
return;
|
||||
}
|
||||
|
||||
Provider.of<User>(context, listen: false)
|
||||
.removeActivity(activityObj);
|
||||
Provider.of<User>(context, listen: false)
|
||||
.insertActivity(0, activityObj);
|
||||
},
|
||||
isSelected: !Provider.of<User>(context)
|
||||
.managerSelectedActivity
|
||||
.fileNotSelected(activityObj.fileUuid),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -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(),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
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: () {},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -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",
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -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<ProfileNotification> createState() => _ProfileNotification();
|
||||
}
|
||||
|
||||
class _ProfileNotification extends State<ProfileNotification> {
|
||||
@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<bool>(
|
||||
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))
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
]),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:smartfit_app_mobile/common/colo_extension.dart';
|
||||
import 'package:smartfit_app_mobile/modele/utile/home_view/data_home_view.dart';
|
||||
|
||||
class FuncBpmAndSpeedByTime {
|
||||
final DataHomeView data;
|
||||
|
||||
FuncBpmAndSpeedByTime(this.data);
|
||||
|
||||
List<int> showingTooltipOnSpots = [0];
|
||||
|
||||
SideTitles get rightTitles => SideTitles(
|
||||
getTitlesWidget: rightTitleWidgets,
|
||||
showTitles: true,
|
||||
interval: 20,
|
||||
reservedSize: 40,
|
||||
);
|
||||
|
||||
late final lineBarsData = [
|
||||
LineChartBarData(
|
||||
spots: data.bpmSecondes,
|
||||
isCurved: false,
|
||||
barWidth: 2,
|
||||
belowBarData: BarAreaData(
|
||||
show: true,
|
||||
gradient: LinearGradient(colors: [
|
||||
TColor.secondaryColor1.withOpacity(0.4),
|
||||
TColor.secondaryColor2.withOpacity(0.1),
|
||||
], begin: Alignment.topCenter, end: Alignment.bottomCenter),
|
||||
),
|
||||
dotData: const FlDotData(show: false),
|
||||
gradient: LinearGradient(
|
||||
colors: TColor.secondaryG,
|
||||
),
|
||||
),
|
||||
];
|
||||
late final tooltipsOnBar = lineBarsData[0];
|
||||
|
||||
Widget rightTitleWidgets(double value, TitleMeta meta) {
|
||||
String text;
|
||||
switch (value.toInt()) {
|
||||
case 0:
|
||||
text = '0%';
|
||||
break;
|
||||
case 20:
|
||||
text = '20%';
|
||||
break;
|
||||
case 40:
|
||||
text = '40%';
|
||||
break;
|
||||
case 60:
|
||||
text = '60%';
|
||||
break;
|
||||
case 80:
|
||||
text = '80%';
|
||||
break;
|
||||
case 100:
|
||||
text = '100%';
|
||||
break;
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
|
||||
return Text(text,
|
||||
style: TextStyle(
|
||||
color: TColor.gray,
|
||||
fontSize: 12,
|
||||
),
|
||||
textAlign: TextAlign.center);
|
||||
}
|
||||
|
||||
List<LineChartBarData> get lineBarsData1 => [
|
||||
lineChartBarData1_1,
|
||||
lineChartBarData1_2,
|
||||
];
|
||||
|
||||
LineChartBarData get lineChartBarData1_1 => LineChartBarData(
|
||||
isCurved: true,
|
||||
gradient: LinearGradient(colors: [
|
||||
TColor.primaryColor2.withOpacity(0.5),
|
||||
TColor.primaryColor1.withOpacity(0.5),
|
||||
]),
|
||||
barWidth: 4,
|
||||
isStrokeCapRound: true,
|
||||
dotData: const FlDotData(show: false),
|
||||
belowBarData: BarAreaData(show: false),
|
||||
spots: data.vitesseSecondes,
|
||||
);
|
||||
|
||||
LineChartBarData get lineChartBarData1_2 => LineChartBarData(
|
||||
isCurved: true,
|
||||
gradient: LinearGradient(colors: [
|
||||
TColor.secondaryColor2.withOpacity(0.5),
|
||||
TColor.secondaryColor1.withOpacity(0.5),
|
||||
]),
|
||||
barWidth: 2,
|
||||
isStrokeCapRound: true,
|
||||
dotData: const FlDotData(show: false),
|
||||
belowBarData: BarAreaData(
|
||||
show: false,
|
||||
),
|
||||
spots: data.bpmSecondes2,
|
||||
);
|
||||
}
|
@ -1,430 +0,0 @@
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../common/colo_extension.dart';
|
||||
import '../../common_widget/today_target_cell.dart';
|
||||
|
||||
class ActivityTrackerView extends StatefulWidget {
|
||||
const ActivityTrackerView({super.key});
|
||||
|
||||
@override
|
||||
State<ActivityTrackerView> createState() => _ActivityTrackerViewState();
|
||||
}
|
||||
|
||||
class _ActivityTrackerViewState extends State<ActivityTrackerView> {
|
||||
int touchedIndex = -1;
|
||||
|
||||
List latestArr = [
|
||||
{
|
||||
"image": "assets/img/workout1.svg",
|
||||
"title": "Drinking 300ml Water",
|
||||
"time": "About 1 minutes ago"
|
||||
},
|
||||
{
|
||||
"image": "assets/img/workout1.svg",
|
||||
"title": "Eat Snack (Fitbar)",
|
||||
"time": "About 3 hours ago"
|
||||
},
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var media = MediaQuery.of(context).size;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: TColor.white,
|
||||
centerTitle: true,
|
||||
elevation: 0,
|
||||
leading: InkWell(
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
height: 40,
|
||||
width: 40,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: TColor.lightGray,
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
child: Image.asset(
|
||||
"assets/img/black_btn.png",
|
||||
width: 15,
|
||||
height: 15,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
"Suivi d'activité",
|
||||
style: TextStyle(
|
||||
color: TColor.black, fontSize: 16, fontWeight: FontWeight.w700),
|
||||
),
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
height: 40,
|
||||
width: 40,
|
||||
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: 25, horizontal: 25),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
TColor.primaryColor2.withOpacity(0.3),
|
||||
TColor.primaryColor1.withOpacity(0.3)
|
||||
]),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Objectif d'aujourd'hui",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: TColor.primaryG,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: MaterialButton(
|
||||
onPressed: () {},
|
||||
padding: EdgeInsets.zero,
|
||||
height: 30,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(25)),
|
||||
textColor: TColor.primaryColor1,
|
||||
minWidth: double.maxFinite,
|
||||
elevation: 0,
|
||||
color: Colors.transparent,
|
||||
child: const Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
size: 15,
|
||||
)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TodayTargetCell(
|
||||
icon: "assets/img/workout1.svg",
|
||||
value: "800",
|
||||
title: "Calories",
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 15,
|
||||
),
|
||||
Expanded(
|
||||
child: TodayTargetCell(
|
||||
icon: "assets/img/workout1.svg",
|
||||
value: "2400",
|
||||
title: "Nombre pas",
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: media.width * 0.1,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"Activité journalière",
|
||||
style: TextStyle(
|
||||
color: TColor.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
Container(
|
||||
height: 30,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: TColor.primaryG),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton(
|
||||
items: ["Semaine", "Mois"]
|
||||
.map((name) => DropdownMenuItem(
|
||||
value: name,
|
||||
child: Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
color: TColor.gray, fontSize: 14),
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
onChanged: (value) {},
|
||||
icon: Icon(Icons.expand_more, color: TColor.white),
|
||||
hint: Text(
|
||||
"Semaine",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: TColor.white, fontSize: 12),
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: media.width * 0.05,
|
||||
),
|
||||
Container(
|
||||
height: media.width * 0.5,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 15, horizontal: 0),
|
||||
decoration: BoxDecoration(
|
||||
color: TColor.white,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.black12, blurRadius: 3)
|
||||
]),
|
||||
child: BarChart(BarChartData(
|
||||
barTouchData: BarTouchData(
|
||||
touchTooltipData: BarTouchTooltipData(
|
||||
tooltipBgColor: Colors.grey,
|
||||
tooltipHorizontalAlignment: FLHorizontalAlignment.right,
|
||||
tooltipMargin: 10,
|
||||
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||
String weekDay;
|
||||
switch (group.x) {
|
||||
case 0:
|
||||
weekDay = 'Monday';
|
||||
break;
|
||||
case 1:
|
||||
weekDay = 'Tuesday';
|
||||
break;
|
||||
case 2:
|
||||
weekDay = 'Wednesday';
|
||||
break;
|
||||
case 3:
|
||||
weekDay = 'Thursday';
|
||||
break;
|
||||
case 4:
|
||||
weekDay = 'Friday';
|
||||
break;
|
||||
case 5:
|
||||
weekDay = 'Saturday';
|
||||
break;
|
||||
case 6:
|
||||
weekDay = 'Sunday';
|
||||
break;
|
||||
default:
|
||||
throw Error();
|
||||
}
|
||||
return BarTooltipItem(
|
||||
'$weekDay\n',
|
||||
const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: (rod.toY - 1).toString(),
|
||||
style: TextStyle(
|
||||
color: TColor.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
touchCallback: (FlTouchEvent event, barTouchResponse) {
|
||||
setState(() {
|
||||
if (!event.isInterestedForInteractions ||
|
||||
barTouchResponse == null ||
|
||||
barTouchResponse.spot == null) {
|
||||
touchedIndex = -1;
|
||||
return;
|
||||
}
|
||||
touchedIndex =
|
||||
barTouchResponse.spot!.touchedBarGroupIndex;
|
||||
});
|
||||
},
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
rightTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
topTitles: AxisTitles(
|
||||
sideTitles: SideTitles(showTitles: false),
|
||||
),
|
||||
bottomTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: true,
|
||||
getTitlesWidget: getTitles,
|
||||
reservedSize: 38,
|
||||
),
|
||||
),
|
||||
leftTitles: AxisTitles(
|
||||
sideTitles: SideTitles(
|
||||
showTitles: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
borderData: FlBorderData(
|
||||
show: false,
|
||||
),
|
||||
barGroups: showingGroups(),
|
||||
gridData: FlGridData(show: false),
|
||||
)),
|
||||
),
|
||||
SizedBox(
|
||||
height: media.width * 0.05,
|
||||
),
|
||||
SizedBox(
|
||||
height: media.width * 0.1,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getTitles(double value, TitleMeta meta) {
|
||||
var style = TextStyle(
|
||||
color: TColor.gray,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
);
|
||||
Widget text;
|
||||
switch (value.toInt()) {
|
||||
case 0:
|
||||
text = Text('Dim', style: style);
|
||||
break;
|
||||
case 1:
|
||||
text = Text('Lun', style: style);
|
||||
break;
|
||||
case 2:
|
||||
text = Text('Mar', style: style);
|
||||
break;
|
||||
case 3:
|
||||
text = Text('Mer', style: style);
|
||||
break;
|
||||
case 4:
|
||||
text = Text('Jeu', style: style);
|
||||
break;
|
||||
case 5:
|
||||
text = Text('Ven', style: style);
|
||||
break;
|
||||
case 6:
|
||||
text = Text('Sam', style: style);
|
||||
break;
|
||||
default:
|
||||
text = Text('', style: style);
|
||||
break;
|
||||
}
|
||||
return SideTitleWidget(
|
||||
axisSide: meta.axisSide,
|
||||
space: 16,
|
||||
child: text,
|
||||
);
|
||||
}
|
||||
|
||||
List<BarChartGroupData> showingGroups() => List.generate(7, (i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return makeGroupData(0, 5, TColor.primaryG,
|
||||
isTouched: i == touchedIndex);
|
||||
case 1:
|
||||
return makeGroupData(1, 10.5, TColor.secondaryG,
|
||||
isTouched: i == touchedIndex);
|
||||
case 2:
|
||||
return makeGroupData(2, 5, TColor.primaryG,
|
||||
isTouched: i == touchedIndex);
|
||||
case 3:
|
||||
return makeGroupData(3, 7.5, TColor.secondaryG,
|
||||
isTouched: i == touchedIndex);
|
||||
case 4:
|
||||
return makeGroupData(4, 15, TColor.primaryG,
|
||||
isTouched: i == touchedIndex);
|
||||
case 5:
|
||||
return makeGroupData(5, 5.5, TColor.secondaryG,
|
||||
isTouched: i == touchedIndex);
|
||||
case 6:
|
||||
return makeGroupData(6, 8.5, TColor.primaryG,
|
||||
isTouched: i == touchedIndex);
|
||||
default:
|
||||
return throw Error();
|
||||
}
|
||||
});
|
||||
|
||||
BarChartGroupData makeGroupData(
|
||||
int x,
|
||||
double y,
|
||||
List<Color> barColor, {
|
||||
bool isTouched = false,
|
||||
double width = 22,
|
||||
List<int> showTooltips = const [],
|
||||
}) {
|
||||
return BarChartGroupData(
|
||||
x: x,
|
||||
barRods: [
|
||||
BarChartRodData(
|
||||
toY: isTouched ? y + 1 : y,
|
||||
gradient: LinearGradient(
|
||||
colors: barColor,
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter),
|
||||
width: width,
|
||||
borderSide: isTouched
|
||||
? const BorderSide(color: Colors.green)
|
||||
: const BorderSide(color: Colors.white, width: 0),
|
||||
backDrawRodData: BackgroundBarChartRodData(
|
||||
show: true,
|
||||
toY: 20,
|
||||
color: TColor.lightGray,
|
||||
),
|
||||
),
|
||||
],
|
||||
showingTooltipIndicators: showTooltips,
|
||||
);
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
|
||||
|
||||
//import '../sleep_tracker/sleep_tracker_view.dart';
|
||||
/*
|
||||
class SelectView extends StatelessWidget {
|
||||
const SelectView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// var media = MediaQuery.of(context).size;
|
||||
|
||||
return Scaffold(
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
RoundButton(
|
||||
title: "Workout Tracker",
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const BlankView(),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
RoundButton(
|
||||
title: "Meal Planner",
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const BlankView(),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
RoundButton(
|
||||
title: "Sleep Tracker",
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const BlankView(),
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
File diff suppressed because it is too large
Load Diff
@ -1,131 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:location/location.dart';
|
||||
import 'package:smartfit_app_mobile/common/colo_extension.dart';
|
||||
|
||||
class MobileMyMaps extends StatefulWidget {
|
||||
const MobileMyMaps({super.key});
|
||||
|
||||
@override
|
||||
State<MobileMyMaps> createState() => _MobileMyMaps();
|
||||
}
|
||||
|
||||
class _MobileMyMaps extends State<MobileMyMaps> {
|
||||
Completer<GoogleMapController> _googleMapController = Completer();
|
||||
CameraPosition? _cameraPosition;
|
||||
Location? _location;
|
||||
LocationData? _currentLocation;
|
||||
List<LatLng> _polylineCoordinates = [];
|
||||
Set<Polyline> _polylines = {};
|
||||
Set<Marker> _markers = {}; // Add a set to store markers
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_init();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
_init() async {
|
||||
_location = Location();
|
||||
_cameraPosition = const CameraPosition(
|
||||
target: LatLng(
|
||||
0, 0), // this is just the example lat and lng for initializing
|
||||
zoom: 20);
|
||||
_initLocation();
|
||||
}
|
||||
|
||||
//function to listen when we move position
|
||||
_initLocation() {
|
||||
_location?.getLocation().then((location) {
|
||||
_currentLocation = location;
|
||||
});
|
||||
|
||||
_location?.onLocationChanged.listen((newLocation) {
|
||||
setState(() {
|
||||
_currentLocation = newLocation;
|
||||
_polylineCoordinates.add(LatLng(
|
||||
_currentLocation?.latitude ?? 0,
|
||||
_currentLocation?.longitude ?? 0,
|
||||
));
|
||||
_updatePolyline();
|
||||
});
|
||||
|
||||
moveToPosition(LatLng(
|
||||
_currentLocation?.latitude ?? 0, _currentLocation?.longitude ?? 0));
|
||||
});
|
||||
}
|
||||
|
||||
_updatePolyline() {
|
||||
setState(() {
|
||||
_polylines.clear();
|
||||
_polylines.add(Polyline(
|
||||
polylineId: PolylineId("polyline"),
|
||||
color: TColor.primaryColor1,
|
||||
points: _polylineCoordinates,
|
||||
width: 10,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
// Updated _updateMarker to use the custom marker
|
||||
_updateMarker(LatLng position) async {
|
||||
final markerId = MarkerId('marker');
|
||||
final marker = Marker(markerId: markerId, position: position);
|
||||
_markers.clear();
|
||||
_markers.add(marker);
|
||||
}*/
|
||||
|
||||
moveToPosition(LatLng latLng) async {
|
||||
GoogleMapController mapController = await _googleMapController.future;
|
||||
mapController.animateCamera(CameraUpdate.newCameraPosition(
|
||||
CameraPosition(target: latLng, zoom: 15)));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: _getMap(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getMarker() {
|
||||
return Container(
|
||||
width: 25,
|
||||
height: 25,
|
||||
padding: EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey,
|
||||
offset: Offset(0, 3),
|
||||
spreadRadius: 4,
|
||||
blurRadius: 6)
|
||||
]),
|
||||
child: ClipOval(child: Image.asset("assets/img/u1.png")),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getMap() {
|
||||
return Stack(
|
||||
children: [
|
||||
GoogleMap(
|
||||
initialCameraPosition: _cameraPosition!,
|
||||
mapType: MapType.normal,
|
||||
onMapCreated: (GoogleMapController controller) {
|
||||
if (!_googleMapController.isCompleted) {
|
||||
_googleMapController.complete(controller);
|
||||
}
|
||||
},
|
||||
polylines: _polylines,
|
||||
markers: _markers,
|
||||
),
|
||||
Positioned.fill(
|
||||
child: Align(alignment: Alignment.center, child: _getMarker()))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -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<ProfileViewAllPlatforme> createState() => _ProfileViewAllPlatforme();
|
||||
}
|
||||
|
||||
class _ProfileViewAllPlatforme extends State<ProfileViewAllPlatforme> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String username = context.watch<User>().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)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue