Redesign Settings as grouped searchable page
Replace the tabbed Settings flow with a single grouped page that searches and lazily loads server-backed sections. Preserve existing settings behavior while adding inline loading and retry states and updating coverage for the new navigation model.
This commit is contained in:
@@ -16,28 +16,39 @@ import 'package:pipelines_app/features/settings/settings_store.dart';
|
||||
import 'package:pipelines_app/features/settings/settings_trust_warning.dart';
|
||||
|
||||
import 'fake_channel.dart';
|
||||
import 'settings_topic_test_helper.dart';
|
||||
import 'settings_section_test_helper.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('groups start at the bar inset and stop at the reading width', (
|
||||
testWidgets('groups are centred at the reading width beside the index', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester, size: const Size(1200, 1600));
|
||||
|
||||
// The list area is the window less the jump index and the side insets.
|
||||
const area = 1200 - settingsIndexWidth - 2 * settingsPageSidePadding;
|
||||
final expectedLeft =
|
||||
settingsPageSidePadding + (area - settingsContentMaxWidth) / 2;
|
||||
final groups = find.byType(SettingsGroup);
|
||||
expect(groups, findsWidgets);
|
||||
for (final group in groups.evaluate()) {
|
||||
final rect = tester.getRect(find.byWidget(group.widget));
|
||||
// The column starts where the bar's title pill does, not centred.
|
||||
expect(rect.left, closeTo(settingsPageSidePadding, 0.01));
|
||||
expect(rect.left, closeTo(expectedLeft, 0.01));
|
||||
expect(rect.width, closeTo(settingsContentMaxWidth, 0.01));
|
||||
}
|
||||
// A header's text lines up with its rows' text.
|
||||
final header = tester.getRect(find.text('Connection').last);
|
||||
expect(
|
||||
header.left,
|
||||
closeTo(settingsPageSidePadding + settingsRowInset, 0.01),
|
||||
);
|
||||
final groupLeft = tester.getRect(find.byType(SettingsGroup).first).left;
|
||||
final header = tester.getRect(find.text('Connection').first);
|
||||
expect(header.left, closeTo(groupLeft + settingsRowInset, 0.01));
|
||||
});
|
||||
|
||||
testWidgets('on a narrow window the groups fill the inset width', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester, size: const Size(390, 844));
|
||||
|
||||
final group = tester.getRect(find.byType(SettingsGroup).first);
|
||||
expect(group.left, closeTo(settingsPageSidePadding, 0.01));
|
||||
expect(group.width, closeTo(390 - 2 * settingsPageSidePadding, 0.01));
|
||||
});
|
||||
|
||||
testWidgets('Material groups are flat surfaces, not elevated cards', (
|
||||
@@ -64,32 +75,24 @@ void main() {
|
||||
}
|
||||
// The trust warning is the Connection group's footer, not a card.
|
||||
expect(find.byType(SettingsTrustWarning), findsOneWidget);
|
||||
final title = tester.widget<Text>(find.text('Connection').last);
|
||||
final theme = Theme.of(tester.element(find.text('Connection').last));
|
||||
final title = tester.widget<Text>(find.text('Connection').first);
|
||||
final theme = Theme.of(tester.element(find.text('Connection').first));
|
||||
expect(title.style?.color, theme.colorScheme.primary);
|
||||
});
|
||||
|
||||
testWidgets('content starts below the bar and persistent topic tabs', (
|
||||
testWidgets('content starts below the bar, with the search field pinned', (
|
||||
tester,
|
||||
) async {
|
||||
const barHeight = 72.0;
|
||||
await _pump(tester, topPadding: barHeight);
|
||||
|
||||
final first = tester.getRect(find.byType(SettingsGroup).first);
|
||||
expect(
|
||||
first.top,
|
||||
closeTo(
|
||||
barHeight +
|
||||
tester.getSize(find.byType(TabBar)).height +
|
||||
settingsPageTopPadding,
|
||||
0.01,
|
||||
),
|
||||
);
|
||||
// The topic selector stays above each page scroll view.
|
||||
expect(
|
||||
tester.getRect(find.byKey(const ValueKey('settings.scroll')).last).top,
|
||||
barHeight + tester.getSize(find.byType(TabBar)).height,
|
||||
// The search field sits under the bar and stays above the scrolling list.
|
||||
final search = tester.getRect(
|
||||
find.byKey(const ValueKey('settings.search')),
|
||||
);
|
||||
expect(search.top, closeTo(barHeight + settingsPageTopPadding, 0.01));
|
||||
final list = tester.getRect(find.byKey(const ValueKey('settings.scroll')));
|
||||
expect(list.top, greaterThan(search.bottom));
|
||||
});
|
||||
|
||||
testWidgets('the notification tile is the section\'s only title', (
|
||||
@@ -101,9 +104,9 @@ void main() {
|
||||
addTearDown(notifications.dispose);
|
||||
await _pump(tester, notifications: notifications);
|
||||
|
||||
await selectSettingsTopic(tester, 'Notifications');
|
||||
expect(find.text('Notifications'), findsNWidgets(2));
|
||||
expect(find.text('Connection').last, findsOneWidget);
|
||||
await openSettingsSection(tester, 'Notifications');
|
||||
expect(find.text('Notifications'), findsOneWidget);
|
||||
expect(find.text('Connection'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('server rows show which server is selected', (tester) async {
|
||||
@@ -183,5 +186,5 @@ Future<void> _pump(
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
await openSettingsSection(tester, 'Connection');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user