Skip to content

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

Redraw settings, about and onboarding with a fixed icon column

InlitX60650af4cf96
diff --git a/lib/screens/about_screen.dart b/lib/screens/about_screen.dart
index 02752ce..8588d43 100644
--- a/lib/screens/about_screen.dart
+++ b/lib/screens/about_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 'package:url_launcher/url_launcher.dart';
import '../catalog/exercise_catalog.dart';
@@ -9,7 +9,7 @@ import '../theme/app_colors.dart';
import '../theme/app_theme.dart';
import '../widgets/ui_kit.dart';
-const _kVersion = '1.1.0';
+const _kVersion = '1.2.0';
const _kAuthor = 'InlitX';
const _kAuthorUrl = 'https://github.com/InlitX';
const _kRepoUrl = 'https://github.com/InlitX/GymMane';
@@ -24,7 +24,7 @@ class AboutScreen extends StatelessWidget {
return SafeArea(
bottom: false,
child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 32),
+ padding: const EdgeInsets.fromLTRB(20, 12, 20, 36),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -34,161 +34,212 @@ class AboutScreen extends StatelessWidget {
titleSize: 18,
titleSpacing: 1,
),
- const SizedBox(height: 20),
+ const SizedBox(height: 18),
_hero(gc),
- const SizedBox(height: 24),
- _principle(gc, PhosphorIconsRegular.gift, t.freeForever, t.freeForeverWhy),
- const SizedBox(height: 10),
- _principle(gc, PhosphorIconsRegular.wifiSlash, t.fullyOffline, t.fullyOfflineWhy),
- const SizedBox(height: 10),
- _principle(gc, PhosphorIconsRegular.export, t.yoursToTake, t.yoursToTakeWhy),
- const SizedBox(height: 24),
- Text(t.whatsInside,
- style: AppTheme.d(12, weight: FontWeight.w600, color: gc.textSecondary, letterSpacing: 3)),
- const SizedBox(height: 10),
- _principle(gc, PhosphorIconsRegular.barbell, t.exercisesInside(kExercises.length),
- t.exercisesInsideWhy),
- const SizedBox(height: 10),
- _principle(gc, PhosphorIconsRegular.calculator, t.calculatorsInside, t.calculatorsInsideWhy),
- const SizedBox(height: 10),
- _principle(gc, PhosphorIconsRegular.chartLineUp, t.mathInside, t.mathInsideWhy),
- const SizedBox(height: 24),
+ const SizedBox(height: 20),
+ _group(gc, [
+ (PhosphorIconsRegular.gift, t.freeForever, t.freeForeverWhy),
+ (PhosphorIconsRegular.wifiSlash, t.fullyOffline, t.fullyOfflineWhy),
+ (PhosphorIconsRegular.export, t.yoursToTake, t.yoursToTakeWhy),
+ ]),
+ const SizedBox(height: 18),
+ _sectionLabel(gc, t.whatsInside),
+ const SizedBox(height: 8),
+ _group(gc, [
+ (PhosphorIconsRegular.barbell, t.exercisesInside(kExercises.length),
+ t.exercisesInsideWhy),
+ (PhosphorIconsRegular.calculator, t.calculatorsInside, t.calculatorsInsideWhy),
+ (PhosphorIconsRegular.chartLineUp, t.mathInside, t.mathInsideWhy),
+ ]),
+ const SizedBox(height: 22),
Text(t.aboutBlurb,
- textAlign: TextAlign.center, style: AppTheme.s(12, color: gc.textTertiary, height: 1.6)),
+ textAlign: TextAlign.center,
+ style: AppTheme.f(12.5, weight: FontWeight.w500, color: gc.textTertiary, height: 1.6)),
const SizedBox(height: 20),
- _credit(gc, PhosphorIconsFill.heart, t.madeWithLoveBy, _kAuthor, _kAuthorUrl),
- const SizedBox(height: 10),
- _credit(gc, PhosphorIconsRegular.githubLogo, t.sourceCode, 'InlitX/GymMane', _kRepoUrl),
- const SizedBox(height: 10),
- _credit(gc, PhosphorIconsRegular.coffee, t.buyCoffee, 'ko-fi.com/inlitx', _kKofiUrl),
+ _credits(gc),
],
),
),
);
}
- Widget _credit(GymColors gc, IconData icon, String label, String value, String url) {
- return Semantics(
- button: true,
- link: true,
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () => _open(url),
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
- decoration: BoxDecoration(
- color: gc.bgRaised,
- border: Border.all(color: gc.border),
- borderRadius: BorderRadius.circular(16),
+ Widget _sectionLabel(GymColors gc, String label) => Text(label.toUpperCase(),
+ style: AppTheme.f(10.5, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.3));
+
+ Widget _hero(GymColors gc) {
+ return Container(
+ height: 178,
+ clipBehavior: Clip.antiAlias,
+ decoration: BoxDecoration(
+ color: gc.bgRaised,
+ borderRadius: BorderRadius.circular(22),
+ ),
+ child: Stack(
+ children: [
+ Positioned(
+ left: -46,
+ bottom: -56,
+ child: Container(
+ width: 162,
+ height: 162,
+ decoration: BoxDecoration(color: gc.accentSoft, shape: BoxShape.circle),
+ ),
+ ),
+ Positioned(
+ left: 128,
+ top: -42,
+ child: Container(
+ width: 88,
+ height: 88,
+ decoration: BoxDecoration(color: gc.emberSoft, shape: BoxShape.circle),
+ ),
),
- child: Row(
- children: [
- Icon(icon, size: 18, color: gc.accent),
- const SizedBox(width: 14),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(label,
- style: AppTheme.d(10.5,
- weight: FontWeight.w600, color: gc.textTertiary, letterSpacing: 2)),
- const SizedBox(height: 4),
- Text(value,
- style: AppTheme.d(17, weight: FontWeight.w700, color: gc.text)),
- ],
+ Positioned(
+ right: 6,
+ top: 14,
+ bottom: 14,
+ child: Opacity(
+ opacity: 0.6,
+ child: Image.asset('assets/img/runner.png', fit: BoxFit.fitHeight),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(22),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text('GymMane',
+ style: AppTheme.f(33, weight: FontWeight.w800, color: gc.text, letterSpacing: -0.5)),
+ const SizedBox(height: 10),
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 11, vertical: 5),
+ decoration: BoxDecoration(
+ color: gc.bgRaised2,
+ borderRadius: BorderRadius.circular(100),
+ ),
+ child: Text(t.version(_kVersion),
+ style: AppTheme.f(11.5, weight: FontWeight.w600, color: gc.textSecondary)),
),
- ),
- Icon(PhosphorIconsRegular.arrowUpRight, size: 15, color: gc.textTertiary),
- ],
+ ],
+ ),
),
- ),
+ ],
),
);
}
- Future<void> _open(String url) async {
- try {
- await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
- } catch (_) {}
- }
-
- Widget _hero(GymColors gc) {
- return ClipRRect(
- borderRadius: BorderRadius.circular(24),
- child: Container(
- height: 190,
- decoration: BoxDecoration(
- color: gc.bgRaised,
- border: Border.all(color: gc.border),
- borderRadius: BorderRadius.circular(24),
- ),
- child: Stack(
- children: [
- Positioned(
- left: -50,
- bottom: -60,
- child: Container(
- width: 170,
- height: 170,
- decoration: BoxDecoration(color: gc.accentSoft, shape: BoxShape.circle),
- ),
- ),
- Positioned(
- right: -10,
- top: 8,
- bottom: 8,
- child: Opacity(
- opacity: 0.5,
- child: Image.asset('assets/img/runner.png', fit: BoxFit.fitHeight),
+ Widget _group(GymColors gc, List<(IconData, String, String)> rows) {
+ return Container(
+ clipBehavior: Clip.antiAlias,
+ decoration: BoxDecoration(
+ color: gc.bgRaised,
+ borderRadius: BorderRadius.circular(20),
+ ),
+ child: Column(
+ children: [
+ for (int i = 0; i < rows.length; i++)
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 15),
+ decoration: BoxDecoration(
+ border: i < rows.length - 1
+ ? Border(bottom: BorderSide(color: gc.border.withValues(alpha: 0.6)))
+ : null,
),
- ),
- Padding(
- padding: const EdgeInsets.all(22),
- child: Column(
+ child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.center,
children: [
- Text('GYMMANE',
- style: AppTheme.d(34, weight: FontWeight.w700, color: gc.text, letterSpacing: 1)),
- const SizedBox(height: 4),
- Text(t.version(_kVersion), style: AppTheme.s(12, color: gc.textSecondary)),
+ Padding(
+ padding: const EdgeInsets.only(top: 1, right: 14),
+ child: SizedBox(
+ width: 22,
+ child: Icon(rows[i].$1, size: 19, color: gc.textSecondary),
+ ),
+ ),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(rows[i].$2, style: AppTheme.f(14.5, weight: FontWeight.w600, color: gc.text)),
+ const SizedBox(height: 3),
+ Text(rows[i].$3,
+ style: AppTheme.f(12.5,
+ weight: FontWeight.w500, color: gc.textSecondary, height: 1.4)),
+ ],
+ ),
+ ),
],
),
),
- ],
- ),
+ ],
),
);
}
- Widget _principle(GymColors gc, IconData icon, String title, String why) {
+ Widget _credits(GymColors gc) {
+ final rows = <(IconData, String, String, String, Color?)>[
+ (PhosphorIconsFill.heart, t.madeWithLoveBy, _kAuthor, _kAuthorUrl, gc.accent),
+ (PhosphorIconsRegular.githubLogo, t.sourceCode, 'InlitX/GymMane', _kRepoUrl, null),
+ (PhosphorIconsRegular.coffee, t.buyCoffee, 'ko-fi.com/inlitx', _kKofiUrl, null),
+ ];
return Container(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
+ clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: gc.bgRaised,
- border: Border.all(color: gc.border),
- borderRadius: BorderRadius.circular(16),
+ borderRadius: BorderRadius.circular(20),
),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
+ child: Column(
children: [
- Padding(
- padding: const EdgeInsets.only(top: 2),
- child: Icon(icon, size: 18, color: gc.accent),
- ),
- const SizedBox(width: 14),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(title, style: AppTheme.s(14, weight: FontWeight.w600, color: gc.text)),
- const SizedBox(height: 3),
- Text(why, style: AppTheme.s(12, color: gc.textSecondary, height: 1.35)),
- ],
+ for (int i = 0; i < rows.length; i++)
+ Semantics(
+ button: true,
+ link: true,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => _open(rows[i].$4),
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
+ decoration: BoxDecoration(
+ border: i < rows.length - 1
+ ? Border(bottom: BorderSide(color: gc.border.withValues(alpha: 0.6)))
+ : null,
+ ),
+ child: Row(
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(right: 14),
+ child: SizedBox(
+ width: 22,
+ child: Icon(rows[i].$1, size: 19, color: rows[i].$5 ?? gc.textSecondary),
+ ),
+ ),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(rows[i].$2.toUpperCase(),
+ style: AppTheme.f(10,
+ weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.3)),
+ const SizedBox(height: 4),
+ Text(rows[i].$3,
+ style: AppTheme.f(15.5, weight: FontWeight.w700, color: gc.text)),
+ ],
+ ),
+ ),
+ Icon(PhosphorIconsRegular.arrowUpRight, size: 15, color: gc.textTertiary),
+ ],
+ ),
+ ),
+ ),
),
- ),
],
),
);
}
+
+ Future<void> _open(String url) async {
+ try {
+ await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
+ } catch (_) {}
+ }
}
diff --git a/lib/screens/onboarding_screen.dart b/lib/screens/onboarding_screen.dart
index e7f56d4..09e5535 100644
--- a/lib/screens/onboarding_screen.dart
+++ b/lib/screens/onboarding_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 '../l10n/l10n.dart';
import '../state/fit_state.dart';
@@ -15,9 +15,14 @@ class OnboardingScreen extends StatefulWidget {
State<OnboardingScreen> createState() => _OnboardingScreenState();
}
-class _OnboardingScreenState extends State<OnboardingScreen> {
+class _OnboardingScreenState extends State<OnboardingScreen>
+ with SingleTickerProviderStateMixin {
final _page = PageController();
late final TextEditingController _name = TextEditingController();
+ late final AnimationController _reveal = AnimationController(
+ vsync: this,
+ duration: const Duration(milliseconds: 680),
+ )..forward();
int _index = 0;
static const _last = 4;
@@ -25,12 +30,17 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
void dispose() {
_page.dispose();
_name.dispose();
+ _reveal.dispose();
super.dispose();
}
void _go(int i) {
+ _page.animateToPage(i, duration: const Duration(milliseconds: 340), curve: Curves.easeOutCubic);
+ }
+
+ void _onPage(int i) {
setState(() => _index = i);
- _page.animateToPage(i, duration: const Duration(milliseconds: 280), curve: Curves.easeOutCubic);
+ _reveal.forward(from: 0);
}
void _finish() {
@@ -39,11 +49,27 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
fit.completeOnboarding();
}
+ Widget _in(int order, Widget child) {
+ return AnimatedBuilder(
+ animation: _reveal,
+ builder: (context, kid) {
+ final v = Curves.easeOutCubic
+ .transform(((_reveal.value - 0.08 * order) / 0.6).clamp(0.0, 1.0));
+ return Opacity(
+ opacity: v,
+ child: Transform.translate(offset: Offset(0, 20 * (1 - v)), child: kid),
+ );
+ },
+ child: child,
+ );
+ }
+
@override
Widget build(BuildContext context) {
final gc = context.gc;
return Scaffold(
backgroundColor: gc.bg,
+ resizeToAvoidBottomInset: false,
body: Stack(
children: [
Positioned.fill(child: _Glow(gc)),
@@ -55,7 +81,7 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
Expanded(
child: PageView(
controller: _page,
- onPageChanged: (i) => setState(() => _index = i),
+ onPageChanged: _onPage,
children: [
_welcome(gc),
_nameStep(gc),
@@ -76,32 +102,36 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
Widget _topBar(GymColors gc) {
return Padding(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
+ padding: const EdgeInsets.fromLTRB(24, 16, 16, 0),
child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Row(children: [
- for (int i = 0; i <= _last; i++)
- AnimatedContainer(
- duration: const Duration(milliseconds: 240),
- margin: const EdgeInsets.only(right: 6),
- width: i == _index ? 20 : 6,
- height: 6,
- decoration: BoxDecoration(
- color: i <= _index ? gc.ember : gc.bgRaised2,
- borderRadius: BorderRadius.circular(3),
- ),
- ),
- ]),
- Semantics(
- button: true,
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: _finish,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
- child: Text(t.skip2, style: AppTheme.s(13, color: gc.textTertiary)),
- ),
+ Expanded(
+ child: Row(
+ children: [
+ for (int i = 0; i <= _last; i++)
+ Expanded(
+ child: AnimatedContainer(
+ duration: const Duration(milliseconds: 280),
+ curve: Curves.easeOutCubic,
+ margin: const EdgeInsets.only(right: 6),
+ height: 3,
+ decoration: BoxDecoration(
+ color: i <= _index ? gc.text : gc.bgRaised2,
+ borderRadius: BorderRadius.circular(3),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(width: 10),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: _finish,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
+ child: Text(t.skip2,
+ style: AppTheme.f(12.5, weight: FontWeight.w600, color: gc.textTertiary)),
),
),
],
@@ -111,25 +141,22 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
Widget _bottomBar(GymColors gc) {
return Padding(
- padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
+ padding: const EdgeInsets.fromLTRB(24, 8, 24, 22),
child: Row(
children: [
if (_index > 0)
- Expanded(
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () => _go(_index - 1),
- child: SizedBox(
- height: 52,
- child: Center(
- child: Text(t.back,
- style: AppTheme.d(13, weight: FontWeight.w600, color: gc.textSecondary, letterSpacing: 1)),
- ),
- ),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => _go(_index - 1),
+ child: Container(
+ width: 56,
+ height: 56,
+ margin: const EdgeInsets.only(right: 12),
+ decoration: BoxDecoration(color: gc.bgRaised, shape: BoxShape.circle),
+ child: Icon(PhosphorIconsBold.arrowLeft, size: 18, color: gc.textSecondary),
),
),
Expanded(
- flex: 2,
child: PrimaryButton(
label: _index == _last ? t.welcomeStart : t.next,
onTap: () => _index == _last ? _finish() : _go(_index + 1),
@@ -150,23 +177,36 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
}) {
return LayoutBuilder(
builder: (context, box) => SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(24, 24, 24, 24),
+ padding: const EdgeInsets.fromLTRB(24, 20, 24, 20),
child: ConstrainedBox(
- constraints: BoxConstraints(minHeight: box.maxHeight - 48),
+ constraints: BoxConstraints(minHeight: box.maxHeight - 40),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- _badge(gc, icon),
- const SizedBox(height: 20),
- Text(t.onbStep(step, _last),
- style: AppTheme.d(11, weight: FontWeight.w600, color: gc.brass, letterSpacing: 3)),
- const SizedBox(height: 8),
- Text(title, style: AppTheme.d(30, weight: FontWeight.w700, color: gc.text, height: 1.1)),
- const SizedBox(height: 8),
- Text(why, style: AppTheme.s(14, color: gc.textSecondary, height: 1.4)),
- const SizedBox(height: 28),
- child,
+ _in(0, _badge(gc, icon)),
+ const SizedBox(height: 22),
+ _in(
+ 1,
+ Text(t.onbStep(step, _last).toUpperCase(),
+ style: AppTheme.f(10.5,
+ weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.6)),
+ ),
+ const SizedBox(height: 9),
+ _in(
+ 2,
+ Text(title,
+ style: AppTheme.f(30, weight: FontWeight.w800, color: gc.text, height: 1.12)),
+ ),
+ const SizedBox(height: 10),
+ _in(
+ 3,
+ Text(why,
+ style: AppTheme.f(13.5,
+ weight: FontWeight.w500, color: gc.textSecondary, height: 1.45)),
+ ),
+ const SizedBox(height: 26),
+ _in(4, child),
],
),
),
@@ -177,53 +217,84 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
Widget _badge(GymColors gc, IconData icon) => Align(
alignment: Alignment.centerLeft,
child: Container(
- width: 56,
- height: 56,
+ width: 54,
+ height: 54,
decoration: BoxDecoration(
- color: gc.emberSoft,
+ color: gc.bgRaised,
borderRadius: BorderRadius.circular(18),
- border: Border.all(color: gc.border),
),
- child: Icon(icon, size: 26, color: gc.ember),
+ child: Icon(icon, size: 24, color: gc.textSecondary),
),
);
Widget _welcome(GymColors gc) {
- return SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(24, 0, 24, 24),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Center(
- child: Image.asset('assets/img/runner.png',
- height: 200, opacity: const AlwaysStoppedAnimation(0.85)),
+ return LayoutBuilder(
+ builder: (context, box) => SingleChildScrollView(
+ padding: const EdgeInsets.fromLTRB(24, 20, 24, 20),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(minHeight: box.maxHeight - 40),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _in(
+ 0,
+ Center(
+ child: Image.asset('assets/img/runner.png',
+ height: 218, opacity: const AlwaysStoppedAnimation(0.9)),
+ ),
+ ),
+ const SizedBox(height: 30),
+ _in(
+ 1,
+ Text(t.welcomeKicker.toUpperCase(),
+ style: AppTheme.f(10.5,
+ weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.6)),
+ ),
+ const SizedBox(height: 8),
+ _in(
+ 2,
+ Text('GymMane',
+ style: AppTheme.f(44, weight: FontWeight.w800, color: gc.text, height: 1)),
+ ),
+ const SizedBox(height: 12),
+ _in(
+ 3,
+ Text(t.welcomeBlurb,
+ style: AppTheme.f(14.5,
+ weight: FontWeight.w500, color: gc.textSecondary, height: 1.5)),
+ ),
+ const SizedBox(height: 26),
+ _in(
+ 4,
+ SoftCard(
+ radius: 22,
+ padding: const EdgeInsets.fromLTRB(18, 16, 18, 16),
+ child: Column(
+ children: [
+ _promise(gc, PhosphorIconsRegular.wifiSlash, t.fullyOffline),
+ const SizedBox(height: 14),
+ _promise(gc, PhosphorIconsRegular.sealCheck, t.freeForever),
+ const SizedBox(height: 14),
+ _promise(gc, PhosphorIconsRegular.lockKey, t.yoursToTake),
+ ],
+ ),
+ ),
+ ),
+ ],
),
- const SizedBox(height: 28),
- Text(t.welcomeKicker,
- style: AppTheme.d(12, weight: FontWeight.w600, color: gc.brass, letterSpacing: 3)),
- const SizedBox(height: 6),
- Text('GYMMANE', style: AppTheme.d(46, weight: FontWeight.w700, color: gc.text, letterSpacing: 1)),
- const SizedBox(height: 12),
- Text(t.welcomeBlurb, style: AppTheme.s(15, color: gc.textSecondary, height: 1.45)),
- const SizedBox(height: 26),
- _promise(gc, PhosphorIconsRegular.wifiSlash, t.fullyOffline),
- const SizedBox(height: 10),
- _promise(gc, PhosphorIconsRegular.sealCheck, t.freeForever),
- const SizedBox(height: 10),
- _promise(gc, PhosphorIconsRegular.lockKey, t.yoursToTake),
- ],
+ ),
),
);
}
Widget _promise(GymColors gc, IconData icon, String label) => Row(
children: [
- Icon(icon, size: 17, color: gc.sage),
- const SizedBox(width: 10),
+ Icon(icon, size: 17, color: gc.textSecondary),
+ const SizedBox(width: 12),
Expanded(
child: Text(label,
- style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary)),
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.text)),
),
],
);
@@ -238,17 +309,18 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
child: TextField(
controller: _name,
textCapitalization: TextCapitalization.words,
- textInputAction: TextInputAction.next,
- style: AppTheme.d(22, weight: FontWeight.w600, color: gc.text),
+ textInputAction: TextInputAction.done,
+ style: AppTheme.f(20, weight: FontWeight.w700, color: gc.text),
cursorColor: gc.accent,
onSubmitted: (_) => _go(2),
decoration: InputDecoration(
hintText: t.onbNameHint,
- hintStyle: AppTheme.d(22, weight: FontWeight.w600, color: gc.textTertiary),
+ hintStyle: AppTheme.f(20, weight: FontWeight.w700, color: gc.textTertiary),
filled: true,
fillColor: gc.bgRaised,
- contentPadding: const EdgeInsets.symmetric(horizontal: 18, vertical: 18),
- border: OutlineInputBorder(borderRadius: BorderRadius.circular(16), borderSide: BorderSide.none),
+ contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
+ border:
+ OutlineInputBorder(borderRadius: BorderRadius.circular(20), borderSide: BorderSide.none),
),
),
);
@@ -262,21 +334,32 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
icon: PhosphorIconsRegular.ruler,
title: t.onbBodyTitle,
why: t.onbBodyWhy,
- child: Column(children: [
- _row(gc, t.sexLabel, SegToggle([
- SegOption(t.male, p.sex == 'male', () => _up(() => fit.updateProfile(sex: 'male'))),
- SegOption(t.female, p.sex == 'female', () => _up(() => fit.updateProfile(sex: 'female'))),
- ])),
- const SizedBox(height: 12),
- _stepper(gc, t.ageLabel, '${p.age}', () => fit.updateProfile(ageDelta: -1), () => fit.updateProfile(ageDelta: 1)),
- const SizedBox(height: 12),
- _stepper(gc, t.heightLabel, '${fmt(p.heightCm)} cm', () => fit.updateProfile(heightDelta: -1),
- () => fit.updateProfile(heightDelta: 1)),
- const SizedBox(height: 12),
- _stepper(gc, t.weightLabel, fit.weightLabel(p.weightKg),
- () => fit.updateProfile(weightDelta: -fit.fromDisplayWeight(fit.isLb ? 1 : 0.5)),
- () => fit.updateProfile(weightDelta: fit.fromDisplayWeight(fit.isLb ? 1 : 0.5))),
- ]),
+ child: SoftCard(
+ radius: 22,
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
+ child: Column(
+ children: [
+ _row(gc, t.sexLabel, SegToggle([
+ SegOption(t.male, p.sex == 'male', () => _up(() => fit.updateProfile(sex: 'male'))),
+ SegOption(
+ t.female, p.sex == 'female', () => _up(() => fit.updateProfile(sex: 'female'))),
+ ])),
+ _divider(gc),
+ _stepperRow(gc, t.ageLabel, '${p.age}', () => fit.updateProfile(ageDelta: -1),
+ () => fit.updateProfile(ageDelta: 1)),
+ _divider(gc),
+ _stepperRow(gc, t.heightLabel, '${fmt(p.heightCm)} cm',
+ () => fit.updateProfile(heightDelta: -1), () => fit.updateProfile(heightDelta: 1)),
+ _divider(gc),
+ _stepperRow(
+ gc,
+ t.weightLabel,
+ fit.weightLabel(p.weightKg),
+ () => fit.updateProfile(weightDelta: -fit.fromDisplayWeight(fit.isLb ? 1 : 0.5)),
+ () => fit.updateProfile(weightDelta: fit.fromDisplayWeight(fit.isLb ? 1 : 0.5))),
+ ],
+ ),
+ ),
);
}
@@ -290,21 +373,22 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
child: Column(
children: [
Text(t.perWeek(fit.profile.weeklyGoal),
- style: AppTheme.d(28, weight: FontWeight.w700, color: gc.text)),
- const SizedBox(height: 18),
+ style: AppTheme.f(26, weight: FontWeight.w800, color: gc.text)),
+ const SizedBox(height: 20),
Wrap(
- spacing: 8,
- runSpacing: 8,
+ spacing: 9,
+ runSpacing: 9,
alignment: WrapAlignment.center,
children: [
for (int n = 2; n <= 7; n++)
Pill(
label: '$n×',
- bg: fit.profile.weeklyGoal == n ? gc.ember : gc.bgRaised2,
+ bg: fit.profile.weeklyGoal == n ? gc.ember : gc.bgRaised,
fg: fit.profile.weeklyGoal == n ? gc.onEmber : gc.textSecondary,
- onTap: () => _up(() => fit.updateProfile(weeklyGoalDelta: n - fit.profile.weeklyGoal)),
- hPad: 18,
- vPad: 12,
+ onTap: () =>
+ _up(() => fit.updateProfile(weeklyGoalDelta: n - fit.profile.weeklyGoal)),
+ hPad: 20,
+ vPad: 13,
fontSize: 15,
),
],
@@ -326,22 +410,23 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
for (final u in const ['kg', 'lb'])
Expanded(
child: Padding(
- padding: const EdgeInsets.only(right: 10),
+ padding: EdgeInsets.only(right: u == 'kg' ? 12 : 0),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _up(() => fit.setUnits(u)),
child: AnimatedContainer(
- duration: const Duration(milliseconds: 160),
- height: 90,
+ duration: const Duration(milliseconds: 200),
+ curve: Curves.easeOutCubic,
+ height: 96,
decoration: BoxDecoration(
color: fit.units == u ? gc.ember : gc.bgRaised,
- border: Border.all(color: fit.units == u ? gc.ember : gc.border),
- borderRadius: BorderRadius.circular(18),
+ borderRadius: BorderRadius.circular(22),
),
alignment: Alignment.center,
child: Text(u,
- style: AppTheme.d(30,
- weight: FontWeight.w700, color: fit.units == u ? gc.onEmber : gc.text)),
+ style: AppTheme.f(28,
+ weight: FontWeight.w800,
+ color: fit.units == u ? gc.onEmber : gc.text)),
),
),
),
@@ -356,24 +441,27 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
setState(() {});
}
- Widget _row(GymColors gc, String label, Widget control) => SoftCard(
- radius: 14,
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+ Widget _divider(GymColors gc) => Container(height: 1, color: gc.bgRaised2);
+
+ Widget _row(GymColors gc, String label, Widget control) => Padding(
+ padding: const EdgeInsets.symmetric(vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(label, style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary)),
+ Text(label, style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary)),
control,
],
),
);
- Widget _stepper(GymColors gc, String label, String value, VoidCallback dec, VoidCallback inc) => _row(
+ Widget _stepperRow(
+ GymColors gc, String label, String value, VoidCallback dec, VoidCallback inc) =>
+ _row(
gc,
label,
StepperControl(
value: value,
- minWidth: 74,
+ minWidth: 78,
btnSize: 34,
gap: 12,
fontSize: 15,
@@ -395,7 +483,7 @@ class _Glow extends StatelessWidget {
gradient: RadialGradient(
center: const Alignment(0.9, -0.85),
radius: 1.1,
- colors: [gc.ember.withValues(alpha: 0.16), gc.bg.withValues(alpha: 0)],
+ colors: [gc.ember.withValues(alpha: 0.12), gc.bg.withValues(alpha: 0)],
),
),
child: DecoratedBox(
@@ -403,7 +491,7 @@ class _Glow extends StatelessWidget {
gradient: RadialGradient(
center: const Alignment(-0.9, 0.9),
radius: 1.0,
- colors: [gc.brass.withValues(alpha: 0.08), gc.bg.withValues(alpha: 0)],
+ colors: [gc.brass.withValues(alpha: 0.07), gc.bg.withValues(alpha: 0)],
),
),
child: const SizedBox.expand(),
diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart
index 4313723..8fb38d2 100644
--- a/lib/screens/settings_screen.dart
+++ b/lib/screens/settings_screen.dart
@@ -7,11 +7,12 @@ import 'package:flutter/material.dart';
import 'package:home_widget/home_widget.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path_provider/path_provider.dart';
-import 'package:phosphor_flutter/phosphor_flutter.dart';
+import 'package:phosphoricons_flutter/phosphoricons_flutter.dart';
import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import '../l10n/l10n.dart';
+import '../models/profile.dart';
import '../services/alarm_store.dart';
import '../services/backup_zip.dart';
import '../services/fitnotes_backup.dart';
@@ -25,6 +26,7 @@ import '../theme/app_theme.dart';
import '../widgets/dialogs.dart';
import '../widgets/photo_source_sheet.dart';
import '../widgets/profile_avatar.dart';
+import 'profile_screen.dart';
import '../widgets/ui_kit.dart';
const _kRepoUrl = 'https://github.com/InlitX/GymMane';
@@ -41,48 +43,24 @@ class SettingsScreen extends StatelessWidget {
return SafeArea(
bottom: false,
child: SingleChildScrollView(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 110),
+ padding: const EdgeInsets.fromLTRB(20, 12, 20, 32),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- ScreenTitle(t.settings),
- const SizedBox(height: 22),
- GestureDetector(
- onTap: () => _editProfile(context),
- child: SoftCard(
- radius: 20,
- child: Row(children: [
- ProfileAvatar(),
- const SizedBox(width: 14),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(fit.profile.name,
- style: AppTheme.d(16, weight: FontWeight.w600, color: gc.text)),
- const SizedBox(height: 2),
- Text(t.levelStreak(fit.athleteLevel, fit.currentStreak),
- style: AppTheme.s(13, color: gc.textSecondary)),
- ],
- ),
- ),
- Icon(PhosphorIconsRegular.pencilSimple, size: 18, color: gc.textSecondary),
- ]),
- ),
- ),
- const SizedBox(height: 22),
+ ScreenHeader(title: t.settings, onBack: fit.backFromPreferences),
+ const SizedBox(height: 20),
_sectionLabel(gc, t.preferences),
- const SizedBox(height: 10),
+ const SizedBox(height: 8),
SoftCard(
- radius: 18,
- padding: const EdgeInsets.all(16),
+ radius: 20,
+ borderColor: Colors.transparent,
+ padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
- _prefRow(gc, PhosphorIconsRegular.moonStars, t.theme, SegToggle([
+ _prefRow(gc, PhosphorIconsRegular.moon, t.theme, SegToggle([
SegOption(t.darkTheme, fit.dark, fit.setThemeDark),
SegOption(t.lightTheme, !fit.dark, fit.setThemeLight),
])),
- const SizedBox(height: 16),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _editLanguage(context),
@@ -93,25 +71,23 @@ class SettingsScreen extends StatelessWidget {
Row(mainAxisSize: MainAxisSize.min, children: [
Text(
languageNameOf(fit.language),
- style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary),
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary),
),
const SizedBox(width: 6),
- Icon(PhosphorIconsRegular.caretRight, size: 16, color: gc.textSecondary),
+ Icon(PhosphorIconsRegular.caretRight, size: 15, color: gc.textTertiary),
]),
),
),
- const SizedBox(height: 16),
_prefRow(gc, PhosphorIconsRegular.scales, t.unitsLabel, SegToggle([
SegOption('kg', fit.units == 'kg', () => fit.setUnits('kg')),
SegOption('lb', fit.units == 'lb', () => fit.setUnits('lb')),
])),
- const SizedBox(height: 16),
_prefRow(
gc,
PhosphorIconsRegular.timer,
t.restTimer,
StepperControl(
- value: '${fit.restSeconds}s',
+ value: fit.restSeconds == 0 ? t.restOff : '${fit.restSeconds}s',
minWidth: 48,
btnSize: 28,
gap: 10,
@@ -120,13 +96,34 @@ class SettingsScreen extends StatelessWidget {
onInc: () => fit.setRestSeconds(fit.restSeconds + 15),
),
),
- const SizedBox(height: 16),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => _editTrainReminder(context),
+ child: _prefRow(
+ gc,
+ PhosphorIconsRegular.bellSimple,
+ t.trainReminder,
+ Row(mainAxisSize: MainAxisSize.min, children: [
+ Flexible(
+ child: Text(
+ _reminderValue(context),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ textAlign: TextAlign.right,
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary),
+ ),
+ ),
+ const SizedBox(width: 6),
+ Icon(PhosphorIconsRegular.caretRight, size: 15, color: gc.textTertiary),
+ ]),
+ ),
+ ),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => _editAlarmSound(context),
child: _prefRow(
gc,
- PhosphorIconsRegular.bellRinging,
+ PhosphorIconsRegular.speakerHigh,
t.alarmSound,
Row(mainAxisSize: MainAxisSize.min, children: [
ConstrainedBox(
@@ -136,11 +133,11 @@ class SettingsScreen extends StatelessWidget {
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.right,
- style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary),
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary),
),
),
const SizedBox(width: 6),
- Icon(PhosphorIconsRegular.caretRight, size: 16, color: gc.textSecondary),
+ Icon(PhosphorIconsRegular.caretRight, size: 15, color: gc.textTertiary),
]),
),
),
@@ -148,64 +145,80 @@ class SettingsScreen extends StatelessWidget {
const SizedBox(height: 14),
_alarmWarning(context, gc),
],
- const SizedBox(height: 16),
- _prefRow(gc, PhosphorIconsRegular.gridFour, t.background, SegToggle([
- SegOption(t.bgNone, fit.bgPattern == 'none', () => fit.setBgPattern('none')),
- SegOption(t.bgDots, fit.bgPattern == 'dots', () => fit.setBgPattern('dots')),
- SegOption(t.bgGrid, fit.bgPattern == 'grid', () => fit.setBgPattern('grid')),
- ], hPad: 11)),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: fit.toggleFocusCard,
+ child: _prefRow(gc, PhosphorIconsRegular.target, t.focusCard,
+ TinySwitch(on: fit.showFocus)),
+ ),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: fit.toggleLogRpe,
+ child: _prefRow(gc, PhosphorIconsRegular.gauge, t.logRpe,
+ TinySwitch(on: fit.logRpe)),
+ ),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: fit.toggleAutoAdvance,
+ child: _prefRow(gc, PhosphorIconsRegular.skipForward, t.autoAdvance,
+ TinySwitch(on: fit.autoAdvance)),
+ ),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => _editBackground(context),
+ child: _prefRow(
+ gc,
+ PhosphorIconsRegular.image,
+ t.background,
+ Row(mainAxisSize: MainAxisSize.min, children: [
+ Text(_bgName(fit.bgPattern),
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary)),
+ const SizedBox(width: 6),
+ Icon(PhosphorIconsRegular.caretRight, size: 15, color: gc.textTertiary),
+ ]),
+ ),
+ ),
],
),
),
- const SizedBox(height: 22),
+ const SizedBox(height: 18),
if (Platform.isAndroid) ...[
_sectionLabel(gc, t.homeWidgets),
- const SizedBox(height: 10),
+ const SizedBox(height: 8),
_linkGroup(gc, [
(PhosphorIconsRegular.squaresFour, t.addActivityWidget, () => _addWidget(context, 'HeatmapWidgetProvider')),
(PhosphorIconsRegular.chartBar, t.addStatsWidget, () => _addWidget(context, 'StatsWidgetProvider')),
(PhosphorIconsRegular.person, t.addBodyWidget, () => _addWidget(context, 'BodyWidgetProvider')),
+ (PhosphorIconsRegular.checkCircle, t.addTodayWidget, () => _addWidget(context, 'TodayWidgetProvider')),
]),
- const SizedBox(height: 22),
+ const SizedBox(height: 18),
],
_linkGroup(gc, [
- (PhosphorIconsRegular.mapPin, t.places, fit.goPlaces),
+ (PhosphorIconsRegular.mapPin, t.placesLabel, fit.goPlaces),
]),
- const SizedBox(height: 22),
+ const SizedBox(height: 18),
_sectionLabel(gc, t.data),
- const SizedBox(height: 10),
+ const SizedBox(height: 8),
_linkGroup(gc, [
- (PhosphorIconsRegular.table, t.exportCsv, () => _exportCsv(context)),
- (PhosphorIconsRegular.uploadSimple, t.exportBackup, () => _exportBackup(context)),
+ (PhosphorIconsRegular.fileCsv, t.exportCsv, () => _exportCsv(context)),
+ (PhosphorIconsRegular.fileZip, t.exportBackup, () => _exportBackup(context)),
(PhosphorIconsRegular.downloadSimple, t.importBackup, () => _importBackup(context)),
- (PhosphorIconsRegular.arrowSquareIn, t.importFromApp, () => _importFromApp(context)),
+ (PhosphorIconsRegular.arrowSquareIn, t.importFromApp, () => _openImportApps(context)),
(PhosphorIconsRegular.trash, t.resetData, () => _resetAll(context)),
- ]),
- const SizedBox(height: 22),
+ ], danger: 4),
+ const SizedBox(height: 18),
_sectionLabel(gc, t.support),
- const SizedBox(height: 10),
+ const SizedBox(height: 8),
_linkGroup(gc, [
- (PhosphorIconsRegular.warningCircle, t.reportBug, () => _open(context, _kBugUrl)),
+ (PhosphorIconsRegular.bug, t.reportBug, () => _open(context, _kBugUrl)),
(PhosphorIconsRegular.lightbulb, t.requestFeature, () => _open(context, _kFeatureUrl)),
(PhosphorIconsRegular.githubLogo, t.starOnGithub, () => _open(context, _kRepoUrl)),
(PhosphorIconsRegular.coffee, t.buyCoffee, () => _open(context, _kKofiUrl)),
]),
const SizedBox(height: 22),
- GestureDetector(
- onTap: fit.goAbout,
- child: SoftCard(
- radius: 18,
- padding: const EdgeInsets.all(16),
- child: Row(
- children: [
- Icon(PhosphorIconsRegular.info, size: 20, color: gc.textSecondary),
- const SizedBox(width: 14),
- Expanded(child: Text(t.aboutGymmane, style: AppTheme.s(14, weight: FontWeight.w600, color: gc.text))),
- Icon(PhosphorIconsRegular.caretRight, size: 16, color: gc.textSecondary),
- ],
- ),
- ),
- ),
+ _linkGroup(gc, [
+ (PhosphorIconsRegular.info, t.aboutGymmane, fit.goAbout),
+ ]),
],
),
),
@@ -213,25 +226,36 @@ class SettingsScreen extends StatelessWidget {
}
Widget _sectionLabel(GymColors gc, String t) =>
- Text(t, style: AppTheme.s(11, weight: FontWeight.w600, color: gc.textSecondary, letterSpacing: 2));
+ Text(t.toUpperCase(),
+ style: AppTheme.f(10.5, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.3));
Widget _prefRow(GymColors gc, IconData icon, String label, Widget control) {
- return Row(
- children: [
- Icon(icon, size: 20, color: gc.textSecondary),
- const SizedBox(width: 12),
- Expanded(child: Text(label, style: AppTheme.s(14, color: gc.text))),
- control,
- ],
+ return SizedBox(
+ height: 52,
+ child: Row(
+ children: [
+ _rowIcon(gc, icon),
+ Expanded(child: Text(label, style: AppTheme.f(14.5, weight: FontWeight.w500, color: gc.text))),
+ const SizedBox(width: 12),
+ control,
+ ],
+ ),
);
}
- Widget _linkGroup(GymColors gc, List<(IconData, String, VoidCallback)> items) {
+ Widget _rowIcon(GymColors gc, IconData icon, {Color? color}) => Padding(
+ padding: const EdgeInsets.only(right: 14),
+ child: SizedBox(
+ width: 22,
+ child: Icon(icon, size: 19, color: color ?? gc.textSecondary),
+ ),
+ );
+
+ Widget _linkGroup(GymColors gc, List<(IconData, String, VoidCallback)> items, {int? danger}) {
return Container(
decoration: BoxDecoration(
color: gc.bgRaised,
- border: Border.all(color: gc.border),
- borderRadius: BorderRadius.circular(18),
+ borderRadius: BorderRadius.circular(20),
),
clipBehavior: Clip.antiAlias,
child: Column(
@@ -241,16 +265,21 @@ class SettingsScreen extends StatelessWidget {
behavior: HitTestBehavior.opaque,
onTap: items[i].$3,
child: Container(
- padding: const EdgeInsets.all(16),
+ height: 52,
+ padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
- border: i < items.length - 1 ? Border(bottom: BorderSide(color: gc.border)) : null,
+ border: i < items.length - 1
+ ? Border(bottom: BorderSide(color: gc.border.withValues(alpha: 0.6)))
+ : null,
),
child: Row(
children: [
- Icon(items[i].$1, size: 20, color: gc.textSecondary),
- const SizedBox(width: 14),
- Expanded(child: Text(items[i].$2, style: AppTheme.s(14, color: gc.text))),
- Icon(PhosphorIconsRegular.caretRight, size: 16, color: gc.textSecondary),
+ _rowIcon(gc, items[i].$1, color: i == danger ? gc.danger : null),
+ Expanded(
+ child: Text(items[i].$2,
+ style: AppTheme.f(14.5,
+ weight: FontWeight.w500, color: i == danger ? gc.danger : gc.text))),
+ Icon(PhosphorIconsRegular.caretRight, size: 15, color: gc.textTertiary),
],
),
),
@@ -353,20 +382,110 @@ class SettingsScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(t.alarmBlockedTitle,
- style: AppTheme.s(13, weight: FontWeight.w600, color: gc.text)),
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.text)),
const SizedBox(height: 2),
- Text(t.alarmBlockedBody, style: AppTheme.s(11.5, color: gc.textSecondary)),
+ Text(t.alarmBlockedBody, style: AppTheme.f(11.5, weight: FontWeight.w500, color: gc.textSecondary)),
],
),
),
const SizedBox(width: 8),
Text(t.alarmBlockedAction,
- style: AppTheme.d(12, weight: FontWeight.w700, color: gc.accent, letterSpacing: 1)),
+ style: AppTheme.f(12, weight: FontWeight.w700, color: gc.accent, letterSpacing: 1)),
]),
),
);
}
+ void _openImportApps(BuildContext context) {
+ final gc = context.gc;
+ showModalBottomSheet<void>(
+ context: context,
+ backgroundColor: Colors.transparent,
+ isScrollControlled: true,
+ builder: (sheet) => Container(
+ padding: sheetPad(sheet),
+ decoration: BoxDecoration(
+ color: gc.bgRaised,
+ 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.importFromApp,
+ textAlign: TextAlign.center,
+ style: AppTheme.f(14, weight: FontWeight.w700, color: gc.text, letterSpacing: 0.4)),
+ const SizedBox(height: 18),
+ Text(t.importApps,
+ style: AppTheme.f(10, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.5)),
+ const SizedBox(height: 10),
+ _appRow(gc, 'Hevy', 'workout_data.csv'),
+ _appRow(gc, 'Strong', 'strong.csv'),
+ _appRow(gc, 'FitNotes', '.fitnotes'),
+ _appRow(gc, 'openGym', 'opengym-backup.json'),
+ _appRow(gc, 'CSV', t.importOtherCsv),
+ const SizedBox(height: 8),
+ Text(t.importHint, style: AppTheme.f(11.5, weight: FontWeight.w500, color: gc.textTertiary, height: 1.4)),
+ const SizedBox(height: 18),
+ PrimaryButton(
+ label: t.chooseFile,
+ onTap: () {
+ Navigator.pop(sheet);
+ _importFromApp(context);
+ },
+ ),
+ const SizedBox(height: 6),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ Navigator.pop(sheet);
+ _open(context, _kFeatureUrl);
+ },
+ child: Container(
+ height: 46,
+ alignment: Alignment.center,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Icon(PhosphorIconsRegular.githubLogo, size: 15, color: gc.accent),
+ const SizedBox(width: 8),
+ Text(t.importAskApp,
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.accent)),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget _appRow(GymColors gc, String name, String what) {
+ return Container(
+ margin: const EdgeInsets.only(bottom: 8),
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
+ decoration: BoxDecoration(color: gc.bgRaised2, borderRadius: BorderRadius.circular(14)),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: 76,
+ child: Text(name, style: AppTheme.f(13.5, weight: FontWeight.w700, color: gc.text)),
+ ),
+ const SizedBox(width: 8),
+ Expanded(
+ child: Text(what, style: AppTheme.f(12, weight: FontWeight.w500, color: gc.textSecondary, height: 1.35)),
+ ),
+ ],
+ ),
+ );
+ }
+
Future<void> _importFromApp(BuildContext context) async {
Uint8List? bytes;
try {
@@ -447,8 +566,8 @@ class SettingsScreen extends StatelessWidget {
context: context,
builder: (dctx) => appDialog(
gc,
- title: Text(t.importUnitTitle, style: AppTheme.d(18, weight: FontWeight.w700, color: gc.text)),
- content: Text(t.importUnitBody, style: AppTheme.s(13, color: gc.textSecondary)),
+ title: Text(t.importUnitTitle, style: AppTheme.f(18, weight: FontWeight.w700, color: gc.text)),
+ content: Text(t.importUnitBody, style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary)),
actions: [
dialogAction('kg', gc.accent, () => Navigator.of(dctx).pop(false)),
dialogAction('lb', gc.accent, () => Navigator.of(dctx).pop(true)),
@@ -482,6 +601,269 @@ class SettingsScreen extends StatelessWidget {
}
}
+ String _clockLabel(BuildContext context, int minuteOfDay) =>
+ TimeOfDay(hour: minuteOfDay ~/ 60, minute: minuteOfDay % 60).format(context);
+
+ String _reminderValue(BuildContext context) {
+ if (fit.trainReminderMin == null) return t.photoEveryOff;
+ if (!fit.smartReminder) return _clockLabel(context, fit.trainReminderMin!);
+ return _habitLabel(context) ?? t.reminderSmart;
+ }
+
+ String? _habitLabel(BuildContext context) {
+ final days = fit.usualWeekdays;
+ final at = fit.usualStartMinute;
+ if (days.isEmpty || at == null) return null;
+ final initials = days.map(t.weekdayInitial).join(' ');
+ return '$initials · ${_clockLabel(context, at)}';
+ }
+
+ void _editTrainReminder(BuildContext context) {
+ final gc = context.gc;
+ var minutes = fit.trainReminderMin ?? 19 * 60;
+ var smart = fit.smartReminder;
+ showModalBottomSheet<void>(
+ context: context,
+ backgroundColor: Colors.transparent,
+ builder: (sheet) => StatefulBuilder(
+ builder: (sheet, setSheet) => 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.trainReminder,
+ textAlign: TextAlign.center,
+ style: AppTheme.f(14, weight: FontWeight.w700, color: gc.text, letterSpacing: 0.4)),
+ const SizedBox(height: 16),
+ Center(
+ child: SegToggle([
+ SegOption(t.reminderFixed, !smart, () => setSheet(() => smart = false)),
+ SegOption(t.reminderSmart, smart, () => setSheet(() => smart = true)),
+ ]),
+ ),
+ const SizedBox(height: 18),
+ if (smart) ...[
+ Text(_habitLabel(sheet) ?? t.reminderSmartEmpty,
+ textAlign: TextAlign.center,
+ style: _habitLabel(sheet) == null
+ ? AppTheme.f(12.5, weight: FontWeight.w500, color: gc.textSecondary)
+ : AppTheme.f(22, weight: FontWeight.w700, color: gc.ember)),
+ const SizedBox(height: 12),
+ Text(t.reminderSmartHint,
+ textAlign: TextAlign.center,
+ style: AppTheme.f(12, weight: FontWeight.w500, color: gc.textSecondary, height: 1.4)),
+ ] else ...[
+ Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ StepperControl(
+ value: (minutes ~/ 60).toString().padLeft(2, '0'),
+ minWidth: 34,
+ btnSize: 30,
+ gap: 10,
+ fontSize: 22,
+ onDec: () => setSheet(() => minutes = (minutes - 60 + 1440) % 1440),
+ onInc: () => setSheet(() => minutes = (minutes + 60) % 1440),
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 6),
+ child: Text(':',
+ style: AppTheme.f(22, weight: FontWeight.w700, color: gc.textTertiary)),
+ ),
+ StepperControl(
+ value: (minutes % 60).toString().padLeft(2, '0'),
+ minWidth: 34,
+ btnSize: 30,
+ gap: 10,
+ fontSize: 22,
+ onDec: () => setSheet(() => minutes = (minutes - 15 + 1440) % 1440),
+ onInc: () => setSheet(() => minutes = (minutes + 15) % 1440),
+ ),
+ ],
+ ),
+ const SizedBox(height: 8),
+ Text(_clockLabel(sheet, minutes),
+ textAlign: TextAlign.center,
+ style: AppTheme.f(12.5, weight: FontWeight.w600, color: gc.ember)),
+ const SizedBox(height: 14),
+ Text(t.trainReminderHint,
+ textAlign: TextAlign.center,
+ style: AppTheme.f(12, weight: FontWeight.w500, color: gc.textSecondary, height: 1.4)),
+ ],
+ const SizedBox(height: 18),
+ PrimaryButton(
+ label: t.save,
+ onTap: () {
+ fit.setSmartReminder(smart);
+ fit.setTrainReminder(minutes);
+ fit.askAlarmPermission(force: true);
+ Navigator.of(sheet).pop();
+ },
+ ),
+ const SizedBox(height: 6),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ fit.setTrainReminder(null);
+ Navigator.of(sheet).pop();
+ },
+ child: Container(
+ height: 46,
+ alignment: Alignment.center,
+ child: Text(t.photoEveryOff,
+ style: AppTheme.f(13,
+ weight: FontWeight.w600, color: gc.textSecondary, letterSpacing: 1)),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+
+ String _bgName(String pattern) => switch (pattern) {
+ 'none' => t.bgNone,
+ 'grid' => t.bgGrid,
+ 'photo' => t.bgPhoto,
+ _ => t.bgDots,
+ };
+
+ void _editBackground(BuildContext context) {
+ final gc = context.gc;
+ showModalBottomSheet<void>(
+ context: context,
+ backgroundColor: Colors.transparent,
+ isScrollControlled: true,
+ builder: (sheet) => StatefulBuilder(
+ builder: (sheet, setSheet) {
+ final photo = fit.bgPhotoPath;
+ return Container(
+ padding: sheetPad(sheet),
+ decoration: BoxDecoration(
+ color: gc.bgRaised,
+ 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.background,
+ textAlign: TextAlign.center,
+ style: AppTheme.f(14, weight: FontWeight.w700, color: gc.text, letterSpacing: 0.4)),
+ const SizedBox(height: 18),
+ for (final pattern in ['none', 'dots', 'grid'])
+ _bgOption(gc, _bgName(pattern), fit.bgPattern == pattern,
+ () => setSheet(() => fit.setBgPattern(pattern))),
+ if (photo != null)
+ _bgOption(gc, t.bgPhoto, fit.bgPattern == 'photo',
+ () => setSheet(() => fit.setBgPattern('photo')),
+ thumb: photo),
+ const SizedBox(height: 8),
+ if (photo != null) ...[
+ Text(t.bgDim,
+ style: AppTheme.f(10, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.5)),
+ const SizedBox(height: 8),
+ Center(
+ child: SegToggle([
+ SegOption(t.dimSoft, fit.bgDim < 0.5, () => setSheet(() => fit.setBgDim(0.4))),
+ SegOption(t.dimMedium, fit.bgDim >= 0.5 && fit.bgDim < 0.65,
+ () => setSheet(() => fit.setBgDim(0.55))),
+ SegOption(t.dimStrong, fit.bgDim >= 0.65, () => setSheet(() => fit.setBgDim(0.72))),
+ ]),
+ ),
+ const SizedBox(height: 14),
+ ],
+ GhostButton(
+ label: photo == null ? t.bgPhotoPick : t.bgPhotoChange,
+ icon: PhosphorIconsRegular.image,
+ onTap: () async {
+ await _pickBackground();
+ setSheet(() {});
+ },
+ ),
+ if (photo != null) ...[
+ const SizedBox(height: 6),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => setSheet(fit.clearBgPhoto),
+ child: Container(
+ height: 44,
+ alignment: Alignment.center,
+ child: Text(t.bgPhotoRemove,
+ style: AppTheme.f(13, weight: FontWeight.w600, color: gc.accent)),
+ ),
+ ),
+ ],
+ const SizedBox(height: 6),
+ Text(t.bgPhotoHint,
+ textAlign: TextAlign.center,
+ style: AppTheme.f(11.5, weight: FontWeight.w500, color: gc.textTertiary, height: 1.4)),
+ const SizedBox(height: 16),
+ PrimaryButton(label: t.done, onTap: () => Navigator.of(sheet).pop()),
+ ],
+ ),
+ ),
+ );
+ },
+ ),
+ );
+ }
+
+ Widget _bgOption(GymColors gc, String label, bool selected, VoidCallback onTap, {String? thumb}) {
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ child: Container(
+ margin: const EdgeInsets.only(bottom: 8),
+ padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
+ decoration: BoxDecoration(
+ color: selected ? gc.emberSoft : gc.bgRaised2,
+ borderRadius: BorderRadius.circular(14),
+ border: Border.all(color: selected ? gc.ember : Colors.transparent),
+ ),
+ child: Row(
+ children: [
+ if (thumb != null) ...[
+ ClipRRect(
+ borderRadius: BorderRadius.circular(8),
+ child: Image.file(File(thumb),
+ width: 40,
+ height: 30,
+ fit: BoxFit.cover,
+ errorBuilder: (_, _, _) => const SizedBox(width: 40, height: 30)),
+ ),
+ const SizedBox(width: 12),
+ ],
+ Expanded(
+ child: Text(label,
+ style: AppTheme.f(14, weight: FontWeight.w600, color: selected ? gc.ember : gc.text)),
+ ),
+ if (selected) Icon(PhosphorIconsBold.check, size: 14, color: gc.ember),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Future<void> _pickBackground() async {
+ try {
+ final result = await FilePicker.platform.pickFiles(type: FileType.image);
+ final path = result?.files.single.path;
+ if (path != null) await fit.setBgPhoto(path);
+ } catch (_) {}
+ }
+
void _editLanguage(BuildContext context) {
showModalBottomSheet(
context: context,
@@ -561,19 +943,11 @@ class SettingsScreen extends StatelessWidget {
return noExt.length > 28 ? '${noExt.substring(0, 27)}…' : noExt;
}
- void _editProfile(BuildContext context) {
- showModalBottomSheet(
- context: context,
- backgroundColor: Colors.transparent,
- isScrollControlled: true,
- builder: (_) => const _ProfileSheet(),
- );
- }
void _snack(BuildContext context, String msg) {
final gc = context.gc;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
- content: Text(msg, style: AppTheme.s(13, weight: FontWeight.w600, color: gc.onEmber)),
+ content: Text(msg, style: AppTheme.f(13, weight: FontWeight.w600, color: gc.onEmber)),
backgroundColor: gc.ember,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
@@ -588,10 +962,9 @@ class _LanguageSheet extends StatelessWidget {
Widget build(BuildContext context) {
final gc = context.gc;
return Container(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
+ padding: sheetPad(context),
decoration: BoxDecoration(
color: gc.bgRaised,
- border: Border.all(color: gc.border),
borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
),
child: Column(
@@ -602,7 +975,7 @@ class _LanguageSheet extends StatelessWidget {
const SizedBox(height: 18),
Text(t.languageLabel,
textAlign: TextAlign.center,
- style: AppTheme.d(14, weight: FontWeight.w600, color: gc.text, letterSpacing: 2)),
+ style: AppTheme.f(17, weight: FontWeight.w700, color: gc.text)),
const SizedBox(height: 18),
for (final code in appLanguages) ...[
_option(context, code),
@@ -628,8 +1001,7 @@ class _LanguageSheet extends StatelessWidget {
child: Row(children: [
Expanded(
child: Text(languageNameOf(code),
- style: AppTheme.s(14,
- weight: FontWeight.w600, color: active ? gc.ember : gc.text)),
+ style: AppTheme.f(14, weight: FontWeight.w600, color: active ? gc.ember : gc.text)),
),
if (active) Icon(PhosphorIconsFill.check, size: 16, color: gc.ember),
]),
@@ -650,10 +1022,9 @@ class _AlarmSoundSheet extends StatelessWidget {
final gc = context.gc;
final current = fit.alarmSoundName ?? t.alarmDefaultName;
return Container(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
+ padding: sheetPad(context),
decoration: BoxDecoration(
color: gc.bgRaised,
- border: Border.all(color: gc.border),
borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
),
child: Column(
@@ -664,10 +1035,10 @@ class _AlarmSoundSheet extends StatelessWidget {
const SizedBox(height: 18),
Text(t.alarmSound,
textAlign: TextAlign.center,
- style: AppTheme.d(14, weight: FontWeight.w600, color: gc.text, letterSpacing: 2)),
+ style: AppTheme.f(17, weight: FontWeight.w700, color: gc.text)),
const SizedBox(height: 4),
Text('$current · ${t.alarmSoundHint}',
- textAlign: TextAlign.center, style: AppTheme.s(12, color: gc.textSecondary)),
+ textAlign: TextAlign.center, style: AppTheme.f(12, weight: FontWeight.w500, color: gc.textSecondary)),
const SizedBox(height: 18),
_option(context, PhosphorIconsRegular.play, t.alarmPreview, onPreview),
const SizedBox(height: 10),
@@ -692,13 +1063,22 @@ class _AlarmSoundSheet extends StatelessWidget {
child: Row(children: [
Icon(icon, size: 20, color: gc.textSecondary),
const SizedBox(width: 14),
- Expanded(child: Text(label, style: AppTheme.s(14, weight: FontWeight.w600, color: gc.text))),
+ Expanded(child: Text(label, style: AppTheme.f(14, weight: FontWeight.w600, color: gc.text))),
]),
),
);
}
}
+void showProfileSheet(BuildContext context) {
+ showModalBottomSheet<void>(
+ context: context,
+ isScrollControlled: true,
+ backgroundColor: Colors.transparent,
+ builder: (_) => const _ProfileSheet(),
+ );
+}
+
class _ProfileSheet extends StatefulWidget {
const _ProfileSheet();
@override
@@ -707,10 +1087,12 @@ class _ProfileSheet extends StatefulWidget {
class _ProfileSheetState extends State<_ProfileSheet> {
late final TextEditingController _name = TextEditingController(text: fit.profile.name);
+ late final TextEditingController _handle = TextEditingController(text: fit.profile.handle);
@override
void dispose() {
_name.dispose();
+ _handle.dispose();
super.dispose();
}
@@ -719,10 +1101,9 @@ class _ProfileSheetState extends State<_ProfileSheet> {
final gc = context.gc;
final p = fit.profile;
return Container(
- padding: EdgeInsets.fromLTRB(20, 12, 20, 20 + MediaQuery.of(context).viewInsets.bottom),
+ padding: EdgeInsets.fromLTRB(20, 12, 20, 20 + MediaQuery.of(context).viewInsets.bottom + MediaQuery.paddingOf(context).bottom),
decoration: BoxDecoration(
color: gc.bgRaised,
- border: Border.all(color: gc.border),
borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
),
child: SingleChildScrollView(
@@ -734,21 +1115,25 @@ class _ProfileSheetState extends State<_ProfileSheet> {
const SizedBox(height: 18),
Text(t.yourProfile,
textAlign: TextAlign.center,
- style: AppTheme.d(14, weight: FontWeight.w600, color: gc.text, letterSpacing: 2)),
+ style: AppTheme.f(17, weight: FontWeight.w700, color: gc.text)),
const SizedBox(height: 4),
- Text(t.autofills, textAlign: TextAlign.center, style: AppTheme.s(13, color: gc.textSecondary)),
+ Text(t.autofills, textAlign: TextAlign.center, style: AppTheme.f(13, weight: FontWeight.w500, color: gc.textSecondary)),
const SizedBox(height: 20),
Center(child: _photoPicker(gc)),
+ const SizedBox(height: 18),
+ _coverPicker(gc),
const SizedBox(height: 20),
_label(gc, t.nameLabel),
const SizedBox(height: 8),
TextField(
controller: _name,
- style: AppTheme.s(15, weight: FontWeight.w600, color: gc.text),
+ style: AppTheme.f(15, weight: FontWeight.w600, color: gc.text),
cursorColor: gc.accent,
textCapitalization: TextCapitalization.words,
onChanged: (v) => fit.updateProfile(name: v),
decoration: InputDecoration(
+ hintText: kDefaultName,
+ hintStyle: AppTheme.f(15, weight: FontWeight.w600, color: gc.textTertiary),
filled: true,
fillColor: gc.bgRaised2,
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
@@ -756,6 +1141,32 @@ class _ProfileSheetState extends State<_ProfileSheet> {
),
),
const SizedBox(height: 16),
+ _label(gc, t.handleLabel),
+ const SizedBox(height: 8),
+ TextField(
+ controller: _handle,
+ style: AppTheme.f(15, weight: FontWeight.w600, color: gc.text),
+ cursorColor: gc.accent,
+ onChanged: fit.setProfileHandle,
+ decoration: InputDecoration(
+ filled: true,
+ fillColor: gc.bgRaised2,
+ hintText: fit.profileHandle,
+ hintStyle: AppTheme.f(15, weight: FontWeight.w600, color: gc.textTertiary),
+ prefixIcon: Padding(
+ padding: const EdgeInsets.only(left: 16, right: 6),
+ child: Text('@',
+ style: AppTheme.f(15, weight: FontWeight.w700, color: gc.textSecondary)),
+ ),
+ prefixIconConstraints: const BoxConstraints(minWidth: 0, minHeight: 0),
+ contentPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 14),
+ border: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(14), borderSide: BorderSide.none),
+ ),
+ ),
+ const SizedBox(height: 16),
+ _row(gc, t.pickBadge, _badgeDots(gc)),
+ const SizedBox(height: 12),
_row(gc, t.sexLabel, SegToggle([
SegOption(t.male, p.sex == 'male', () => _up(() => fit.updateProfile(sex: 'male'))),
SegOption(t.female, p.sex == 'female', () => _up(() => fit.updateProfile(sex: 'female'))),
@@ -819,13 +1230,64 @@ class _ProfileSheetState extends State<_ProfileSheet> {
onTap: has ? () => _up(fit.clearProfilePhoto) : _pickPhoto,
child: Text(
has ? t.removePhoto : t.addPhoto,
- style: AppTheme.s(12, weight: FontWeight.w600, color: gc.textSecondary),
+ style: AppTheme.f(12, weight: FontWeight.w600, color: gc.textSecondary),
+ ),
+ ),
+ ],
+ );
+ }
+
+ Widget _coverPicker(GymColors gc) {
+ final bytes = fit.profileBanner;
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ _label(gc, t.coverLabel),
+ const SizedBox(height: 8),
+ GestureDetector(
+ onTap: _pickBanner,
+ child: Container(
+ height: 96,
+ decoration: BoxDecoration(
+ color: gc.bgRaised2,
+ borderRadius: BorderRadius.circular(14),
+ image: DecorationImage(
+ image: bytes == null ? kDefaultBanner : MemoryImage(bytes),
+ fit: BoxFit.cover,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(height: 8),
+ Center(
+ child: GestureDetector(
+ onTap: bytes == null ? _pickBanner : () => _up(fit.clearProfileBanner),
+ child: Text(
+ bytes == null ? t.addCover : t.removeCover,
+ style: AppTheme.f(12, weight: FontWeight.w600, color: gc.textSecondary),
+ ),
),
),
],
);
}
+ Future<void> _pickBanner() async {
+ final source = await pickPhotoSource(context);
+ if (source == null) return;
+
+ final shot = await ImagePicker().pickImage(
+ source: source,
+ maxWidth: 1600,
+ maxHeight: 900,
+ imageQuality: 82,
+ );
+ if (shot == null) return;
+ final bytes = await shot.readAsBytes();
+ if (!mounted) return;
+ _up(() => fit.setProfileBanner(bytes));
+ }
+
Future<void> _pickPhoto() async {
final source = await pickPhotoSource(context);
if (source == null) return;
@@ -842,8 +1304,38 @@ class _ProfileSheetState extends State<_ProfileSheet> {
_up(() => fit.setProfilePhoto(bytes));
}
+ Widget _badgeDots(GymColors gc) {
+ return Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ for (final id in kProfileBadges) ...[
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () => _up(() => fit.setProfileBadge(id)),
+ child: Semantics(
+ button: true,
+ selected: fit.profile.badge == id,
+ label: t.badgeName(id),
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 5),
+ child: Icon(
+ PhosphorIconsFill.sealCheck,
+ size: fit.profile.badge == id ? 26 : 22,
+ color: fit.profile.badge == id
+ ? badgeColor(id)
+ : badgeColor(id).withValues(alpha: 0.32),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ],
+ );
+ }
+
Widget _label(GymColors gc, String t) =>
- Text(t, style: AppTheme.s(11, weight: FontWeight.w600, color: gc.textSecondary, letterSpacing: 2));
+ Text(t.toUpperCase(),
+ style: AppTheme.f(10.5, weight: FontWeight.w700, color: gc.textTertiary, letterSpacing: 1.3));
Widget _row(GymColors gc, String label, Widget control) {
return SoftCard(
@@ -852,7 +1344,7 @@ class _ProfileSheetState extends State<_ProfileSheet> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(label, style: AppTheme.s(13, weight: FontWeight.w600, color: gc.textSecondary)),
+ Text(label, style: AppTheme.f(13, weight: FontWeight.w600, color: gc.textSecondary)),
control,
],
),
diff --git a/lib/state/settings_state.dart b/lib/state/settings_state.dart
index 84acf5f..c89db3f 100644
--- a/lib/state/settings_state.dart
+++ b/lib/state/settings_state.dart
@@ -1,6 +1,8 @@
part of 'fit_state.dart';
-mixin SettingsState on FitCore, ToolsState {
+const String kBgPhotoId = 'bg';
+
+mixin SettingsState on FitCore, ToolsState, LibraryState {
bool dark = true;
ThemeMode get themeMode => dark ? ThemeMode.dark : ThemeMode.light;
int restSeconds = 90;
@@ -10,6 +12,12 @@ mixin SettingsState on FitCore, ToolsState {
String? get alarmSoundPath => AlarmStore.pathFor(alarmSound);
String bgPattern = 'dots';
+ double bgDim = 0.55;
+ bool showFocus = true;
+ bool autoAdvance = true;
+ bool logRpe = false;
+ int? trainReminderMin;
+ bool smartReminder = false;
bool onboarded = false;
bool alarmAllowed = true;
int? alarmAskedAt;
@@ -62,7 +70,7 @@ mixin SettingsState on FitCore, ToolsState {
double? activity,
int? weeklyGoalDelta,
}) {
- if (name != null) profile.name = name.trim().isEmpty ? 'InlitX' : name.trim();
+ if (name != null) profile.name = name.trim();
if (sex != null) profile.sex = sex;
if (ageDelta != null) profile.age = (profile.age + ageDelta).clamp(10, 90);
if (heightDelta != null) profile.heightCm = _clamp(profile.heightCm + heightDelta, 100, 250);
@@ -103,14 +111,78 @@ mixin SettingsState on FitCore, ToolsState {
notifyListeners();
}
+ Uint8List? _bannerBytes;
+ String? _bannerCacheKey;
+
+ Uint8List? get profileBanner {
+ final raw = profile.banner;
+ if (raw.isEmpty) return null;
+ if (_bannerCacheKey != raw) {
+ try {
+ _bannerBytes = base64Decode(raw);
+ } catch (_) {
+ _bannerBytes = null;
+ }
+ _bannerCacheKey = raw;
+ }
+ return _bannerBytes;
+ }
+
+ void setProfileBanner(Uint8List bytes) {
+ profile.banner = base64Encode(bytes);
+ _persist();
+ notifyListeners();
+ }
+
+ void clearProfileBanner() {
+ profile.banner = '';
+ _persist();
+ notifyListeners();
+ }
+
+ String heatTone = 'ember';
+
+ void setHeatTone(String tone) {
+ heatTone = tone;
+ _persist();
+ notifyListeners();
+ }
+
+ void setProfileBadge(String badge) {
+ profile.badge = profile.badge == badge ? '' : badge;
+ _persist();
+ notifyListeners();
+ }
+
+ void setProfileHandle(String handle) {
+ profile.handle = handle.trim().replaceAll(RegExp(r'[^A-Za-z0-9_.]'), '');
+ _persist();
+ notifyListeners();
+ }
+
+ bool get hasOwnIdentity =>
+ profile.handle.isNotEmpty || (profile.name.isNotEmpty && profile.name != kDefaultName);
+
+ String get displayName => profile.name.isEmpty ? kDefaultName : profile.name;
+
+ String get profileHandle {
+ final own = profile.handle;
+ if (own.isNotEmpty) return own;
+ final from = displayName.toLowerCase().replaceAll(RegExp(r'[^a-z0-9]'), '');
+ return from.isEmpty ? kDefaultHandle : from;
+ }
+
+ DateTime get memberSince => profile.since ?? DateTime.now();
+
void completeOnboarding() {
onboarded = true;
+ refreshAwards();
persistNow();
notifyListeners();
}
void setRestSeconds(int v) {
- restSeconds = v.clamp(15, 600);
+ restSeconds = v <= 0 ? 0 : v.clamp(15, 600);
_persist();
notifyListeners();
}
@@ -123,7 +195,7 @@ mixin SettingsState on FitCore, ToolsState {
if (seconds == null) {
exerciseRest.remove(exerciseId);
} else {
- exerciseRest[exerciseId] = seconds.clamp(15, 600);
+ exerciseRest[exerciseId] = seconds <= 0 ? 0 : seconds.clamp(15, 600);
}
_persist();
notifyListeners();
@@ -146,13 +218,102 @@ mixin SettingsState on FitCore, ToolsState {
notifyListeners();
}
+ bool warmsUp(String exerciseId) => autoWarmup.contains(exerciseId);
+
+ void toggleAutoWarmup(String exerciseId) {
+ if (!autoWarmup.remove(exerciseId)) autoWarmup.add(exerciseId);
+ _persist();
+ notifyListeners();
+ }
+
+ void setTrainReminder(int? minuteOfDay) {
+ trainReminderMin = minuteOfDay?.clamp(0, 24 * 60 - 1);
+ _persist();
+ syncTrainReminder();
+ notifyListeners();
+ }
+
+ void setSmartReminder(bool on) {
+ smartReminder = on;
+ _persist();
+ syncTrainReminder();
+ notifyListeners();
+ }
+
+ void toggleLogRpe() {
+ logRpe = !logRpe;
+ _persist();
+ notifyListeners();
+ }
+
+ void toggleAutoAdvance() {
+ autoAdvance = !autoAdvance;
+ _persist();
+ notifyListeners();
+ }
+
+ double? progressFor(String exerciseId) => progressStep[exerciseId];
+
+ bool hasProgress(String exerciseId) => (progressStep[exerciseId] ?? 0) > 0;
+
+ void toggleProgress(String exerciseId) {
+ if (hasProgress(exerciseId)) {
+ progressStep.remove(exerciseId);
+ } else {
+ progressStep[exerciseId] = fromDisplayWeight(weightStep);
+ }
+ _persist();
+ notifyListeners();
+ }
+
+ void bumpProgressStep(String exerciseId, int dir) {
+ final current = toDisplayWeight(progressStep[exerciseId] ?? 0);
+ final next = (current + dir * weightStep / 2).clamp(weightStep / 2, weightStep * 8);
+ progressStep[exerciseId] = fromDisplayWeight(next);
+ _persist();
+ notifyListeners();
+ }
+
+ void toggleFocusCard() {
+ showFocus = !showFocus;
+ _persist();
+ notifyListeners();
+ }
+
+ static const bgPatterns = ['none', 'dots', 'grid', 'photo'];
+
void setBgPattern(String v) {
- if (v != 'none' && v != 'dots' && v != 'grid') return;
+ if (!bgPatterns.contains(v)) return;
+ if (v == 'photo' && bgPhoto == null) return;
bgPattern = v;
_persist();
notifyListeners();
}
+ String? get bgPhoto => exerciseMedia[kBgPhotoId];
+
+ String? get bgPhotoPath => MediaStore.pathFor(bgPhoto ?? '');
+
+ Future<void> setBgPhoto(String srcPath) async {
+ await attachExerciseMedia(kBgPhotoId, srcPath);
+ if (bgPhoto != null) bgPattern = 'photo';
+ _persist();
+ notifyListeners();
+ }
+
+ void clearBgPhoto() {
+ clearExerciseMedia(kBgPhotoId);
+ if (bgPattern == 'photo') bgPattern = 'dots';
+ _persist();
+ notifyListeners();
+ }
+
+ void setBgDim(double v) {
+ bgDim = v.clamp(0.3, 0.85);
+ _persist();
+ notifyListeners();
+ }
+
static const _askAgainAfter = Duration(days: 3);
Future<void> refreshAlarmPermission() async {