Close the phone chat page explicitly from its Back button

The chat page's Back had no handler and relied on the stock Back popping
the nearest route, while the system gesture went through the app's own
back handling. Back now pops the page's own route (or leaves the open
chat), the same path the gesture takes.
This commit is contained in:
2026-11-12 19:20:33 +00:00
parent 767643d991
commit 19b1d1326a
4 changed files with 100 additions and 3 deletions
@@ -178,11 +178,13 @@ void main() {
await tester.tap(find.text('Chat a').first);
await tester.pumpAndSettle();
expect(find.byTooltip('Back').hitTestable(), findsOneWidget);
// The page's Back closes that page explicitly rather than popping
// whichever route is nearest the button.
expect(
tester
.widget<BackButton>(find.byType(BackButton).hitTestable())
.onPressed,
isNull,
isNotNull,
);
final stateA = tester.state(_thread('a'));
await tester.enterText(_input('a'), 'Phone draft A');