Skip to content

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

Own progressions in routines and a smoother routine editor

InlitXd1f40b16a6a0
diff --git a/lib/screens/ladder_sheet.dart b/lib/screens/ladder_sheet.dart
new file mode 100644
index 0000000..561eb9a
--- /dev/null
+++ b/lib/screens/ladder_sheet.dart
@@ -0,0 +1,276 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:phosphoricons_flutter/phosphoricons_flutter.dart';
+
+import '../l10n/l10n.dart';
+import '../models/exercise.dart';
+import '../models/workout.dart';
+import '../state/fit_state.dart';
+import '../theme/app_colors.dart';
+import '../theme/app_theme.dart';
+import '../widgets/exercise_media.dart';
+import '../widgets/glass.dart';
+import '../widgets/ui_kit.dart';
+
+Future<void> showLadderSheet(BuildContext context, String routineId, Exercise ex) => showAppSheet<void>(
+ context: context,
+ isScrollControlled: true,
+ backgroundColor: Colors.transparent,
+ builder: (_) => _LadderSheet(routineId: routineId, ex: ex),
+ );
+
+class _LadderSheet extends StatefulWidget {
+ const _LadderSheet({required this.routineId, required this.ex});
+
+ final String routineId;
+ final Exercise ex;
+
+ @override
+ State<_LadderSheet> createState() => _LadderSheetState();
+}
+
+class _LadderSheetState extends State<_LadderSheet> {
+ late final Routine? _routine = fit.routineById(widget.routineId);
+ late List<String> _steps = [
+ ...?fit.ladderIn(_routine, widget.ex.id) ?? fit.builtInLadder(widget.ex.id),
+ ];
+ late bool _own = fit.ladderIn(_routine, widget.ex.id) != null;
+
+ @override
+ void initState() {
+ super.initState();
+ if (_steps.isEmpty) _steps = [widget.ex.id];
+ }
+
+ void _commit(List<String> next) {
+ HapticFeedback.selectionClick();
+ setState(() {
+ _steps = next;
+ _own = true;
+ });
+ fit.setLadder(widget.routineId, widget.ex.id, next);
+ }
+
+ Future<void> _add() async {
+ final picked = await _pickStep(context, widget.ex, _steps);
+ if (picked == null || !mounted) return;
+ _commit([..._steps, picked.id]);
+ }
+
+ void _clear() {
+ HapticFeedback.selectionClick();
+ fit.setLadder(widget.routineId, widget.ex.id, const []);
+ setState(() {
+ _steps = [...fit.builtInLadder(widget.ex.id) ?? [widget.ex.id]];
+ _own = false;
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final gc = context.gc;
+ final current = _steps.indexOf(widget.ex.id);
+ return Container(
+ padding: sheetPad(context),
+ constraints: BoxConstraints(maxHeight: MediaQuery.sizeOf(context).height * 0.9),
+ decoration: BoxDecoration(
+ color: gc.bgRaised,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ const SheetHandle(),
+ const SizedBox(height: 18),
+ Row(children: [
+ Icon(PhosphorIconsFill.stairs, size: 17, color: gc.sage),
+ const SizedBox(width: 8),
+ Expanded(child: Text(t.ladderTitle, style: AppTheme.f(19, weight: FontWeight.w800, color: gc.text))),
+ ]),
+ const SizedBox(height: 6),
+ Text(_own || _steps.length < 2 ? t.ladderHint : t.ladderBuiltIn,
+ style: AppTheme.f(12.5, weight: FontWeight.w500, color: gc.textSecondary, height: 1.4)),
+ const SizedBox(height: 14),
+ Flexible(
+ child: ReorderableListView.builder(
+ shrinkWrap: true,
+ buildDefaultDragHandles: false,
+ itemCount: _steps.length,
+ proxyDecorator: (child, _, _) => Material(color: Colors.transparent, child: child),
+ onReorder: (from, to) {
+ final next = [..._steps];
+ if (to > from) to -= 1;
+ next.insert(to, next.removeAt(from));
+ _commit(next);
+ },
+ itemBuilder: (context, i) => _row(gc, i, current),
+ ),
+ ),
+ const SizedBox(height: 10),
+ GhostButton(label: t.ladderAdd, icon: PhosphorIconsRegular.plus, onTap: _add),
+ if (_own)
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: _clear,
+ child: Container(
+ height: 44,
+ alignment: Alignment.center,
+ child: Text(t.ladderClear, style: AppTheme.f(13, weight: FontWeight.w600, color: gc.accent)),
+ ),
+ )
+ else
+ const SizedBox(height: 12),
+ PrimaryButton(label: t.done, onTap: () => Navigator.of(context).pop()),
+ ],
+ ),
+ );
+ }
+
+ Widget _row(GymColors gc, int i, int current) {
+ final id = _steps[i];
+ final ex = fit.exerciseById(id);
+ final here = id == widget.ex.id;
+ final passed = i < current;
+ return Padding(
+ key: ValueKey(id),
+ padding: const EdgeInsets.only(bottom: 8),
+ child: Container(
+ padding: const EdgeInsets.fromLTRB(10, 8, 4, 8),
+ decoration: BoxDecoration(
+ color: here ? gc.sageSoft : gc.bgRaised2,
+ borderRadius: BorderRadius.circular(16),
+ ),
+ child: Row(children: [
+ Container(
+ width: 24,
+ height: 24,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: here ? gc.sage : (passed ? gc.mutedFill : gc.bgRaised),
+ shape: BoxShape.circle,
+ ),
+ child: passed
+ ? Icon(PhosphorIconsBold.check, size: 11, color: gc.textSecondary)
+ : Text('${i + 1}',
+ style: AppTheme.f(11, weight: FontWeight.w800, color: here ? gc.onEmber : gc.textSecondary)),
+ ),
+ const SizedBox(width: 10),
+ if (ex != null) ...[
+ SizedBox(width: 38, child: ExerciseMedia(ex: ex, height: 38, radius: 9)),
+ const SizedBox(width: 10),
+ ],
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(ex == null ? id : exerciseName(ex),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: AppTheme.f(13.5, weight: here ? FontWeight.w800 : FontWeight.w600, color: gc.text)),
+ if (here) ...[
+ const SizedBox(height: 2),
+ Text(t.ladderInRoutine.toUpperCase(),
+ style: AppTheme.f(9.5, weight: FontWeight.w700, color: gc.sage, letterSpacing: 1)),
+ ],
+ ]),
+ ),
+ if (!here)
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => _commit([..._steps]..removeAt(i)),
+ child: SizedBox(
+ width: 36,
+ height: 40,
+ child: Icon(PhosphorIconsRegular.x, size: 15, color: gc.textTertiary),
+ ),
+ ),
+ ReorderableDragStartListener(
+ index: i,
+ child: SizedBox(
+ width: 36,
+ height: 40,
+ child: Icon(PhosphorIconsRegular.dotsSixVertical, size: 18, color: gc.textTertiary),
+ ),
+ ),
+ ]),
+ ),
+ );
+ }
+}
+
+Future<Exercise?> _pickStep(BuildContext context, Exercise base, List<String> taken) {
+ final search = TextEditingController();
+ return showAppSheet<Exercise>(
+ context: context,
+ isScrollControlled: true,
+ backgroundColor: Colors.transparent,
+ builder: (sheet) => Padding(
+ padding: EdgeInsets.only(bottom: MediaQuery.viewInsetsOf(sheet).bottom),
+ child: StatefulBuilder(builder: (sheet, setSheet) {
+ final gc = sheet.gc;
+ final q = search.text.trim();
+ final list = [
+ for (final e in q.isEmpty
+ ? fit.allExercises.where((e) => e.primary == base.primary && !fit.isArchived(e.id))
+ : fit.trainSearchResults(q))
+ if (!taken.contains(e.id)) e,
+ ];
+ return Container(
+ padding: sheetPad(sheet),
+ constraints: BoxConstraints(maxHeight: MediaQuery.sizeOf(sheet).height * 0.82),
+ decoration: BoxDecoration(
+ color: gc.bgRaised,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ const SheetHandle(),
+ const SizedBox(height: 18),
+ Text(t.ladderPick, style: AppTheme.f(19, weight: FontWeight.w800, color: gc.text)),
+ const SizedBox(height: 12),
+ SearchField(
+ controller: search,
+ hint: t.searchExercises,
+ color: gc.bgRaised2,
+ onChanged: (_) => setSheet(() {}),
+ ),
+ const SizedBox(height: 12),
+ Flexible(
+ child: ListView.builder(
+ shrinkWrap: true,
+ itemCount: list.length,
+ itemBuilder: (_, i) {
+ final e = list[i];
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 8),
+ child: Pressable(
+ scale: 0.98,
+ onTap: () => Navigator.of(sheet).pop(e),
+ child: Container(
+ padding: const EdgeInsets.all(10),
+ decoration: BoxDecoration(color: gc.bgRaised2, borderRadius: BorderRadius.circular(14)),
+ child: Row(children: [
+ SizedBox(width: 40, child: ExerciseMedia(ex: e, height: 40, radius: 9)),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Text(exerciseName(e),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: AppTheme.f(13.5, weight: FontWeight.w600, color: gc.text)),
+ ),
+ Icon(PhosphorIconsRegular.plus, size: 15, color: gc.textSecondary),
+ ]),
+ ),
+ ),
+ );
+ },
+ ),
+ ),
+ ],
+ ),
+ );
+ }),
+ ),
+ );
+}
diff --git a/lib/screens/routine_edit_screen.dart b/lib/screens/routine_edit_screen.dart
index 1781949..b01262c 100644
--- a/lib/screens/routine_edit_screen.dart
+++ b/lib/screens/routine_edit_screen.dart
@@ -21,6 +21,7 @@ import '../widgets/svg_icon.dart';
import '../widgets/timer_panel.dart';
import '../widgets/ui_kit.dart';
import 'exercises_screen.dart';
+import 'ladder_sheet.dart';
import 'plan_import_sheet.dart';
class RoutineEditScreen extends StatefulWidget {
@@ -36,6 +37,7 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
TextEditingController(text: fit.activeRoutine?.name ?? '');
final TextEditingController _search = TextEditingController();
String _q = '';
+ late final Set<String> _seen = {...?fit.activeRoutine?.exerciseIds};
@override
void dispose() {
@@ -113,13 +115,22 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
],
),
),
- if (start) ...[
+ if (start)
const Positioned(left: 0, right: 0, bottom: 0, child: EdgeBlur(top: false, height: 112, sigma: 11, shade: 0.35)),
- Positioned(
- left: 20,
- right: 20,
- bottom: 16,
- child: Row(children: [
+ Positioned(
+ left: 20,
+ right: 20,
+ bottom: 16,
+ child: IgnorePointer(
+ ignoring: !start,
+ child: AnimatedSlide(
+ offset: start ? Offset.zero : const Offset(0, 1.6),
+ duration: const Duration(milliseconds: 340),
+ curve: start ? Curves.easeOutBack : Curves.easeInCubic,
+ child: AnimatedOpacity(
+ opacity: start ? 1 : 0,
+ duration: const Duration(milliseconds: 220),
+ child: Row(children: [
Expanded(
flex: 2,
child: Pressable(
@@ -147,8 +158,10 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
),
),
]),
+ ),
+ ),
),
- ],
+ ),
],
),
);
@@ -217,7 +230,8 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
Semantics(
button: true,
label: t.shareRoutine,
- child: GestureDetector(
+ child: Pressable(
+ scale: 0.85,
onTap: () => _shareIntro(routine),
child: Padding(
padding: const EdgeInsets.all(6),
@@ -229,7 +243,8 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
Semantics(
button: true,
label: t.duplicateRoutine,
- child: GestureDetector(
+ child: Pressable(
+ scale: 0.85,
onTap: () => fit.openRoutine(fit.duplicateRoutine(_id)),
child: Padding(
padding: const EdgeInsets.all(6),
@@ -238,7 +253,8 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
),
),
const SizedBox(width: 4),
- GestureDetector(
+ Pressable(
+ scale: 0.85,
onTap: _confirmDelete,
child: Padding(
padding: const EdgeInsets.all(6),
@@ -249,21 +265,21 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
const SizedBox(height: 18),
_colors(gc, routine),
const SizedBox(height: 22),
- Text(t.schedule, style: AppTheme.f(12, weight: FontWeight.w600, color: gc.textSecondary, letterSpacing: 1.5)),
- const SizedBox(height: 10),
+ _label(gc, t.schedule),
+ const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [for (int i = 0; i < 7; i++) _dayToggle(gc, i)],
),
const SizedBox(height: 18),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
+ Pressable(
+ scale: 0.98,
onTap: () => _pickGroup(routine),
child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 13),
decoration: BoxDecoration(
color: gc.bgRaised,
- borderRadius: BorderRadius.circular(14),
+ borderRadius: BorderRadius.circular(18),
),
child: Row(
children: [
@@ -282,8 +298,8 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
),
),
const SizedBox(height: 24),
- Text(t.exercisesWithCount(count), style: AppTheme.f(12, weight: FontWeight.w600, color: gc.textSecondary, letterSpacing: 1.5)),
- const SizedBox(height: 10),
+ _label(gc, t.exercisesWithCount(count)),
+ const SizedBox(height: 12),
if (routine.exerciseIds.isEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 6),
@@ -297,6 +313,12 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
);
}
+ Widget _label(GymColors gc, String text) => Padding(
+ padding: const EdgeInsets.only(left: 4),
+ child: Text(text.toUpperCase(),
+ style: AppTheme.f(10.5, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.4)),
+ );
+
Widget _chosenList(GymColors gc) {
final routine = fit.activeRoutine!;
final chosen = fit.routineExercises(routine);
@@ -395,9 +417,15 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
Widget _dayToggle(GymColors gc, int i) {
final weekday = fit.weekdayAt(i);
final on = fit.plannedOn(weekday, _id);
- return GestureDetector(
- onTap: () => fit.togglePlanDay(weekday, _id),
- child: Container(
+ return Pressable(
+ scale: 0.86,
+ onTap: () {
+ HapticFeedback.selectionClick();
+ fit.togglePlanDay(weekday, _id);
+ },
+ child: AnimatedContainer(
+ duration: const Duration(milliseconds: 220),
+ curve: Curves.easeOutCubic,
width: 38,
height: 38,
decoration: BoxDecoration(
@@ -405,8 +433,11 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
shape: BoxShape.circle,
),
alignment: Alignment.center,
- child: Text(t.weekdayInitial(weekday),
- style: AppTheme.f(14, weight: FontWeight.w700, color: on ? gc.onEmber : gc.textSecondary)),
+ child: AnimatedDefaultTextStyle(
+ duration: const Duration(milliseconds: 220),
+ style: AppTheme.f(14, weight: FontWeight.w700, color: on ? gc.onEmber : gc.textSecondary),
+ child: Text(t.weekdayInitial(weekday)),
+ ),
),
);
}
@@ -534,8 +565,11 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
final anyChain = [
for (var i = 0; i < routine.exerciseIds.length - 1; i++) fit.chainsToNext(routine, routine.exerciseIds[i]),
].any((x) => x);
- return Padding(
+ final fresh = _seen.add(ex.id);
+ return _GrowIn(
key: ValueKey(ex.id),
+ play: fresh,
+ child: Padding(
padding: EdgeInsets.only(bottom: linksNext ? 0 : 8),
child: Dismissible(
key: ValueKey('swipe-${ex.id}'),
@@ -545,7 +579,7 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
margin: EdgeInsets.only(bottom: linksNext ? 4 : 0),
alignment: Alignment.centerRight,
padding: const EdgeInsets.only(right: 22),
- decoration: BoxDecoration(color: gc.warn.withValues(alpha: 0.16), borderRadius: BorderRadius.circular(14)),
+ decoration: BoxDecoration(color: gc.warn.withValues(alpha: 0.16), borderRadius: BorderRadius.circular(18)),
child: Icon(PhosphorIconsFill.trash, size: 20, color: gc.warn),
),
child: IntrinsicHeight(
@@ -562,6 +596,7 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
),
),
),
+ ),
);
}
@@ -572,7 +607,7 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: gc.bgRaised,
- borderRadius: BorderRadius.circular(14),
+ borderRadius: BorderRadius.circular(18),
),
child: Row(children: [
ReorderableDragStartListener(
@@ -620,6 +655,11 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
Text(t.superset.toUpperCase(),
style: AppTheme.f(9.5, weight: FontWeight.w700, color: gc.brass, letterSpacing: 1)),
],
+ if (fit.ladderIn(routine, ex.id) case final ladder?) ...[
+ const SizedBox(height: 2),
+ Text('${t.ladderTitle} · ${ladder.indexOf(ex.id) + 1}/${ladder.length}'.toUpperCase(),
+ style: AppTheme.f(9.5, weight: FontWeight.w700, color: gc.sage, letterSpacing: 1)),
+ ],
const SizedBox(height: 2),
FittedBox(
fit: BoxFit.scaleDown,
@@ -663,12 +703,18 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
width: 38,
height: 44,
child: Center(
- child: Icon(
- routine.chained.contains(ex.id)
- ? PhosphorIconsFill.link
- : PhosphorIconsRegular.link,
- size: 17,
- color: routine.chained.contains(ex.id) ? gc.ember : gc.textTertiary,
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 240),
+ transitionBuilder: (child, a) => ScaleTransition(
+ scale: Tween(begin: 0.5, end: 1.0).animate(CurvedAnimation(parent: a, curve: Curves.easeOutBack)),
+ child: FadeTransition(opacity: a, child: child),
+ ),
+ child: Icon(
+ routine.chained.contains(ex.id) ? PhosphorIconsFill.link : PhosphorIconsRegular.link,
+ key: ValueKey(routine.chained.contains(ex.id)),
+ size: 17,
+ color: routine.chained.contains(ex.id) ? gc.ember : gc.textTertiary,
+ ),
),
),
),
@@ -696,17 +742,22 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
Widget _pickRow(GymColors gc, Exercise ex) {
final inRoutine = fit.routineHas(_id, ex.id);
- return GestureDetector(
- onTap: () => fit.toggleRoutineExercise(_id, ex.id),
+ return Pressable(
+ scale: 0.98,
+ onTap: () {
+ HapticFeedback.selectionClick();
+ fit.toggleRoutineExercise(_id, ex.id);
+ },
onLongPress: () => _preview(ex),
- behavior: HitTestBehavior.opaque,
- child: Container(
+ child: AnimatedContainer(
+ duration: const Duration(milliseconds: 220),
+ curve: Curves.easeOutCubic,
margin: const EdgeInsets.only(bottom: 8),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: gc.bgRaised,
- border: Border.all(color: inRoutine ? gc.ember : gc.border),
- borderRadius: BorderRadius.circular(14),
+ border: Border.all(color: inRoutine ? gc.ember.withValues(alpha: 0.75) : Colors.transparent),
+ borderRadius: BorderRadius.circular(18),
),
child: Row(children: [
GestureDetector(
@@ -724,7 +775,9 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
],
),
),
- Container(
+ AnimatedContainer(
+ duration: const Duration(milliseconds: 220),
+ curve: Curves.easeOutCubic,
width: 30,
height: 30,
decoration: BoxDecoration(
@@ -732,9 +785,19 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
shape: BoxShape.circle,
border: Border.all(color: inRoutine ? gc.ember : gc.border, width: 2),
),
- child: inRoutine
- ? SvgPathIcon(Ic.checkBold, size: 14, color: gc.onEmber)
- : Icon(PhosphorIconsRegular.plus, size: 15, color: gc.textSecondary),
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 260),
+ transitionBuilder: (child, a) => ScaleTransition(
+ scale: CurvedAnimation(parent: a, curve: Curves.easeOutBack),
+ child: child,
+ ),
+ child: KeyedSubtree(
+ key: ValueKey(inRoutine),
+ child: inRoutine
+ ? SvgPathIcon(Ic.checkBold, size: 14, color: gc.onEmber)
+ : Icon(PhosphorIconsRegular.plus, size: 15, color: gc.textSecondary),
+ ),
+ ),
),
]),
),
@@ -826,6 +889,10 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
),
const SizedBox(height: 10),
_restRow(sheet, gc, routine, ex),
+ if (fit.modeOf(ex.id).isEmpty) ...[
+ const SizedBox(height: 8),
+ _ladderRow(sheet, gc, routine, ex),
+ ],
const SizedBox(height: 14),
PrimaryButton(label: t.done, onTap: () => Navigator.of(sheet).pop()),
],
@@ -837,6 +904,42 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
);
}
+ Widget _ladderRow(BuildContext sheet, GymColors gc, Routine routine, Exercise ex) {
+ final own = fit.ladderIn(routine, ex.id);
+ final next = fit.nextStepIn(routine, ex.id);
+ final nextEx = next == null ? null : fit.exerciseById(next);
+ return Pressable(
+ scale: 0.98,
+ onTap: () => showLadderSheet(sheet, routine.id, ex),
+ child: Container(
+ padding: const EdgeInsets.fromLTRB(16, 12, 12, 12),
+ decoration: BoxDecoration(color: gc.bgRaised2, borderRadius: BorderRadius.circular(18)),
+ child: Row(children: [
+ Icon(PhosphorIconsRegular.stairs, size: 19, color: own != null ? gc.sage : gc.textSecondary),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
+ Text(t.ladderTitle, style: AppTheme.f(14, weight: FontWeight.w600, color: gc.text)),
+ const SizedBox(height: 3),
+ Text(
+ nextEx == null
+ ? t.ladderNone
+ : [
+ if (own != null) t.ladderStep(own.indexOf(ex.id) + 1, own.length),
+ t.rotationRestUpNext(exerciseName(nextEx)),
+ ].join(' · '),
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ style: AppTheme.f(11.5, weight: FontWeight.w500, color: gc.textSecondary, height: 1.3)),
+ ]),
+ ),
+ const SizedBox(width: 8),
+ Icon(PhosphorIconsBold.caretRight, size: 13, color: gc.textTertiary),
+ ]),
+ ),
+ );
+ }
+
Widget _restRow(BuildContext sheet, GymColors gc, Routine routine, Exercise ex) {
final own = fit.routineRest(routine.id, ex.id);
final seconds = own ?? fit.restFor(ex.id);
@@ -970,7 +1073,7 @@ class _RoutineEditScreenState extends State<RoutineEditScreen> {
() => ask(
t.weightTitle(fit.units.toUpperCase()),
p.weightKg == null ? (fit.isLb ? 45 : 20) : fit.toDisplayWeight(p.weightKg!),
- fit.isLb ? 660 : 300,
+ fit.isLb ? 1540 : 700,
fit.rulerStep,
10,
fit.units,
@@ -1219,3 +1322,41 @@ class _ShareArt extends StatelessWidget {
);
}
}
+
+class _GrowIn extends StatefulWidget {
+ const _GrowIn({super.key, required this.play, required this.child});
+
+ final bool play;
+ final Widget child;
+
+ @override
+ State<_GrowIn> createState() => _GrowInState();
+}
+
+class _GrowInState extends State<_GrowIn> with SingleTickerProviderStateMixin {
+ late final AnimationController _c = AnimationController(
+ vsync: this,
+ duration: const Duration(milliseconds: 380),
+ value: widget.play ? 0 : 1,
+ )..forward();
+ late final Animation<double> _v = CurvedAnimation(parent: _c, curve: Curves.easeOutCubic);
+
+ @override
+ void dispose() {
+ _c.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) => SizeTransition(
+ sizeFactor: _v,
+ axisAlignment: -1,
+ child: FadeTransition(
+ opacity: _v,
+ child: SlideTransition(
+ position: Tween(begin: const Offset(0, -0.15), end: Offset.zero).animate(_v),
+ child: widget.child,
+ ),
+ ),
+ );
+}