Miler rider app: surface system, visible design language, backend lifecycle
Design system - MilerSurface ladder (canvas → working → raised → floating) with MilerPanel as layer 1; canvas moved to #DEE3EA so white separates at 1.290:1. - Visible vocabulary applied across Home, Deliveries, Activity, Account and the sheets: hero heads (tabular numeral + small caption, clamped at 1.3x), canvas wells for anything that opens, small filled tags for shelf labels, demoted placeholders. Recorded in DESIGN_SYSTEM.md §6. - One icon family: 222 Material glyphs migrated to Lucide; none left outside lib/xpress. - Colour semantics corrected: amber only for what is genuinely owed, brand red reserved for the live stop, disabled primaries go neutral rather than pale. Data and lifecycle - lib/data/lifecycle.dart reads mutations for what they prove; route_order.dart makes admin sequence the single ordering authority; service_day.dart, and stop_area.dart rewritten against live Coimbatore addresses (digit-token stripping, city stoplist, street suffixes, stammer collapse). - countLabel states the load once, in bags. Testing - 1440 tests passing; golden shot harnesses for Home, Deliveries, Activity, sheets and verify, with test/failures/ now gitignored (diff debris). - New pins: home_gutter_test, stop_area_test, plus updated structural bounds. Note: this commit also carries pre-existing working-tree deletions that were present before this work (API_SPEC.md, README.md, demo test fixtures). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
83
test/home_empty_state_test.dart
Normal file
83
test/home_empty_state_test.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
import 'package:miler/data/service_profile.dart';
|
||||
import 'package:miler/views/Dashboard/home/trip.dart';
|
||||
import 'package:miler/views/Dashboard/home/trip_card.dart';
|
||||
|
||||
/// ─────────────────────────────────────────────────────────────────────────
|
||||
/// A DAY WITH NO WORK HAS TO SAY SO
|
||||
///
|
||||
/// Home's empty branch rendered `SizedBox.shrink()` — literally nothing — so a
|
||||
/// rider whose hub had not assigned him anything opened the app to a blank
|
||||
/// screen and could not tell it apart from one that had failed to load. Two
|
||||
/// very different situations, one identical rendering: wait, or report it.
|
||||
///
|
||||
/// The empty state itself was never missing; it was orphaned when the trip tabs
|
||||
/// were removed and nothing called it any more. This pins the wiring, because
|
||||
/// the failure is silent — everything compiles and the screen just goes quiet.
|
||||
/// ─────────────────────────────────────────────────────────────────────────
|
||||
void main() {
|
||||
tearDown(() => ServiceProfile.setActive(ServiceProfile.parcel));
|
||||
|
||||
Future<void> pump(WidgetTester tester, {required bool anyStops}) async {
|
||||
tester.view.physicalSize = const Size(1170, 2532);
|
||||
tester.view.devicePixelRatio = 3.0;
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
await tester.pumpWidget(
|
||||
ScreenUtilInit(
|
||||
designSize: const Size(390, 844),
|
||||
builder: (_, _) => MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: TripCard(
|
||||
trip: Trip.fromStops(
|
||||
id: 't',
|
||||
stops: anyStops
|
||||
? [
|
||||
{
|
||||
'orderid': 'A',
|
||||
'pickupcustomer': 'Sri Balaji Stores',
|
||||
'pickupaddress': '12 Main Rd, Coimbatore',
|
||||
'orderstatus': 'new',
|
||||
'Quantity': 1,
|
||||
},
|
||||
]
|
||||
: const [],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
testWidgets('a trip with no stops renders something, not nothing', (
|
||||
tester,
|
||||
) async {
|
||||
await pump(tester, anyStops: false);
|
||||
|
||||
// Whatever the composition, the screen must not be blank: a rider looking
|
||||
// at an empty rectangle cannot tell "no work" from "load failed".
|
||||
expect(find.byType(TripCard), findsOneWidget);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('a trip with work draws the route, not the empty state', (
|
||||
tester,
|
||||
) async {
|
||||
await pump(tester, anyStops: true);
|
||||
|
||||
expect(find.text('Sri Balaji Stores'), findsOneWidget);
|
||||
expect(
|
||||
find.byType(Lottie),
|
||||
findsNothing,
|
||||
reason: 'the empty animation must not sit under a populated route',
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user