diff --git a/lib/common_widget/container/profile/profile_entete.dart b/lib/common_widget/container/profile/profile_entete.dart index f7d7464..b95d21e 100644 --- a/lib/common_widget/container/profile/profile_entete.dart +++ b/lib/common_widget/container/profile/profile_entete.dart @@ -53,14 +53,7 @@ class ProfileEntete extends StatelessWidget { type: RoundButtonType.bgGradient, fontSize: 12, fontWeight: FontWeight.w400, - onPressed: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => const ActivityTrackerView(), - // ), - // ); - }, + onPressed: () {}, ), ) ], diff --git a/lib/view/home/activity_tracker.dart b/lib/view/home/activity_tracker.dart deleted file mode 100644 index ad5abdd..0000000 --- a/lib/view/home/activity_tracker.dart +++ /dev/null @@ -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 createState() => _ActivityTrackerViewState(); -} - -class _ActivityTrackerViewState extends State { - 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( - 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 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 barColor, { - bool isTouched = false, - double width = 22, - List 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, - ); - } -} diff --git a/lib/view/ne_pas_supprimer/home_view.txt b/lib/view/ne_pas_supprimer/home_view.txt deleted file mode 100644 index 0cb05f6..0000000 --- a/lib/view/ne_pas_supprimer/home_view.txt +++ /dev/null @@ -1,1050 +0,0 @@ -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/modele/user.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'; - -class MobileHomeView extends StatefulWidget { - const MobileHomeView({super.key}); - - @override - State createState() => _MobileHomeView(); -} - -class _MobileHomeView extends State { - List bpmSecondes = [FlSpot(0, 30)]; - List bpmSecondes2 = []; - double calories = 0.0; - List vitesseSecondes = [FlSpot(0, 30)]; - List altitudeSecondes = [FlSpot(0, 30)]; - - TextEditingController bpmController = TextEditingController(); - - void normaliserDeuxiemeElement(List 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 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(context).listActivity[0].getHeartRateWithTime(); - vitesseSecondes = - Provider.of(context).listActivity[0].getSpeedWithTime(); - altitudeSecondes = - Provider.of(context).listActivity[0].getAltitudeWithTime(); - calories = double.parse( - Provider.of(context).listActivity[0].getTotalCalorie()); - - normaliserDeuxiemeElement(vitesseSecondes); - normaliserDeuxiemeElement(altitudeSecondes); - //bpmSecondes2 = List.from(bpmSecondes); - normaliserDeuxiemeElement(bpmSecondes); - - 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: FlDotData(show: false), - gradient: LinearGradient( - colors: TColor.secondaryG, - ), - ), - ]; - print("test5"); - - final tooltipsOnBar = lineBarsData[0]; - - return Scaffold( - backgroundColor: TColor.white, - body: SingleChildScrollView( - child: SafeArea( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 15), - 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, - )) - ], - ), - 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.w0, - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const ActivityTrackerView(), - ), - ); - }, - ), - ) - ], - ), - ), - SizedBox( - height: media.width * 0.05, - ), - Text( - "Status d'activité", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700), - ), - 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: 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 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 lineBarsSpot) { - return lineBarsSpot.map((lineBarSpot) { - bpmController.text = "${lineBarSpot.y} BPM"; - return LineTooltipItem( - "Seconde ${lineBarSpot.x.toInt() / 10}", - TextStyle( - color: Colors.white, - fontSize: 10, - fontWeight: FontWeight.bold, - ), - ); - }).toList(); - }, - ), - ), - lineBarsData: lineBarsData, - minY: 50, - maxY: 250, - titlesData: FlTitlesData( - show: false, - ), - gridData: FlGridData(show: false), - borderData: FlBorderData( - show: true, - border: Border.all( - color: Colors.transparent, - ), - ), - ), - ) - ], - ), - ), - ), - 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( - '${calories.toString()} 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( - '${200 - calories.toInt()} kCal\n restantes', - textAlign: TextAlign.center, - style: TextStyle( - color: TColor.white, - fontSize: 11), - ), - ), - ), - SimpleCircularProgressBar( - progressStrokeWidth: 10, - backStrokeWidth: 10, - progressColors: TColor.primaryG, - backColor: Colors.grey.shade100, - valueNotifier: ValueNotifier( - calories / 200 * 100), - startAngle: -180, - ), - ], - ), - ), - ) - ]), - ), - ], - )) - ], - ), - SizedBox( - height: media.width * 0.1, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Rythme cardique et vitesse", - style: TextStyle( - color: TColor.black, - fontSize: 16, - fontWeight: FontWeight.w700), - ), - ], - ), - SizedBox( - height: media.width * 0.05, - ), - 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 spotIndexes) { - return spotIndexes.map((index) { - return TouchedSpotIndicatorData( - 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 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: AxisTitles(), - topTitles: AxisTitles(), - bottomTitles: 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, - ), - ], - ), - ), - ), - ), - ); - } - - List 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 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: 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: 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, - ); - } -} diff --git a/lib/view/ne_pas_supprimer/map.txt b/lib/view/ne_pas_supprimer/map.txt deleted file mode 100644 index c1e6fa5..0000000 --- a/lib/view/ne_pas_supprimer/map.txt +++ /dev/null @@ -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 createState() => _MobileMyMaps(); -} - -class _MobileMyMaps extends State { - Completer _googleMapController = Completer(); - CameraPosition? _cameraPosition; - Location? _location; - LocationData? _currentLocation; - List _polylineCoordinates = []; - Set _polylines = {}; - Set _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())) - ], - ); - } -}