The effort pass, end to end. Every screen was run through one test — if I remove this sentence, does the customer make a worse decision? — and the parts that failed it are gone. The flow Home ▸ BOOK ▸ Where is it going? ▸ When shall we collect? ▸ details ▸ booked BOOK opens a sheet, not a form. The destination is browsed state-then-district because a flat list of every serviceable district survives twelve and not sixty, and search cuts across states because somebody who knows they are sending to Chennai should not have to know which state it is in. Districts multi-select, but only where the server allows it: BookingLimits advertises maxDestinations: 1 until the Miler build keys on consignmentid, and a sheet that ignored that would sell a booking the network cannot complete. The pickup window is now a step the customer answers rather than a slot chosen for them. A pickup window is a promise about somebody's afternoon. What the screens stopped saying Home lost the orb caption for returning customers and a four-cell live card. Send lost the city strip, both address fields, the optional disclosure and three sentences about charging — the route, the packages and the button are what is left. Tracking lost a radar with a bike in it, a Milers-in-your-zone count, a "Step 2 of 7" and a sentence describing the screen you were looking at. The window sheet lost "Fastest pickup", "4 Milers nearby" and "Relaxed evening handover". Type Poppins, which has no variable release — four static cuts, and the sans styles set fontWeight alone because fontVariations on a static font is ignored in silence. Every weight dropped a step and the tracking went deeper: Poppins is built on near-circles and carries more ink than the humanist faces before it. Objects One lit sphere on Home, and the primary button now takes its gradient and rim because a committing action that is not lit like the hero reads as a different material. The tracking rail's connector is crimson as far as the parcel has come, so the line is the progress bar. Confirmation is a white tick on green: crimson is this app's action colour and that screen has nothing left to do. Bugs found on the way The OTP screen dropped digits. Four fields passing focus along lose a keystroke that arrives mid-transition, so "1234" became "124" and the screen answered "That code did not match" — blaming the customer for its own race. One field now, four boxes that only draw. Nothing ever asked for the customer's location: detectPickupLocation was the OTP screen's job, so a restored session or an auto-login never triggered the permission prompt and the pickup map had nothing to centre on. The launcher icon and both splash screens pointed at a house drawn as two vector paths — a placeholder that shipped. The splash clock started when the widget was built rather than when it was visible, so the truck got 0.45s of a 1.8s beat behind Android's own splash. It waits on waitUntilFirstFrameRasterized now, raced against a timeout so a binding that never reports one cannot strand the app. Also: design/screens/ holds all 19 screens under readable names, tool/ has the scripts that refresh them and rebrand the Lottie, and DESIGN.md is current. flutter analyze clean. 88 tests, 1 skipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EqVJPB9B4QuieZnBAAKgYQ
260 lines
9.0 KiB
Dart
260 lines
9.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:lucide_icons_flutter/lucide_icons.dart';
|
|
|
|
import '../tokens.dart';
|
|
import 'account_screen.dart';
|
|
import 'home_screen.dart';
|
|
import 'orders_screen.dart';
|
|
|
|
/// Bottom-navigation shell: Home · Orders · Account.
|
|
///
|
|
/// Booking and tracking screens are pushed on top, so the tab bar only ever
|
|
/// shows on the three destinations that need it.
|
|
class ShellScreen extends StatefulWidget {
|
|
const ShellScreen({super.key, this.initialTab = 0});
|
|
|
|
final int initialTab;
|
|
|
|
static ShellScreenState? of(BuildContext context) =>
|
|
context.findAncestorStateOfType<ShellScreenState>();
|
|
|
|
@override
|
|
State<ShellScreen> createState() => ShellScreenState();
|
|
}
|
|
|
|
class ShellScreenState extends State<ShellScreen> {
|
|
late int _index = widget.initialTab;
|
|
|
|
void goToTab(int index) {
|
|
if (index == _index) return;
|
|
HapticFeedback.selectionClick();
|
|
setState(() => _index = index);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: DmColors.canvas,
|
|
body: IndexedStack(
|
|
index: _index,
|
|
children: const [HomeScreen(), OrdersScreen(), AccountScreen()],
|
|
),
|
|
bottomNavigationBar: _TabBar(index: _index, onChanged: goToTab),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// The tab bar, fixed to the bottom edge.
|
|
///
|
|
/// ── Why it is no longer a floating pill-shaped bar ──
|
|
///
|
|
/// It used to hover 10pt above the bottom with a 28pt radius and a shadow
|
|
/// under it, which put a second rounded surface between the content and the
|
|
/// gesture bar and made every screen end in two stacked edges. It now sits on
|
|
/// the edge with a single hairline above it, like the footers in the rest of
|
|
/// the app.
|
|
///
|
|
/// The indicator does the work instead: a crimson pill that travels to the tab
|
|
/// you pick, with the glyph turning white as it arrives. Selection reads as one
|
|
/// object moving rather than three tabs changing colour in place — and the
|
|
/// label under it stays crimson, so the tab is still identifiable in the
|
|
/// half-second the pill is in flight.
|
|
///
|
|
/// ── What the 2026-09-22 pass changed ──
|
|
///
|
|
/// **The pill stopped glowing.** It carried [DmShadow.liftSm] — a 65% crimson
|
|
/// shadow built for the committing button on a screen — which on a bar resting
|
|
/// against the bottom edge read as a smear under the tab rather than as lift.
|
|
/// It is a quarter of that strength now and sits closer to the shape.
|
|
///
|
|
/// **The glyph arrives.** The icon pops to 1.14 and settles as the pill lands
|
|
/// under it, on the same overshoot curve the pill travels on, so the two read
|
|
/// as one gesture instead of a moving rectangle and an icon that recolours when
|
|
/// it happens to be covered.
|
|
///
|
|
/// **A tab gives way when pressed.** The whole column scales to 0.9 under the
|
|
/// finger. Without it the only feedback for a tap was the pill starting to
|
|
/// move, which on the tab you are already on is no feedback at all.
|
|
class _TabBar extends StatelessWidget {
|
|
const _TabBar({required this.index, required this.onChanged});
|
|
|
|
final int index;
|
|
final ValueChanged<int> onChanged;
|
|
|
|
/// Lucide, not Material. One 1.5px stroke family at one weight, so the three
|
|
/// glyphs read as a set instead of three different drawing styles — and the
|
|
/// same set the pushed screens use.
|
|
static const _items = [
|
|
(label: 'Home', icon: LucideIcons.house),
|
|
(label: 'Orders', icon: LucideIcons.package),
|
|
(label: 'Account', icon: LucideIcons.userRound),
|
|
];
|
|
|
|
/// The travelling pill's size. Narrower than its slot so it reads as an
|
|
/// object sitting in the row rather than as a selected cell.
|
|
static const double _pillWidth = 62;
|
|
static const double _pillHeight = 34;
|
|
|
|
/// The pill's own lift. Not [DmShadow.liftSm]: that is the glow under a
|
|
/// committing action, and at the bottom edge of the screen it read as dirt
|
|
/// under the tab.
|
|
static const _pillShadow = [
|
|
BoxShadow(
|
|
color: Color(0x2E8F0F06),
|
|
blurRadius: 10,
|
|
spreadRadius: -2,
|
|
offset: Offset(0, 4),
|
|
),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DecoratedBox(
|
|
decoration: const BoxDecoration(
|
|
color: DmColors.surface,
|
|
border: Border(top: BorderSide(color: DmColors.border)),
|
|
),
|
|
child: SafeArea(
|
|
top: false,
|
|
child: Padding(
|
|
padding: const EdgeInsets.fromLTRB(6, 9, 6, 7),
|
|
child: SizedBox(
|
|
// The row is the pill plus the label, and the label is type: at
|
|
// 1.8x accessibility text a fixed 58 clipped it by two points. The
|
|
// bar gets taller instead, which is what a larger-text user asked
|
|
// for.
|
|
height: _pillHeight +
|
|
5 +
|
|
MediaQuery.textScalerOf(context).scale(11.5) * 1.3,
|
|
child: LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
final slot = constraints.maxWidth / _items.length;
|
|
return Stack(
|
|
children: [
|
|
AnimatedPositioned(
|
|
duration: DmMotion.slow,
|
|
curve: DmMotion.glide,
|
|
left: slot * index + (slot - _pillWidth) / 2,
|
|
width: _pillWidth,
|
|
top: 0,
|
|
height: _pillHeight,
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: DmColors.brand,
|
|
borderRadius: DmRadius.all(DmRadius.pill),
|
|
boxShadow: _pillShadow,
|
|
),
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
for (var i = 0; i < _items.length; i++)
|
|
Expanded(
|
|
child: _TabButton(
|
|
label: _items[i].label,
|
|
icon: _items[i].icon,
|
|
selected: index == i,
|
|
onTap: () => onChanged(i),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _TabButton extends StatefulWidget {
|
|
const _TabButton({
|
|
required this.label,
|
|
required this.icon,
|
|
required this.selected,
|
|
required this.onTap,
|
|
});
|
|
|
|
final String label;
|
|
final IconData icon;
|
|
final bool selected;
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
State<_TabButton> createState() => _TabButtonState();
|
|
}
|
|
|
|
class _TabButtonState extends State<_TabButton> {
|
|
bool _down = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Semantics(
|
|
button: true,
|
|
selected: widget.selected,
|
|
child: GestureDetector(
|
|
behavior: HitTestBehavior.opaque,
|
|
onTapDown: (_) => setState(() => _down = true),
|
|
onTapUp: (_) => setState(() => _down = false),
|
|
onTapCancel: () => setState(() => _down = false),
|
|
onTap: widget.onTap,
|
|
child: AnimatedScale(
|
|
// The whole column, including the label: a press that only moved the
|
|
// glyph would read as the icon coming loose from its own tab.
|
|
scale: _down ? 0.9 : 1,
|
|
duration: DmMotion.fast,
|
|
curve: DmMotion.ease,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: _TabBar._pillHeight,
|
|
child: Center(
|
|
child: AnimatedScale(
|
|
// Lands with the pill, on the pill's own curve. The
|
|
// overshoot is what ties the two together — the glyph is
|
|
// reacting to the thing arriving under it.
|
|
scale: widget.selected ? 1.14 : 1,
|
|
duration: DmMotion.slow,
|
|
curve: DmMotion.glide,
|
|
child: AnimatedSwitcher(
|
|
duration: DmMotion.base,
|
|
child: Icon(
|
|
widget.icon,
|
|
key: ValueKey(widget.selected),
|
|
size: 21,
|
|
color: widget.selected ? Colors.white : DmColors.ink3,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 5),
|
|
AnimatedDefaultTextStyle(
|
|
duration: DmMotion.base,
|
|
curve: DmMotion.ease,
|
|
style: DmText.label.copyWith(
|
|
fontSize: 11.5,
|
|
height: 1.0,
|
|
color: widget.selected ? DmColors.brand : DmColors.ink3,
|
|
fontWeight:
|
|
widget.selected ? FontWeight.w700 : FontWeight.w600,
|
|
),
|
|
child: Text(
|
|
widget.label,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|