Refine Settings destination shell integration

Keep Settings navigation independent while preserving shell actions and destination-specific state. Add the reviewed chat, run-entry, layout, and regression-test updates needed by the destination behavior.
This commit is contained in:
2026-11-12 11:21:26 +00:00
parent 95902e3e49
commit 26bb583f10
49 changed files with 2386 additions and 483 deletions
@@ -3,6 +3,8 @@ import 'package:flutter_test/flutter_test.dart';
import '../../native_back.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/screen.dart';
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart'
show segmentedMoreKey;
/// A chat destination gateway: one listed session whose harness offers models.
class _ScreenGateway implements ApiGateway {
@@ -77,6 +79,22 @@ Future<void> _pumpScreen(
await tester.pumpAndSettle();
}
/// A phone bar keeps the model in the More menu's settings sheet: opens it
/// (a wide bar shows the control already).
Future<void> _openSettings(WidgetTester tester) async {
if (find.byKey(const Key('chat-model')).evaluate().isNotEmpty) return;
await tester.tap(find.byKey(segmentedMoreKey).hitTestable());
await tester.pumpAndSettle();
await tester.tap(find.text('Chat settings'));
await tester.pumpAndSettle();
}
/// Dismisses that sheet through its barrier, above the bar.
Future<void> _closeSettings(WidgetTester tester) async {
await tester.tapAt(const Offset(5, 5));
await tester.pumpAndSettle();
}
void main() {
testWidgets('an accepted switch survives leaving and reopening the chat', (
tester,
@@ -86,6 +104,7 @@ void main() {
await tester.tap(find.byKey(const Key('chat-row-s')));
await tester.pumpAndSettle();
await _openSettings(tester);
expect(find.byTooltip('Change model (currently model-a)'), findsOneWidget);
await tester.tap(find.byKey(const Key('chat-model')));
@@ -93,6 +112,7 @@ void main() {
await tester.tap(find.text('Model Beta'));
await tester.pumpAndSettle();
expect(find.byTooltip('Change model (currently model-b)'), findsOneWidget);
await _closeSettings(tester);
await tester.tap(findNativeBack());
await tester.pumpAndSettle();
@@ -102,6 +122,7 @@ void main() {
// still show the model the server accepted.
await tester.tap(find.byKey(const Key('chat-row-s')));
await tester.pumpAndSettle();
await _openSettings(tester);
expect(find.byTooltip('Change model (currently model-b)'), findsOneWidget);
expect(find.byTooltip('Change model (currently model-a)'), findsNothing);
@@ -133,6 +154,7 @@ void main() {
// The deep link opened before any row was tapped: the list's own read
// supplies the title and the recorded model, with no second list request.
expect(find.text('Wire chat'), findsOneWidget);
await _openSettings(tester);
expect(find.byTooltip('Change model (currently model-a)'), findsOneWidget);
expect(find.byKey(const Key('chat-model')), findsOneWidget);
expect(gateway.count('chat_sessions'), 1);