From cd034db77a868b79c39dac5e1c61927e7ef87fb2 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Sat, 7 Nov 2026 22:01:40 +0000 Subject: [PATCH] Remove shared backdrop from main tab labels --- .../ui/adaptive/floating_destination_bar.dart | 1 - .../adaptive/floating_destination_labels.dart | 76 ++++++++----------- app/notes/main-tab-label-backdrop.md | 8 ++ app/test/shell/floating_tab_bar_test.dart | 19 +++++ 4 files changed, 58 insertions(+), 46 deletions(-) create mode 100644 app/notes/main-tab-label-backdrop.md diff --git a/app/lib/ui/adaptive/floating_destination_bar.dart b/app/lib/ui/adaptive/floating_destination_bar.dart index a9bf07c4..8f7815ac 100644 --- a/app/lib/ui/adaptive/floating_destination_bar.dart +++ b/app/lib/ui/adaptive/floating_destination_bar.dart @@ -208,7 +208,6 @@ class _FloatingDestinationBarState extends State selected: currentIndex, buttonBuilder: (index) => _button(context, index), onTap: widget.onTap, - backdrop: _backdrop, ); } final gap = _gap(width); diff --git a/app/lib/ui/adaptive/floating_destination_labels.dart b/app/lib/ui/adaptive/floating_destination_labels.dart index 92caa3c4..7196927e 100644 --- a/app/lib/ui/adaptive/floating_destination_labels.dart +++ b/app/lib/ui/adaptive/floating_destination_labels.dart @@ -12,23 +12,18 @@ class FloatingDestinationLabels extends StatelessWidget { required this.selected, required this.buttonBuilder, required this.onTap, - required this.backdrop, }); final bool cupertino; final List labels; final int selected; final Widget Function(int) buttonBuilder; final ValueChanged onTap; - final BackdropKey backdrop; @override Widget build(BuildContext context) { final color = cupertino ? CupertinoColors.label.resolveFrom(context) : Theme.of(context).colorScheme.onSurface; - final surface = cupertino - ? CupertinoColors.secondarySystemBackground.resolveFrom(context) - : Theme.of(context).colorScheme.surfaceContainer; final style = cupertino ? CupertinoTheme.of(context).textTheme.tabLabelTextStyle : Theme.of(context).textTheme.labelSmall!; @@ -36,49 +31,40 @@ class FloatingDestinationLabels extends StatelessWidget { role: SemanticsRole.tabBar, container: true, explicitChildNodes: true, - child: DecoratedBox( - decoration: BoxDecoration( - color: surface, - borderRadius: BorderRadius.circular(16), - ), - child: Padding( - padding: const EdgeInsets.all(8), - child: BackdropGroup( - backdropKey: backdrop, - child: Wrap( - alignment: WrapAlignment.center, - crossAxisAlignment: WrapCrossAlignment.center, - spacing: 8, - runSpacing: 8, - children: [ - for (var index = 0; index < labels.length; index++) - GestureDetector( - key: ValueKey('destination-label-${labels[index]}'), - excludeFromSemantics: true, - onTap: () => onTap(index), - child: TextFieldTapRegion( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - buttonBuilder(index), - ExcludeSemantics( - child: Text( - labels[index], - style: style.copyWith( - color: color, - fontWeight: index == selected - ? FontWeight.w600 - : style.fontWeight, - ), - ), + child: Padding( + padding: const EdgeInsets.all(8), + child: Wrap( + alignment: WrapAlignment.center, + crossAxisAlignment: WrapCrossAlignment.center, + spacing: 8, + runSpacing: 8, + children: [ + for (var index = 0; index < labels.length; index++) + GestureDetector( + key: ValueKey('destination-label-${labels[index]}'), + excludeFromSemantics: true, + onTap: () => onTap(index), + child: TextFieldTapRegion( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + buttonBuilder(index), + ExcludeSemantics( + child: Text( + labels[index], + style: style.copyWith( + color: color, + fontWeight: index == selected + ? FontWeight.w600 + : style.fontWeight, ), - ], + ), ), - ), + ], ), - ], - ), - ), + ), + ), + ], ), ), ); diff --git a/app/notes/main-tab-label-backdrop.md b/app/notes/main-tab-label-backdrop.md new file mode 100644 index 00000000..cfee4bb0 --- /dev/null +++ b/app/notes/main-tab-label-backdrop.md @@ -0,0 +1,8 @@ +# Main tab captions without a shared backdrop + +Removed the shared rounded surface and backdrop group behind the main +navigation captions. The labels retain their content-driven padding, wrapping, +hit targets, text scaling, safe-area clearance, and existing per-tab selected +button decoration. Focused coverage checks phone and wide layouts on Material +and Cupertino hosts. Browser captures also covered 560px/1200px Material layouts +in light and dark themes; the four PNGs were inspected during review. diff --git a/app/test/shell/floating_tab_bar_test.dart b/app/test/shell/floating_tab_bar_test.dart index c930b66b..8ec010d4 100644 --- a/app/test/shell/floating_tab_bar_test.dart +++ b/app/test/shell/floating_tab_bar_test.dart @@ -5,6 +5,7 @@ import 'package:pipelines_app/shell/list_detail_policy.dart'; import 'package:pipelines_app/shell/adaptive_shell.dart'; import 'package:pipelines_app/shell/destination.dart'; import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart'; +import 'package:pipelines_app/ui/adaptive/floating_destination_labels.dart'; /// Main navigation keeps visible captions and full-size targets, floating at /// the trailing edge on a phone and centered under the list on a wide window. @@ -39,6 +40,22 @@ void main() { expect(bounds.width - contentBounds!.width, inInclusiveRange(0, 32)); } + Future expectNoSharedBackdrop(WidgetTester tester) async { + expect( + find.descendant( + of: find.byType(FloatingDestinationLabels), + matching: find.byWidgetPredicate( + (widget) => + widget is DecoratedBox && + widget.decoration is BoxDecoration && + (widget.decoration as BoxDecoration).borderRadius == + BorderRadius.circular(16), + ), + ), + findsNothing, + ); + } + Future setSize(WidgetTester tester, Size size) async { tester.view.physicalSize = size; tester.view.devicePixelRatio = 1; @@ -80,6 +97,7 @@ void main() { await tester.pumpWidget(shell(cupertino: cupertino)); final rect = tester.getRect(pill()); await expectLabeledTargets(tester, rect); + await expectNoSharedBackdrop(tester); expect(rect.width, lessThanOrEqualTo(390 - 2 * 16)); expect(rect.right, 390 - 16); expect(rect.bottom, 844 - 16); @@ -111,6 +129,7 @@ void main() { expect(rect.width, lessThan(1200 * 0.6)); // Captions participate in the bar's content-driven width. await expectLabeledTargets(tester, rect); + await expectNoSharedBackdrop(tester); expect( rect.width, lessThanOrEqualTo(listDetailListWidth(1200, 1200, null) - 2 * 16),