Offline gym log for Android. No account, no ads, no internet.
Dart androidbodybuildingdartexercisesf-droidfitnessfluttergymgym-apphealthprivacyself-hostedworkoutworkout-appworkout-tracker
Widget and catalog updates
InlitXc90c25ef2a7b
diff --git a/lib/catalog/exercise_catalog.dart b/lib/catalog/exercise_catalog.dartindex 43224ac..5e78f15 100644--- a/lib/catalog/exercise_catalog.dart+++ b/lib/catalog/exercise_catalog.dart@@ -7443,6 +7443,8 @@ const List<ToolMeta> kToolMeta = [ToolMeta('rpe', 'RPE load', 'Weight for a target effort'),ToolMeta('dots', 'Strength level', 'DOTS score'),ToolMeta('wilks', 'Wilks', 'Wilks score'),+ ToolMeta('protein', 'Protein', 'Daily protein'),+ ToolMeta('water', 'Water', 'Daily water'),];const List<String> kFilterMuscles = [diff --git a/lib/widgets/app_background.dart b/lib/widgets/app_background.dartindex 423dcd2..98226f9 100644--- a/lib/widgets/app_background.dart+++ b/lib/widgets/app_background.dart@@ -1,101 +1,100 @@-import 'dart:io';-import 'dart:ui' as ui;--import 'package:flutter/material.dart';--import '../theme/app_colors.dart';--class AppBackground extends StatelessWidget {- const AppBackground({super.key, required this.pattern, this.photo, this.dim = 0.55});-- final String pattern;- final String? photo;- final double dim;-- @override- Widget build(BuildContext context) {- final gc = context.gc;- if (pattern == 'photo') {- final path = photo;- if (path == null) return const SizedBox.shrink();- final media = MediaQuery.of(context);- final cacheWidth = (media.size.width * media.devicePixelRatio).round();- return IgnorePointer(- child: RepaintBoundary(- child: Stack(- fit: StackFit.expand,- children: [- Image.file(- File(path),- fit: BoxFit.cover,- cacheWidth: cacheWidth,- filterQuality: FilterQuality.medium,- errorBuilder: (_, _, _) => const SizedBox.shrink(),- ),- DecoratedBox(- decoration: BoxDecoration(- gradient: LinearGradient(- begin: Alignment.topCenter,- end: Alignment.bottomCenter,- colors: [- gc.bg.withValues(alpha: dim),- gc.bg.withValues(alpha: (dim + 0.18).clamp(0.0, 1.0)),- ],- ),- ),- ),- ],- ),- ),- );- }- if (pattern != 'dots' && pattern != 'grid') return const SizedBox.shrink();- return IgnorePointer(- child: RepaintBoundary(- child: CustomPaint(- size: Size.infinite,- painter: _BgPainter(pattern: pattern, color: gc.border),- ),- ),- );- }-}--class _BgPainter extends CustomPainter {- _BgPainter({required this.pattern, required this.color});-- final String pattern;- final Color color;- static const _gap = 26.0;-- @override- void paint(Canvas canvas, Size size) {- if (pattern == 'dots') {- canvas.drawPoints(- ui.PointMode.points,- [- for (double y = _gap; y < size.height; y += _gap)- for (double x = _gap; x < size.width; x += _gap) Offset(x, y),- ],- Paint()- ..color = color.withValues(alpha: 0.5)- ..strokeWidth = 2.2- ..strokeCap = StrokeCap.round,- );- } else {- canvas.drawPoints(- ui.PointMode.lines,- [- for (double x = _gap; x < size.width; x += _gap) ...[Offset(x, 0), Offset(x, size.height)],- for (double y = _gap; y < size.height; y += _gap) ...[Offset(0, y), Offset(size.width, y)],- ],- Paint()- ..color = color.withValues(alpha: 0.35)- ..strokeWidth = 1,- );- }- }-- @override- bool shouldRepaint(_BgPainter old) => old.pattern != pattern || old.color != color;-}+import 'dart:ui' as ui;++import 'package:flutter/material.dart';++import '../theme/app_colors.dart';+import 'local_image.dart';++class AppBackground extends StatelessWidget {+ const AppBackground({super.key, required this.pattern, this.photo, this.dim = 0.55});++ final String pattern;+ final String? photo;+ final double dim;++ @override+ Widget build(BuildContext context) {+ final gc = context.gc;+ if (pattern == 'photo') {+ final path = photo;+ if (path == null) return const SizedBox.shrink();+ final media = MediaQuery.of(context);+ final cacheWidth = (media.size.width * media.devicePixelRatio).round();+ return IgnorePointer(+ child: RepaintBoundary(+ child: Stack(+ fit: StackFit.expand,+ children: [+ Image(+ image: ResizeImage.resizeIfNeeded(cacheWidth, null, localImage(path)),+ fit: BoxFit.cover,+ filterQuality: FilterQuality.medium,+ errorBuilder: (_, _, _) => const SizedBox.shrink(),+ ),+ DecoratedBox(+ decoration: BoxDecoration(+ gradient: LinearGradient(+ begin: Alignment.topCenter,+ end: Alignment.bottomCenter,+ colors: [+ gc.bg.withValues(alpha: dim),+ gc.bg.withValues(alpha: (dim + 0.18).clamp(0.0, 1.0)),+ ],+ ),+ ),+ ),+ ],+ ),+ ),+ );+ }+ if (pattern != 'dots' && pattern != 'grid') return const SizedBox.shrink();+ return IgnorePointer(+ child: RepaintBoundary(+ child: CustomPaint(+ size: Size.infinite,+ painter: _BgPainter(pattern: pattern, color: gc.border),+ ),+ ),+ );+ }+}++class _BgPainter extends CustomPainter {+ _BgPainter({required this.pattern, required this.color});++ final String pattern;+ final Color color;+ static const _gap = 26.0;++ @override+ void paint(Canvas canvas, Size size) {+ if (pattern == 'dots') {+ canvas.drawPoints(+ ui.PointMode.points,+ [+ for (double y = _gap; y < size.height; y += _gap)+ for (double x = _gap; x < size.width; x += _gap) Offset(x, y),+ ],+ Paint()+ ..color = color.withValues(alpha: 0.5)+ ..strokeWidth = 2.2+ ..strokeCap = StrokeCap.round,+ );+ } else {+ canvas.drawPoints(+ ui.PointMode.lines,+ [+ for (double x = _gap; x < size.width; x += _gap) ...[Offset(x, 0), Offset(x, size.height)],+ for (double y = _gap; y < size.height; y += _gap) ...[Offset(0, y), Offset(size.width, y)],+ ],+ Paint()+ ..color = color.withValues(alpha: 0.35)+ ..strokeWidth = 1,+ );+ }+ }++ @override+ bool shouldRepaint(_BgPainter old) => old.pattern != pattern || old.color != color;+}diff --git a/lib/widgets/auto_backup_sheet.dart b/lib/widgets/auto_backup_sheet.dartindex ede1e2d..cf03a97 100644--- a/lib/widgets/auto_backup_sheet.dart+++ b/lib/widgets/auto_backup_sheet.dart@@ -22,9 +22,11 @@ void showAutoBackupSheet(BuildContext context) {Future<void> now(BuildContext sheet) async {if (!b.hasFolder && !await b.pickFolder()) return;+ final n = await b.pull();final ok = await b.run(force: true);if (!sheet.mounted) return;- showNotchToast(sheet, ok ? t.autoBackupSaved : t.autoBackupLost,+ final merged = n > 0;+ showNotchToast(sheet, ok ? (merged ? t.autoBackupMerged : t.autoBackupSaved) : t.autoBackupLost,icon: ok ? PhosphorIconsFill.checkCircle : PhosphorIconsFill.warningCircle,accent: ok ? sheet.gc.sage : sheet.gc.danger);}@@ -77,6 +79,12 @@ void showAutoBackupSheet(BuildContext context) {onTap: b.pickFolder,),]),+ const SizedBox(height: 10),+ Padding(+ padding: const EdgeInsets.symmetric(horizontal: 4),+ child: Text(t.autoBackupSyncHint,+ style: AppTheme.f(12, weight: FontWeight.w500, color: gc.textSecondary, height: 1.4)),+ ),const SizedBox(height: 16),Row(children: [@@ -97,7 +105,7 @@ void showAutoBackupSheet(BuildContext context) {),const SizedBox(height: 18),Center(- child: b.running+ child: b.running || b.pulling? Padding(padding: const EdgeInsets.symmetric(vertical: 10),child: SizedBox(@@ -107,8 +115,8 @@ void showAutoBackupSheet(BuildContext context) {),): GhostButton(- label: t.autoBackupNow,- icon: PhosphorIconsRegular.fileZip,+ label: t.autoBackupSync,+ icon: PhosphorIconsRegular.arrowsClockwise,onTap: () => now(sheet),),),diff --git a/lib/widgets/charts.dart b/lib/widgets/charts.dartindex ad922bf..c160e85 100644--- a/lib/widgets/charts.dart+++ b/lib/widgets/charts.dart@@ -579,6 +579,7 @@ class HeatmapYear extends StatelessWidget {).createShader(r),blendMode: BlendMode.dstIn,child: SingleChildScrollView(+ key: const PageStorageKey('h-charts-582'),scrollDirection: Axis.horizontal,reverse: true,padding: const EdgeInsets.only(left: 18),diff --git a/lib/widgets/entrance.dart b/lib/widgets/entrance.dartindex 4ccada7..8a731f4 100644--- a/lib/widgets/entrance.dart+++ b/lib/widgets/entrance.dart@@ -48,8 +48,8 @@ class _RiseFlag extends InheritedWidget {bool updateShouldNotify(_RiseFlag old) => old.on != on;}-List<Widget> riseAll(List<Widget> children) {- var i = 0;+List<Widget> riseAll(List<Widget> children, {int from = 0}) {+ var i = from;return [for (final c in children) c is SizedBox && c.child == null ? c : Rise(index: i++, child: c),];diff --git a/lib/widgets/exercise_media.dart b/lib/widgets/exercise_media.dartindex d9cecfe..036d09c 100644--- a/lib/widgets/exercise_media.dart+++ b/lib/widgets/exercise_media.dart@@ -1,5 +1,4 @@import 'dart:async';-import 'dart:io';import 'dart:math' as math;import 'package:flutter/cupertino.dart';@@ -13,6 +12,7 @@ import '../theme/app_colors.dart';import 'exercise_art.dart';import 'file_thumb.dart';import 'shimmer.dart';+import 'local_image.dart';const _shortDemo = Duration(seconds: 10);@@ -159,7 +159,7 @@ class _VideoTileState extends State<_VideoTile> {Future<void> _load() async {try {- final c = VideoPlayerController.file(File(widget.path), videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true));+ final c = localVideo(widget.path, options: VideoPlayerOptions(mixWithOthers: true));await c.initialize();await c.setVolume(0);if (widget.still) {diff --git a/lib/widgets/exercise_preview.dart b/lib/widgets/exercise_preview.dartindex 6e16e58..264a2a0 100644--- a/lib/widgets/exercise_preview.dart+++ b/lib/widgets/exercise_preview.dart@@ -1,4 +1,3 @@-import 'dart:io';import 'package:flutter/material.dart';import 'package:flutter/services.dart';@@ -16,6 +15,7 @@ import 'glass.dart';import 'shimmer.dart';import 'svg_icon.dart';import 'ui_kit.dart';+import 'local_image.dart';Future<void> showExercisePreview(BuildContext context, Exercise ex,{bool suggestions = false, ValueGetter<bool>? added, VoidCallback? onAdd}) {@@ -53,7 +53,7 @@ class _ExercisePreviewState extends State<_ExercisePreview> {}Future<void> _load(String path) async {- final c = VideoPlayerController.file(File(path), videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true));+ final c = localVideo(path, options: VideoPlayerOptions(mixWithOthers: true));setState(() => _video = c);try {await c.initialize();diff --git a/lib/widgets/glass.dart b/lib/widgets/glass.dartindex c9b0b8a..b2ae721 100644--- a/lib/widgets/glass.dart+++ b/lib/widgets/glass.dart@@ -2,6 +2,7 @@ import 'dart:ui' as ui;import 'package:flutter/material.dart';+import '../app/desktop.dart';import '../theme/app_colors.dart';bool blurEffects = true;@@ -67,16 +68,21 @@ Future<T?> showAppSheet<T>({bool isDismissible = true,bool enableDrag = true,bool useSafeArea = false,+ double maxWidth = 600,}) {final nav = Navigator.of(context);+ final desk = DesktopScope.wideFor(MediaQuery.sizeOf(context).width);+ final inner = enableDrag && isDismissible ? (BuildContext c) => _PullToClose(child: builder(c)) : builder;return nav.push(_GlassSheetRoute<T>(- builder: enableDrag && isDismissible ? (c) => _PullToClose(child: builder(c)) : builder,+ builder: desk ? (c) => ClipRRect(borderRadius: BorderRadius.circular(28), child: inner(c)) : inner,isScrollControlled: isScrollControlled,backgroundColor: backgroundColor,- shape: shape,+ shape: desk ? RoundedRectangleBorder(borderRadius: BorderRadius.circular(28)) : shape,+ floating: desk,isDismissible: isDismissible,enableDrag: enableDrag,useSafeArea: useSafeArea,+ constraints: desk ? BoxConstraints(maxWidth: maxWidth) : null,modalBarrierColor: Colors.black.withValues(alpha: 0.38),capturedThemes: InheritedTheme.capture(from: context, to: nav.context),barrierLabel: MaterialLocalizations.of(context).scrimLabel,@@ -85,6 +91,7 @@ Future<T?> showAppSheet<T>({class _GlassSheetRoute<T> extends ModalBottomSheetRoute<T> with _GlassCount<T> {_GlassSheetRoute({+ this.floating = false,required super.builder,required super.isScrollControlled,super.backgroundColor,@@ -92,11 +99,20 @@ class _GlassSheetRoute<T> extends ModalBottomSheetRoute<T> with _GlassCount<T> {super.isDismissible,super.enableDrag,super.useSafeArea,+ super.constraints,super.modalBarrierColor,super.capturedThemes,super.barrierLabel,});+ final bool floating;++ @override+ Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {+ final page = super.buildPage(context, animation, secondaryAnimation);+ return floating ? Padding(padding: const EdgeInsets.only(top: 28, bottom: 28), child: page) : page;+ }+@overridebool canTransitionTo(TransitionRoute<dynamic> nextRoute) => nextRoute is _GlassSheetRoute;diff --git a/lib/widgets/gym_pass_card.dart b/lib/widgets/gym_pass_card.dartindex 1076ad1..b035966 100644--- a/lib/widgets/gym_pass_card.dart+++ b/lib/widgets/gym_pass_card.dart@@ -1,286 +1,286 @@-import 'dart:io';--import 'package:barcode/barcode.dart';-import 'package:flutter/material.dart';--import '../l10n/l10n.dart';-import '../models/gym_pass.dart';-import '../services/media_store.dart';-import '../state/fit_state.dart';-import '../theme/app_theme.dart';-import 'routine_folder.dart';--const double kPassRatio = 1.586;--Barcode barcodeFor(PassFormat f) => switch (f) {- PassFormat.qr => Barcode.qrCode(errorCorrectLevel: BarcodeQRCorrectionLevel.medium),- PassFormat.code128 => Barcode.code128(),- PassFormat.ean13 => Barcode.ean13(),- PassFormat.ean8 => Barcode.ean8(),- PassFormat.upca => Barcode.upcA(),- PassFormat.code39 => Barcode.code39(),- PassFormat.itf => Barcode.itf(),- PassFormat.dataMatrix => Barcode.dataMatrix(),- PassFormat.pdf417 => Barcode.pdf417(),- PassFormat.aztec => Barcode.aztec(),- PassFormat.photo => Barcode.code128(),- };--String passFormatLabel(PassFormat f) => switch (f) {- PassFormat.qr => 'QR',- PassFormat.code128 => 'Code 128',- PassFormat.ean13 => 'EAN-13',- PassFormat.ean8 => 'EAN-8',- PassFormat.upca => 'UPC-A',- PassFormat.code39 => 'Code 39',- PassFormat.itf => 'ITF',- PassFormat.dataMatrix => 'Data Matrix',- PassFormat.pdf417 => 'PDF417',- PassFormat.aztec => 'Aztec',- PassFormat.photo => t.gymPassPictureFormat,- };--bool passCodeValid(PassFormat f, String code) =>- code.isNotEmpty && (f == PassFormat.photo || barcodeFor(f).isValid(code));--Color passHue(int hue) => kFolderHues[hue.abs() % kFolderHues.length];--class PassCode extends StatelessWidget {- const PassCode({super.key, required this.code, required this.format, this.caption = true});-- final String code;- final PassFormat format;- final bool caption;-- @override- Widget build(BuildContext context) {- if (format == PassFormat.photo) return PassPhoto(name: code);- final square = const {PassFormat.qr, PassFormat.dataMatrix, PassFormat.aztec}.contains(format);- final bars = CustomPaint(painter: _CodePainter(code, format, MediaQuery.devicePixelRatioOf(context)));- if (square) return AspectRatio(aspectRatio: 1, child: bars);- return Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.stretch,- children: [- Expanded(child: bars),- if (caption) ...[- const SizedBox(height: 6),- FittedBox(- fit: BoxFit.scaleDown,- child: Text(code,- maxLines: 1,- style: AppTheme.f(13, weight: FontWeight.w700, color: Colors.black, letterSpacing: 2.2)- .copyWith(fontFeatures: const [FontFeature.tabularFigures()])),- ),- ],- ],- );- }-}--class PassPhoto extends StatelessWidget {- const PassPhoto({super.key, required this.name});-- final String name;-- @override- Widget build(BuildContext context) {- final path = MediaStore.pathFor(name);- if (path == null) return const SizedBox.shrink();- return Image.file(- File(path),- fit: BoxFit.contain,- filterQuality: FilterQuality.high,- gaplessPlayback: true,- errorBuilder: (_, _, _) => const SizedBox.shrink(),- );- }-}--class _CodePainter extends CustomPainter {- _CodePainter(this.code, this.format, this.ratio);-- final String code;- final PassFormat format;- final double ratio;-- @override- void paint(Canvas canvas, Size size) {- if (size.isEmpty) return;- final Iterable<BarcodeElement> parts;- try {- parts = barcodeFor(format).make(code, width: size.width, height: size.height);- } catch (_) {- return;- }- double snap(double v) => (v * ratio).roundToDouble() / ratio;- final paint = Paint()- ..color = Colors.black- ..isAntiAlias = false;- for (final e in parts) {- if (e is BarcodeBar && e.black) {- canvas.drawRect(- Rect.fromLTRB(snap(e.left), snap(e.top), snap(e.left + e.width), snap(e.top + e.height)),- paint,- );- }- }- }-- @override- bool shouldRepaint(_CodePainter old) => old.code != code || old.format != format || old.ratio != ratio;-}--class GymPassCard extends StatelessWidget {- const GymPassCard({super.key, required this.pass, this.hero = true});-- final GymPass pass;- final bool hero;-- @override- Widget build(BuildContext context) {- final hue = passHue(pass.hue);- final soft = Color.lerp(hue, Colors.white, 0.25)!;- final member = pass.member.isNotEmpty ? pass.member : fit.displayName;- final card = AspectRatio(- aspectRatio: kPassRatio,- child: LayoutBuilder(builder: (context, box) {- final w = box.maxWidth;- final pad = w * 0.062;- final radius = w * 0.058;- final eyebrow = FittedBox(- fit: BoxFit.scaleDown,- alignment: Alignment.centerLeft,- child: Text(t.gymPass.toUpperCase(),- maxLines: 1,- style: AppTheme.f(w * 0.028, weight: FontWeight.w800, color: soft, letterSpacing: w * 0.004)),- );- final name = Text(pass.name.isEmpty ? '—' : pass.name,- maxLines: 2,- overflow: TextOverflow.ellipsis,- style: AppTheme.f(w * 0.058, weight: FontWeight.w800, color: Colors.white, height: 1.12, letterSpacing: -0.2));- final who = Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [- Text(t.gymPassMember.toUpperCase(),- style: AppTheme.f(w * 0.024,- weight: FontWeight.w700, color: Colors.white.withValues(alpha: 0.42), letterSpacing: w * 0.004)),- SizedBox(height: w * 0.008),- Text(member,- maxLines: 1,- overflow: TextOverflow.ellipsis,- style: AppTheme.f(w * 0.04, weight: FontWeight.w700, color: Colors.white.withValues(alpha: 0.9))),- ]);- final panel = Container(- padding: EdgeInsets.all(w * 0.026),- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(w * 0.032)),- child: PassCode(code: pass.code, format: pass.format, caption: false),- );- return DecoratedBox(- decoration: BoxDecoration(- borderRadius: BorderRadius.circular(radius),- boxShadow: [- BoxShadow(color: Colors.black.withValues(alpha: 0.45), blurRadius: 26, offset: const Offset(0, 12)),- ],- ),- child: ClipRRect(- borderRadius: BorderRadius.circular(radius),- child: Stack(children: [- const Positioned.fill(- child: DecoratedBox(- decoration: BoxDecoration(- gradient: LinearGradient(- begin: Alignment.topLeft,- end: Alignment.bottomRight,- colors: [Color(0xFF232327), Color(0xFF141416), Color(0xFF0E0E10)],- stops: [0, 0.55, 1],- ),- ),- ),- ),- Positioned.fill(- child: DecoratedBox(- decoration: BoxDecoration(- gradient: RadialGradient(- center: const Alignment(-1.05, -1.15),- radius: 1.1,- colors: [hue.withValues(alpha: 0.30), hue.withValues(alpha: 0.06), Colors.transparent],- stops: const [0, 0.45, 1],- ),- ),- ),- ),- Positioned.fill(child: CustomPaint(painter: _Guilloche(Colors.white.withValues(alpha: 0.035)))),- Positioned.fill(- child: DecoratedBox(- decoration: BoxDecoration(- borderRadius: BorderRadius.circular(radius),- border: Border.all(color: Colors.white.withValues(alpha: 0.09)),- gradient: LinearGradient(- begin: Alignment.topCenter,- end: Alignment.center,- colors: [Colors.white.withValues(alpha: 0.05), Colors.transparent],- ),- ),- ),- ),- Padding(- padding: EdgeInsets.all(pad),- child: pass.square- ? Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [- Expanded(- child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [- eyebrow,- SizedBox(height: w * 0.022),- name,- const Spacer(),- who,- ]),- ),- SizedBox(width: pad * 0.7),- panel,- ])- : Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [- Row(crossAxisAlignment: CrossAxisAlignment.start, children: [- Expanded(- child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [- eyebrow,- SizedBox(height: w * 0.018),- name,- ]),- ),- SizedBox(width: pad * 0.6),- who,- ]),- const Spacer(),- SizedBox(height: w * 0.25, child: panel),- ]),- ),- ]),- ),- );- }),- );- if (!hero) return card;- return Hero(tag: 'pass-${pass.id}', child: Material(type: MaterialType.transparency, child: card));- }-}--class _Guilloche extends CustomPainter {- const _Guilloche(this.color);-- final Color color;-- @override- void paint(Canvas canvas, Size size) {- final paint = Paint()- ..color = color- ..style = PaintingStyle.stroke- ..strokeWidth = 1;- final center = Offset(size.width * 1.02, size.height * 1.1);- for (var r = size.width * 0.18; r < size.width * 1.1; r += size.width * 0.034) {- canvas.drawCircle(center, r, paint);- }- }-- @override- bool shouldRepaint(_Guilloche old) => old.color != color;-}++import 'package:barcode/barcode.dart';+import 'package:flutter/material.dart';++import '../l10n/l10n.dart';+import '../models/gym_pass.dart';+import '../services/media_store.dart';+import '../state/fit_state.dart';+import '../theme/app_theme.dart';+import 'routine_folder.dart';+import 'local_image.dart';++const double kPassRatio = 1.586;++Barcode barcodeFor(PassFormat f) => switch (f) {+ PassFormat.qr => Barcode.qrCode(errorCorrectLevel: BarcodeQRCorrectionLevel.medium),+ PassFormat.code128 => Barcode.code128(),+ PassFormat.ean13 => Barcode.ean13(),+ PassFormat.ean8 => Barcode.ean8(),+ PassFormat.upca => Barcode.upcA(),+ PassFormat.code39 => Barcode.code39(),+ PassFormat.itf => Barcode.itf(),+ PassFormat.dataMatrix => Barcode.dataMatrix(),+ PassFormat.pdf417 => Barcode.pdf417(),+ PassFormat.aztec => Barcode.aztec(),+ PassFormat.photo => Barcode.code128(),+ };++String passFormatLabel(PassFormat f) => switch (f) {+ PassFormat.qr => 'QR',+ PassFormat.code128 => 'Code 128',+ PassFormat.ean13 => 'EAN-13',+ PassFormat.ean8 => 'EAN-8',+ PassFormat.upca => 'UPC-A',+ PassFormat.code39 => 'Code 39',+ PassFormat.itf => 'ITF',+ PassFormat.dataMatrix => 'Data Matrix',+ PassFormat.pdf417 => 'PDF417',+ PassFormat.aztec => 'Aztec',+ PassFormat.photo => t.gymPassPictureFormat,+ };++bool passCodeValid(PassFormat f, String code) =>+ code.isNotEmpty && (f == PassFormat.photo || barcodeFor(f).isValid(code));++Color passHue(int hue) => kFolderHues[hue.abs() % kFolderHues.length];++class PassCode extends StatelessWidget {+ const PassCode({super.key, required this.code, required this.format, this.caption = true});++ final String code;+ final PassFormat format;+ final bool caption;++ @override+ Widget build(BuildContext context) {+ if (format == PassFormat.photo) return PassPhoto(name: code);+ final square = const {PassFormat.qr, PassFormat.dataMatrix, PassFormat.aztec}.contains(format);+ final bars = CustomPaint(painter: _CodePainter(code, format, MediaQuery.devicePixelRatioOf(context)));+ if (square) return AspectRatio(aspectRatio: 1, child: bars);+ return Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Expanded(child: bars),+ if (caption) ...[+ const SizedBox(height: 6),+ FittedBox(+ fit: BoxFit.scaleDown,+ child: Text(code,+ maxLines: 1,+ style: AppTheme.f(13, weight: FontWeight.w700, color: Colors.black, letterSpacing: 2.2)+ .copyWith(fontFeatures: const [FontFeature.tabularFigures()])),+ ),+ ],+ ],+ );+ }+}++class PassPhoto extends StatelessWidget {+ const PassPhoto({super.key, required this.name});++ final String name;++ @override+ Widget build(BuildContext context) {+ final path = MediaStore.pathFor(name);+ if (path == null) return const SizedBox.shrink();+ return Image(+ image: localImage(path),+ fit: BoxFit.contain,+ filterQuality: FilterQuality.high,+ gaplessPlayback: true,+ errorBuilder: (_, _, _) => const SizedBox.shrink(),+ );+ }+}++class _CodePainter extends CustomPainter {+ _CodePainter(this.code, this.format, this.ratio);++ final String code;+ final PassFormat format;+ final double ratio;++ @override+ void paint(Canvas canvas, Size size) {+ if (size.isEmpty) return;+ final Iterable<BarcodeElement> parts;+ try {+ parts = barcodeFor(format).make(code, width: size.width, height: size.height);+ } catch (_) {+ return;+ }+ double snap(double v) => (v * ratio).roundToDouble() / ratio;+ final paint = Paint()+ ..color = Colors.black+ ..isAntiAlias = false;+ for (final e in parts) {+ if (e is BarcodeBar && e.black) {+ canvas.drawRect(+ Rect.fromLTRB(snap(e.left), snap(e.top), snap(e.left + e.width), snap(e.top + e.height)),+ paint,+ );+ }+ }+ }++ @override+ bool shouldRepaint(_CodePainter old) => old.code != code || old.format != format || old.ratio != ratio;+}++class GymPassCard extends StatelessWidget {+ const GymPassCard({super.key, required this.pass, this.hero = true});++ final GymPass pass;+ final bool hero;++ @override+ Widget build(BuildContext context) {+ final hue = passHue(pass.hue);+ final soft = Color.lerp(hue, Colors.white, 0.25)!;+ final member = pass.member.isNotEmpty ? pass.member : fit.displayName;+ final card = AspectRatio(+ aspectRatio: kPassRatio,+ child: LayoutBuilder(builder: (context, box) {+ final w = box.maxWidth;+ final pad = w * 0.062;+ final radius = w * 0.058;+ final eyebrow = FittedBox(+ fit: BoxFit.scaleDown,+ alignment: Alignment.centerLeft,+ child: Text(t.gymPass.toUpperCase(),+ maxLines: 1,+ style: AppTheme.f(w * 0.028, weight: FontWeight.w800, color: soft, letterSpacing: w * 0.004)),+ );+ final name = Text(pass.name.isEmpty ? '—' : pass.name,+ maxLines: 2,+ overflow: TextOverflow.ellipsis,+ style: AppTheme.f(w * 0.058, weight: FontWeight.w800, color: Colors.white, height: 1.12, letterSpacing: -0.2));+ final who = Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [+ Text(t.gymPassMember.toUpperCase(),+ style: AppTheme.f(w * 0.024,+ weight: FontWeight.w700, color: Colors.white.withValues(alpha: 0.42), letterSpacing: w * 0.004)),+ SizedBox(height: w * 0.008),+ Text(member,+ maxLines: 1,+ overflow: TextOverflow.ellipsis,+ style: AppTheme.f(w * 0.04, weight: FontWeight.w700, color: Colors.white.withValues(alpha: 0.9))),+ ]);+ final panel = Container(+ padding: EdgeInsets.all(w * 0.026),+ decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(w * 0.032)),+ child: PassCode(code: pass.code, format: pass.format, caption: false),+ );+ return DecoratedBox(+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(radius),+ boxShadow: [+ BoxShadow(color: Colors.black.withValues(alpha: 0.45), blurRadius: 26, offset: const Offset(0, 12)),+ ],+ ),+ child: ClipRRect(+ borderRadius: BorderRadius.circular(radius),+ child: Stack(children: [+ const Positioned.fill(+ child: DecoratedBox(+ decoration: BoxDecoration(+ gradient: LinearGradient(+ begin: Alignment.topLeft,+ end: Alignment.bottomRight,+ colors: [Color(0xFF232327), Color(0xFF141416), Color(0xFF0E0E10)],+ stops: [0, 0.55, 1],+ ),+ ),+ ),+ ),+ Positioned.fill(+ child: DecoratedBox(+ decoration: BoxDecoration(+ gradient: RadialGradient(+ center: const Alignment(-1.05, -1.15),+ radius: 1.1,+ colors: [hue.withValues(alpha: 0.30), hue.withValues(alpha: 0.06), Colors.transparent],+ stops: const [0, 0.45, 1],+ ),+ ),+ ),+ ),+ Positioned.fill(child: CustomPaint(painter: _Guilloche(Colors.white.withValues(alpha: 0.035)))),+ Positioned.fill(+ child: DecoratedBox(+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(radius),+ border: Border.all(color: Colors.white.withValues(alpha: 0.09)),+ gradient: LinearGradient(+ begin: Alignment.topCenter,+ end: Alignment.center,+ colors: [Colors.white.withValues(alpha: 0.05), Colors.transparent],+ ),+ ),+ ),+ ),+ Padding(+ padding: EdgeInsets.all(pad),+ child: pass.square+ ? Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [+ Expanded(+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [+ eyebrow,+ SizedBox(height: w * 0.022),+ name,+ const Spacer(),+ who,+ ]),+ ),+ SizedBox(width: pad * 0.7),+ panel,+ ])+ : Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [+ Row(crossAxisAlignment: CrossAxisAlignment.start, children: [+ Expanded(+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [+ eyebrow,+ SizedBox(height: w * 0.018),+ name,+ ]),+ ),+ SizedBox(width: pad * 0.6),+ who,+ ]),+ const Spacer(),+ SizedBox(height: w * 0.25, child: panel),+ ]),+ ),+ ]),+ ),+ );+ }),+ );+ if (!hero) return card;+ return Hero(tag: 'pass-${pass.id}', child: Material(type: MaterialType.transparency, child: card));+ }+}++class _Guilloche extends CustomPainter {+ const _Guilloche(this.color);++ final Color color;++ @override+ void paint(Canvas canvas, Size size) {+ final paint = Paint()+ ..color = color+ ..style = PaintingStyle.stroke+ ..strokeWidth = 1;+ final center = Offset(size.width * 1.02, size.height * 1.1);+ for (var r = size.width * 0.18; r < size.width * 1.1; r += size.width * 0.034) {+ canvas.drawCircle(center, r, paint);+ }+ }++ @override+ bool shouldRepaint(_Guilloche old) => old.color != color;+}diff --git a/lib/widgets/note_kit.dart b/lib/widgets/note_kit.dartindex 3d372d0..400ef66 100644--- a/lib/widgets/note_kit.dart+++ b/lib/widgets/note_kit.dart@@ -1,4 +1,3 @@-import 'dart:io';import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';@@ -19,6 +18,7 @@ import 'file_thumb.dart';import 'glass.dart';import 'note_folder.dart';import 'ui_kit.dart';+import 'local_image.dart';Color noteKindColor(GymColors gc, NoteKind k) => switch (k) {NoteKind.note => gc.info,@@ -358,6 +358,7 @@ class NoteFilterBar extends StatelessWidget {return SizedBox(height: 38,child: ListView(+ key: const PageStorageKey('h-note_kit-361'),scrollDirection: Axis.horizontal,padding: padding.copyWith(right: padding.right - 8),children: [@@ -1116,7 +1117,7 @@ class _MediaViewerState extends State<_MediaViewer> {if (MediaStore.isVideo(name)) {return _FullVideo(key: ValueKey(path), path: path);}- final image = Image.file(File(path), fit: BoxFit.contain);+ final image = Image(image: localImage(path), fit: BoxFit.contain);return InteractiveViewer(maxScale: 5,child: Center(@@ -1182,7 +1183,7 @@ class _FullVideoState extends State<_FullVideo> {Future<void> _load() async {try {- final c = VideoPlayerController.file(File(widget.path));+ final c = localVideo(widget.path);await c.initialize();await c.setLooping(true);await c.play();diff --git a/lib/widgets/photo_source_sheet.dart b/lib/widgets/photo_source_sheet.dartindex e303ac6..c16f4cf 100644--- a/lib/widgets/photo_source_sheet.dart+++ b/lib/widgets/photo_source_sheet.dart@@ -7,14 +7,16 @@ import '../theme/app_colors.dart';import 'glass.dart';import 'ui_kit.dart';-Future<ImageSource?> pickPhotoSource(BuildContext context) => showAppSheet<ImageSource>(+Future<ImageSource?> pickPhotoSource(BuildContext context, {VoidCallback? onRemove}) => showAppSheet<ImageSource>(context: context,backgroundColor: Colors.transparent,- builder: (_) => const PhotoSourceSheet(),+ builder: (_) => PhotoSourceSheet(onRemove: onRemove),);class PhotoSourceSheet extends StatelessWidget {- const PhotoSourceSheet({super.key});+ const PhotoSourceSheet({super.key, this.onRemove});++ final VoidCallback? onRemove;@overrideWidget build(BuildContext context) {@@ -33,6 +35,11 @@ class PhotoSourceSheet extends StatelessWidget {icon: PhosphorIconsRegular.camera, onTap: () => Navigator.of(context).pop(ImageSource.camera)),OptionItem(t.chooseGallery,icon: PhosphorIconsRegular.image, onTap: () => Navigator.of(context).pop(ImageSource.gallery)),+ if (onRemove case final remove?)+ OptionItem(t.removePhoto, icon: PhosphorIconsRegular.trash, danger: true, onTap: () {+ Navigator.of(context).pop();+ remove();+ }),]),],),diff --git a/lib/widgets/settings_showcase.dart b/lib/widgets/settings_showcase.dartindex 56d50ae..93c35d4 100644--- a/lib/widgets/settings_showcase.dart+++ b/lib/widgets/settings_showcase.dart@@ -3,6 +3,7 @@ import 'dart:ui' as ui;import 'package:flutter/material.dart';import 'package:phosphoricons_flutter/phosphoricons_flutter.dart';+import '../catalog/exercise_catalog.dart';import '../l10n/l10n.dart';import '../models/gym_pass.dart';import '../state/fit_state.dart';@@ -14,10 +15,13 @@ import 'gym_pass_card.dart';import 'medal.dart';class _Collage extends StatelessWidget {- const _Collage({required this.columns, this.offset = Offset.zero});+ const _Collage({required this.columns, this.left = const [], this.right = const [], this.offset = Offset.zero});final List<Widget> columns;+ final List<Widget> left;+ final List<Widget> right;static const height = 380.0;+ static const wideFrom = 620.0;final Offset offset;@override@@ -27,44 +31,126 @@ class _Collage extends StatelessWidget {height: height,child: ExcludeSemantics(child: IgnorePointer(- child: SizedBox(- height: height,- child: ClipRRect(- borderRadius: BorderRadius.circular(28),- child: ColoredBox(- color: gc.bgRaised,- child: OverflowBox(- maxWidth: 1000,- maxHeight: 1000,- child: Transform.translate(- offset: offset,- child: Transform.rotate(- angle: -0.16,- child: Transform.scale(- scale: 0.66,- child: Row(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- for (var i = 0; i < columns.length; i++) ...[- if (i > 0) const SizedBox(width: 10),- columns[i],+ child: LayoutBuilder(builder: (context, box) {+ final wide = box.maxWidth >= wideFrom;+ final cols = wide ? [...left, ...columns, ...right] : columns;+ return SizedBox(+ height: height,+ child: ClipRRect(+ borderRadius: BorderRadius.circular(28),+ child: ColoredBox(+ color: gc.bgRaised,+ child: OverflowBox(+ maxWidth: wide ? 3000 : 1000,+ maxHeight: 1000,+ child: Transform.translate(+ offset: offset,+ child: Transform.rotate(+ angle: -0.16,+ child: Transform.scale(+ scale: 0.66,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: wide ? CrossAxisAlignment.center : CrossAxisAlignment.start,+ children: [+ for (var i = 0; i < cols.length; i++) ...[+ if (i > 0) const SizedBox(width: 10),+ cols[i],+ ],],- ],+ ),),),),),),),- ),- ),+ );+ }),),),);}}+Widget _wideStat(GymColors gc, IconData icon, String value, String label, Color tone, {double h = 96}) => _Tile(+ w: 330,+ h: h,+ child: Row(children: [+ Icon(icon, size: 28, color: tone),+ const SizedBox(width: 14),+ Expanded(+ child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [+ _big(gc, value, size: 26),+ if (label.isNotEmpty) ...[const SizedBox(height: 4), _kicker(gc, label)],+ ]),+ ),+ ]),+ );++Widget _bars(GymColors gc, List<double> values, {int hi = -1, double h = 120}) => _Tile(+ w: 330,+ h: h,+ child: Row(crossAxisAlignment: CrossAxisAlignment.end, children: [+ for (final (i, v) in values.indexed) ...[+ if (i > 0) const SizedBox(width: 8),+ Expanded(+ child: Container(+ height: 6 + (h - 38) * v,+ decoration: BoxDecoration(+ color: v == 0 ? gc.bgRaised : (i == hi ? gc.accent : gc.text.withValues(alpha: 0.5)),+ borderRadius: BorderRadius.circular(6),+ ),+ ),+ ),+ ],+ ]),+ );++Widget _chips(GymColors gc, List<String> labels, {int on = 0, double h = 96}) => _Tile(+ w: 330,+ h: h,+ child: Center(+ child: Wrap(spacing: 8, runSpacing: 8, alignment: WrapAlignment.center, children: [+ for (final (i, l) in labels.indexed)+ Container(+ padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 7),+ decoration: BoxDecoration(color: i == on ? gc.text : gc.bgRaised, borderRadius: BorderRadius.circular(100)),+ child: Text(l, style: AppTheme.f(13, weight: FontWeight.w800, color: i == on ? gc.bg : gc.textSecondary)),+ ),+ ]),+ ),+ );++Widget _toggleTile(GymColors gc, IconData icon, bool on, {double h = 96}) => _Tile(+ w: 150,+ h: h,+ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [+ Icon(icon, size: 24, color: on ? gc.text : gc.textTertiary),+ const Spacer(),+ Container(+ width: 52,+ height: 30,+ padding: const EdgeInsets.all(4),+ alignment: on ? Alignment.centerRight : Alignment.centerLeft,+ decoration: BoxDecoration(color: on ? gc.sage : gc.bgRaised, borderRadius: BorderRadius.circular(100)),+ child: Container(+ width: 22,+ height: 22,+ decoration: BoxDecoration(color: on ? Colors.white : gc.textTertiary, shape: BoxShape.circle),+ ),+ ),+ ]),+ );++Widget _gauge(GymColors gc, double value, String center, Color tone, {double h = 170}) => _Tile(+ w: 150,+ h: h,+ child: Center(+ child: _Ring(value: value, color: tone, size: 108, child: _big(gc, center, size: 24)),+ ),+ );+class ShowcaseFrame extends StatelessWidget {const ShowcaseFrame({super.key, required this.height, required this.child});@@ -120,14 +206,138 @@ Widget _kicker(GymColors gc, String text) => Text(text.toUpperCase(),Widget _big(GymColors gc, String text, {double size = 30, Color? color}) =>Text(text, maxLines: 1, style: AppTheme.f(size, weight: FontWeight.w800, color: color ?? gc.text, height: 1.05));-Widget _iconTile(GymColors gc, IconData icon, String value, String label, Color tone, {double h = 120}) => _Tile(+Widget _iconTile(GymColors gc, IconData icon, String value, String label, Color tone, {double? h}) => _Tile(w: 150,- h: h,+ h: h ?? (label.isEmpty ? 92 : 108),child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Icon(icon, size: 24, color: tone),const Spacer(),_big(gc, value, size: 24),- if (label.isNotEmpty) _kicker(gc, label),+ if (label.isNotEmpty) ...[const SizedBox(height: 3), _kicker(gc, label)],+ ]),+ );++Widget _exerciseList(GymColors gc, int from, {List<String> sets = const ['3 × 8', '4 × 10', '3 × 12']}) {+ final picks = [for (var i = 0; i < 3; i++) kExercises[(from + i * 37) % kExercises.length]];+ return _Tile(+ w: 330,+ h: 150,+ pad: 14,+ child: Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [+ for (final (i, e) in picks.indexed)+ Row(children: [+ Container(+ width: 26,+ height: 26,+ alignment: Alignment.center,+ decoration: BoxDecoration(color: gc.bgRaised, shape: BoxShape.circle),+ child: Text('${i + 1}', style: AppTheme.f(12, weight: FontWeight.w800, color: gc.textSecondary)),+ ),+ const SizedBox(width: 10),+ Expanded(+ child: Text(t.catalogName(e.id, e.name),+ maxLines: 1, overflow: TextOverflow.ellipsis, style: AppTheme.f(14, weight: FontWeight.w700, color: gc.text)),+ ),+ const SizedBox(width: 8),+ Text(sets[i % sets.length], style: AppTheme.f(12.5, weight: FontWeight.w700, color: gc.textTertiary)),+ ]),+ ]),+ );+}++Widget _calendar(GymColors gc, int seed, String value, Color tone) => _Tile(+ w: 330,+ h: 150,+ pad: 14,+ child: Row(children: [+ Expanded(+ child: Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [+ for (var r = 0; r < 5; r++)+ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [+ for (var c = 0; c < 7; c++)+ Container(+ width: 18,+ height: 18,+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ color: ((r * 7 + c) * seed + r) % 5 < 2 ? tone : gc.bgRaised,+ ),+ ),+ ]),+ ]),+ ),+ const SizedBox(width: 16),+ _big(gc, value, size: 30),+ ]),+ );++Widget _spark(GymColors gc, List<double> values, Color tone, String value, String label) => _Tile(+ w: 330,+ h: 124,+ pad: 0,+ child: ClipRRect(+ borderRadius: BorderRadius.circular(24),+ child: Stack(children: [+ Positioned.fill(+ top: 40,+ child: CustomPaint(+ painter: _Pulse(values, line: tone, grid: gc.text.withValues(alpha: 0.06), dotRing: gc.bgRaised2),+ ),+ ),+ Padding(+ padding: const EdgeInsets.fromLTRB(16, 14, 16, 0),+ child: Row(children: [+ Expanded(child: _kicker(gc, label)),+ _big(gc, value, size: 22),+ ]),+ ),+ ]),+ ),+ );++Widget _rings(GymColors gc, List<(double, Color, String)> rings) => _Tile(+ w: 330,+ h: 116,+ pad: 12,+ child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [+ for (final (v, c, label) in rings)+ SizedBox(+ width: 80,+ height: 80,+ child: Stack(alignment: Alignment.center, children: [+ SizedBox.expand(+ child: CircularProgressIndicator(+ value: v, strokeWidth: 7, strokeCap: StrokeCap.round, color: c, backgroundColor: gc.bgRaised),+ ),+ Text(label, style: AppTheme.f(14, weight: FontWeight.w800, color: gc.text)),+ ]),+ ),+ ]),+ );++Widget _macros(GymColors gc, List<(String, double, Color)> rows) => _Tile(+ w: 330,+ h: 124,+ pad: 14,+ child: Column(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [+ for (final (label, v, c) in rows)+ Row(children: [+ SizedBox(width: 70, child: Text(label, style: AppTheme.f(12.5, weight: FontWeight.w700, color: gc.textSecondary))),+ Expanded(+ child: ClipRRect(+ borderRadius: BorderRadius.circular(5),+ child: SizedBox(+ height: 10,+ child: Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [+ Expanded(flex: (v * 100).round(), child: ColoredBox(color: c)),+ Expanded(flex: 100 - (v * 100).round(), child: ColoredBox(color: gc.bgRaised)),+ ]),+ ),+ ),+ ),+ const SizedBox(width: 10),+ Text('${(v * 100).round()} %', style: AppTheme.f(12, weight: FontWeight.w800, color: gc.text)),+ ]),]),);@@ -244,11 +454,7 @@ class AlertsShowcase extends StatelessWidget {]),]),);- final vibrate = _Tile(- w: 150,- h: 110,- child: Center(child: Icon(PhosphorIconsRegular.vibrate, size: 48, color: gc.textSecondary)),- );+ final vibrate = _toggleTile(gc, PhosphorIconsRegular.vibrate, true);final live = _note(gc,icon: PhosphorIconsFill.barbell,@@ -336,9 +542,49 @@ class AlertsShowcase extends StatelessWidget {);return _Collage(offset: const Offset(22, -8),+ left: [+ _stack(0, [+ _toggleTile(gc, PhosphorIconsRegular.bell, true),+ _iconTile(gc, PhosphorIconsRegular.calendarCheck, '3', '', gc.sage),+ _iconTile(gc, PhosphorIconsRegular.moonStars, '23:00', '', gc.textSecondary),+ _gauge(gc, 0.85, '85 %', gc.sage),+ _iconTile(gc, PhosphorIconsRegular.sunHorizon, '7:30', '', gc.warn),+ _iconTile(gc, PhosphorIconsRegular.barbell, '4/4', '', gc.accent),+ _iconTile(gc, PhosphorIconsRegular.timer, '45 s', '', gc.textSecondary),+ ]),+ _stack(0, [+ _chips(gc, const ['30 s', '60 s', '90 s', '2 min', '3 min'], on: 2),+ _bars(gc, const [0.5, 0.2, 0.9, 0.4, 0.0, 0.7, 0.3], hi: 2),+ _wideStat(gc, PhosphorIconsRegular.bellSimple, '7:00 · 18:30', '', gc.sage),+ _exerciseList(gc, 3),+ _chips(gc, [for (var d = 1; d <= 7; d++) _letter(d)], on: 0),+ _calendar(gc, 3, '12', gc.sage),+ _wideStat(gc, PhosphorIconsRegular.clockClockwise, '3 min', '', gc.accent),+ ]),+ ],+ right: [+ _stack(0, [+ _wideStat(gc, PhosphorIconsRegular.pill, '10:00', t.suppCreatine, gc.brass),+ _chips(gc, const ['5 g', '3 g', '500 mg', '1000 IU'], on: 0),+ _macros(gc, [('P', 0.8, gc.accent), ('C', 0.55, gc.sage), ('G', 0.4, gc.warn)]),+ _wideStat(gc, PhosphorIconsRegular.drop, '2 L', '', gc.info),+ _bars(gc, const [0.3, 0.6, 0.45, 0.8, 0.55, 1.0, 0.7], hi: 5),+ _wideStat(gc, PhosphorIconsRegular.camera, '14', t.notifPhotoTitle, gc.info),+ _rings(gc, [(0.7, gc.accent, '7/10'), (0.4, gc.sage, '2 L'), (0.9, gc.brass, '5 g')]),+ ]),+ _stack(0, [+ _iconTile(gc, PhosphorIconsRegular.speakerHigh, '80 %', '', gc.text),+ _toggleTile(gc, PhosphorIconsRegular.headphones, true),+ _gauge(gc, 0.75, '16 h', gc.warn),+ _iconTile(gc, PhosphorIconsRegular.bellSimpleSlash, '8:00', '', gc.textTertiary),+ _iconTile(gc, PhosphorIconsRegular.footprints, '6 240', '', gc.sage),+ _iconTile(gc, PhosphorIconsRegular.coffee, '1', '', gc.brass),+ _toggleTile(gc, PhosphorIconsRegular.moon, false),+ ]),+ ],columns: [_stack(20, [bell, sound, vibrate, _iconTile(gc, PhosphorIconsRegular.bellSlash, '22:00', '', gc.textSecondary),- _iconTile(gc, PhosphorIconsRegular.alarm, '7:00', '', gc.accent)]),+ _iconTile(gc, PhosphorIconsRegular.alarm, '7:00', '', gc.accent), _gauge(gc, 0.4, '2:00', gc.accent)]),_stack(0, [restNote,live,@@ -391,9 +637,11 @@ class AlertsShowcase extends StatelessWidget {),]),),+ _spark(gc, const [62, 75, 58, 90, 70, 84, 96, 78, 88], gc.accent, '1:30', t.liveResting),]),_stack(40, [timer, supp, fast, _iconTile(gc, PhosphorIconsRegular.ruler, '14', t.notifMeasureTitle, gc.warn),- _iconTile(gc, PhosphorIconsRegular.drop, '1,5 L', '', gc.info)]),+ _iconTile(gc, PhosphorIconsRegular.drop, '1,5 L', '', gc.info),+ _iconTile(gc, PhosphorIconsRegular.clockCountdown, '5 min', '', gc.accent)]),],);}@@ -422,31 +670,6 @@ class HomeExtrasShowcase extends StatelessWidget {),),);- final level = _Tile(- w: 150,- h: 130,- child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [- Row(children: [- Icon(PhosphorIconsRegular.medal, size: 22, color: gc.accent),- const Spacer(),- _big(gc, '7'),- ]),- const Spacer(),- ClipRRect(- borderRadius: BorderRadius.circular(4),- child: SizedBox(- height: 7,- child: Row(children: [- Expanded(- flex: 64,- child: DecoratedBox(decoration: BoxDecoration(gradient: LinearGradient(colors: [gc.accent, gc.brass]))),- ),- Expanded(flex: 36, child: ColoredBox(color: gc.bgRaised)),- ]),- ),- ),- ]),- );final medal = _Tile(w: 150, h: 150, child: Center(child: Medal(id: AwardId.values[1], size: 96)));final medalLocked = _Tile(w: 150, h: 150, child: Center(child: Medal(id: AwardId.values[6], size: 96, locked: true)));final passCard = SizedBox(width: 330, child: _lift(const GymPassCard(pass: pass, hero: false), radius: 22));@@ -504,7 +727,7 @@ class HomeExtrasShowcase extends StatelessWidget {);final streak = _Tile(w: 150,- h: 130,+ h: 108,child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Icon(PhosphorIconsFill.flame, size: 24, color: gc.accent),const Spacer(),@@ -514,7 +737,7 @@ class HomeExtrasShowcase extends StatelessWidget {);final sleep = _Tile(w: 150,- h: 130,+ h: 108,child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Icon(PhosphorIconsRegular.moonStars, size: 24, color: gc.warn),const Spacer(),@@ -524,9 +747,51 @@ class HomeExtrasShowcase extends StatelessWidget {);return _Collage(offset: const Offset(22, -8),+ left: [+ _stack(0, [+ _gauge(gc, 0.6, '60 %', gc.accent),+ _iconTile(gc, PhosphorIconsRegular.heartbeat, '128', t.healthBpm, gc.accent),+ _iconTile(gc, PhosphorIconsRegular.barbell, '42', '', gc.text),+ _iconTile(gc, PhosphorIconsRegular.lightning, '4', t.streakCaps, gc.accent),+ _iconTile(gc, PhosphorIconsRegular.target, '100 %', '', gc.sage),+ _toggleTile(gc, PhosphorIconsRegular.heart, false),+ _iconTile(gc, PhosphorIconsRegular.bicycle, '12', 'km', gc.textSecondary),+ ]),+ _stack(0, [+ _bars(gc, const [0.4, 0.7, 0.2, 0.9, 0.5, 1.0, 0.3], hi: 5),+ _wideStat(gc, PhosphorIconsRegular.personSimpleRun, '8 432', t.homeCardSteps, gc.sage),+ _chips(gc, [for (var d = 1; d <= 7; d++) _letter(d)], on: 3),+ _calendar(gc, 7, '18', gc.accent),+ _wideStat(gc, PhosphorIconsRegular.barbell, '3,9 t', '', gc.text),+ _rings(gc, [(0.8, gc.accent, '4/5'), (0.6, gc.sage, '60 %'), (0.95, gc.warn, '7 h')]),+ _wideStat(gc, PhosphorIconsRegular.calendarCheck, '4/4', '', gc.accent),+ ]),+ ],+ right: [+ _stack(0, [+ _wideStat(gc, PhosphorIconsRegular.moon, '7:42', t.unitHours, gc.warn),+ _bars(gc, const [0.6, 0.3, 0.8, 1.0, 0.0, 0.5, 0.7], hi: 3),+ _wideStat(gc, PhosphorIconsRegular.chartLineUp, '+2,5 kg', '', gc.sage),+ _chips(gc, const ['1 RM', '5 RM', '10 RM'], on: 0),+ _macros(gc, [('P', 0.9, gc.accent), ('C', 0.6, gc.sage), ('G', 0.45, gc.warn)]),+ _exerciseList(gc, 25),+ _spark(gc, const [80.2, 79.8, 79.9, 79.1, 78.9, 79.0, 78.6, 78.4], gc.brass, '78,4', 'kg'),+ ]),+ _stack(0, [+ _iconTile(gc, PhosphorIconsRegular.drop, '2,1 L', '', gc.info),+ _toggleTile(gc, PhosphorIconsRegular.bell, true),+ _iconTile(gc, PhosphorIconsRegular.clock, '17:05', '', gc.textSecondary),+ _iconTile(gc, PhosphorIconsRegular.trendUp, '+12 %', '', gc.sage),+ _iconTile(gc, PhosphorIconsRegular.swimmingPool, '1 km', '', gc.info),+ _iconTile(gc, PhosphorIconsRegular.mountains, '320 m', '', gc.textSecondary),+ _toggleTile(gc, PhosphorIconsRegular.sun, true),+ ]),+ ],columns: [- _stack(20, [steps, level, medal, _iconTile(gc, PhosphorIconsRegular.fire, '520', 'kcal', gc.accent),- _iconTile(gc, PhosphorIconsRegular.scales, '78,4', 'kg', gc.textSecondary)]),+ _stack(20, [steps, medal, _iconTile(gc, PhosphorIconsRegular.fire, '520', 'kcal', gc.accent),+ _iconTile(gc, PhosphorIconsRegular.scales, '78,4', 'kg', gc.textSecondary),+ _toggleTile(gc, PhosphorIconsRegular.footprints, true),+ _iconTile(gc, PhosphorIconsRegular.timer, '55 min', '', gc.textSecondary)]),_stack(0, [passCard,heart,@@ -560,9 +825,10 @@ class HomeExtrasShowcase extends StatelessWidget {],]),),+ _exerciseList(gc, 11),]),_stack(40, [streak, sleep, medalLocked, _iconTile(gc, PhosphorIconsRegular.path, '4,2', 'km', gc.sage),- _iconTile(gc, PhosphorIconsRegular.trophy, '3', '', gc.brass)]),+ _iconTile(gc, PhosphorIconsRegular.trophy, '3', '', gc.brass), _gauge(gc, 0.9, '9/10', gc.brass)]),],);}@@ -716,16 +982,54 @@ class LookShowcase extends StatelessWidget {]),),);- final motion = _Tile(- w: 150,- h: 110,- child: Center(child: Icon(PhosphorIconsRegular.waveSine, size: 48, color: gc.textSecondary)),- );+ final motion = _toggleTile(gc, PhosphorIconsRegular.waveSine, true);return _Collage(offset: const Offset(22, -8),+ left: [+ _stack(0, [+ _iconTile(gc, PhosphorIconsRegular.globe, '17', '', gc.accent),+ _toggleTile(gc, PhosphorIconsRegular.sparkle, false),+ _iconTile(gc, PhosphorIconsRegular.ruler, 'cm', '', gc.sage),+ _gauge(gc, 0.3, '1,15×', gc.sage),+ _iconTile(gc, PhosphorIconsRegular.thermometer, '°C', '', gc.warn),+ _iconTile(gc, PhosphorIconsRegular.arrowsLeftRight, 'RTL', '', gc.textSecondary),+ _iconTile(gc, PhosphorIconsRegular.calendarBlank, _letter(1), '', gc.accent),+ ]),+ _stack(0, [+ _wideStat(gc, PhosphorIconsRegular.clock, '6:30 PM', '12 h', gc.textSecondary),+ _bars(gc, const [0.2, 0.9, 0.5, 0.7, 0.35, 0.6, 0.0], hi: 1),+ _chips(gc, const ['ES', 'EN', 'DE', 'FR', 'IT', 'PT', 'العربية'], on: 0),+ _calendar(gc, 5, '84', gc.accent),+ _rings(gc, [(0.33, gc.textSecondary, '1×'), (0.66, gc.accent, '1,15×'), (1.0, gc.text, '1,3×')]),+ _wideStat(gc, PhosphorIconsRegular.squaresFour, '3', '', gc.text),+ _chips(gc, const ['00:00', '06:00', '12:00', '18:00'], on: 3),+ ]),+ ],+ right: [+ _stack(0, [+ _wideStat(gc, PhosphorIconsRegular.paintBrush, 'D9A184', '', gc.accent),+ _bars(gc, const [0.7, 0.4, 0.0, 0.8, 1.0, 0.3, 0.55], hi: 4),+ _exerciseList(gc, 80),+ _chips(gc, const ['Auto', '1×', '2×', '3×'], on: 0),+ _spark(gc, const [40, 52, 48, 61, 58, 70, 66, 75], gc.sage, '60 fps', ''),+ _wideStat(gc, PhosphorIconsRegular.monitor, '1440 × 900', '', gc.textSecondary),+ _wideStat(gc, PhosphorIconsRegular.vibrate, '20 ms', '', gc.textSecondary),+ ]),+ _stack(0, [+ _toggleTile(gc, PhosphorIconsRegular.sunDim, false),+ _iconTile(gc, PhosphorIconsRegular.eye, '100 %', '', gc.textSecondary),+ _iconTile(gc, PhosphorIconsRegular.image, '9:16', '', gc.info),+ _iconTile(gc, PhosphorIconsRegular.palette, '4', '', gc.accent),+ _iconTile(gc, PhosphorIconsRegular.frameCorners, '16', '', gc.textSecondary),+ _iconTile(gc, PhosphorIconsRegular.monitor, '1440', '', gc.textSecondary),+ _toggleTile(gc, PhosphorIconsRegular.drop, true),+ ]),+ ],columns: [_stack(20, [themes, units, text, _iconTile(gc, PhosphorIconsRegular.translate, 'A文', '', gc.accent),- _iconTile(gc, PhosphorIconsRegular.clock, '18:30', '24 h', gc.textSecondary)]),+ _iconTile(gc, PhosphorIconsRegular.clock, '18:30', '24 h', gc.textSecondary),+ _toggleTile(gc, PhosphorIconsRegular.moon, true),+ _iconTile(gc, PhosphorIconsRegular.textAa, '1,3×', '', gc.textSecondary)]),_stack(0, [heat,languages,@@ -774,9 +1078,11 @@ class LookShowcase extends StatelessWidget {),]),),+ _wideStat(gc, PhosphorIconsRegular.batteryHigh, '98 %', '', gc.sage),]),- _stack(40, [dots, blur, motion, _iconTile(gc, PhosphorIconsRegular.sunHorizon, '', t.lightTheme, gc.warn),- _iconTile(gc, PhosphorIconsRegular.moon, '', t.darkTheme, gc.textSecondary)]),+ _stack(40, [dots, blur, motion, _iconTile(gc, PhosphorIconsRegular.sunHorizon, '7:30', t.lightTheme, gc.warn),+ _iconTile(gc, PhosphorIconsRegular.moon, '21:00', t.darkTheme, gc.textSecondary),+ _gauge(gc, 0.5, 'Aa', gc.accent)]),],);}diff --git a/lib/widgets/share_cards.dart b/lib/widgets/share_cards.dartindex 0d0fd88..6ed2dea 100644--- a/lib/widgets/share_cards.dart+++ b/lib/widgets/share_cards.dart@@ -1,4 +1,3 @@-import 'dart:io';import 'package:flutter/material.dart';@@ -13,6 +12,7 @@ import 'ui_kit.dart';import 'body_map.dart';import 'charts.dart';import 'profile_avatar.dart';+import 'local_image.dart';const Size kShareCardSize = Size(340, 425);@@ -264,7 +264,7 @@ class ShareCard extends StatelessWidget {clipBehavior: Clip.antiAlias,child: path == null? const SizedBox.expand()- : Image.file(File(path), fit: BoxFit.cover, gaplessPlayback: true,+ : Image(image: localImage(path), fit: BoxFit.cover, gaplessPlayback: true,errorBuilder: (_, _, _) => const SizedBox.expand()),);}diff --git a/lib/widgets/tool_art.dart b/lib/widgets/tool_art.dartindex daf64c2..605f4d6 100644--- a/lib/widgets/tool_art.dart+++ b/lib/widgets/tool_art.dart@@ -382,6 +382,48 @@ class _ToolArtPainter extends CustomPainter {Paint()..color = Colors.white.withValues(alpha: 0.42));canvas.drawRRect(RRect.fromRectAndRadius(Rect.fromCenter(center: Offset(bx, by + 4), width: 10, height: 6), const Radius.circular(2)),Paint()..color = _ink(iron).withValues(alpha: 0.28));+ case 'protein':+ final cx = w / 2;+ final tub = _hue(1);+ final body = Rect.fromLTWH(cx - 14, 14, 28, h - 17);+ _block(canvas, body, 6, tub);+ canvas.drawRRect(RRect.fromRectAndRadius(Rect.fromLTWH(body.left + 3, body.top + 11, body.width - 6, 13), const Radius.circular(2.5)),+ Paint()..color = Colors.white.withValues(alpha: 0.78));+ canvas.drawRRect(RRect.fromRectAndRadius(Rect.fromLTWH(body.left + 7, body.top + 15, body.width - 14, 2.2), const Radius.circular(1.1)),+ Paint()..color = _ink(tub).withValues(alpha: 0.7));+ canvas.drawRRect(RRect.fromRectAndRadius(Rect.fromLTWH(body.left + 9, body.top + 19, body.width - 18, 1.8), const Radius.circular(0.9)),+ Paint()..color = _ink(tub).withValues(alpha: 0.4));+ final lid = Rect.fromLTWH(cx - 16, 6, 32, 10);+ _block(canvas, lid, 3.5, Color.lerp(tub, Colors.black, 0.28)!);+ for (var k = 1; k < 8; k++) {+ canvas.drawRect(Rect.fromLTWH(lid.left + k * 4, lid.top + 2, 0.9, lid.height - 4), Paint()..color = Colors.black.withValues(alpha: 0.16));+ }+ case 'water':+ final cx = w / 2;+ final blue = _hue(3);+ canvas.drawCircle(Offset(cx, h - 18), 17,+ Paint()+ ..color = blue.withValues(alpha: dark ? 0.22 : 0.16)+ ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 9));+ final top = 4.0, bottom = h - 3, r = 15.0;+ final drop = Path()+ ..moveTo(cx, top)+ ..cubicTo(cx + 4, top + 10, cx + r, bottom - r * 1.6, cx + r, bottom - r)+ ..arcToPoint(Offset(cx - r, bottom - r), radius: Radius.circular(r))+ ..cubicTo(cx - r, bottom - r * 1.6, cx - 4, top + 10, cx, top)+ ..close();+ _shadow(canvas, drop);+ _fill(canvas, drop, blue);+ canvas.save();+ canvas.clipPath(drop);+ canvas.drawPath(drop.shift(const Offset(-2.5, 2)),+ Paint()+ ..style = PaintingStyle.stroke+ ..strokeWidth = 2+ ..color = Colors.white.withValues(alpha: 0.3));+ canvas.restore();+ canvas.drawOval(Rect.fromCenter(center: Offset(cx - 6, bottom - r - 3), width: 5, height: 9),+ Paint()..color = Colors.white.withValues(alpha: 0.5));}}diff --git a/lib/widgets/ui_kit.dart b/lib/widgets/ui_kit.dartindex e439218..0317b7a 100644--- a/lib/widgets/ui_kit.dart+++ b/lib/widgets/ui_kit.dart@@ -1,5 +1,6 @@import 'dart:math' as math;+import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:phosphoricons_flutter/phosphoricons_flutter.dart';@@ -279,7 +280,7 @@ class _PressableState extends State<Pressable> {@overrideWidget build(BuildContext context) {- return GestureDetector(+ final tap = GestureDetector(behavior: HitTestBehavior.opaque,onTap: widget.onTap,onLongPress: widget.onLongPress,@@ -293,6 +294,8 @@ class _PressableState extends State<Pressable> {child: widget.child,),);+ if (!kIsWeb || widget.onTap == null) return tap;+ return MouseRegion(cursor: SystemMouseCursors.click, child: tap);}}