Skip to content

Offline gym log for Android. No account, no ads, no internet.

Edit logged sets by type and fill the workout progress bar

InlitXcf43e7a0e6bd
diff --git a/lib/screens/progress_screen.dart b/lib/screens/progress_screen.dart
index 115fbd9..61d7d44 100644
--- a/lib/screens/progress_screen.dart
+++ b/lib/screens/progress_screen.dart
@@ -55,6 +55,22 @@ class ProgressScreen extends StatelessWidget {
child: Text(t.progressTitle,
style: AppTheme.f(27, weight: FontWeight.w800, color: gc.text)),
),
+ if (fit.sessions.isNotEmpty) ...[
+ Semantics(
+ button: true,
+ label: sentenceCase(t.historyTitle),
+ child: GestureDetector(
+ onTap: fit.goHistory,
+ child: Container(
+ width: 38,
+ height: 38,
+ decoration: BoxDecoration(color: gc.bgRaised, shape: BoxShape.circle),
+ child: Icon(PhosphorIconsRegular.clockCounterClockwise, size: 17, color: gc.text),
+ ),
+ ),
+ ),
+ const SizedBox(width: 8),
+ ],
Semantics(
button: true,
label: t.share,
@@ -260,12 +276,20 @@ class ProgressScreen extends StatelessWidget {
],
),
const SizedBox(height: 14),
- Heatmap(
- levels: fit.heatmapWeeks,
- firstDay: fit.heatmapWeekDate(0),
- labels: fit.heatmapLabels,
- onTapDay: (i) => _showDay(context, i),
- ),
+ if (fit.heatmapYear)
+ HeatmapYear(
+ levels: fit.heatmapShown,
+ firstDay: fit.heatmapShownDate(0),
+ weekdays: fit.heatmapLabels,
+ onTapDay: (i) => _showDay(context, i),
+ )
+ else
+ Heatmap(
+ levels: fit.heatmapWeeks,
+ firstDay: fit.heatmapWeekDate(0),
+ labels: fit.heatmapLabels,
+ onTapDay: (i) => _showDay(context, i),
+ ),
const SizedBox(height: 14),
Row(children: [
Icon(PhosphorIconsFill.fire, size: 14, color: gc.accent),
@@ -493,14 +517,23 @@ class ProgressScreen extends StatelessWidget {
),
const SizedBox(width: 11),
Expanded(
- child: Text(t.timeline,
- style: AppTheme.d(14, weight: FontWeight.w600, color: gc.text, letterSpacing: 1)),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(t.timeline,
+ style: AppTheme.d(14, weight: FontWeight.w600, color: gc.text, letterSpacing: 1)),
+ if (last != null && left != null) ...[
+ const SizedBox(height: 3),
+ Text(fit.photoDue ? t.photoDueNow : t.photoNextIn(left),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: AppTheme.s(11.5,
+ weight: FontWeight.w600,
+ color: fit.photoDue ? gc.accent : gc.textTertiary)),
+ ],
+ ],
+ ),
),
- if (last != null && left != null)
- Text(fit.photoDue ? t.photoDueNow : t.photoNextIn(left),
- style: AppTheme.s(11.5,
- weight: FontWeight.w600,
- color: fit.photoDue ? gc.accent : gc.textTertiary)),
const SizedBox(width: 8),
Icon(PhosphorIconsRegular.caretRight, size: 15, color: gc.textTertiary),
],
@@ -560,11 +593,15 @@ class ProgressScreen extends StatelessWidget {
),
Expanded(
child: pair == null
- ? Text(t.compareNeedTwo,
- textAlign: TextAlign.center,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- style: AppTheme.s(11, weight: FontWeight.w500, color: gc.textTertiary))
+ ? Column(mainAxisSize: MainAxisSize.min, children: [
+ Text(t.compareNeedTwo,
+ textAlign: TextAlign.center,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: AppTheme.s(11, weight: FontWeight.w500, color: gc.textTertiary)),
+ const SizedBox(height: 4),
+ _hideShotsBtn(gc),
+ ])
: _hideShotsBtn(gc),
),
SizedBox(
@@ -653,6 +690,9 @@ class ProgressScreen extends StatelessWidget {
decoration: BoxDecoration(
color: gc.bgRaised2,
borderRadius: BorderRadius.circular(12),
+ ),
+ foregroundDecoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(12),
border: Border.all(color: gc.border),
),
clipBehavior: Clip.antiAlias,
@@ -664,12 +704,22 @@ class ProgressScreen extends StatelessWidget {
curve: Curves.easeOutCubic,
builder: (_, v, _) => Stack(
fit: StackFit.expand,
+ clipBehavior: Clip.none,
children: [
- ImageFiltered(
- imageFilter: ui.ImageFilter.blur(sigmaX: 14 * v, sigmaY: 14 * v, tileMode: TileMode.clamp),
- child: Image.file(File(path), fit: BoxFit.cover, gaplessPlayback: true,
- errorBuilder: (_, _, _) =>
- Icon(PhosphorIconsRegular.imageSquare, size: 16, color: gc.textTertiary)),
+ Positioned.fill(
+ left: -28 * v,
+ top: -28 * v,
+ right: -28 * v,
+ bottom: -28 * v,
+ child: ImageFiltered(
+ imageFilter: ui.ImageFilter.blur(sigmaX: 14 * v, sigmaY: 14 * v, tileMode: TileMode.mirror),
+ child: Transform.scale(
+ scale: 1 + 0.8 * v,
+ child: Image.file(File(path), fit: BoxFit.cover, gaplessPlayback: true,
+ errorBuilder: (_, _, _) =>
+ Icon(PhosphorIconsRegular.imageSquare, size: 16, color: gc.textTertiary)),
+ ),
+ ),
),
Opacity(
opacity: v,
@@ -743,7 +793,7 @@ class ProgressScreen extends StatelessWidget {
);
}
- void _showDay(BuildContext context, int index) => showDaySheet(context, fit.heatmapWeekDate(index));
+ void _showDay(BuildContext context, int index) => showDaySheet(context, fit.heatmapShownDate(index));
void _logBodyweight(BuildContext context) => showLogBodyweightSheet(context);
}
@@ -2089,6 +2139,33 @@ void showEditLoggedSheet(BuildContext context, LoggedSession s, LoggedExercise e
Widget _editSetRow(GymColors gc, LoggedSession s, LoggedExercise e, int i, bool repsOnly) {
final set = e.sets[i];
+ final distance = fit.loggedDistance(e);
+ final timed = !distance && fit.loggedTimed(e);
+ Widget cell(String label, String value, VoidCallback onDec, VoidCallback onInc, {double minWidth = 30}) => Expanded(
+ child: Column(
+ children: [
+ FittedBox(
+ fit: BoxFit.scaleDown,
+ child: Text(label,
+ maxLines: 1,
+ style: AppTheme.s(9.5, weight: FontWeight.w600, color: gc.textTertiary, letterSpacing: 1)),
+ ),
+ const SizedBox(height: 2),
+ StepperControl(
+ value: value,
+ onDec: onDec,
+ onInc: onInc,
+ minWidth: minWidth,
+ btnSize: 26,
+ gap: 8,
+ fontSize: 14,
+ ),
+ ],
+ ),
+ );
+ final time = cell(t.timeCol, durationLabel(set.sec ?? 0), () => fit.bumpLoggedSec(e, i, -1),
+ () => fit.bumpLoggedSec(e, i, 1),
+ minWidth: 40);
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
decoration: BoxDecoration(color: gc.bgRaised2, borderRadius: BorderRadius.circular(14)),
@@ -2098,44 +2175,21 @@ Widget _editSetRow(GymColors gc, LoggedSession s, LoggedExercise e, int i, bool
width: 22,
child: Text('${i + 1}', style: AppTheme.d(15, weight: FontWeight.w700, color: gc.text)),
),
- Expanded(
- child: Column(
- children: [
- Text(t.repsCol,
- style: AppTheme.s(9.5, weight: FontWeight.w600, color: gc.textTertiary, letterSpacing: 1)),
- const SizedBox(height: 2),
- StepperControl(
- value: '${set.reps}',
- onDec: () => fit.bumpLoggedReps(e, i, -1),
- onInc: () => fit.bumpLoggedReps(e, i, 1),
- minWidth: 30,
- btnSize: 26,
- gap: 8,
- fontSize: 14,
- ),
- ],
- ),
- ),
- if (!repsOnly)
- Expanded(
- child: Column(
- children: [
- Text(t.weightCol(fit.units.toUpperCase()),
- style:
- AppTheme.s(9.5, weight: FontWeight.w600, color: gc.textTertiary, letterSpacing: 1)),
- const SizedBox(height: 2),
- StepperControl(
- value: fit.weightValue(set.weight),
- onDec: () => fit.bumpLoggedWeight(e, i, -1),
- onInc: () => fit.bumpLoggedWeight(e, i, 1),
- minWidth: 34,
- btnSize: 26,
- gap: 8,
- fontSize: 14,
- ),
- ],
- ),
- ),
+ if (distance) ...[
+ cell(t.distanceCol(fit.distanceUnit).replaceAll(RegExp(r'\s*\(.*\)'), ''), fit.distanceValue(set.km ?? 0),
+ () => fit.bumpLoggedKm(e, i, -1), () => fit.bumpLoggedKm(e, i, 1),
+ minWidth: 36),
+ time,
+ ] else ...[
+ if (timed)
+ time
+ else
+ cell(t.repsCol, '${set.reps}', () => fit.bumpLoggedReps(e, i, -1), () => fit.bumpLoggedReps(e, i, 1)),
+ if (!repsOnly && (!timed || set.weight > 0))
+ cell(t.weightCol(fit.units.toUpperCase()), fit.weightValue(set.weight), () => fit.bumpLoggedWeight(e, i, -1),
+ () => fit.bumpLoggedWeight(e, i, 1),
+ minWidth: 34),
+ ],
Semantics(
button: true,
label: t.removeSet,
diff --git a/lib/screens/session_screen.dart b/lib/screens/session_screen.dart
index 53f394a..29026fd 100644
--- a/lib/screens/session_screen.dart
+++ b/lib/screens/session_screen.dart
@@ -23,6 +23,7 @@ import '../widgets/ruler_picker.dart';
import '../widgets/svg_icon.dart';
import '../widgets/timer_panel.dart';
import '../widgets/ui_kit.dart';
+import '../widgets/workout_notes.dart';
import 'exercises_screen.dart';
import 'tool_detail_screen.dart';
import 'share_sheet.dart';
@@ -172,7 +173,7 @@ class SessionScreen extends StatelessWidget {
label: t.addNote,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
- onTap: () => fit.openNoteEditor(exerciseId: ex?.id ?? ''),
+ onTap: () => ex == null ? fit.openNoteEditor() : showWorkoutNoteEditor(context, ex.id),
child: Container(
width: 46,
height: 46,
@@ -387,6 +388,11 @@ class SessionScreen extends StatelessWidget {
),
]),
),
+ if (fit.workoutNotesFor(ex.id).isNotEmpty)
+ Padding(
+ padding: const EdgeInsets.fromLTRB(8, 10, 8, 0),
+ child: _guard(locked, WorkoutNoteStrip(exerciseId: ex.id, onDark: true)),
+ ),
const SizedBox(height: 12),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 6),
@@ -481,7 +487,7 @@ class SessionScreen extends StatelessWidget {
}),
OptionItem(t.addNote, icon: PhosphorIconsRegular.notePencil, onTap: () {
Navigator.pop(sheet);
- fit.openNoteEditor(exerciseId: ex.id);
+ showWorkoutNoteEditor(context, ex.id);
}),
if (i > 0)
OptionItem(t.moveUp, icon: PhosphorIconsRegular.arrowUp, onTap: () {
@@ -809,6 +815,10 @@ class SessionScreen extends StatelessWidget {
),
],
]),
+ if (ex != null && fit.workoutNotesFor(ex.id).isNotEmpty) ...[
+ const SizedBox(height: 12),
+ WorkoutNoteStrip(exerciseId: ex.id, onDark: true),
+ ],
if (ex != null && fit.lastSummaryFor(ex.id) != null) ...[
const SizedBox(height: 10),
GestureDetector(
@@ -860,17 +870,7 @@ class SessionScreen extends StatelessWidget {
Row(children: [
for (var i = 0; i < n; i++) ...[
if (i > 0) SizedBox(width: n > 12 ? 2 : 4),
- Expanded(
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 320),
- curve: Curves.easeOutCubic,
- height: i == s.currentIndex ? 6 : 4,
- decoration: BoxDecoration(
- color: _stripColor(gc, s, i),
- borderRadius: BorderRadius.circular(3),
- ),
- ),
- ),
+ Expanded(child: _stripSegment(gc, s, i)),
],
]),
],
@@ -879,13 +879,31 @@ class SessionScreen extends StatelessWidget {
);
}
- Color _stripColor(GymColors gc, WorkoutSession s, int i) {
+ Widget _stripSegment(GymColors gc, WorkoutSession s, int i) {
final sets = s.exercises[i].sets;
- final done = sets.isNotEmpty && sets.every((st) => st.done);
- if (i == s.currentIndex) return done ? gc.sage : gc.ember;
- if (done) return gc.sage;
- if (sets.any((st) => st.done)) return Color.lerp(gc.bgRaised2, gc.sage, 0.45)!;
- return gc.bgRaised2;
+ final count = sets.where((st) => st.done).length;
+ final part = sets.isEmpty ? 0.0 : count / sets.length;
+ final current = i == s.currentIndex;
+ final fill = gc.sage;
+ final track = current || count > 0 ? Color.lerp(gc.bgRaised2, gc.sage, 0.3)! : gc.bgRaised2;
+ return AnimatedContainer(
+ duration: const Duration(milliseconds: 320),
+ curve: Curves.easeOutCubic,
+ height: current ? 6 : 4,
+ clipBehavior: Clip.antiAlias,
+ decoration: BoxDecoration(color: track, borderRadius: BorderRadius.circular(3)),
+ child: TweenAnimationBuilder<double>(
+ tween: Tween(end: part),
+ duration: const Duration(milliseconds: 380),
+ curve: Curves.easeOutCubic,
+ builder: (_, v, _) => FractionallySizedBox(
+ alignment: AlignmentDirectional.centerStart,
+ widthFactor: v.clamp(0.0, 1.0),
+ heightFactor: 1,
+ child: ColoredBox(color: fill),
+ ),
+ ),
+ );
}
Widget _swipeToDelete(BuildContext context, GymColors gc, int exIdx, int j, SessionSet st,
@@ -951,7 +969,8 @@ class SessionScreen extends StatelessWidget {
);
if (target.up) return Text.rich(main);
final holdStyle = AppTheme.f(11.5, weight: FontWeight.w400, color: gc.textTertiary);
- final both = TextSpan(children: [main, TextSpan(text: ' · ${t.nextHold}', style: holdStyle)]);
+ final why = target.deload ? t.nextDeload(fit.stallStreak(id)) : t.nextHold;
+ final both = TextSpan(children: [main, TextSpan(text: ' · $why', style: holdStyle)]);
final painter = TextPainter(
text: both,
textDirection: Directionality.of(context),
@@ -966,7 +985,7 @@ class SessionScreen extends StatelessWidget {
children: [
Text.rich(main),
const SizedBox(height: 2),
- Text(t.nextHold, style: holdStyle),
+ Text(why, style: holdStyle),
],
);
}),