diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 45e26795..7c2e595c 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -155,18 +155,6 @@ "@reps": { "description": "Shorthand for repetitions, used when space constraints are tighter" }, - "eight_reps": "8", - "@reps": { - "description": "Shorthand for 8 repetitions, used when space constraints are tighter" - }, - "ten_reps": "10", - "@reps": { - "description": "Shorthand for 10 repetitions, used when space constraints are tighter" - }, - "twelve_reps": "12", - "@reps": { - "description": "Shorthand for 12 repetitions, used when space constraints are tighter" - }, "rir": "RiR", "@rir": { "description": "Shorthand for Repetitions In Reserve" diff --git a/lib/widgets/measurements/charts.dart b/lib/widgets/measurements/charts.dart index 65cee152..fdbae75f 100644 --- a/lib/widgets/measurements/charts.dart +++ b/lib/widgets/measurements/charts.dart @@ -159,6 +159,7 @@ class Indicator extends StatelessWidget { required this.text, required this.isSquare, this.size = 16, + this.marginRight = 15, this.textColor, }); @@ -166,6 +167,7 @@ class Indicator extends StatelessWidget { final String text; final bool isSquare; final double size; + final double marginRight; final Color? textColor; @override @@ -188,7 +190,10 @@ class Indicator extends StatelessWidget { style: TextStyle( color: textColor, ), - ) + ), + SizedBox( + width: marginRight, + ), ], ); } diff --git a/lib/widgets/workouts/log.dart b/lib/widgets/workouts/log.dart index dd136408..0ca46332 100644 --- a/lib/widgets/workouts/log.dart +++ b/lib/widgets/workouts/log.dart @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; @@ -39,20 +38,51 @@ class ExerciseLogChart extends StatelessWidget { Widget build(BuildContext context) { final workoutPlansData = Provider.of(context, listen: false); final workout = workoutPlansData.currentPlan; + var colors = generateChartColors(1).iterator; Future> getChartEntries(BuildContext context) async { return workoutPlansData.fetchLogData(workout!, _base); } return FutureBuilder( - future: getChartEntries(context), - builder: (context, AsyncSnapshot> snapshot) => SizedBox( - height: 190, - child: snapshot.connectionState == ConnectionState.waiting - ? const Center(child: CircularProgressIndicator()) - : LogChartWidgetFl(snapshot.data!, _currentDate), - ), - ); + future: getChartEntries(context), + builder: (context, AsyncSnapshot> snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + colors = generateChartColors(snapshot.data!['chart_data'].length).iterator; + } + + return SizedBox( + height: 260, + child: snapshot.connectionState == ConnectionState.waiting + ? const Center(child: CircularProgressIndicator()) + : Column( + mainAxisSize: MainAxisSize.max, + children: [ + LogChartWidgetFl(snapshot.data!, _currentDate), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...snapshot.data!['chart_data'].map((e) { + // e is the list of logs with the same reps, so we can just take the + // first entry and read the reps from it. Yes, this is an amazingly ugly hack + final reps = e.first['reps']; + + colors.moveNext(); + return Indicator( + color: colors.current, + text: reps.toString(), + isSquare: false, + ); + }).toList(), + ], + ), + const SizedBox( + height: 15, + ) + ], + ), + ); + }); } } @@ -112,35 +142,6 @@ class _DayLogWidgetState extends State { ) .toList(), ExerciseLogChart(base, widget._date), - Padding( - padding: const EdgeInsets.all(30.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Indicator( - color: LIST_OF_COLORS3[0], - text: AppLocalizations.of(context).eight_reps, - isSquare: false, - ), - const SizedBox( - width: 15, - ), - Indicator( - color: LIST_OF_COLORS3[1], - text: AppLocalizations.of(context).ten_reps, - isSquare: false, - ), - const SizedBox( - width: 15, - ), - Indicator( - color: LIST_OF_COLORS3[2], - text: AppLocalizations.of(context).twelve_reps, - isSquare: false, - ), - ], - ), - ), ], ); }).toList()