|
|
|
@ -1,16 +1,12 @@
|
|
|
|
|
import 'package:dotted_dashed_line/dotted_dashed_line.dart';
|
|
|
|
|
import 'package:fl_chart/fl_chart.dart';
|
|
|
|
|
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_widget/container/ligne_container_stats.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/common_widget/graph/bpm_and_speed_by_time.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/common_widget/graph/bpm_by_time.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/common_widget/other/entete_home_view.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/view/home/activity_tracker.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/view/home/notification_view.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/modele/utile/home_view/data_home_view.dart';
|
|
|
|
|
import 'package:smartfit_app_mobile/modele/utile/home_view/home_view_util.dart';
|
|
|
|
|
|
|
|
|
|
class MobileHomeView extends StatefulWidget {
|
|
|
|
|
const MobileHomeView({super.key});
|
|
|
|
@ -20,103 +16,14 @@ class MobileHomeView extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
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)];
|
|
|
|
|
|
|
|
|
|
late DataHomeView data;
|
|
|
|
|
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 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"},
|
|
|
|
|
{"title": "9am - 11am", "subtitle": "500ml"},
|
|
|
|
|
{"title": "11am - 2pm", "subtitle": "1000ml"},
|
|
|
|
|
{"title": "2pm - 4pm", "subtitle": "700ml"},
|
|
|
|
|
{"title": "4pm - now", "subtitle": "900ml"},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
var media = MediaQuery.of(context).size;
|
|
|
|
|
|
|
|
|
|
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(
|
|
|
|
|
spots: 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,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
final tooltipsOnBar = lineBarsData[0];
|
|
|
|
|
data = HomeViewUtil().initData(context);
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: TColor.white,
|
|
|
|
@ -127,42 +34,7 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Bienvenue,",
|
|
|
|
|
style: TextStyle(color: TColor.gray, fontSize: 12),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Benjelloun Othmane",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
IconButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => const NotificationView(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
icon: Image.asset(
|
|
|
|
|
"assets/img/notification_active.png",
|
|
|
|
|
width: 25,
|
|
|
|
|
height: 25,
|
|
|
|
|
fit: BoxFit.fitHeight,
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const EnteteHomeView(),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
@ -176,147 +48,7 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.02,
|
|
|
|
|
),
|
|
|
|
|
ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.circular(25),
|
|
|
|
|
child: Container(
|
|
|
|
|
height: media.width * 0.4,
|
|
|
|
|
width: double.maxFinite,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: TColor.primaryColor2.withOpacity(0.3),
|
|
|
|
|
borderRadius: BorderRadius.circular(25),
|
|
|
|
|
),
|
|
|
|
|
child: Stack(
|
|
|
|
|
alignment: Alignment.topLeft,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
|
vertical: 20, horizontal: 20),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Rythme cardiaque",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: TColor.black,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
),
|
|
|
|
|
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
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
LineChart(
|
|
|
|
|
LineChartData(
|
|
|
|
|
showingTooltipIndicators:
|
|
|
|
|
showingTooltipOnSpots.map((index) {
|
|
|
|
|
return ShowingTooltipIndicators([
|
|
|
|
|
LineBarSpot(
|
|
|
|
|
tooltipsOnBar,
|
|
|
|
|
lineBarsData.indexOf(tooltipsOnBar),
|
|
|
|
|
tooltipsOnBar.spots[index],
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
}).toList(),
|
|
|
|
|
lineTouchData: LineTouchData(
|
|
|
|
|
enabled: true,
|
|
|
|
|
handleBuiltInTouches: false,
|
|
|
|
|
touchCallback: (FlTouchEvent event,
|
|
|
|
|
LineTouchResponse? response) {
|
|
|
|
|
if (response == null ||
|
|
|
|
|
response.lineBarSpots == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (event is FlTapUpEvent) {
|
|
|
|
|
final spotIndex =
|
|
|
|
|
response.lineBarSpots!.first.spotIndex;
|
|
|
|
|
showingTooltipOnSpots.clear();
|
|
|
|
|
setState(() {
|
|
|
|
|
showingTooltipOnSpots.add(spotIndex);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mouseCursorResolver: (FlTouchEvent event,
|
|
|
|
|
LineTouchResponse? response) {
|
|
|
|
|
if (response == null ||
|
|
|
|
|
response.lineBarSpots == null) {
|
|
|
|
|
return SystemMouseCursors.basic;
|
|
|
|
|
}
|
|
|
|
|
return SystemMouseCursors.click;
|
|
|
|
|
},
|
|
|
|
|
getTouchedSpotIndicator:
|
|
|
|
|
(LineChartBarData barData,
|
|
|
|
|
List<int> spotIndexes) {
|
|
|
|
|
return spotIndexes.map((index) {
|
|
|
|
|
return TouchedSpotIndicatorData(
|
|
|
|
|
FlLine(
|
|
|
|
|
color: TColor.secondaryColor1,
|
|
|
|
|
),
|
|
|
|
|
FlDotData(
|
|
|
|
|
show: true,
|
|
|
|
|
getDotPainter:
|
|
|
|
|
(spot, percent, barData, index) =>
|
|
|
|
|
FlDotCirclePainter(
|
|
|
|
|
radius: 3,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
strokeWidth: 3,
|
|
|
|
|
strokeColor: TColor.secondaryColor1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
touchTooltipData: LineTouchTooltipData(
|
|
|
|
|
tooltipBgColor: TColor.secondaryColor1,
|
|
|
|
|
tooltipRoundedRadius: 20,
|
|
|
|
|
getTooltipItems:
|
|
|
|
|
(List<LineBarSpot> lineBarsSpot) {
|
|
|
|
|
return lineBarsSpot.map((lineBarSpot) {
|
|
|
|
|
bpmController.text = "${lineBarSpot.y} BPM";
|
|
|
|
|
return LineTooltipItem(
|
|
|
|
|
"Seconde ${lineBarSpot.x.toInt() / 10}",
|
|
|
|
|
const TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
lineBarsData: lineBarsData,
|
|
|
|
|
minY: 50,
|
|
|
|
|
maxY: 250,
|
|
|
|
|
titlesData: const FlTitlesData(
|
|
|
|
|
show: false,
|
|
|
|
|
),
|
|
|
|
|
gridData: const FlGridData(show: false),
|
|
|
|
|
borderData: FlBorderData(
|
|
|
|
|
show: true,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
GraphBpmByTime(media, data),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
@ -336,123 +68,16 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
GraphBpmAndSpeedByTime(media, data),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
const LigneContainerStats("1", "2", "3", "s", "s", "s"),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 15),
|
|
|
|
|
height: media.width * 0.5,
|
|
|
|
|
width: double.maxFinite,
|
|
|
|
|
child: LineChart(
|
|
|
|
|
LineChartData(
|
|
|
|
|
showingTooltipIndicators:
|
|
|
|
|
showingTooltipOnSpots.map((index) {
|
|
|
|
|
return ShowingTooltipIndicators([
|
|
|
|
|
LineBarSpot(
|
|
|
|
|
tooltipsOnBar,
|
|
|
|
|
lineBarsData.indexOf(tooltipsOnBar),
|
|
|
|
|
tooltipsOnBar.spots[index],
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
}).toList(),
|
|
|
|
|
lineTouchData: LineTouchData(
|
|
|
|
|
enabled: true,
|
|
|
|
|
handleBuiltInTouches: false,
|
|
|
|
|
touchCallback: (FlTouchEvent event,
|
|
|
|
|
LineTouchResponse? response) {
|
|
|
|
|
if (response == null ||
|
|
|
|
|
response.lineBarSpots == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (event is FlTapUpEvent) {
|
|
|
|
|
final spotIndex =
|
|
|
|
|
response.lineBarSpots!.first.spotIndex;
|
|
|
|
|
showingTooltipOnSpots.clear();
|
|
|
|
|
setState(() {
|
|
|
|
|
showingTooltipOnSpots.add(spotIndex);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mouseCursorResolver: (FlTouchEvent event,
|
|
|
|
|
LineTouchResponse? response) {
|
|
|
|
|
if (response == null ||
|
|
|
|
|
response.lineBarSpots == null) {
|
|
|
|
|
return SystemMouseCursors.basic;
|
|
|
|
|
}
|
|
|
|
|
return SystemMouseCursors.click;
|
|
|
|
|
},
|
|
|
|
|
getTouchedSpotIndicator: (LineChartBarData barData,
|
|
|
|
|
List<int> spotIndexes) {
|
|
|
|
|
return spotIndexes.map((index) {
|
|
|
|
|
return TouchedSpotIndicatorData(
|
|
|
|
|
const FlLine(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
FlDotData(
|
|
|
|
|
show: true,
|
|
|
|
|
getDotPainter:
|
|
|
|
|
(spot, percent, barData, index) =>
|
|
|
|
|
FlDotCirclePainter(
|
|
|
|
|
radius: 3,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
strokeWidth: 3,
|
|
|
|
|
strokeColor: TColor.secondaryColor1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
touchTooltipData: LineTouchTooltipData(
|
|
|
|
|
tooltipBgColor: TColor.secondaryColor1,
|
|
|
|
|
tooltipRoundedRadius: 20,
|
|
|
|
|
getTooltipItems: (List<LineBarSpot> lineBarsSpot) {
|
|
|
|
|
return lineBarsSpot.map((lineBarSpot) {
|
|
|
|
|
return LineTooltipItem(
|
|
|
|
|
"Seconde ${lineBarSpot.x.toInt() / 10} ",
|
|
|
|
|
const TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
lineBarsData: lineBarsData1,
|
|
|
|
|
minY: 0,
|
|
|
|
|
maxY: 110,
|
|
|
|
|
titlesData: FlTitlesData(
|
|
|
|
|
show: true,
|
|
|
|
|
leftTitles: const AxisTitles(),
|
|
|
|
|
topTitles: const AxisTitles(),
|
|
|
|
|
bottomTitles: const AxisTitles(),
|
|
|
|
|
rightTitles: AxisTitles(
|
|
|
|
|
sideTitles: rightTitles,
|
|
|
|
|
)),
|
|
|
|
|
gridData: FlGridData(
|
|
|
|
|
show: true,
|
|
|
|
|
drawHorizontalLine: true,
|
|
|
|
|
horizontalInterval: 25,
|
|
|
|
|
drawVerticalLine: false,
|
|
|
|
|
getDrawingHorizontalLine: (value) {
|
|
|
|
|
return FlLine(
|
|
|
|
|
color: TColor.gray.withOpacity(0.15),
|
|
|
|
|
strokeWidth: 2,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
borderData: FlBorderData(
|
|
|
|
|
show: true,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.05,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: media.width * 0.1,
|
|
|
|
|
),
|
|
|
|
|
child: LineChart(LineChartData()))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -460,168 +85,4 @@ class _MobileHomeView extends State<MobileHomeView> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PieChartSectionData> showingSections() {
|
|
|
|
|
return List.generate(
|
|
|
|
|
2,
|
|
|
|
|
(i) {
|
|
|
|
|
var color0 = TColor.secondaryColor1;
|
|
|
|
|
|
|
|
|
|
switch (i) {
|
|
|
|
|
case 0:
|
|
|
|
|
return PieChartSectionData(
|
|
|
|
|
color: color0,
|
|
|
|
|
value: 33,
|
|
|
|
|
title: '',
|
|
|
|
|
radius: 55,
|
|
|
|
|
titlePositionPercentageOffset: 0.55,
|
|
|
|
|
badgeWidget: const Text(
|
|
|
|
|
"20,1",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
|
));
|
|
|
|
|
case 1:
|
|
|
|
|
return PieChartSectionData(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
value: 75,
|
|
|
|
|
title: '',
|
|
|
|
|
radius: 45,
|
|
|
|
|
titlePositionPercentageOffset: 0.55,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
throw Error();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LineTouchData get lineTouchData1 => LineTouchData(
|
|
|
|
|
handleBuiltInTouches: true,
|
|
|
|
|
touchTooltipData: LineTouchTooltipData(
|
|
|
|
|
tooltipBgColor: Colors.blueGrey.withOpacity(0.8),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
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: 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: bpmSecondes2,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
SideTitles get rightTitles => SideTitles(
|
|
|
|
|
getTitlesWidget: rightTitleWidgets,
|
|
|
|
|
showTitles: true,
|
|
|
|
|
interval: 20,
|
|
|
|
|
reservedSize: 40,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SideTitles get bottomTitles => SideTitles(
|
|
|
|
|
showTitles: true,
|
|
|
|
|
reservedSize: 50,
|
|
|
|
|
interval: 1,
|
|
|
|
|
getTitlesWidget: bottomTitleWidgets,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Widget bottomTitleWidgets(double value, TitleMeta meta) {
|
|
|
|
|
var style = TextStyle(
|
|
|
|
|
color: TColor.gray,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
);
|
|
|
|
|
Widget text;
|
|
|
|
|
switch (value.toInt()) {
|
|
|
|
|
case 1:
|
|
|
|
|
text = Text('Dim', style: style);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
text = Text('Lun', style: style);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
text = Text('Mar', style: style);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
text = Text('Mer', style: style);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
text = Text('Jeu', style: style);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
text = Text('Ven', style: style);
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
text = Text('Sam', style: style);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
text = Text('', style: style);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SideTitleWidget(
|
|
|
|
|
axisSide: meta.axisSide,
|
|
|
|
|
space: 10,
|
|
|
|
|
child: text,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|