perf: fix scroll lag on profile/contribute, unpin calendar gradient
profile_screen: SingleChildScrollView + Column eagerly built every event card (all images, shadows, tiles) at once even when off-screen. Replaced with CustomScrollView + SliverList so only visible tiles are built per frame. Also switches to BouncingScrollPhysics for natural momentum. contribute_screen: Each _formCard wrapped in RepaintBoundary so form cards are isolated render layers — one card's repaint doesn't invalidate its siblings. Added BouncingScrollPhysics to the form SingleChildScrollView. calendar_screen: Blue gradient banner was Positioned(top:0) making it sticky even as the user scrolled. Removed the fixed Positioned layer and moved the gradient inside the CustomScrollView as the first sliver in a Stack alongside the calendar card (which keeps its y=110 visual overlap). Now the entire page — gradient, calendar, events — scrolls as one unit.
This commit is contained in:
@@ -1470,6 +1470,7 @@ class _ContributeScreenState extends State<ContributeScreen>
|
||||
Widget _buildContributeTab(BuildContext context, GamificationProvider provider) {
|
||||
final theme = Theme.of(context);
|
||||
return SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: const EdgeInsets.fromLTRB(16, 20, 16, 32),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
@@ -1563,13 +1564,15 @@ class _ContributeScreenState extends State<ContributeScreen>
|
||||
}
|
||||
|
||||
Widget _formCard(List<Widget> children) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.04), blurRadius: 8, offset: const Offset(0, 2))],
|
||||
return RepaintBoundary(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.04), blurRadius: 8, offset: const Offset(0, 2))],
|
||||
),
|
||||
child: Column(children: children),
|
||||
),
|
||||
child: Column(children: children),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user