Add safe area to home, remove unnecessary scaffold

This commit is contained in:
Tommy Chow 2021-12-30 04:12:49 -05:00
parent 8e4f049678
commit d7913ad547
2 changed files with 53 additions and 53 deletions

View file

@ -11,51 +11,49 @@ class CategoryStreams extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: RefreshIndicator(
onRefresh: store.refresh,
child: Observer(
builder: (_) {
return CustomScrollView(
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
slivers: [
SliverAppBar(
stretch: true,
pinned: true,
expandedHeight: MediaQuery.of(context).size.height / 3,
flexibleSpace: FlexibleSpaceBar(
title: Text(
store.categoryInfo.name,
style: Theme.of(context).textTheme.headline6?.copyWith(fontWeight: FontWeight.bold),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
background: Hero(
tag: store.categoryInfo.id,
child: CachedNetworkImage(
imageUrl: store.categoryInfo.boxArtUrl.replaceFirst('-{width}x{height}', '-300x400'),
color: const Color.fromRGBO(255, 255, 255, 0.5),
colorBlendMode: BlendMode.modulate,
fit: BoxFit.cover,
),
return RefreshIndicator(
onRefresh: store.refresh,
child: Observer(
builder: (_) {
return CustomScrollView(
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
slivers: [
SliverAppBar(
stretch: true,
pinned: true,
expandedHeight: MediaQuery.of(context).size.height / 3,
flexibleSpace: FlexibleSpaceBar(
title: Text(
store.categoryInfo.name,
style: Theme.of(context).textTheme.headline6?.copyWith(fontWeight: FontWeight.bold),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
background: Hero(
tag: store.categoryInfo.id,
child: CachedNetworkImage(
imageUrl: store.categoryInfo.boxArtUrl.replaceFirst('-{width}x{height}', '-300x400'),
color: const Color.fromRGBO(255, 255, 255, 0.5),
colorBlendMode: BlendMode.modulate,
fit: BoxFit.cover,
),
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index > store.streams.length / 2 && store.hasMore) {
store.getStreams();
}
return StreamCard(streamInfo: store.streams[index]);
},
childCount: store.streams.length,
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index > store.streams.length / 2 && store.hasMore) {
store.getStreams();
}
return StreamCard(streamInfo: store.streams[index]);
},
childCount: store.streams.length,
),
],
);
},
),
),
],
);
},
),
);
}

View file

@ -66,18 +66,20 @@ class Home extends StatelessWidget {
)
],
),
body: Observer(
builder: (_) {
return IndexedStack(
index: homeStore.selectedIndex,
children: [
if (authStore.isLoggedIn) FollowedStreams(store: followedStreamsStore),
TopStreams(store: topStreamsStore),
Categories(store: categoriesStore),
Search(searchStore: searchStore),
],
);
},
body: SafeArea(
child: Observer(
builder: (_) {
return IndexedStack(
index: homeStore.selectedIndex,
children: [
if (authStore.isLoggedIn) FollowedStreams(store: followedStreamsStore),
TopStreams(store: topStreamsStore),
Categories(store: categoriesStore),
Search(searchStore: searchStore),
],
);
},
),
),
bottomNavigationBar: Observer(
builder: (_) {