|
|
|
@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:simple_animation_progress_bar/simple_animation_progress_bar.dart';
|
|
|
|
|
import 'package:simple_circular_progress_bar/simple_circular_progress_bar.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/common_widget/container_stats.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/common_widget/ligne_container_stats.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/modele/user.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/common/colo_extension.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/common_widget/round_button.dart';
|
|
|
|
@ -18,9 +20,56 @@ class MobileHomeView extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
List<int> showingTooltipOnSpots = [0];
|
|
|
|
|
List<FlSpot> bpmSecondes = [FlSpot(0, 30)];
|
|
|
|
|
List<FlSpot> bpmSecondes2 = [];
|
|
|
|
|
double calories = 0.0;
|
|
|
|
|
List<FlSpot> vitesseSecondes = [FlSpot(0, 30)];
|
|
|
|
|
List<FlSpot> altitudeSecondes = [FlSpot(0, 30)];
|
|
|
|
|
|
|
|
|
|
TextEditingController bpmController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
void normaliserDeuxiemeElement(List<FlSpot> liste) {
|
|
|
|
|
// Trouver le plus grand élément dans la liste
|
|
|
|
|
double maxElement = 0.0;
|
|
|
|
|
for (var spot in liste) {
|
|
|
|
|
if (spot.y > maxElement) {
|
|
|
|
|
maxElement = spot.y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Calculer le facteur de normalisation
|
|
|
|
|
double normalisationFactor = maxElement != 0.0 ? 100 / maxElement : 1.0;
|
|
|
|
|
|
|
|
|
|
// Mettre à jour tous les éléments de la liste
|
|
|
|
|
for (int i = 0; i < liste.length; i++) {
|
|
|
|
|
liste[i] = FlSpot(liste[i].x, liste[i].y * normalisationFactor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<FlSpot> allSpots = [const FlSpot(0, 20)];
|
|
|
|
|
List lastWorkoutArr = [
|
|
|
|
|
{
|
|
|
|
|
"name": "Full Body Workout",
|
|
|
|
|
"image": "assets/img/Workout1.png",
|
|
|
|
|
"kcal": "180",
|
|
|
|
|
"time": "20",
|
|
|
|
|
"progress": 0.3
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"name": "Lower Body Workout",
|
|
|
|
|
"image": "assets/img/Workout2.png",
|
|
|
|
|
"kcal": "200",
|
|
|
|
|
"time": "30",
|
|
|
|
|
"progress": 0.4
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"name": "Ab Workout",
|
|
|
|
|
"image": "assets/img/Workout3.png",
|
|
|
|
|
"kcal": "300",
|
|
|
|
|
"time": "40",
|
|
|
|
|
"progress": 0.7
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
List<int> showingTooltipOnSpots = [0];
|
|
|
|
|
|
|
|
|
|
List waterArr = [
|
|
|
|
|
{"title": "6am - 8am", "subtitle": "600ml"},
|
|
|
|
@ -33,12 +82,24 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
var media = MediaQuery.of(context).size;
|
|
|
|
|
User user = context.watch<User>();
|
|
|
|
|
|
|
|
|
|
bpmSecondes =
|
|
|
|
|
Provider.of<User>(context).listActivity[0].getHeartRateWithTime();
|
|
|
|
|
vitesseSecondes =
|
|
|
|
|
Provider.of<User>(context).listActivity[0].getSpeedWithTime();
|
|
|
|
|
altitudeSecondes =
|
|
|
|
|
Provider.of<User>(context).listActivity[0].getAltitudeWithTime();
|
|
|
|
|
calories = double.parse(
|
|
|
|
|
Provider.of<User>(context).listActivity[0].getTotalCalorie());
|
|
|
|
|
|
|
|
|
|
normaliserDeuxiemeElement(vitesseSecondes);
|
|
|
|
|
normaliserDeuxiemeElement(altitudeSecondes);
|
|
|
|
|
bpmSecondes2 = List.from(bpmSecondes);
|
|
|
|
|
normaliserDeuxiemeElement(bpmSecondes2);
|
|
|
|
|
|
|
|
|
|
final lineBarsData = [
|
|
|
|
|
LineChartBarData(
|
|
|
|
|
showingIndicators: showingTooltipOnSpots,
|
|
|
|
|
spots: allSpots,
|
|
|
|
|
spots: bpmSecondes,
|
|
|
|
|
isCurved: false,
|
|
|
|
|
barWidth: 2,
|
|
|
|
|
belowBarData: BarAreaData(
|
|
|
|
@ -77,7 +138,7 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
style: TextStyle(color: TColor.gray, fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
user.username,
|
|
|
|
|
"Benjelloun Othmane",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 20,
|
|
|
|
@ -105,123 +166,6 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: media.width * 0.4,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
gradient: LinearGradient(colors: TColor.primaryG),
|
|
|
|
|
borderRadius: BorderRadius.circular(media.width * 0.075)),
|
|
|
|
|
child: Stack(alignment: Alignment.center, children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/img/bg_dots.png",
|
|
|
|
|
height: media.width * 0.4,
|
|
|
|
|
width: double.maxFinite,
|
|
|
|
|
fit: BoxFit.fitHeight,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 25, horizontal: 25),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Graph 1",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.white,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Sous titre 1",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.white.withOpacity(0.7),
|
|
|
|
|
fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 120,
|
|
|
|
|
height: 35,
|
|
|
|
|
child: RoundButton(
|
|
|
|
|
title: "Voir plus",
|
|
|
|
|
type: RoundButtonType.bgSGradient,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
onPressed: () {}))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
AspectRatio(
|
|
|
|
|
aspectRatio: 1,
|
|
|
|
|
child: PieChart(
|
|
|
|
|
PieChartData(
|
|
|
|
|
pieTouchData: PieTouchData(
|
|
|
|
|
touchCallback:
|
|
|
|
|
(FlTouchEvent event, pieTouchResponse) {},
|
|
|
|
|
),
|
|
|
|
|
startDegreeOffset: 250,
|
|
|
|
|
borderData: FlBorderData(
|
|
|
|
|
show: false,
|
|
|
|
|
),
|
|
|
|
|
sectionsSpace: 1,
|
|
|
|
|
centerSpaceRadius: 0,
|
|
|
|
|
sections: showingSections(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: TColor.primaryColor2.withOpacity(0.3),
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Suivi d'activité",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 70,
|
|
|
|
|
height: 25,
|
|
|
|
|
child: RoundButton(
|
|
|
|
|
title: "Voir",
|
|
|
|
|
type: RoundButtonType.bgGradient,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
const ActivityTrackerView(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Status d'activité",
|
|
|
|
|
style: TextStyle(
|
|
|
|
@ -253,29 +197,23 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Graph 2 ( rhythme cardiaque )",
|
|
|
|
|
"Rythme cardiaque",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
ShaderMask(
|
|
|
|
|
blendMode: BlendMode.srcIn,
|
|
|
|
|
shaderCallback: (bounds) {
|
|
|
|
|
return LinearGradient(
|
|
|
|
|
colors: TColor.primaryG,
|
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
|
end: Alignment.centerRight)
|
|
|
|
|
.createShader(Rect.fromLTRB(
|
|
|
|
|
0, 0, bounds.width, bounds.height));
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
"78 BPM",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color:
|
|
|
|
|
TColor.primaryColor1.withOpacity(0.7),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 18),
|
|
|
|
|
TextField(
|
|
|
|
|
controller: bpmController,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color:
|
|
|
|
|
TColor.primaryColor1.withOpacity(0.8),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 18),
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
border: InputBorder
|
|
|
|
|
.none, // Ajoutez cette ligne pour supprimer la bordure
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -347,8 +285,9 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
getTooltipItems:
|
|
|
|
|
(List<LineBarSpot> lineBarsSpot) {
|
|
|
|
|
return lineBarsSpot.map((lineBarSpot) {
|
|
|
|
|
bpmController.text = "${lineBarSpot.y} BPM";
|
|
|
|
|
return LineTooltipItem(
|
|
|
|
|
"il y a ${lineBarSpot.x.toInt()} minutes",
|
|
|
|
|
"Seconde ${lineBarSpot.x.toInt() / 10}",
|
|
|
|
|
const TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 10,
|
|
|
|
@ -360,12 +299,12 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
lineBarsData: lineBarsData,
|
|
|
|
|
minY: 0,
|
|
|
|
|
maxY: 130,
|
|
|
|
|
titlesData: FlTitlesData(
|
|
|
|
|
minY: 50,
|
|
|
|
|
maxY: 250,
|
|
|
|
|
titlesData: const FlTitlesData(
|
|
|
|
|
show: false,
|
|
|
|
|
),
|
|
|
|
|
gridData: FlGridData(show: false),
|
|
|
|
|
gridData: const FlGridData(show: false),
|
|
|
|
|
borderData: FlBorderData(
|
|
|
|
|
show: true,
|
|
|
|
|
border: Border.all(
|
|
|
|
@ -381,352 +320,17 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: media.width * 0.95,
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 25, horizontal: 20),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(25),
|
|
|
|
|
boxShadow: const [
|
|
|
|
|
BoxShadow(color: Colors.black12, blurRadius: 2)
|
|
|
|
|
]),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
SimpleAnimationProgressBar(
|
|
|
|
|
height: media.width * 0.85,
|
|
|
|
|
width: media.width * 0.07,
|
|
|
|
|
backgroundColor: Colors.grey.shade100,
|
|
|
|
|
foregrondColor: Colors.purple,
|
|
|
|
|
ratio: 0.5,
|
|
|
|
|
direction: Axis.vertical,
|
|
|
|
|
curve: Curves.fastLinearToSlowEaseIn,
|
|
|
|
|
duration: const Duration(seconds: 3),
|
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
|
gradientColor: LinearGradient(
|
|
|
|
|
colors: TColor.primaryG,
|
|
|
|
|
begin: Alignment.bottomCenter,
|
|
|
|
|
end: Alignment.topCenter),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Graph 3",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
ShaderMask(
|
|
|
|
|
blendMode: BlendMode.srcIn,
|
|
|
|
|
shaderCallback: (bounds) {
|
|
|
|
|
return LinearGradient(
|
|
|
|
|
colors: TColor.primaryG,
|
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
|
end: Alignment.centerRight)
|
|
|
|
|
.createShader(Rect.fromLTRB(
|
|
|
|
|
0, 0, bounds.width, bounds.height));
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
"ex : objectif",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.white.withOpacity(0.7),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Mis à jour en temps réel",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.gray,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: waterArr.map((wObj) {
|
|
|
|
|
var isLast = wObj == waterArr.last;
|
|
|
|
|
return Row(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin:
|
|
|
|
|
const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 4),
|
|
|
|
|
width: 10,
|
|
|
|
|
height: 10,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: TColor.secondaryColor1
|
|
|
|
|
.withOpacity(0.5),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.circular(5),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (!isLast)
|
|
|
|
|
DottedDashedLine(
|
|
|
|
|
height: media.width * 0.078,
|
|
|
|
|
width: 0,
|
|
|
|
|
dashColor: TColor
|
|
|
|
|
.secondaryColor1
|
|
|
|
|
.withOpacity(0.5),
|
|
|
|
|
axis: Axis.vertical)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 10,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
wObj["title"].toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.gray,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
ShaderMask(
|
|
|
|
|
blendMode: BlendMode.srcIn,
|
|
|
|
|
shaderCallback: (bounds) {
|
|
|
|
|
return LinearGradient(
|
|
|
|
|
colors:
|
|
|
|
|
TColor.secondaryG,
|
|
|
|
|
begin: Alignment
|
|
|
|
|
.centerLeft,
|
|
|
|
|
end: Alignment
|
|
|
|
|
.centerRight)
|
|
|
|
|
.createShader(Rect.fromLTRB(
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
bounds.width,
|
|
|
|
|
bounds.height));
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
wObj["subtitle"].toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.white
|
|
|
|
|
.withOpacity(0.7),
|
|
|
|
|
fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: double.maxFinite,
|
|
|
|
|
height: media.width * 0.45,
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 25, horizontal: 20),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(25),
|
|
|
|
|
boxShadow: const [
|
|
|
|
|
BoxShadow(color: Colors.black12, blurRadius: 2)
|
|
|
|
|
]),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Graph 4",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
ShaderMask(
|
|
|
|
|
blendMode: BlendMode.srcIn,
|
|
|
|
|
shaderCallback: (bounds) {
|
|
|
|
|
return LinearGradient(
|
|
|
|
|
colors: TColor.primaryG,
|
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
|
end: Alignment.centerRight)
|
|
|
|
|
.createShader(Rect.fromLTRB(
|
|
|
|
|
0, 0, bounds.width, bounds.height));
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
"durée",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.white.withOpacity(0.7),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Spacer(),
|
|
|
|
|
Image.asset("assets/img/sleep_graph.png",
|
|
|
|
|
width: double.maxFinite,
|
|
|
|
|
height: 80,
|
|
|
|
|
fit: BoxFit.fitWidth)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.maxFinite,
|
|
|
|
|
height: media.width * 0.45,
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 25, horizontal: 20),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: BorderRadius.circular(25),
|
|
|
|
|
boxShadow: const [
|
|
|
|
|
BoxShadow(color: Colors.black12, blurRadius: 2)
|
|
|
|
|
]),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Calories",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
ShaderMask(
|
|
|
|
|
blendMode: BlendMode.srcIn,
|
|
|
|
|
shaderCallback: (bounds) {
|
|
|
|
|
return LinearGradient(
|
|
|
|
|
colors: TColor.primaryG,
|
|
|
|
|
begin: Alignment.centerLeft,
|
|
|
|
|
end: Alignment.centerRight)
|
|
|
|
|
.createShader(Rect.fromLTRB(
|
|
|
|
|
0, 0, bounds.width, bounds.height));
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
"760 kCal",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.white.withOpacity(0.7),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 14),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const Spacer(),
|
|
|
|
|
Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
width: media.width * 0.2,
|
|
|
|
|
height: media.width * 0.2,
|
|
|
|
|
child: Stack(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: media.width * 0.15,
|
|
|
|
|
height: media.width * 0.15,
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
colors: TColor.primaryG),
|
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
|
media.width * 0.075),
|
|
|
|
|
),
|
|
|
|
|
child: FittedBox(
|
|
|
|
|
child: Text(
|
|
|
|
|
"230kCal\nrestantes",
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.white,
|
|
|
|
|
fontSize: 11),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SimpleCircularProgressBar(
|
|
|
|
|
progressStrokeWidth: 10,
|
|
|
|
|
backStrokeWidth: 10,
|
|
|
|
|
progressColors: TColor.primaryG,
|
|
|
|
|
backColor: Colors.grey.shade100,
|
|
|
|
|
valueNotifier: ValueNotifier(50),
|
|
|
|
|
startAngle: -180,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.1,
|
|
|
|
|
),
|
|
|
|
|
const LigneContainerStats("1", "2", "3", "s", "s", "s"),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"graph 5",
|
|
|
|
|
"Rythme cardique et vitesse",
|
|
|
|
|
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(
|
|
|
|
@ -778,7 +382,7 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
List<int> spotIndexes) {
|
|
|
|
|
return spotIndexes.map((index) {
|
|
|
|
|
return TouchedSpotIndicatorData(
|
|
|
|
|
FlLine(
|
|
|
|
|
const FlLine(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
FlDotData(
|
|
|
|
@ -801,7 +405,7 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
getTooltipItems: (List<LineBarSpot> lineBarsSpot) {
|
|
|
|
|
return lineBarsSpot.map((lineBarSpot) {
|
|
|
|
|
return LineTooltipItem(
|
|
|
|
|
"il y a ${lineBarSpot.x.toInt()} minutes",
|
|
|
|
|
"Seconde ${lineBarSpot.x.toInt() / 10} ",
|
|
|
|
|
const TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 10,
|
|
|
|
@ -813,15 +417,13 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
lineBarsData: lineBarsData1,
|
|
|
|
|
minY: -0.5,
|
|
|
|
|
minY: 0,
|
|
|
|
|
maxY: 110,
|
|
|
|
|
titlesData: FlTitlesData(
|
|
|
|
|
show: true,
|
|
|
|
|
leftTitles: AxisTitles(),
|
|
|
|
|
topTitles: AxisTitles(),
|
|
|
|
|
bottomTitles: AxisTitles(
|
|
|
|
|
sideTitles: bottomTitles,
|
|
|
|
|
),
|
|
|
|
|
leftTitles: const AxisTitles(),
|
|
|
|
|
topTitles: const AxisTitles(),
|
|
|
|
|
bottomTitles: const AxisTitles(),
|
|
|
|
|
rightTitles: AxisTitles(
|
|
|
|
|
sideTitles: rightTitles,
|
|
|
|
|
)),
|
|
|
|
@ -859,12 +461,6 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void updateChartData(List<FlSpot> newData) {
|
|
|
|
|
setState(() {
|
|
|
|
|
allSpots = newData;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PieChartSectionData> showingSections() {
|
|
|
|
|
return List.generate(
|
|
|
|
|
2,
|
|
|
|
@ -922,17 +518,9 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
]),
|
|
|
|
|
barWidth: 4,
|
|
|
|
|
isStrokeCapRound: true,
|
|
|
|
|
dotData: FlDotData(show: false),
|
|
|
|
|
dotData: const FlDotData(show: false),
|
|
|
|
|
belowBarData: BarAreaData(show: false),
|
|
|
|
|
spots: const [
|
|
|
|
|
FlSpot(1, 35),
|
|
|
|
|
FlSpot(2, 70),
|
|
|
|
|
FlSpot(3, 40),
|
|
|
|
|
FlSpot(4, 80),
|
|
|
|
|
FlSpot(5, 25),
|
|
|
|
|
FlSpot(6, 70),
|
|
|
|
|
FlSpot(7, 35),
|
|
|
|
|
],
|
|
|
|
|
spots: vitesseSecondes,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
LineChartBarData get lineChartBarData1_2 => LineChartBarData(
|
|
|
|
@ -943,19 +531,11 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
]),
|
|
|
|
|
barWidth: 2,
|
|
|
|
|
isStrokeCapRound: true,
|
|
|
|
|
dotData: FlDotData(show: false),
|
|
|
|
|
dotData: const FlDotData(show: false),
|
|
|
|
|
belowBarData: BarAreaData(
|
|
|
|
|
show: false,
|
|
|
|
|
),
|
|
|
|
|
spots: const [
|
|
|
|
|
FlSpot(1, 80),
|
|
|
|
|
FlSpot(2, 50),
|
|
|
|
|
FlSpot(3, 90),
|
|
|
|
|
FlSpot(4, 40),
|
|
|
|
|
FlSpot(5, 80),
|
|
|
|
|
FlSpot(6, 35),
|
|
|
|
|
FlSpot(7, 60),
|
|
|
|
|
],
|
|
|
|
|
spots: bpmSecondes2,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
SideTitles get rightTitles => SideTitles(
|
|
|
|
@ -1000,7 +580,7 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
|
|
|
|
|
SideTitles get bottomTitles => SideTitles(
|
|
|
|
|
showTitles: true,
|
|
|
|
|
reservedSize: 32,
|
|
|
|
|
reservedSize: 50,
|
|
|
|
|
interval: 1,
|
|
|
|
|
getTitlesWidget: bottomTitleWidgets,
|
|
|
|
|
);
|
|
|
|
|