Offline gym log for Android. No account, no ads, no internet.
Dart androidbodybuildingdartexercisesf-droidfitnessfluttergymgym-apphealthprivacyself-hostedworkoutworkout-appworkout-tracker
Tidy the shared widgets
InlitX81421b95541b
diff --git a/lib/theme/app_colors.dart b/lib/theme/app_colors.dartindex c408564..c2d97e9 100644--- a/lib/theme/app_colors.dart+++ b/lib/theme/app_colors.dart@@ -24,6 +24,9 @@ class GymColors extends ThemeExtension<GymColors> {required this.sageSoft,required this.mutedFill,required this.heatEmpty,+ required this.info,+ required this.warn,+ required this.danger,});final Color pageBg;@@ -47,6 +50,9 @@ class GymColors extends ThemeExtension<GymColors> {final Color sageSoft;final Color mutedFill;final Color heatEmpty;+ final Color info;+ final Color warn;+ final Color danger;static const dark = GymColors(pageBg: Color(0xFF0A0908),@@ -70,6 +76,9 @@ class GymColors extends ThemeExtension<GymColors> {sageSoft: Color(0x298FA377),mutedFill: Color(0xFF2A2A2A),heatEmpty: Color(0xFF181818),+ info: Color(0xFF7FA8C9),+ warn: Color(0xFFE0B15A),+ danger: Color(0xFFE5674C),);static const light = GymColors(@@ -94,6 +103,9 @@ class GymColors extends ThemeExtension<GymColors> {sageSoft: Color(0x235F7A50),mutedFill: Color(0xFFDCCFB8),heatEmpty: Color(0xFFE8DFD0),+ info: Color(0xFF37648B),+ warn: Color(0xFF8A6218),+ danger: Color(0xFFB0341C),);@override@@ -119,6 +131,9 @@ class GymColors extends ThemeExtension<GymColors> {Color? sageSoft,Color? mutedFill,Color? heatEmpty,+ Color? info,+ Color? warn,+ Color? danger,}) {return GymColors(pageBg: pageBg ?? this.pageBg,@@ -142,6 +157,9 @@ class GymColors extends ThemeExtension<GymColors> {sageSoft: sageSoft ?? this.sageSoft,mutedFill: mutedFill ?? this.mutedFill,heatEmpty: heatEmpty ?? this.heatEmpty,+ info: info ?? this.info,+ warn: warn ?? this.warn,+ danger: danger ?? this.danger,);}@@ -171,6 +189,9 @@ class GymColors extends ThemeExtension<GymColors> {sageSoft: c(sageSoft, other.sageSoft),mutedFill: c(mutedFill, other.mutedFill),heatEmpty: c(heatEmpty, other.heatEmpty),+ info: c(info, other.info),+ warn: c(warn, other.warn),+ danger: c(danger, other.danger),);}}diff --git a/lib/widgets/svg_icon.dart b/lib/widgets/svg_icon.dartindex d496a15..b95e88c 100644--- a/lib/widgets/svg_icon.dart+++ b/lib/widgets/svg_icon.dart@@ -94,4 +94,5 @@ class Ic {static const layers = [IconPath('M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5', strokeWidth: 2)];static const clock = [IconPath('M12 2a10 10 0 100 20 10 10 0 000-20zM12 6v6l4 2', strokeWidth: 2)];static const noAds = [IconPath('M4.9 4.9l14.2 14.2M12 2v2M12 20v2M2 12h2M20 12h2', strokeWidth: 2)];+ static const plus = [IconPath('M12 5v14M5 12h14', strokeWidth: 2.5)];}diff --git a/lib/widgets/ui_kit.dart b/lib/widgets/ui_kit.dartindex ecab990..0ab8678 100644--- a/lib/widgets/ui_kit.dart+++ b/lib/widgets/ui_kit.dart@@ -1,3 +1,5 @@+import 'dart:math' as math;+import 'package:flutter/material.dart';import '../theme/app_colors.dart';@@ -206,6 +208,50 @@ class SegToggle extends StatelessWidget {}}+class DashedRail extends StatelessWidget {+ const DashedRail({super.key, required this.color, this.dash = 4, this.gap = 5, this.thickness = 1.6});++ final Color color;+ final double dash;+ final double gap;+ final double thickness;++ @override+ Widget build(BuildContext context) => Center(+ child: SizedBox(+ width: thickness,+ child: CustomPaint(+ size: Size.infinite,+ painter: _DashPainter(color, dash, gap, thickness),+ ),+ ),+ );+}++class _DashPainter extends CustomPainter {+ _DashPainter(this.color, this.dash, this.gap, this.thickness);+ final Color color;+ final double dash, gap, thickness;++ @override+ void paint(Canvas canvas, Size size) {+ final p = Paint()+ ..color = color+ ..strokeWidth = thickness+ ..strokeCap = StrokeCap.round;+ for (double y = 0; y < size.height; y += dash + gap) {+ canvas.drawLine(+ Offset(size.width / 2, y),+ Offset(size.width / 2, math.min(y + dash, size.height)),+ p,+ );+ }+ }++ @override+ bool shouldRepaint(_DashPainter o) => o.color != color || o.dash != dash || o.gap != gap;+}+class Pill extends StatelessWidget {const Pill({super.key,@@ -265,11 +311,19 @@ class PrimaryButton extends StatelessWidget {width: double.infinity,height: height,decoration: BoxDecoration(color: bg ?? gc.ember, borderRadius: BorderRadius.circular(100)),+ padding: const EdgeInsets.symmetric(horizontal: 16),child: Row(mainAxisAlignment: MainAxisAlignment.center,children: [if (icon != null) ...[SvgPathIcon(icon!, size: 18, color: f), const SizedBox(width: 10)],- Text(label, style: AppTheme.d(16, weight: FontWeight.w600, color: f, letterSpacing: 2)),+ Flexible(+ child: FittedBox(+ fit: BoxFit.scaleDown,+ child: Text(label,+ maxLines: 1,+ style: AppTheme.d(16, weight: FontWeight.w600, color: f, letterSpacing: 2)),+ ),+ ),],),),