Make Settings a top-level navigation destination
Show Back only when Settings is reached through a pushed route, and remove duplicate Settings controls where the shell already provides navigation. Update focused widget coverage and document the destination behavior.
This commit is contained in:
@@ -11,7 +11,6 @@ import 'package:pipelines_app/features/settings/settings_screen.dart';
|
||||
import 'package:pipelines_app/features/pipelines/screen.dart';
|
||||
import 'package:pipelines_app/shell/destination.dart';
|
||||
|
||||
import '../bar_action.dart';
|
||||
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
|
||||
import '../features/pipelines/fixtures.dart';
|
||||
import 'pipelines_app_test.dart' show webServer;
|
||||
@@ -63,13 +62,10 @@ void main() {
|
||||
final app = await mount(tester);
|
||||
await replyPipelines(tester, app.channel, PipelineFixture());
|
||||
await tester.pumpAndSettle();
|
||||
await tapBarAction(
|
||||
tester,
|
||||
find.byKey(const Key('pipelines-open-settings')),
|
||||
'Settings',
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await tab(tester, 'settings');
|
||||
expect(app.provider.value.uri.path, '/settings');
|
||||
// A destination opened from its nav item: no Back.
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
|
||||
final settingsState = tester.state(find.byType(SettingsScreen));
|
||||
await tab(tester, 'chat');
|
||||
expect(app.provider.value.uri.path, '/chat');
|
||||
@@ -77,19 +73,12 @@ void main() {
|
||||
expect(app.provider.value.uri.path, '/settings');
|
||||
expect(tester.state(find.byType(SettingsScreen)), same(settingsState));
|
||||
await tab(tester, 'pipelines');
|
||||
expect(
|
||||
app.provider.value.uri.path,
|
||||
'/settings',
|
||||
reason: 'tab retap is not Back',
|
||||
);
|
||||
await tester.tap(find.byKey(const ValueKey('shell.back')));
|
||||
await tester.pump();
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
expect(
|
||||
app.provider.value.uri.path,
|
||||
'/pipelines',
|
||||
reason: 'explicit Back still exits Settings',
|
||||
reason: 'the Pipelines item leaves Settings for its list',
|
||||
);
|
||||
expect(find.byKey(const ValueKey('shell.back')), findsNothing);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
testWidgets(
|
||||
@@ -191,8 +180,8 @@ void main() {
|
||||
await tab(tester, 'pipelines');
|
||||
expect(app.provider.value.uri.path, '/settings');
|
||||
expect(tester.widget<PipelinesScreen>(hidden).initialPipelineId, 1);
|
||||
await tester.tap(find.byKey(const Key('shell.back')));
|
||||
await tester.pumpAndSettle();
|
||||
// Settings has no Back; the Pipelines item returns to the open pipeline.
|
||||
await tab(tester, 'pipelines');
|
||||
expect(app.provider.value.uri.path, '/pipelines/1');
|
||||
expect(tester.state(find.byType(PipelinesScreen)), same(pipelineState));
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user