diff --git a/app/lib/features/attention/ui/notification_permission_tile.dart b/app/lib/features/attention/ui/notification_permission_tile.dart index 16de654d..6604bc5a 100644 --- a/app/lib/features/attention/ui/notification_permission_tile.dart +++ b/app/lib/features/attention/ui/notification_permission_tile.dart @@ -62,49 +62,24 @@ class NotificationPermissionTile extends StatelessWidget { : Theme.of(context).textTheme.bodyMedium?.copyWith( color: Theme.of(context).colorScheme.onSurfaceVariant, ); + // The Settings section supplies the `Notifications` heading and the page + // inset, as for every other section, so the body starts at that edge. return Column( + key: notificationTileKey, crossAxisAlignment: CrossAxisAlignment.start, children: [ - native - ? CupertinoListTile( - key: notificationTileKey, - leading: const Icon(CupertinoIcons.bell), - title: const Text(notificationSectionTitle), - ) - : ListTile( - key: notificationTileKey, - leading: const Icon(Icons.notifications_outlined), - title: const Text(notificationSectionTitle), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(notificationRationale, style: bodyStyle), - const SizedBox(height: 8), - Semantics( - liveRegion: true, - child: Text( - view.body, - key: notificationStateKey, - style: bodyStyle, - ), - ), - // The action sits on its own row, as the browser's settings - // section does: a native button in a row's trailing slot would - // squeeze the section title to one character per line at large - // text, and its label is too long to share the row. - if (action != null) ...[ - const SizedBox(height: 8), - Align( - alignment: AlignmentDirectional.centerStart, - child: action, - ), - ], - ], - ), + Text(notificationRationale, style: bodyStyle), + const SizedBox(height: 8), + Semantics( + liveRegion: true, + child: Text(view.body, key: notificationStateKey, style: bodyStyle), ), + // The action sits on its own row, as the browser's settings section + // does: its label is too long to share a row at large text. + if (action != null) ...[ + const SizedBox(height: 8), + Align(alignment: AlignmentDirectional.centerStart, child: action), + ], ], ); } diff --git a/app/lib/features/settings/settings_screen.dart b/app/lib/features/settings/settings_screen.dart index c0bfd8f8..3ca6e565 100644 --- a/app/lib/features/settings/settings_screen.dart +++ b/app/lib/features/settings/settings_screen.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import '../../core/transport/pipelines_client.dart' as transport; import '../attention/notify/notification_controller.dart'; +import '../attention/notify/notification_models.dart'; import 'default_endpoint.dart'; import 'settings_controller.dart'; import 'settings_controls.dart'; @@ -149,9 +150,8 @@ class _SettingsScreenState extends State { ), if (widget.notifications != null) ...[ const SizedBox(height: settingsSectionGap), - // The permission tile draws its own compact title row, so - // Settings must not add a second "Notifications" heading. _SettingsSection( + title: notificationSectionTitle, child: SettingsNotificationsSection( controller: widget.notifications!, ), diff --git a/app/test/features/attention/notify/notification_manager_wiring_test.dart b/app/test/features/attention/notify/notification_manager_wiring_test.dart index 7ea23459..85a2ac6b 100644 --- a/app/test/features/attention/notify/notification_manager_wiring_test.dart +++ b/app/test/features/attention/notify/notification_manager_wiring_test.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/features/attention/notify/notification_controller.dart'; +import 'package:pipelines_app/features/attention/notify/notification_models.dart'; import 'package:pipelines_app/features/attention/notify/notification_store.dart'; import 'package:pipelines_app/features/attention/ui/needs_you_runs_heading.dart'; import 'package:pipelines_app/features/settings/settings_notifications_section.dart'; @@ -75,7 +76,7 @@ void main() { ), ); await tester.pump(); - expect(find.text('Notifications'), findsWidgets); + expect(find.text(notificationRationale), findsOneWidget); // A denied platform answer shows its own words and no Enable action. final denied = NotificationController( @@ -91,6 +92,6 @@ void main() { ), ); await tester.pump(); - expect(find.text('Notifications'), findsWidgets); + expect(find.text(notificationRationale), findsOneWidget); }); } diff --git a/app/test/features/attention/ui/notification_permission_tile_test.dart b/app/test/features/attention/ui/notification_permission_tile_test.dart index b764b941..f5cd487a 100644 --- a/app/test/features/attention/ui/notification_permission_tile_test.dart +++ b/app/test/features/attention/ui/notification_permission_tile_test.dart @@ -46,7 +46,8 @@ void main() { await tester.pumpWidget( _page(state: entry.key, cupertino: native, onRequest: _noop), ); - expect(find.text(notificationSectionTitle), findsOneWidget); + // The Settings section owns the heading; the tile is its body. + expect(find.text(notificationSectionTitle), findsNothing); expect(find.text(notificationRationale), findsOneWidget); expect(find.text(entry.value), findsOneWidget, reason: '${entry.key}'); expect( @@ -114,16 +115,13 @@ void main() { ); expect(tester.takeException(), isNull); - final title = tester.renderObject( - find.text(notificationSectionTitle), + final rationale = tester.renderObject( + find.text(notificationRationale), ); - // Cupertino's list tile deliberately caps its title at one line; the - // defect this guards is the title being squeezed to a single glyph by the - // action sharing the row, so its width is the meaningful check. expect( - title.size.width, + rationale.size.width, greaterThan(100), - reason: 'the action must not squeeze the section title to one glyph', + reason: 'the action must not squeeze the section copy', ); final body = tester.renderObject( find.text(notificationDefaultCopy),