diff --git a/lib/screens/calendar_screen.dart b/lib/screens/calendar_screen.dart index 86ae38c..436e046 100644 --- a/lib/screens/calendar_screen.dart +++ b/lib/screens/calendar_screen.dart @@ -637,32 +637,54 @@ class _CalendarScreenState extends State { ), ), - // CONTENT: calendar card overlapped on gradient, then summary and list - Column( - children: [ - const SizedBox(height: 110), // leave space for appbar + some gradient top - _calendarCard(context), // calendar card sits visually on top of the gradient - _selectedDateSummary(context), - Expanded( - child: _loadingDay - ? Center(child: CircularProgressIndicator(color: theme.colorScheme.primary)) - : _eventsOfDay.isEmpty - ? Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Icon(Icons.event_available, size: 48, color: theme.hintColor), - const SizedBox(height: 10), - Text('No events scheduled for this date', style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor)), - ], - ), - ) - : ListView.builder( - padding: const EdgeInsets.only(top: 6, bottom: 32), - itemCount: _eventsOfDay.length, - itemBuilder: (context, idx) => _eventCardMobile(_eventsOfDay[idx]), - ), - ), + // CONTENT: whole page scrolls as one — calendar + summary + events + CustomScrollView( + physics: const BouncingScrollPhysics(), + slivers: [ + // Space for app bar + gradient top + const SliverToBoxAdapter(child: SizedBox(height: 110)), + + // Calendar card + SliverToBoxAdapter(child: _calendarCard(context)), + + // Selected date summary + SliverToBoxAdapter(child: _selectedDateSummary(context)), + + // Events area — loading / empty / list + if (_loadingDay) + SliverFillRemaining( + hasScrollBody: false, + child: Center( + child: CircularProgressIndicator(color: theme.colorScheme.primary), + ), + ) + else if (_eventsOfDay.isEmpty) + SliverFillRemaining( + hasScrollBody: false, + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.event_available, size: 48, color: theme.hintColor), + const SizedBox(height: 10), + Text( + 'No events scheduled for this date', + style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor), + ), + ], + ), + ), + ) + else + SliverList( + delegate: SliverChildBuilderDelegate( + (context, idx) => _eventCardMobile(_eventsOfDay[idx]), + childCount: _eventsOfDay.length, + ), + ), + + // Bottom padding + const SliverToBoxAdapter(child: SizedBox(height: 32)), ], ), ],