mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-29 16:53:20 +01:00
workout_app: drop the HTTP sync card from the home screen
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
Tests / lock-popup-safety (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
Tests / lock-popup-safety (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2e2a1fa12f
commit
6abb553156
@ -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/manual_workout_screen.dart';
|
||||||
import 'package:workout_app/screens/settings_screen.dart';
|
import 'package:workout_app/screens/settings_screen.dart';
|
||||||
import 'package:workout_app/screens/workout_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/services/storage_service.dart';
|
||||||
import 'package:workout_app/ui/theme.dart';
|
import 'package:workout_app/ui/theme.dart';
|
||||||
|
|
||||||
@ -24,7 +23,6 @@ class HomeScreen extends StatefulWidget {
|
|||||||
class _HomeScreenState extends State<HomeScreen> {
|
class _HomeScreenState extends State<HomeScreen> {
|
||||||
late List<Exercise> _exercises;
|
late List<Exercise> _exercises;
|
||||||
String _nextType = 'A';
|
String _nextType = 'A';
|
||||||
List<String> _serverAddresses = [];
|
|
||||||
bool _loading = true;
|
bool _loading = true;
|
||||||
bool _doneToday = false;
|
bool _doneToday = false;
|
||||||
Map<String, dynamic>? _savedSession;
|
Map<String, dynamic>? _savedSession;
|
||||||
@ -44,7 +42,6 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
final nextType = await storage.getNextWorkoutType();
|
final nextType = await storage.getNextWorkoutType();
|
||||||
final exercises = await storage.getCurrentExercises(nextType);
|
final exercises = await storage.getCurrentExercises(nextType);
|
||||||
final saved = await storage.loadActiveSession();
|
final saved = await storage.loadActiveSession();
|
||||||
final addrs = await HttpServerService.instance.localAddresses;
|
|
||||||
final lastDate = await storage.getLastWorkoutDate();
|
final lastDate = await storage.getLastWorkoutDate();
|
||||||
final today = DateTime.now();
|
final today = DateTime.now();
|
||||||
final doneToday =
|
final doneToday =
|
||||||
@ -57,7 +54,6 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_nextType = nextType;
|
_nextType = nextType;
|
||||||
_exercises = exercises;
|
_exercises = exercises;
|
||||||
_serverAddresses = addrs;
|
|
||||||
_savedSession = saved;
|
_savedSession = saved;
|
||||||
_doneToday = doneToday;
|
_doneToday = doneToday;
|
||||||
_loading = false;
|
_loading = false;
|
||||||
@ -153,8 +149,6 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
onStart: _openWorkout,
|
onStart: _openWorkout,
|
||||||
onResume: () => _openWorkout(resume: true),
|
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<String> 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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -86,11 +86,6 @@ void main() {
|
|||||||
expect(find.text('Done for today!'), findsOneWidget);
|
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', (
|
testWidgets('manual-workout icon navigates to the manual form', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
@ -195,15 +190,4 @@ void main() {
|
|||||||
await tester.pump(const Duration(milliseconds: 300));
|
await tester.pump(const Duration(milliseconds: 300));
|
||||||
expect(find.text('Workout Tracker'), findsOneWidget);
|
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: <String>[])),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(find.text('Server not started'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user