Skip to content

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

Go edge-to-edge so the system navigation bar stops covering the interface

InlitX4fe08c665d18
diff --git a/lib/app/app_shell.dart b/lib/app/app_shell.dart
index 55d0c3c..25e859a 100644
--- a/lib/app/app_shell.dart
+++ b/lib/app/app_shell.dart
@@ -4,6 +4,7 @@ import 'package:phosphor_flutter/phosphor_flutter.dart';
import '../l10n/l10n.dart';
import '../screens/about_screen.dart';
+import '../screens/ai_plan_screen.dart';
import '../screens/compare_screen.dart';
import '../screens/exercise_detail_screen.dart';
import '../screens/exercises_screen.dart';
@@ -80,15 +81,34 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver {
}
if (!fit.handleBack()) await SystemNavigator.pop();
},
- child: Scaffold(
- backgroundColor: context.gc.bg,
- body: Stack(
- children: [
- Positioned.fill(child: AppBackground(pattern: fit.bgPattern)),
- Positioned.fill(child: _animatedScreen()),
- if (fit.showNav)
- Positioned(left: 18, right: 18, bottom: 18, child: _NavBar()),
- ],
+ child: AnnotatedRegion<SystemUiOverlayStyle>(
+ value: fit.dark ? _overlayDark : _overlayLight,
+ child: Scaffold(
+ backgroundColor: context.gc.bg,
+ body: Builder(
+ builder: (context) {
+ final gap = MediaQuery.paddingOf(context).bottom;
+ return Stack(
+ children: [
+ Positioned.fill(
+ child: AppBackground(
+ pattern: fit.bgPattern,
+ photo: fit.bgPhotoPath,
+ dim: fit.bgDim,
+ ),
+ ),
+ Positioned.fill(
+ child: Padding(
+ padding: EdgeInsets.only(bottom: gap),
+ child: _animatedScreen(),
+ ),
+ ),
+ if (fit.showNav)
+ Positioned(left: 18, right: 18, bottom: 18 + gap, child: _NavBar()),
+ ],
+ );
+ },
+ ),
),
),
);
@@ -148,8 +168,10 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver {
return AboutScreen();
case 'routines':
return RoutinesScreen();
+ case 'ai-plan':
+ return AiPlanScreen();
case 'routine-edit':
- return RoutineEditScreen();
+ return RoutineEditScreen(key: ValueKey(fit.activeRoutineId));
case 'measures':
return MeasuresScreen();
case 'places':
@@ -169,6 +191,26 @@ class _AppShellState extends State<AppShell> with WidgetsBindingObserver {
}
}
+const _overlayBase = SystemUiOverlayStyle(
+ statusBarColor: Colors.transparent,
+ systemNavigationBarColor: Colors.transparent,
+ systemNavigationBarDividerColor: Colors.transparent,
+ systemNavigationBarContrastEnforced: false,
+ systemStatusBarContrastEnforced: false,
+);
+
+final _overlayDark = _overlayBase.copyWith(
+ statusBarIconBrightness: Brightness.light,
+ statusBarBrightness: Brightness.dark,
+ systemNavigationBarIconBrightness: Brightness.light,
+);
+
+final _overlayLight = _overlayBase.copyWith(
+ statusBarIconBrightness: Brightness.dark,
+ statusBarBrightness: Brightness.light,
+ systemNavigationBarIconBrightness: Brightness.dark,
+);
+
class _NavBar extends StatelessWidget {
const _NavBar();
diff --git a/lib/main.dart b/lib/main.dart
index 9b6e73d..795cd24 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -12,8 +12,13 @@ import 'state/fit_state.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
+ SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
+ systemNavigationBarColor: Colors.transparent,
+ systemNavigationBarDividerColor: Colors.transparent,
+ systemNavigationBarContrastEnforced: false,
+ systemStatusBarContrastEnforced: false,
));
await initializeDateFormatting();
@@ -23,6 +28,7 @@ Future<void> main() async {
fit.loadFromStore();
await RestAlarm.instance.init();
fit.syncPhotoReminder();
+ fit.syncTrainReminder();
fit.onWidgetsShouldUpdate = HomeWidgetBridge.update;
runApp(const GymManeApp());
diff --git a/lib/screens/note_edit_screen.dart b/lib/screens/note_edit_screen.dart
index d98ae12..547eb53 100644
--- a/lib/screens/note_edit_screen.dart
+++ b/lib/screens/note_edit_screen.dart
@@ -361,7 +361,7 @@ class _ExercisePickerSheetState extends State<_ExercisePickerSheet> {
),
Expanded(
child: ListView.builder(
- padding: const EdgeInsets.fromLTRB(20, 0, 20, 24),
+ padding: EdgeInsets.fromLTRB(20, 0, 20, 24 + MediaQuery.paddingOf(context).bottom),
itemCount: results.length + 1,
itemBuilder: (context, i) {
if (i == 0) {
diff --git a/lib/screens/timeline_screen.dart b/lib/screens/timeline_screen.dart
index e8cbb7b..06ff406 100644
--- a/lib/screens/timeline_screen.dart
+++ b/lib/screens/timeline_screen.dart
@@ -652,7 +652,7 @@ class _TimelineScreenState extends State<TimelineScreen> {
context: context,
backgroundColor: Colors.transparent,
builder: (sheet) => Container(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
+ padding: sheetPad(context),
decoration: BoxDecoration(
color: gc.bgRaised,
border: Border.all(color: gc.border),
diff --git a/lib/widgets/app_background.dart b/lib/widgets/app_background.dart
index 76cf5c9..1283b7e 100644
--- a/lib/widgets/app_background.dart
+++ b/lib/widgets/app_background.dart
@@ -1,16 +1,54 @@
+import 'dart:io';
+
import 'package:flutter/material.dart';
import '../theme/app_colors.dart';
class AppBackground extends StatelessWidget {
- const AppBackground({super.key, required this.pattern});
+ 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) {
- if (pattern != 'dots' && pattern != 'grid') return const SizedBox.shrink();
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(
diff --git a/lib/widgets/note_kit.dart b/lib/widgets/note_kit.dart
index 25cf873..25f9ab0 100644
--- a/lib/widgets/note_kit.dart
+++ b/lib/widgets/note_kit.dart
@@ -191,7 +191,7 @@ Future<void> showNoteDaySheet(BuildContext context, DateTime day) async {
context: context,
backgroundColor: Colors.transparent,
builder: (sheet) => Container(
- padding: const EdgeInsets.fromLTRB(20, 12, 20, 26),
+ padding: sheetPad(context, bottom: 26),
decoration: BoxDecoration(
color: gc.bgRaised,
border: Border.all(color: gc.border),
diff --git a/lib/widgets/photo_source_sheet.dart b/lib/widgets/photo_source_sheet.dart
index ddec939..b4eaaaa 100644
--- a/lib/widgets/photo_source_sheet.dart
+++ b/lib/widgets/photo_source_sheet.dart
@@ -20,7 +20,7 @@ class PhotoSourceSheet 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),