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>
104 lines
3.0 KiB
Dart
104 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:miler/views/Dashboard/pickups/stop_verify.dart';
|
|
|
|
/// The review step is the last screen before a stop is closed, and the only
|
|
/// thing the rider does on it is check figures. It used to spend a full line on
|
|
/// each — an icon, a caption and a value — for values that are almost always
|
|
/// four characters, so six facts ran past the fold and he had to scroll a
|
|
/// *confirmation* screen to see what he was confirming.
|
|
///
|
|
/// The packing rule is what fixed that, and it is asserted here rather than on
|
|
/// screen: the review sits behind a camera gate no widget test can pass.
|
|
void main() {
|
|
ReviewFact narrow(String label, String value) =>
|
|
ReviewFact(label, value, icon: Icons.circle);
|
|
|
|
ReviewFact wide(String label, String value) =>
|
|
ReviewFact(label, value, icon: Icons.circle, wide: true);
|
|
|
|
List<List<String>> labels(List<List<ReviewFact>> rows) => [
|
|
for (final r in rows) [for (final f in r) f.label],
|
|
];
|
|
|
|
test('two short facts share a row', () {
|
|
final rows = packReviewFacts([
|
|
narrow('Parcels', '3 of 3'),
|
|
narrow('Weight', '4.5 kg'),
|
|
]);
|
|
|
|
expect(labels(rows), [
|
|
['Parcels', 'Weight'],
|
|
]);
|
|
});
|
|
|
|
test('a sentence takes its own row', () {
|
|
// Wrapping a recipient's name or a damage note into half a column is how a
|
|
// grid turns back into a wall of text.
|
|
final rows = packReviewFacts([
|
|
narrow('Parcels', '3 of 3'),
|
|
narrow('Weight', '4.5 kg'),
|
|
wide('Note', 'Corner of the second box is crushed'),
|
|
]);
|
|
|
|
expect(labels(rows), [
|
|
['Parcels', 'Weight'],
|
|
['Note'],
|
|
]);
|
|
});
|
|
|
|
test('a wide fact does not drag its neighbour onto its row', () {
|
|
final rows = packReviewFacts([
|
|
wide('Received by', 'Ramesh Kumar · Security'),
|
|
narrow('OTP', '482156'),
|
|
]);
|
|
|
|
expect(labels(rows), [
|
|
['Received by'],
|
|
['OTP'],
|
|
]);
|
|
});
|
|
|
|
test('empty values are dropped, not rendered as dashes', () {
|
|
final rows = packReviewFacts([
|
|
narrow('Parcels', '3 of 3'),
|
|
narrow('Pickup code', ''),
|
|
narrow('Weight', '4.5 kg'),
|
|
]);
|
|
|
|
expect(labels(rows), [
|
|
['Parcels', 'Weight'],
|
|
]);
|
|
});
|
|
|
|
test('order is meaning, so nothing is re-sorted to pack tighter', () {
|
|
final rows = packReviewFacts([
|
|
narrow('Parcels', '3 of 3'),
|
|
wide('Note', 'Shutter was half down'),
|
|
narrow('Weight', '4.5 kg'),
|
|
narrow('Condition', 'Sealed & intact'),
|
|
]);
|
|
|
|
// A tighter packing exists — pair Parcels with Weight and push the note
|
|
// down — and it is deliberately not taken.
|
|
expect(labels(rows), [
|
|
['Parcels'],
|
|
['Note'],
|
|
['Weight', 'Condition'],
|
|
]);
|
|
});
|
|
|
|
test('the collect leg fits in three rows instead of six', () {
|
|
final rows = packReviewFacts([
|
|
narrow('Parcels', '3 of 3'),
|
|
narrow('Weight', '4.5 kg'),
|
|
narrow('Condition', 'Sealed & intact'),
|
|
narrow('Pickup code', '482156'),
|
|
wide('Note', 'Customer only had two ready'),
|
|
]);
|
|
|
|
expect(rows, hasLength(3));
|
|
});
|
|
}
|