Remove shared backdrop from main tab labels

This commit is contained in:
2026-11-07 22:01:40 +00:00
parent 6e4e11aca2
commit cd034db77a
4 changed files with 58 additions and 46 deletions
@@ -208,7 +208,6 @@ class _FloatingDestinationBarState extends State<FloatingDestinationBar>
selected: currentIndex,
buttonBuilder: (index) => _button(context, index),
onTap: widget.onTap,
backdrop: _backdrop,
);
}
final gap = _gap(width);
@@ -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<String> labels;
final int selected;
final Widget Function(int) buttonBuilder;
final ValueChanged<int> 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,
),
],
),
),
),
],
),
],
),
),
),
),
],
),
),
);
+8
View File
@@ -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.
+19
View File
@@ -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<void> 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<void> 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),