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>
94 lines
3.8 KiB
Dart
94 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/home/trip.dart';
|
|
import 'package:miler/views/Dashboard/home/trip_brief_strip.dart';
|
|
import 'package:miler/views/Dashboard/home/trip_card.dart';
|
|
|
|
/// ─────────────────────────────────────────────────────────────────────────
|
|
/// The trip brief and the hub row have to survive every phone and every
|
|
/// accessibility text size.
|
|
///
|
|
/// This exists because both of them broke in exactly that way while being
|
|
/// written. Putting "VIEW ROUTE" on the START · HUB row overflowed the row by
|
|
/// 6.2px at the design width — a `Row` of two natural-width children with a
|
|
/// `Spacer` between them has no give at all, and the failure only appears once
|
|
/// the two happen to be too wide together. The brief has the same shape of risk
|
|
/// in two places: four figures sharing one row, and a value like `₹1,23,456`
|
|
/// that is far wider than the `₹450` anyone tests with by hand.
|
|
///
|
|
/// So this sweeps the four widths the app actually ships to against the text
|
|
/// scales Android exposes in Settings, and asserts only one thing: nothing
|
|
/// throws. Overflow in Flutter is a layout *exception*, so that single
|
|
/// assertion catches all of it.
|
|
/// ─────────────────────────────────────────────────────────────────────────
|
|
void main() {
|
|
/// 320 is the narrowest Android phone still in the field; 430 is a Pro Max.
|
|
const widths = [320.0, 360.0, 390.0, 430.0];
|
|
|
|
/// 2.0 is the top of Android's font-size slider.
|
|
const textScales = [1.0, 1.3, 1.5, 2.0];
|
|
|
|
/// A worst-case trip: six stops, and a cash figure with enough digits to
|
|
/// stress the narrowest of the four figure columns.
|
|
Trip bigTrip() => Trip.fromStops(
|
|
id: 't1',
|
|
stops: [
|
|
for (var i = 0; i < 6; i++)
|
|
{
|
|
'orderid': 'S$i',
|
|
'type': 'pickup',
|
|
'pickupcustomer': 'Sri Balaji Stores',
|
|
'pickupaddress': '19, Thadagam Road, Venkitapuram, Coimbatore',
|
|
'Quantity': '3',
|
|
'collectionamt': '123456',
|
|
'expected_pickup_time': DateTime.now().toIso8601String(),
|
|
},
|
|
],
|
|
);
|
|
|
|
for (final width in widths) {
|
|
for (final scale in textScales) {
|
|
testWidgets('lays out at ${width.toInt()}pt / ${scale}x', (tester) async {
|
|
tester.view.physicalSize = Size(width * 3, 844 * 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(
|
|
home: MediaQuery(
|
|
data: MediaQueryData(textScaler: TextScaler.linear(scale)),
|
|
child: Scaffold(
|
|
body: SingleChildScrollView(
|
|
child: TripCard(
|
|
trip: bigTrip(),
|
|
// Supplied, so the hub row carries VIEW ROUTE — the
|
|
// element that overflowed.
|
|
onViewRoute: () {},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(
|
|
tester.takeException(),
|
|
isNull,
|
|
reason: 'collapsed brief overflowed at ${width}pt / ${scale}x',
|
|
);
|
|
|
|
expect(
|
|
tester.takeException(),
|
|
isNull,
|
|
reason: 'open brief overflowed at ${width}pt / ${scale}x',
|
|
);
|
|
});
|
|
}
|
|
}
|
|
}
|