responsive home_page

This commit is contained in:
Dr-Blank 2024-05-08 21:25:06 -04:00
parent a720c977c2
commit ebc14a0448
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
9 changed files with 171 additions and 85 deletions

View file

@ -38,19 +38,16 @@ class HomePage extends HookConsumerWidget {
child: views.when(
data: (data) {
final shelvesToDisplay = data
.where((element) => !element.id.contains('discover'))
.map(
(shelf) => HomeShelf(
title: Text(shelf.label),
shelf: shelf,
),
)
.toList();
// .where((element) => !element.id.contains('discover'))
.map((shelf) {
debugPrint('building shelf ${shelf.label}');
return HomeShelf(
title: shelf.label,
shelf: shelf,
);
}).toList();
return RefreshIndicator(
onRefresh: () async {
// await ref
// .read(personalizedViewProvider.notifier)
// .forceRefresh();
return ref.refresh(personalizedViewProvider);
},
child: ListView.separated(
@ -65,7 +62,7 @@ class HomePage extends HookConsumerWidget {
),
);
},
loading: () => const CircularProgressIndicator(),
loading: () => const HomePageSkeleton(),
error: (error, stack) {
return Text('Error: $error');
},
@ -74,3 +71,17 @@ class HomePage extends HookConsumerWidget {
);
}
}
class HomePageSkeleton extends StatelessWidget {
const HomePageSkeleton({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: CircularProgressIndicator(),
),
);
}
}