Skip to content

Commit b10fb79

Browse files
committed
feat(headlines-feed): add saved filters bar to FeedSliverAppBar
- Integrate SavedFiltersBar into FeedSliverAppBar as a bottom preferred size widget - Adjust HeadlinesFeedPage to accommodate the new layout - Update FeedSliverAppBar to be unpinned and implement PreferredSizeWidget
1 parent b693650 commit b10fb79

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

lib/headlines-feed/view/headlines_feed_page.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,15 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
188188
child: CustomScrollView(
189189
controller: _scrollController,
190190
slivers: [
191-
const FeedSliverAppBar(),
192-
const SliverToBoxAdapter(
193-
child: Padding(
194-
padding: EdgeInsets.symmetric(horizontal: AppSpacing.md),
195-
child: SavedFiltersBar(),
191+
const FeedSliverAppBar(
192+
bottom: PreferredSize(
193+
preferredSize: Size.fromHeight(52),
194+
child: Padding(
195+
padding: EdgeInsets.symmetric(
196+
horizontal: AppSpacing.md,
197+
),
198+
child: SavedFiltersBar(),
199+
),
196200
),
197201
),
198202
SliverPadding(

lib/headlines-feed/widgets/feed_sliver_app_bar.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ import 'package:ui_kit/ui_kit.dart';
1818
/// [HeadlineSearchDelegate] and includes a user avatar that opens the
1919
/// [AccountSheet].
2020
/// {@endtemplate}
21-
class FeedSliverAppBar extends StatelessWidget {
21+
class FeedSliverAppBar extends StatelessWidget implements PreferredSizeWidget {
2222
/// {@macro feed_sliver_app_bar}
23-
const FeedSliverAppBar({super.key});
23+
const FeedSliverAppBar({required this.bottom, super.key});
24+
25+
/// This widget appears across the bottom of the app bar.
26+
final PreferredSizeWidget bottom;
2427

2528
@override
2629
Widget build(BuildContext context) {
@@ -29,13 +32,14 @@ class FeedSliverAppBar extends StatelessWidget {
2932

3033
return SliverAppBar(
3134
// The app bar will remain visible at the top when scrolling.
32-
pinned: true,
35+
pinned: false,
3336
// The app bar will become visible as soon as the user scrolls up.
3437
floating: true,
3538
// The app bar will snap into view when scrolling up, even if the user
3639
// stops scrolling partway. This works in conjunction with `floating` to
3740
// create the desired scrolling effect.
3841
snap: true,
42+
bottom: bottom,
3943
// The title is a custom search bar widget.
4044
title: GestureDetector(
4145
onTap: () {
@@ -90,4 +94,8 @@ class FeedSliverAppBar extends StatelessWidget {
9094
),
9195
);
9296
}
97+
98+
@override
99+
Size get preferredSize =>
100+
Size.fromHeight(kToolbarHeight + (bottom.preferredSize.height));
93101
}

0 commit comments

Comments
 (0)