feat(train): a workout's sheet pulled up squares off, its bar naming the activity

As Strava's: over the last 6 % below the highest the sheet goes, its
top corners square off from 28 to 0 and its handle folds away, so the
bar above, opaque by then, meets it without the map showing through
the corners. The bar names the activity rather than the workout, whose
name already heads the sheet: it was in sight twice. sheetSquared in
track_camera.dart, tested beside barShown. ADR 0030, D65.

Whats-New: A workout's page pulled all the way up meets the bar square, which names the activity.
Whats-New-De: Ganz hochgezogen schließt die Seite eines Trainings eckig an die Leiste an, die die Sportart nennt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-04 20:43:33 +01:00
commit 615d66554b
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 101 additions and 9 deletions

View file

@ -4341,10 +4341,48 @@ void main() {
expect(find.byTooltip('Back'), findsOneWidget);
expect(find.byTooltip('Show the map'), findsNothing);
final sheet = find
.descendant(
of: find.byType(DraggableScrollableSheet),
matching: find.byType(Material),
)
.first;
BorderRadiusGeometry corners() =>
(tester.widget<Material>(sheet).shape! as RoundedRectangleBorder)
.borderRadius;
double nameBelowTop() =>
tester
.getTopLeft(
find.descendant(
of: sheet,
matching: find.text('Morning run'),
),
)
.dy -
tester.getTopLeft(sheet).dy;
expect(
corners(),
const BorderRadius.vertical(top: Radius.circular(28)),
);
expect(nameBelowTop(), greaterThanOrEqualTo(28), reason: 'the handle');
await tester.drag(find.text('2.50 km'), const Offset(0, -2000));
await tester.pumpAndSettle();
expect(find.byTooltip('Show the map'), findsOneWidget);
expect(find.byTooltip('Back'), findsNothing);
// As Strava's (D65): square corners, no handle, the bar naming the
// activity, the workout's name only once, on the sheet.
expect(corners(), BorderRadius.zero);
tester
.state<ScrollableState>(
find.descendant(of: sheet, matching: find.byType(Scrollable)),
)
.position
.jumpTo(0);
await tester.pump();
expect(nameBelowTop(), closeTo(0, 1));
expect(find.text('Running'), findsOneWidget);
expect(find.text('Morning run'), findsOneWidget);
await tester.tap(find.byTooltip('Show the map'));
await tester.pumpAndSettle();

View file

@ -80,5 +80,13 @@ void main() {
expect(barShown(1), 1);
expect(barShown((trackBarFrom + 1) / 2), closeTo(0.5, 1e-9));
});
test('squares off over the last 6 % below the highest it goes (D65)', () {
expect(sheetSquared(0.55, 0.9), 0);
expect(sheetSquared(0.84, 0.9), 0);
expect(sheetSquared(0.87, 0.9), closeTo(0.5, 1e-9));
expect(sheetSquared(0.9, 0.9), 1);
expect(sheetSquared(0.95, 0.9), 1);
});
});
}