import 'package:flutter/widgets.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; /// The widest the result column grows on a wide window. const double kSearchContentMaxWidth = 840; /// The bar's own side inset, so the column starts under the title pill. const double kSearchContentInset = 12; /// Search's scroll view: it runs behind the floating top bar (the first item /// starts below the bar's height, read from the media padding), ends clear of /// a floating tab bar, and keeps each sliver to a start-aligned column no /// wider than [kSearchContentMaxWidth]. class SearchScrollView extends StatelessWidget { const SearchScrollView({super.key, required this.slivers}); final List slivers; @override Widget build(BuildContext context) { final padding = MediaQuery.paddingOf(context); return CustomScrollView( slivers: [ SliverToBoxAdapter(child: SizedBox(height: padding.top + 4)), for (final sliver in slivers) SliverPadding( padding: EdgeInsetsDirectional.only( start: kSearchContentInset + padding.left, end: kSearchContentInset + padding.right, ), sliver: SliverConstrainedCrossAxis( maxExtent: kSearchContentMaxWidth, sliver: sliver, ), ), const SliverFloatingBarClearance(), ], ); } }