From cfbd40cc1be899a5cc61a0e67f19b0c8b27c22bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Kowali=C5=84ski?= Date: Sat, 3 Aug 2024 15:01:32 +0200 Subject: [PATCH] fix(home): eliminate jumping scroll --- lib/features/home_view/widgets/news_section.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/features/home_view/widgets/news_section.dart b/lib/features/home_view/widgets/news_section.dart index aabb35bb..4a71a459 100644 --- a/lib/features/home_view/widgets/news_section.dart +++ b/lib/features/home_view/widgets/news_section.dart @@ -34,13 +34,19 @@ class _NewsList extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final state = ref.watch(newsRepositoryProvider); + return switch (state) { AsyncLoading() => const Padding( padding: EdgeInsets.only( left: HomeViewConfig.paddingMedium, - top: HomeViewConfig.paddingMedium, + top: HomeViewConfig.paddingMedium * + 2, // twice the padding of normal state, just to look cool + ), + child: SizedBox( + height: + BigPreviewCardConfig.cardHeight - HomeViewConfig.paddingMedium, + child: BigScrollableSectionLoading(), ), - child: BigScrollableSectionLoading(), ), AsyncError(:final error) => MyErrorWidget(error), AsyncValue(:final value) => Column(