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:
122
test/active_stop_row_test.dart
Normal file
122
test/active_stop_row_test.dart
Normal file
@@ -0,0 +1,122 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_test/flutter_test.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';
|
||||
|
||||
/// The stop being worked lives in the trip list, not on a floating strip.
|
||||
///
|
||||
/// Home used to hide an active parcel stop from its own route and announce it
|
||||
/// instead with a red "Active Pickup" banner pinned over the bottom of the
|
||||
/// page — which covered the last card, said less than the row would have, and
|
||||
/// whose tap only refetched the queue. These tests are the two halves of that
|
||||
/// being one thing now: the row shows, and the row is the way in.
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
tearDown(() => ServiceProfile.setActive(ServiceProfile.parcel));
|
||||
|
||||
Map<String, dynamic> stop({required String id, required String status}) => {
|
||||
'orderid': id,
|
||||
'step': 1,
|
||||
'pickupcustomer': 'Customer $id',
|
||||
'pickupaddress': '1 Main Road, RS Puram',
|
||||
'orderstatus': status,
|
||||
'type': 'pickup',
|
||||
'pickuplat': 13.08,
|
||||
'pickuplon': 80.21,
|
||||
};
|
||||
|
||||
Future<void> pumpRow(
|
||||
WidgetTester tester, {
|
||||
required String status,
|
||||
void Function(Map<String, dynamic>)? onContinue,
|
||||
}) async {
|
||||
tester.view.physicalSize = const Size(1080, 2400);
|
||||
tester.view.devicePixelRatio = 3.0;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
final trip = Trip.fromStops(
|
||||
id: 't',
|
||||
stops: [stop(id: '1', status: status)],
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
ScreenUtilInit(
|
||||
designSize: const Size(390, 844),
|
||||
builder: (_, _) => MaterialApp(
|
||||
home: Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: TripCard(
|
||||
trip: trip,
|
||||
onToggleSelect: (_) {},
|
||||
onContinueStop: onContinue,
|
||||
).buildStops(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
}
|
||||
|
||||
testWidgets('a parcel stop under way stays on Home, marked Active', (
|
||||
tester,
|
||||
) async {
|
||||
ServiceProfile.setActive(ServiceProfile.parcel);
|
||||
await pumpRow(tester, status: 'active', onContinue: (_) {});
|
||||
|
||||
// It used to be filtered out of the list entirely on this tenant.
|
||||
expect(find.text('Customer 1'), findsOneWidget);
|
||||
expect(find.text('Active'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('the live row carries the way back into the stop', (
|
||||
tester,
|
||||
) async {
|
||||
ServiceProfile.setActive(ServiceProfile.parcel);
|
||||
Map<String, dynamic>? continued;
|
||||
await pumpRow(tester, status: 'active', onContinue: (s) => continued = s);
|
||||
|
||||
// Not "finish it in Bookings" beside a banner that was the only real way
|
||||
// through: the row he is looking at is the control.
|
||||
expect(find.text('In progress — finish it in Bookings'), findsNothing);
|
||||
// The control is an icon in the card's action cluster now — labelled, so
|
||||
// it is found the way a screen reader finds it rather than by its glyph.
|
||||
await tester.tap(find.bySemanticsLabel('Continue this stop'));
|
||||
await tester.pump();
|
||||
expect(continued?['orderid'], '1');
|
||||
});
|
||||
|
||||
testWidgets('with nowhere to continue to, the row states its state', (
|
||||
tester,
|
||||
) async {
|
||||
ServiceProfile.setActive(ServiceProfile.parcel);
|
||||
await pumpRow(tester, status: 'active');
|
||||
|
||||
expect(find.bySemanticsLabel('Continue this stop'), findsNothing);
|
||||
expect(find.text('In progress — finish it in Bookings'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('a service run marks its live stop the same way', (tester) async {
|
||||
ServiceProfile.setActive(ServiceProfile.meals);
|
||||
await pumpRow(tester, status: 'active', onContinue: (_) {});
|
||||
|
||||
expect(find.text('Customer 1'), findsOneWidget);
|
||||
expect(find.text('Active'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('an accepted parcel stop still leaves Home for Bookings', (
|
||||
tester,
|
||||
) async {
|
||||
// The handoff rule is untouched — only the *active* state moved.
|
||||
ServiceProfile.setActive(ServiceProfile.parcel);
|
||||
await pumpRow(tester, status: 'accepted', onContinue: (_) {});
|
||||
|
||||
expect(find.text('Customer 1'), findsNothing);
|
||||
expect(find.text('Active'), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user