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>
109 lines
3.8 KiB
Dart
109 lines
3.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:miler/views/Dashboard/pickups/stop_verify.dart';
|
|
|
|
/// The verification page is filled in at a doorstep, one-handed, often by
|
|
/// someone who has turned the system font up. It was rebuilt to remove the
|
|
/// nested boxes it used to be made of, and the pieces that replaced them —
|
|
/// a step counter in the app bar, a full-width parcel list, six OTP tiles, a
|
|
/// label/value review — are all row layouts with fixed-width parts, which is
|
|
/// exactly the shape that overflows when the text grows.
|
|
///
|
|
/// A screenshot on the developer's own phone at 1.0x cannot catch that, so it
|
|
/// is measured here: every leg, on the narrowest phone the app supports, at
|
|
/// every text scale Android offers.
|
|
void main() {
|
|
Future<void> pump(
|
|
WidgetTester tester,
|
|
Map<String, dynamic> stop, {
|
|
double width = 360,
|
|
double textScale = 1.0,
|
|
}) async {
|
|
tester.view.physicalSize = Size(width * 3, 780 * 3);
|
|
tester.view.devicePixelRatio = 3.0;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
|
|
await tester.pumpWidget(
|
|
ScreenUtilInit(
|
|
designSize: const Size(390, 844),
|
|
builder: (_, _) => MaterialApp(
|
|
builder: (context, child) => MediaQuery(
|
|
data: MediaQuery.of(
|
|
context,
|
|
).copyWith(textScaler: TextScaler.linear(textScale)),
|
|
child: child!,
|
|
),
|
|
home: StopVerificationPage(pickup: stop),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
}
|
|
|
|
Map<String, dynamic> stopOf(
|
|
String type, {
|
|
int delivery = 0,
|
|
int pickup = 0,
|
|
}) => <String, dynamic>{
|
|
'orderid': 'T-1',
|
|
'type': type,
|
|
'pickupcustomer': 'Venkateswara Traders & General Merchants',
|
|
'pickupaddress':
|
|
'12/3B, Second Cross Street, Ram Nagar, Near Bus Stand, '
|
|
'Coimbatore, Tamil Nadu 641009',
|
|
if (delivery > 0) 'deliveryqty': '$delivery',
|
|
if (pickup > 0) 'pickupqty': '$pickup',
|
|
'Quantity': '${pickup > 0 ? pickup : delivery}',
|
|
'collectionamt': '2450',
|
|
};
|
|
|
|
for (final scale in const [1.0, 1.3, 1.5, 2.0]) {
|
|
testWidgets('the collect leg lays out at ${scale}x', (tester) async {
|
|
await pump(tester, stopOf('pickup', pickup: 3), textScale: scale);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('the hand-over leg lays out at ${scale}x', (tester) async {
|
|
await pump(tester, stopOf('delivery', delivery: 4), textScale: scale);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|
|
|
|
testWidgets('the whole collect leg is reachable by scrolling', (
|
|
tester,
|
|
) async {
|
|
await pump(tester, stopOf('pickup', pickup: 2));
|
|
|
|
// The last section of the longest leg. If the scroll view were sized wrong
|
|
// — which is the failure mode of a Column inside a Column inside an
|
|
// Expanded — this would never come into view.
|
|
await tester.dragUntilVisible(
|
|
find.text('Pickup code'),
|
|
find.byType(SingleChildScrollView),
|
|
const Offset(0, -200),
|
|
);
|
|
expect(find.text('Pickup code'), findsOneWidget);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('the action bar never scrolls away with the form', (
|
|
tester,
|
|
) async {
|
|
await pump(tester, stopOf('pickup', pickup: 2));
|
|
|
|
final barAtRest = tester.getRect(find.text('Take a photo of the parcels'));
|
|
await tester.drag(
|
|
find.byType(SingleChildScrollView),
|
|
const Offset(0, -400),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
// The blocking hint lives in the pinned bar, so it is still exactly where
|
|
// it was: what the rider must do next cannot scroll off a doorstep screen.
|
|
expect(tester.getRect(find.text('Take a photo of the parcels')), barAtRest);
|
|
});
|
|
}
|