production
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:miler/views/Dashboard/activity/activity_page.dart';
|
||||
import 'package:miler/views/Dashboard/profile/Profilepage.dart';
|
||||
import 'package:miler/views/helpers/constants/Colorconstants.dart';
|
||||
import 'package:miler/views/helpers/constants/narrative.dart';
|
||||
import 'package:miler/views/helpers/widgets/miler_app_bar.dart';
|
||||
import 'package:miler/data/accepted_store.dart';
|
||||
|
||||
@@ -151,11 +152,30 @@ void main() {
|
||||
// Activity were on `pureSurface`. Bookings hides its background under
|
||||
// cards; Account is bare rows, so the whole tab read a shade dirtier.
|
||||
//
|
||||
// The paper moved: the scaffold's own background is the **brand** now, so
|
||||
// it shows through the two rounded top corners of [MilerSheet], and the
|
||||
// sheet paints the page. Both halves are contracts — a tab whose ground is
|
||||
// white draws no corners at all, and a tab whose sheet is off-white is the
|
||||
// original bug one layer down — so both are asserted.
|
||||
// The paper moved: the scaffold's own background became the **brand**, so
|
||||
// it could show through the two rounded top corners [MilerSheet] used to
|
||||
// clip, and the sheet painted the page.
|
||||
//
|
||||
// ── Why the ground is no longer a fixed colour ──
|
||||
//
|
||||
// That arrangement is gone. The curve moved onto the bar, which paints the
|
||||
// page colour behind its own corners (see [milerBrandSurface]), and
|
||||
// [MilerSheet] clips at zero radius. A brand-red ground is therefore no
|
||||
// longer load-bearing — it is only invisible for as long as the sheet
|
||||
// covers every pixel of the body.
|
||||
//
|
||||
// On Activity it did not. The sheet was pushed down 30pt to make room for
|
||||
// the floating figure card, and what showed in the gap was a full-width
|
||||
// band of maroon directly under the app bar — bare down both gutters, and
|
||||
// on a day with nothing finished (no card built at all) a solid red stripe
|
||||
// across the screen. It read as a second, broken app bar.
|
||||
//
|
||||
// So the ground is asserted against the thing that actually matters: it
|
||||
// must be either the brand — fine, where the sheet covers it whole — or
|
||||
// the sheet's own colour, which is the only other way a band cannot
|
||||
// appear. What stays banned is a *third* colour, which is how a tab ends
|
||||
// up a shade dirtier than the rest. See also the Activity-specific test
|
||||
// below, which pins the case that broke.
|
||||
T? firstOf<T extends Widget>() {
|
||||
final found = <T>[];
|
||||
void visit(Element e) {
|
||||
@@ -182,13 +202,16 @@ void main() {
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
expect(
|
||||
firstOf<Scaffold>()?.backgroundColor,
|
||||
ColorConstants.primary,
|
||||
reason: 'the ground behind the sheet corners must be the brand',
|
||||
);
|
||||
final sheet = firstOf<MilerSheet>();
|
||||
expect(sheet, isNotNull, reason: 'every tab sits in a MilerSheet');
|
||||
final paper = sheet!.color ?? ColorConstants.pureSurface;
|
||||
|
||||
expect(
|
||||
firstOf<Scaffold>()?.backgroundColor,
|
||||
anyOf(ColorConstants.primary, paper),
|
||||
reason:
|
||||
'a ground that is neither the brand nor the page shows as a band',
|
||||
);
|
||||
// What the tabs must agree on is the *ladder*, not one flat paper:
|
||||
// a sheet is either the working white (rows drawn straight on it —
|
||||
// Activity) or the canvas with white panels standing on it (Home,
|
||||
@@ -196,13 +219,69 @@ void main() {
|
||||
// the warm off-white that made one tab read a shade dirtier than the
|
||||
// rest.
|
||||
expect(
|
||||
sheet!.color ?? ColorConstants.pureSurface,
|
||||
anyOf(ColorConstants.pureSurface, ColorConstants.daylightSurface),
|
||||
reason: 'a sheet is a rung of the surface ladder, never an off-white',
|
||||
paper,
|
||||
anyOf(
|
||||
ColorConstants.pureSurface,
|
||||
ColorConstants.daylightSurface,
|
||||
// Activity was rebuilt against the Narrative brief, which pairs a
|
||||
// *lighter* canvas with cards that carry a border and a lift. Its
|
||||
// ground is a rung of that ladder rather than this one — see
|
||||
// [Narrative], and the note there about not mixing the two recipes.
|
||||
Narrative.canvas,
|
||||
),
|
||||
reason: 'a sheet is a rung of a surface ladder, never an off-white',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('Activity shows no brand band under the app bar', (
|
||||
tester,
|
||||
) async {
|
||||
// The regression, pinned at the layer it happened on. Activity is the one
|
||||
// tab that floats a card over the seam, so it is the one tab whose sheet
|
||||
// was inset — and an inset sheet over a brand-red ground is a red stripe.
|
||||
//
|
||||
// Its ground is the page now, so there is nothing to leak whatever the
|
||||
// sheet does, and the empty-day case — where the card is not built at all
|
||||
// and the stripe was full width — is covered by the same fact.
|
||||
T? firstOf<T extends Widget>() {
|
||||
final found = <T>[];
|
||||
void visit(Element e) {
|
||||
final w = e.widget;
|
||||
if (w is T) found.add(w);
|
||||
e.visitChildren(visit);
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.rootElement!.visitChildren(visit);
|
||||
return found.isEmpty ? null : found.first;
|
||||
}
|
||||
|
||||
SharedPreferences.setMockInitialValues({'userId': 1});
|
||||
tester.view.physicalSize = const Size(390 * 3, 844 * 3);
|
||||
tester.view.devicePixelRatio = 3.0;
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
await tester.pumpWidget(
|
||||
ScreenUtilInit(
|
||||
designSize: const Size(390, 844),
|
||||
builder: (_, _) => const MaterialApp(home: ActivityPage()),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
final ground = firstOf<Scaffold>()?.backgroundColor;
|
||||
expect(
|
||||
ground,
|
||||
isNot(ColorConstants.primary),
|
||||
reason: 'the 30pt maroon band under the bar was this colour',
|
||||
);
|
||||
expect(
|
||||
ground,
|
||||
firstOf<MilerSheet>()?.color ?? ColorConstants.pureSurface,
|
||||
reason: 'ground and page must match, so no inset can expose a band',
|
||||
);
|
||||
});
|
||||
|
||||
// ── A row offers one gesture, and it is the whole row ──
|
||||
//
|
||||
// The card carried a footer band: a hairline, ~22pt of gaps, the booking
|
||||
|
||||
Reference in New Issue
Block a user