From 6abb553156d5d8c13fd902526254bcab52e116b0 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Fri, 14 Aug 2026 22:25:42 +0200 Subject: [PATCH] workout_app: drop the HTTP sync card from the home screen Co-Authored-By: Claude Opus 5 (1M context) --- .../workout_app/lib/screens/home_screen.dart | 57 ------------------- .../test/screens/home_screen_test.dart | 16 ------ 2 files changed, 73 deletions(-) diff --git a/stronglift_replacement/workout_app/lib/screens/home_screen.dart b/stronglift_replacement/workout_app/lib/screens/home_screen.dart index c0179fa..cbaf511 100644 --- a/stronglift_replacement/workout_app/lib/screens/home_screen.dart +++ b/stronglift_replacement/workout_app/lib/screens/home_screen.dart @@ -8,7 +8,6 @@ import 'package:workout_app/screens/history_screen.dart'; import 'package:workout_app/screens/manual_workout_screen.dart'; import 'package:workout_app/screens/settings_screen.dart'; import 'package:workout_app/screens/workout_screen.dart'; -import 'package:workout_app/services/http_server_service.dart'; import 'package:workout_app/services/storage_service.dart'; import 'package:workout_app/ui/theme.dart'; @@ -24,7 +23,6 @@ class HomeScreen extends StatefulWidget { class _HomeScreenState extends State { late List _exercises; String _nextType = 'A'; - List _serverAddresses = []; bool _loading = true; bool _doneToday = false; Map? _savedSession; @@ -44,7 +42,6 @@ class _HomeScreenState extends State { final nextType = await storage.getNextWorkoutType(); final exercises = await storage.getCurrentExercises(nextType); final saved = await storage.loadActiveSession(); - final addrs = await HttpServerService.instance.localAddresses; final lastDate = await storage.getLastWorkoutDate(); final today = DateTime.now(); final doneToday = @@ -57,7 +54,6 @@ class _HomeScreenState extends State { setState(() { _nextType = nextType; _exercises = exercises; - _serverAddresses = addrs; _savedSession = saved; _doneToday = doneToday; _loading = false; @@ -153,8 +149,6 @@ class _HomeScreenState extends State { onStart: _openWorkout, onResume: () => _openWorkout(resume: true), ), - const SizedBox(height: 20), - ServerAddressTile(addresses: _serverAddresses), ], ), ), @@ -288,54 +282,3 @@ class _WorkoutCard extends StatelessWidget { ); } } - -/// Displays the LAN addresses the workout HTTP server is reachable at, or a -/// "Server not started" placeholder when none are available. Public so the -/// empty-address fallback can be exercised in a widget test. -class ServerAddressTile extends StatelessWidget { - /// Creates a tile listing [addresses] (may be empty). - const ServerAddressTile({required this.addresses, super.key}); - - /// LAN addresses the server is reachable at; empty when not started. - final List addresses; - - @override - Widget build(BuildContext context) { - final colorScheme = Theme.of(context).colorScheme; - final lines = addresses.isEmpty - ? ['Server not started'] - : addresses.map((ip) => '$ip:$kWorkoutServerPort').toList(); - - return Container( - padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), - decoration: BoxDecoration( - color: colorScheme.surfaceContainerHigh, - borderRadius: BorderRadius.circular(AppRadius.sm), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'HTTP sync (no ADB needed)', - style: TextStyle( - color: colorScheme.onSurfaceVariant, - fontSize: AppTextSize.caption, - letterSpacing: 1.1, - ), - ), - const SizedBox(height: 4), - ...lines.map( - (line) => Text( - line, - style: TextStyle( - color: colorScheme.onSurfaceVariant, - fontFamily: 'monospace', - fontSize: AppTextSize.label, - ), - ), - ), - ], - ), - ); - } -} diff --git a/stronglift_replacement/workout_app/test/screens/home_screen_test.dart b/stronglift_replacement/workout_app/test/screens/home_screen_test.dart index 9ef81b6..e4d5991 100644 --- a/stronglift_replacement/workout_app/test/screens/home_screen_test.dart +++ b/stronglift_replacement/workout_app/test/screens/home_screen_test.dart @@ -86,11 +86,6 @@ void main() { expect(find.text('Done for today!'), findsOneWidget); }); - testWidgets('HTTP sync tile renders', (tester) async { - await _pump(tester, _wrap()); - expect(find.text('HTTP sync (no ADB needed)'), findsOneWidget); - }); - testWidgets('manual-workout icon navigates to the manual form', ( tester, ) async { @@ -195,15 +190,4 @@ void main() { await tester.pump(const Duration(milliseconds: 300)); expect(find.text('Workout Tracker'), findsOneWidget); }); - - testWidgets('ServerAddressTile shows a placeholder when no addresses', ( - tester, - ) async { - await tester.pumpWidget( - const MaterialApp( - home: Scaffold(body: ServerAddressTile(addresses: [])), - ), - ); - expect(find.text('Server not started'), findsOneWidget); - }); }