Offline gym log for Android. No account, no ads, no internet.
Dart androidbodybuildingdartexercisesf-droidfitnessfluttergymgym-apphealthprivacyself-hostedworkoutworkout-appworkout-tracker
Keep plates and bar per place so the calculator only offers what you own
InlitXe5596b33dc0a
diff --git a/lib/models/place.dart b/lib/models/place.dartindex 4b3ae38..858e047 100644--- a/lib/models/place.dart+++ b/lib/models/place.dart@@ -1,25 +1,47 @@class GymPlace {- const GymPlace({required this.id, required this.name, required this.equipment});+ const GymPlace({+ required this.id,+ required this.name,+ required this.equipment,+ this.plates = const {},+ this.bar,+ });final String id;final String name;final Set<String> equipment;+ final Map<double, int> plates;+ final double? bar;- GymPlace copyWith({String? name, Set<String>? equipment}) => GymPlace(+ GymPlace copyWith({+ String? name,+ Set<String>? equipment,+ Map<double, int>? plates,+ double? bar,+ bool clearBar = false,+ }) =>+ GymPlace(id: id,name: name ?? this.name,equipment: equipment ?? this.equipment,+ plates: plates ?? this.plates,+ bar: clearBar ? null : (bar ?? this.bar),);Map<String, dynamic> toJson() => {'id': id,'n': name,'e': equipment.toList(),+ if (plates.isNotEmpty) 'p': plates.map((k, v) => MapEntry(k.toString(), v)),+ if (bar != null) 'b': bar,};factory GymPlace.fromJson(Map<String, dynamic> j) => GymPlace(id: (j['id'] ?? '') as String,name: (j['n'] ?? '') as String,equipment: ((j['e'] as List?) ?? const []).cast<String>().toSet(),+ plates: ((j['p'] as Map?) ?? const {})+ .map((k, v) => MapEntry(double.parse(k as String), (v as num).toInt())),+ bar: (j['b'] as num?)?.toDouble(),);}diff --git a/lib/screens/places_screen.dart b/lib/screens/places_screen.dartindex b526aa2..7fe96aa 100644--- a/lib/screens/places_screen.dart+++ b/lib/screens/places_screen.dart@@ -1,5 +1,5 @@import 'package:flutter/material.dart';-import 'package:phosphor_flutter/phosphor_flutter.dart';+import 'package:phosphoricons_flutter/phosphoricons_flutter.dart';import '../catalog/exercise_catalog.dart';import '../l10n/l10n.dart';@@ -152,7 +152,7 @@ class PlacesScreen extends StatelessWidget {decoration: BoxDecoration(color: on ? gc.ember : Colors.transparent,shape: BoxShape.circle,- border: Border.all(color: on ? gc.ember : gc.border, width: 1.5),+ border: Border.all(color: on ? gc.ember : gc.textTertiary, width: 1.5),),child: on? Icon(PhosphorIconsBold.check, size: 14, color: gc.onEmber)@@ -223,6 +223,36 @@ class PlacesScreen extends StatelessWidget {_gearChip(gc, place, gear),],),+ if (place.equipment.contains('Barbell')) ...[+ const SizedBox(height: 14),+ GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () => _editPlates(context, place),+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),+ decoration: BoxDecoration(+ color: gc.bgRaised2,+ borderRadius: BorderRadius.circular(14),+ ),+ child: Row(+ children: [+ Icon(PhosphorIconsRegular.circlesThree, size: 17, color: gc.textSecondary),+ const SizedBox(width: 12),+ Expanded(+ child: Text(t.placePlates,+ style: AppTheme.s(13, weight: FontWeight.w600, color: gc.text)),+ ),+ Text(+ place.plates.isEmpty ? t.platesAll : t.platesOwned(place.plates.length),+ style: AppTheme.s(12, color: gc.textSecondary),+ ),+ const SizedBox(width: 6),+ Icon(PhosphorIconsRegular.caretRight, size: 14, color: gc.textTertiary),+ ],+ ),+ ),+ ),+ ],],),),@@ -264,6 +294,102 @@ class PlacesScreen extends StatelessWidget {);}+ void _editPlates(BuildContext context, GymPlace place) {+ final gc = context.gc;+ showModalBottomSheet<void>(+ context: context,+ backgroundColor: Colors.transparent,+ isScrollControlled: true,+ builder: (sheet) => StatefulBuilder(+ builder: (sheet, setSheet) {+ final current = fit.places.firstWhere((p) => p.id == place.id, orElse: () => place);+ final bar = current.bar == null ? fit.defaultBar : fit.toDisplayWeight(current.bar!);+ return Container(+ padding: sheetPad(sheet),+ decoration: BoxDecoration(+ color: gc.bgRaised,+ border: Border.all(color: gc.border),+ borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),+ ),+ child: SingleChildScrollView(+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ const SheetHandle(),+ const SizedBox(height: 18),+ Text(t.placePlates,+ textAlign: TextAlign.center,+ style: AppTheme.d(14, weight: FontWeight.w700, color: gc.text, letterSpacing: 2)),+ const SizedBox(height: 4),+ Text(current.name,+ textAlign: TextAlign.center,+ style: AppTheme.s(12.5, color: gc.textSecondary)),+ const SizedBox(height: 20),+ ToolRow(+ label: t.barWeight,+ control: StepperControl(+ value: '${fmt(bar)} ${fit.units}',+ minWidth: 66,+ btnSize: 28,+ gap: 8,+ fontSize: 14,+ onDec: () => setSheet(() =>+ fit.setPlaceBar(place.id, fit.fromDisplayWeight(bar - fit.weightStep))),+ onInc: () => setSheet(() =>+ fit.setPlaceBar(place.id, fit.fromDisplayWeight(bar + fit.weightStep))),+ ),+ ),+ const SizedBox(height: 18),+ Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ Text(t.platePairs,+ style: AppTheme.s(10,+ weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.5)),+ if (current.plates.isNotEmpty)+ GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () => setSheet(() => fit.clearPlates(place.id)),+ child: Text(t.platesAll,+ style: AppTheme.s(12, weight: FontWeight.w600, color: gc.accent)),+ ),+ ],+ ),+ const SizedBox(height: 10),+ for (final size in fit.plateSizes) ...[+ _plateRow(gc, place.id, current, size, setSheet),+ const SizedBox(height: 8),+ ],+ const SizedBox(height: 12),+ PrimaryButton(label: t.done, onTap: () => Navigator.of(sheet).pop()),+ ],+ ),+ ),+ );+ },+ ),+ );+ }++ Widget _plateRow(GymColors gc, String placeId, GymPlace place, double size,+ void Function(VoidCallback) setSheet) {+ final kg = fit.fromDisplayWeight(size);+ final pairs = fit.platePairs(place, kg);+ return ToolRow(+ label: '${fmt(size)} ${fit.units}',+ control: StepperControl(+ value: '$pairs',+ minWidth: 34,+ btnSize: 28,+ gap: 10,+ fontSize: 14,+ onDec: () => setSheet(() => fit.setPlatePairs(placeId, kg, pairs - 1)),+ onInc: () => setSheet(() => fit.setPlatePairs(placeId, kg, pairs + 1)),+ ),+ );+ }+Future<void> _rename(BuildContext context, GymPlace? place) async {final gc = context.gc;final controller = TextEditingController(text: place?.name ?? '');diff --git a/lib/screens/tool_detail_screen.dart b/lib/screens/tool_detail_screen.dartindex c762563..33cc7ac 100644--- a/lib/screens/tool_detail_screen.dart+++ b/lib/screens/tool_detail_screen.dart@@ -5,7 +5,6 @@ import '../state/fit_state.dart';import '../theme/app_colors.dart';import '../theme/app_theme.dart';import '../widgets/dialogs.dart';-import '../widgets/svg_icon.dart';import '../widgets/ui_kit.dart';class ToolDetailScreen extends StatelessWidget {@@ -24,28 +23,27 @@ class ToolDetailScreen extends StatelessWidget {child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [- Row(children: [- RoundBtn(icon: Ic.chevronLeft, onTap: fit.closeTool),- const SizedBox(width: 12),- Text(meta.$1, style: AppTheme.d(18, weight: FontWeight.w700, color: gc.text, letterSpacing: 1)),- ]),- const SizedBox(height: 14),+ ScreenHeader(title: meta.$1, onBack: fit.closeTool, titleSize: 21),+ const SizedBox(height: 20),Container(- padding: const EdgeInsets.all(22),+ padding: const EdgeInsets.fromLTRB(22, 24, 22, 24),decoration: BoxDecoration(color: gc.bgRaised,- border: Border.all(color: gc.ember),- borderRadius: BorderRadius.circular(20),+ borderRadius: BorderRadius.circular(24),),child: Column(children: [- Text(t.result, style: AppTheme.s(11, weight: FontWeight.w600, color: gc.brass, letterSpacing: 2)),+ Text(t.result.toUpperCase(),+ style: AppTheme.f(10.5,+ weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.6)),const SizedBox(height: 8),- Text(meta.$2, style: AppTheme.d(36, weight: FontWeight.w700, color: gc.text)),+ Text(meta.$2,+ textAlign: TextAlign.center,+ style: AppTheme.f(40, weight: FontWeight.w800, color: gc.text)),const SizedBox(height: 8),- Text(meta.$3, style: AppTheme.s(13, color: gc.textSecondary), textAlign: TextAlign.center),+ Text(meta.$3, style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary), textAlign: TextAlign.center),]),),- const SizedBox(height: 14),+ const SizedBox(height: 18),..._inputs(context, gc, id),],),@@ -167,7 +165,7 @@ class ToolDetailScreen extends StatelessWidget {child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- Text(t.activityLevel, style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary)),+ Text(t.activityLevel, style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary)),const SizedBox(height: 10),Wrap(spacing: 6, runSpacing: 6, children: [pill(t.activityName('Sedentary'), 1.2),@@ -186,9 +184,9 @@ class ToolDetailScreen extends StatelessWidget {radius: 14,padding: const EdgeInsets.all(12),child: Column(children: [- Text(label, style: AppTheme.s(10, weight: FontWeight.w600, color: gc.textSecondary)),+ Text(label, style: AppTheme.f(10, weight: FontWeight.w600, color: gc.textSecondary)),const SizedBox(height: 4),- Text(value, style: AppTheme.d(16, weight: FontWeight.w700, color: gc.text)),+ Text(value, style: AppTheme.f(16, weight: FontWeight.w700, color: gc.text)),]),),);@@ -212,7 +210,7 @@ class ToolDetailScreen extends StatelessWidget {alignment: Alignment.center,decoration: BoxDecoration(color: active ? gc.ember : gc.bgRaised2, borderRadius: BorderRadius.circular(10)),child: Text('${fmt(v)} ${fit.units}',- style: AppTheme.s(13, weight: FontWeight.w600, color: active ? gc.onEmber : gc.textSecondary)),+ style: AppTheme.f(13, weight: FontWeight.w600, color: active ? gc.onEmber : gc.textSecondary)),),),);@@ -225,7 +223,7 @@ class ToolDetailScreen extends StatelessWidget {child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- Text(t.barWeight, style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary)),+ Text(t.barWeight, style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary)),const SizedBox(height: 10),Row(children: [for (int i = 0; i < bars.length; i++) ...[@@ -240,16 +238,18 @@ class ToolDetailScreen extends StatelessWidget {Widget _perSideCard(GymColors gc) {final rows = fit.plateBreakdown;+ final target = fit.toDisplayWeight(fit.plateTarget);+ final loadable = fit.loadableTotal(target, fit.plateBarDisplay);return SoftCard(radius: 14,padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- Text(t.perSide, style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary)),+ Text(t.perSide, style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary)),const SizedBox(height: 10),if (rows.isEmpty)- Text(t.justTheBar, style: AppTheme.s(13, color: gc.textSecondary))+ Text(t.justTheBar, style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary))elsefor (final p in rows)Padding(@@ -257,11 +257,14 @@ class ToolDetailScreen extends StatelessWidget {child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [- Text('${fmt(p.weight)} ${fit.units}', style: AppTheme.s(14, weight: FontWeight.w600, color: gc.text)),- Text(t.perSideCount(p.count), style: AppTheme.s(13, color: gc.textSecondary)),+ Text('${fmt(p.weight)} ${fit.units}', style: AppTheme.f(14, weight: FontWeight.w600, color: gc.text)),+ Text(t.perSideCount(p.count), style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary)),],),),+ if (loadable < target - 0.01)+ Text(t.plateAchievable('${fmt(loadable)} ${fit.units}'),+ style: AppTheme.f(12, weight: FontWeight.w500, color: gc.brass)),],),);@@ -283,8 +286,8 @@ class ToolDetailScreen extends StatelessWidget {child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [- Text(t.rampSet(sets[i].pct, sets[i].reps), style: AppTheme.s(13, color: gc.textSecondary)),- Text('${fmt(sets[i].weight)} ${fit.units}', style: AppTheme.d(15, weight: FontWeight.w700, color: gc.text)),+ Text(t.rampSet(sets[i].pct, sets[i].reps), style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary)),+ Text('${fmt(sets[i].weight)} ${fit.units}', style: AppTheme.f(15, weight: FontWeight.w700, color: gc.text)),],),),@@ -293,3 +296,93 @@ class ToolDetailScreen extends StatelessWidget {);}}++void showPlateSheet(BuildContext context, double displayTarget) {+ final gc = context.gc;+ var bar = fit.defaultBar;+ showModalBottomSheet<void>(+ context: context,+ backgroundColor: Colors.transparent,+ builder: (sheet) => StatefulBuilder(+ builder: (sheet, setSheet) {+ final rows = fit.platesPerSide(displayTarget, bar);+ final loadable = fit.loadableTotal(displayTarget, bar);+ return Container(+ padding: sheetPad(sheet),+ 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.toolTitle('plate'),+ textAlign: TextAlign.center,+ style: AppTheme.f(14, weight: FontWeight.w700, color: gc.text, letterSpacing: 0.4)),+ const SizedBox(height: 4),+ Text('${fmt(displayTarget)} ${fit.units}',+ textAlign: TextAlign.center,+ style: AppTheme.f(30, weight: FontWeight.w700, color: gc.ember)),+ const SizedBox(height: 18),+ Text(t.barWeight,+ style: AppTheme.f(10, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.5)),+ const SizedBox(height: 8),+ Row(children: [+ for (final option in fit.barOptions) ...[+ if (option != fit.barOptions.first) const SizedBox(width: 8),+ Expanded(+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () => setSheet(() => bar = option),+ child: Container(+ padding: const EdgeInsets.all(10),+ alignment: Alignment.center,+ decoration: BoxDecoration(+ color: bar == option ? gc.ember : gc.bgRaised2,+ borderRadius: BorderRadius.circular(10),+ ),+ child: Text('${fmt(option)} ${fit.units}',+ style: AppTheme.f(13,+ weight: FontWeight.w600,+ color: bar == option ? gc.onEmber : gc.textSecondary)),+ ),+ ),+ ),+ ],+ ]),+ const SizedBox(height: 18),+ Text(t.perSide,+ style: AppTheme.f(10, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.5)),+ const SizedBox(height: 10),+ if (rows.isEmpty)+ Text(t.justTheBar, style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary))+ else+ for (final p in rows)+ Padding(+ padding: const EdgeInsets.only(bottom: 8),+ child: Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ Text('${fmt(p.weight)} ${fit.units}',+ style: AppTheme.f(14, weight: FontWeight.w600, color: gc.text)),+ Text(t.perSideCount(p.count), style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary)),+ ],+ ),+ ),+ if (loadable < displayTarget - 0.01) ...[+ const SizedBox(height: 2),+ Text(t.plateAchievable('${fmt(loadable)} ${fit.units}'),+ style: AppTheme.f(12, weight: FontWeight.w500, color: gc.brass)),+ ],+ const SizedBox(height: 18),+ PrimaryButton(label: t.done, onTap: () => Navigator.of(sheet).pop()),+ ],+ ),+ );+ },+ ),+ );+}diff --git a/lib/screens/tools_screen.dart b/lib/screens/tools_screen.dartindex 02b2cd1..bb51913 100644--- a/lib/screens/tools_screen.dart+++ b/lib/screens/tools_screen.dart@@ -1,5 +1,5 @@import 'package:flutter/material.dart';-import 'package:phosphor_flutter/phosphor_flutter.dart';+import 'package:phosphoricons_flutter/phosphoricons_flutter.dart';import '../catalog/exercise_catalog.dart';import '../l10n/l10n.dart';@@ -31,21 +31,20 @@ class ToolsScreen extends StatelessWidget {child: Column(crossAxisAlignment: CrossAxisAlignment.stretch,children: [- ScreenHeader(title: t.tools, onBack: fit.backFromTools, titleSize: 22),- const SizedBox(height: 6),- Padding(- padding: const EdgeInsets.only(left: 48),- child: Text(t.calculatorsCount(kToolMeta.length),- style: AppTheme.s(13, color: gc.textSecondary)),+ ScreenHeader(+ title: t.tools,+ onBack: fit.backFromTools,+ titleSize: 22,+ subtitle: t.calculatorsCount(kToolMeta.length),),- const SizedBox(height: 20),+ const SizedBox(height: 22),GridView.count(crossAxisCount: 2,shrinkWrap: true,physics: const NeverScrollableScrollPhysics(),mainAxisSpacing: 12,crossAxisSpacing: 12,- childAspectRatio: 1.05,+ childAspectRatio: 1.12,children: [for (final tool in kToolMeta) _card(gc, tool)],),],@@ -58,11 +57,10 @@ class ToolsScreen extends StatelessWidget {return GestureDetector(onTap: () => fit.openTool(tool.id),child: Container(- padding: const EdgeInsets.all(18),+ padding: const EdgeInsets.all(16),decoration: BoxDecoration(color: gc.bgRaised,- border: Border.all(color: gc.border),- borderRadius: BorderRadius.circular(18),+ borderRadius: BorderRadius.circular(20),),child: Column(crossAxisAlignment: CrossAxisAlignment.start,@@ -71,16 +69,24 @@ class ToolsScreen extends StatelessWidget {Container(width: 36,height: 36,- decoration: BoxDecoration(color: gc.emberSoft, borderRadius: BorderRadius.circular(10)),- child: Center(child: Icon(_toolIcon(tool.id), size: 20, color: gc.ember)),+ decoration:+ BoxDecoration(color: gc.bgRaised2, borderRadius: BorderRadius.circular(12)),+ child: Center(child: Icon(_toolIcon(tool.id), size: 19, color: gc.textSecondary)),),const Spacer(),- Text(t.toolName(tool.id), style: AppTheme.d(15, weight: FontWeight.w600, color: gc.text, letterSpacing: 0.5)),- const SizedBox(height: 2),- Text(t.toolDesc(tool.id),- maxLines: 2,+ Text(t.toolName(tool.id),+ maxLines: 1,overflow: TextOverflow.ellipsis,- style: AppTheme.s(12, color: gc.textSecondary)),+ style: AppTheme.f(14.5, weight: FontWeight.w700, color: gc.text)),+ const SizedBox(height: 2),+ SizedBox(+ height: 31,+ child: Text(t.toolDesc(tool.id),+ maxLines: 2,+ overflow: TextOverflow.ellipsis,+ style: AppTheme.f(11.5,+ weight: FontWeight.w500, color: gc.textSecondary, height: 1.3)),+ ),],),),diff --git a/lib/state/places_state.dart b/lib/state/places_state.dartindex 3b0bc69..165df16 100644--- a/lib/state/places_state.dart+++ b/lib/state/places_state.dart@@ -88,6 +88,61 @@ mixin PlacesState on FitCore, LibraryState {notifyListeners();}+ @override+ Map<double, int>? get plateStockKg {+ final p = activePlace;+ if (p == null || p.plates.isEmpty) return null;+ return p.plates;+ }++ @override+ double? get placeBarKg => activePlace?.bar;++ void setPlatePairs(String placeId, double kg, int pairs) {+ final i = places.indexWhere((p) => p.id == placeId);+ if (i < 0) return;+ final plates = {...places[i].plates};+ final key = _plateKey(plates, kg);+ if (pairs <= 0) {+ plates.remove(key);+ } else {+ plates[key] = pairs.clamp(1, 20);+ }+ places[i] = places[i].copyWith(plates: plates);+ _persist();+ notifyListeners();+ }++ void clearPlates(String placeId) {+ final i = places.indexWhere((p) => p.id == placeId);+ if (i < 0) return;+ places[i] = places[i].copyWith(plates: const {}, clearBar: true);+ _persist();+ notifyListeners();+ }++ void setPlaceBar(String placeId, double kg) {+ final i = places.indexWhere((p) => p.id == placeId);+ if (i < 0) return;+ places[i] = places[i].copyWith(bar: _round3(kg.clamp(1, 60)));+ _persist();+ notifyListeners();+ }++ int platePairs(GymPlace place, double kg) {+ for (final e in place.plates.entries) {+ if ((e.key - kg).abs() < 0.05) return e.value;+ }+ return 0;+ }++ double _plateKey(Map<double, int> plates, double kg) {+ for (final k in plates.keys) {+ if ((k - kg).abs() < 0.05) return k;+ }+ return _round3(kg);+ }+void setActivePlace(String id) {activePlaceId = activePlaceId == id ? '' : id;_persist();@@ -102,8 +157,8 @@ mixin PlacesState on FitCore, LibraryState {}@override- List<Exercise> get exercisesFiltered => super- .exercisesFiltered+ List<Exercise> exercisesMatching(String query) => super+ .exercisesMatching(query).where((ex) => (!exNoGearOnly || ex.equipment == 'Bodyweight') && fitsHere(ex)).toList();diff --git a/lib/state/tools_state.dart b/lib/state/tools_state.dartindex 9bd797c..1ad9d4c 100644--- a/lib/state/tools_state.dart+++ b/lib/state/tools_state.dart@@ -91,31 +91,36 @@ mixin ToolsState on FitCore {List<double> get barOptions => isLb ? const [45, 35, 15] : const [20, 15, 10];+ List<double> get plateSizes => _plateSteps;+List<double> get _plateSteps =>isLb ? const [45, 35, 25, 10, 5, 2.5] : const [25, 20, 15, 10, 5, 2.5, 1.25];- List<({double weight, int count})> get plateBreakdown {- final target = toDisplayWeight(plateTarget);- final bar = toDisplayWeight(plateBar);- double perSide = math.max(0, (target - bar) / 2);- final out = <({double weight, int count})>[];- for (final p in _plateSteps) {- final count = (perSide / p + 1e-6).floor();- if (count > 0) {- out.add((weight: p, count: count));- perSide = _round1(perSide - count * p);- }- }- return out;+ List<({double weight, int count})> get plateBreakdown =>+ platesPerSide(toDisplayWeight(plateTarget), toDisplayWeight(plateBar));++ double get defaultBar {+ final placeBar = placeBarKg;+ if (placeBar != null) return _round1(toDisplayWeight(placeBar));+ return isLb ? 45 : 20;}- double get defaultBar => isLb ? 45 : 20;+ Map<double, int>? get plateStockDisplay {+ final stock = plateStockKg;+ if (stock == null) return null;+ return {for (final e in stock.entries) _round1(toDisplayWeight(e.key)): e.value};+ }List<({double weight, int count})> platesPerSide(double displayTarget, double displayBar) {+ final stock = plateStockDisplay;+ final steps = stock == null+ ? _plateSteps+ : (stock.keys.toList()..sort((a, b) => b.compareTo(a)));double perSide = math.max(0, (displayTarget - displayBar) / 2);final out = <({double weight, int count})>[];- for (final p in _plateSteps) {- final count = (perSide / p + 1e-6).floor();+ for (final p in steps) {+ var count = (perSide / p + 1e-6).floor();+ if (stock != null) count = math.min(count, stock[p] ?? 0);if (count > 0) {out.add((weight: p, count: count));perSide = _round1(perSide - count * p);@@ -124,6 +129,11 @@ mixin ToolsState on FitCore {return out;}+ double loadableTotal(double displayTarget, double displayBar) {+ final parts = platesPerSide(displayTarget, displayBar);+ return _round1(displayBar + parts.fold<double>(0, (a, p) => a + p.weight * p.count) * 2);+ }+String? plateHint(String equipment, double weightKg) {if (equipment != 'Barbell') return null;final target = _round1(toDisplayWeight(weightKg));