fix(train): a day's page of its own, in cards, its night and Recharge drawn in place
The night's chart threw mid-paint where Polar's last phase starts at the night's end or after it: its right edge was clamped between left + 1 and the row's width, the lower bound then above the upper (an ArgumentError). A throw mid-paint leaves the canvas moved, so the rows below and the charts after them were drawn out of place, the skin temperature's among them. Each phase now stays within its row, a pixel wide at least. Nightly Recharge showed Polar's marks for a figure it has none of (-1 for the recovery and the intervals, -100 for the nervous system's status, 0 for a baseline not yet learnt) as the person's own. Recharge.known leaves them out, on the page and in the days' list; the figures are rows, each with the person's usual below it, and Polar's explanation of them (the status from -10 to +10, what each measures) is behind halkyon_ui's question mark. The page is a screen of its own over the tabs, without the bar and with the way back at its top left, its parts in cards (the developer's review of 3 Nov 2026; D60 had it inside Profile). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
adbb2c4f2f
commit
ddca423b8a
3 changed files with 1768 additions and 360 deletions
|
|
@ -2825,6 +2825,8 @@ void main() {
|
|||
'recovery': 4,
|
||||
'rmssd': 48,
|
||||
'baselineRmssd': 45,
|
||||
// Polar's mark for a status it has none of.
|
||||
'ansStatus': -100.0,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
|
@ -2862,16 +2864,36 @@ void main() {
|
|||
await tester.tap(find.text('Tuesday, October 27'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Inside Profile, the tabs beside it (D60).
|
||||
expect(find.byType(NavigationBar), findsOneWidget);
|
||||
// A screen of its own over the tabs, the way back at its top left
|
||||
// (the developer's review of 3 Nov 2026).
|
||||
expect(find.byType(NavigationBar), findsNothing);
|
||||
expect(find.byType(BackButton), findsOneWidget);
|
||||
expect(find.text('Heart rate'), findsOneWidget);
|
||||
expect(find.text('The night'), findsOneWidget);
|
||||
expect(find.text('You slept well'), findsOneWidget);
|
||||
await tester.scrollUntilVisible(find.text('Nightly Recharge'), 200);
|
||||
expect(
|
||||
find.text('Heart rate variability 48 ms, your usual 45 ms'),
|
||||
findsOneWidget,
|
||||
// The person's figures in rows, each with their usual; Polar's mark
|
||||
// for no value shown nowhere, the explanation behind the question
|
||||
// mark.
|
||||
expect(find.text('Recovery'), findsOneWidget);
|
||||
expect(find.text('4 of 6'), findsOneWidget);
|
||||
expect(find.text('Heart rate variability'), findsOneWidget);
|
||||
expect(find.text('48 ms'), findsOneWidget);
|
||||
expect(find.text('usually 45 ms'), findsOneWidget);
|
||||
expect(find.textContaining('100'), findsNothing);
|
||||
expect(find.text('Autonomic nervous system'), findsNothing);
|
||||
expect(find.textContaining('from −10 to +10'), findsNothing);
|
||||
await tester.tap(
|
||||
find.descendant(
|
||||
of: find.ancestor(
|
||||
of: find.text('Nightly Recharge'),
|
||||
matching: find.byType(Row),
|
||||
),
|
||||
matching: find.byType(HelpButton),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.textContaining('from −10 to +10'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets("Home shows today's figures from the band, even before a "
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_train_flutter/l10n/app_localizations.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/day/model/day.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/day/widget/night_chart.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets("a phase starting at the night's end or after it paints "
|
||||
'nothing out of its row rather than throwing mid-paint, which left '
|
||||
'the rows and the charts below drawn out of place (3 Nov 2026)', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: SizedBox(
|
||||
width: 320,
|
||||
child: NightChart(
|
||||
phases: [
|
||||
(Duration.zero, SleepState.light),
|
||||
(Duration(hours: 2), SleepState.rem),
|
||||
(Duration(hours: 3), SleepState.deep),
|
||||
// Polar's last phase, at the night's very end, and one past
|
||||
// it.
|
||||
(Duration(hours: 4), SleepState.wake),
|
||||
(Duration(hours: 5), SleepState.rem),
|
||||
],
|
||||
length: Duration(hours: 4),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_train_flutter/src/feature/day/model/day.dart';
|
||||
|
||||
void main() {
|
||||
test("Polar's marks for no value (-1, -100, 0) are no value, the "
|
||||
"person's own figures kept", () {
|
||||
const fromBand = Recharge(
|
||||
ansStatus: -100,
|
||||
recovery: -1,
|
||||
recoverySubLevel: -1,
|
||||
rri: 1000,
|
||||
rmssd: 69,
|
||||
breathInterval: 4380,
|
||||
baselineRri: 0,
|
||||
baselineRmssd: -1,
|
||||
);
|
||||
expect(
|
||||
fromBand.known,
|
||||
const Recharge(rri: 1000, rmssd: 69, breathInterval: 4380),
|
||||
);
|
||||
});
|
||||
|
||||
test('figures in their ranges stay as they are', () {
|
||||
const fromBand = Recharge(
|
||||
ansStatus: -2.5,
|
||||
recovery: 4,
|
||||
recoverySubLevel: 2,
|
||||
rmssd: 48,
|
||||
baselineRmssd: 45,
|
||||
);
|
||||
expect(fromBand.known, fromBand);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue