Offline gym log for Android. No account, no ads, no internet.
Dart androidbodybuildingdartexercisesf-droidfitnessfluttergymgym-apphealthprivacyself-hostedworkoutworkout-appworkout-tracker
Fade covered sheets and keep the background moving while a sheet opens
InlitXdffc77852d93
diff --git a/lib/app/app_shell.dart b/lib/app/app_shell.dartindex 849ddbc..87f35c4 100644--- a/lib/app/app_shell.dart+++ b/lib/app/app_shell.dart@@ -124,6 +124,7 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Singlefinal open = await NutritionWidgets.takeOpen();if (open != null) _openFromWidget(open);if (await HealthSteps.takeUsage()) _showStepsInfo();+ await fit.readDisplay();await _offerLiteMode();});}@@ -187,11 +188,11 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Singlefinal off = await askConfirm(context,title: t.lowEndTitle,- body: t.lowEndBody,+ body: t.lowEndLiteBody,cancelLabel: t.lowEndKeep,- confirmLabel: t.lowEndOff,+ confirmLabel: t.lowEndLiteOn,);- if (off) fit.setBlur(false);+ if (off) fit.setPerfLevel('lite');}bool _onScroll(ScrollNotification n) {@@ -210,18 +211,35 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Single_syncSnap();if (_blurred != null) {_blurAgain?.cancel();- _blurAgain = Timer(const Duration(milliseconds: 350), _queueBlur);+ _blurAgain = Timer(Duration(milliseconds: fineEffects ? 160 : 350), _queueBlur);}}Timer? _blurAgain;+ Timer? _snapLater;+void _syncSnap() => scheduleMicrotask(() {if (!mounted) return;final on = fit.route == 'nutrition' && (glassOpen.value > 0 || (glassShown.value > 0 && !_changedUnder));- if (on == _snap.allowSnapshotting) return;+ if (on == _snap.allowSnapshotting) {+ if (!on) _snapLater?.cancel();+ return;+ }+ if (on) {+ if (_snapLater?.isActive ?? false) return;+ _snapLater = Timer(const Duration(milliseconds: 420), () {+ if (!mounted) return;+ final still = fit.route == 'nutrition' && glassOpen.value > 0;+ if (!still || _snap.allowSnapshotting) return;+ _changedUnder = false;+ _snap.allowSnapshotting = true;+ });+ return;+ }+ _snapLater?.cancel();_changedUnder = false;- _snap.allowSnapshotting = on;+ _snap.allowSnapshotting = false;});void _syncBlurSnap() {@@ -245,7 +263,7 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Singleif (!mounted || sheetRecede.value <= 0.001 || !blurEffects) return;final box = _appKey.currentContext?.findRenderObject();if (box is! RenderRepaintBoundary || !box.hasSize) return;- const scale = 0.3;+ final scale = fineEffects ? 0.5 : 0.3;final ratio = MediaQuery.devicePixelRatioOf(context) * scale;try {final small = box.toImageSync(pixelRatio: ratio);@@ -266,6 +284,7 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver, Singlevoid dispose() {sheetRecede.removeListener(_syncBlurSnap);_blurAgain?.cancel();+ _snapLater?.cancel();_blurred?.dispose();glassOpen.removeListener(_syncSnap);glassShown.removeListener(_syncSnap);diff --git a/lib/widgets/glass.dart b/lib/widgets/glass.dartindex bc58baa..c9b0b8a 100644--- a/lib/widgets/glass.dart+++ b/lib/widgets/glass.dart@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';import '../theme/app_colors.dart';bool blurEffects = true;+bool fineEffects = false;final sheetRecede = ValueNotifier<double>(0);@@ -95,6 +96,29 @@ class _GlassSheetRoute<T> extends ModalBottomSheetRoute<T> with _GlassCount<T> {super.capturedThemes,super.barrierLabel,});++ @override+ bool canTransitionTo(TransitionRoute<dynamic> nextRoute) => nextRoute is _GlassSheetRoute;++ @override+ Widget buildTransitions(+ BuildContext context, Animation<double> animation, Animation<double> secondary, Widget child) {+ final under = CurvedAnimation(parent: secondary, curve: Curves.easeOutCubic, reverseCurve: Curves.easeInCubic);+ return AnimatedBuilder(+ animation: under,+ child: child,+ builder: (_, child) {+ final v = under.value;+ return IgnorePointer(+ ignoring: v > 0.5,+ child: Opacity(+ opacity: 1 - v,+ child: Transform.translate(offset: Offset(0, 36 * v), child: child),+ ),+ );+ },+ );+ }}class _PullToClose extends StatefulWidget {@@ -226,7 +250,7 @@ class _EdgeBlurState extends State<EdgeBlur> {}List<ui.ImageFilter> _layers(ui.FragmentProgram program, double dpr) {- final key = (widget.height, widget.top, widget.sigma, dpr);+ final key = (widget.height, widget.top, widget.sigma, dpr, fineEffects);if (_filters != null && _filtersFor == key) return _filters!;_dropShaders();ui.ImageFilter layer(double sigma, double from, double to) {@@ -243,7 +267,9 @@ class _EdgeBlurState extends State<EdgeBlur> {}_filtersFor = key;- return _filters = [layer(widget.sigma * 0.8, 0.06, 0.82)];+ return _filters = fineEffects+ ? [layer(widget.sigma * 0.35, 0.2, 1), layer(widget.sigma, 0.08, 0.66)]+ : [layer(widget.sigma * 0.8, 0.06, 0.82)];}@override