mirror of
https://github.com/block/buzz.git
synced 2026-11-07 01:41:06 +00:00
Standardizes mobile navigation headers: Android uses Home’s shared Flutter blur; iOS uses native soft edges, with graduated material retained during large-title collapse and the iOS 26 fallback preserved. Preserves Home’s upward title motion with a soft boundary and keeps the avatar crop title visible. Validation: 4,112 Flutter tests and 111 native tests passed after merging main. Rendered partial-scroll regression verified on the iOS 27 simulator; removing either review fix fails its regression assertion. The earlier preview was installed on a physical iPhone with the existing profile. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
64 lines
1.7 KiB
Dart
64 lines
1.7 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../theme/theme.dart';
|
|
import 'ios_navigation_bar.dart';
|
|
|
|
/// The shared top-edge treatment, independent of a header's controls.
|
|
///
|
|
/// iOS uses the same native soft edge as [IosNavigationBar]. Other platforms
|
|
/// use Home's translucent Flutter blur. The child remains interactive and
|
|
/// supplies its own safe-area padding.
|
|
class NavigationBackdrop extends StatelessWidget {
|
|
const NavigationBackdrop({
|
|
super.key,
|
|
required this.child,
|
|
this.active = true,
|
|
this.suppressNativeView = false,
|
|
});
|
|
|
|
final Widget child;
|
|
|
|
/// Activates the Flutter blur; UIKit owns native scroll-edge visibility.
|
|
final bool active;
|
|
|
|
/// Flutter backdrop transitions cannot composite over a native platform view.
|
|
final bool suppressNativeView;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (defaultTargetPlatform == TargetPlatform.iOS && !suppressNativeView) {
|
|
return Stack(
|
|
children: [
|
|
Positioned.fill(
|
|
child: IgnorePointer(
|
|
child: ExcludeSemantics(
|
|
child: IosNavigationBar(
|
|
title: '',
|
|
backdropOnly: true,
|
|
alwaysFrosted: true,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
child,
|
|
],
|
|
);
|
|
}
|
|
return ClipRect(
|
|
child: BackdropFilter(
|
|
enabled: active,
|
|
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
|
child: ColoredBox(
|
|
color: active
|
|
? context.colors.surface.withValues(alpha: 0.45)
|
|
: Colors.transparent,
|
|
child: child,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|