perf: fix Android lag, snapping animations & slow image loading

Fix 1: Replace overshooting Cubic(1.95) tab glider curve with
  Curves.easeInOutCubic; reduce duration 450ms → 280ms
Fix 2: Replace marquee jumpTo() with animateTo(linear) for fluid scroll
Fix 3: Replace Image.network with CachedNetworkImage in search results
Fix 4: Replace Image.network with CachedNetworkImage in desktop cards
Fix 5: Wrap IndexedStack children in RepaintBoundary to isolate
  repaints across tabs (Home/Calendar/Contribute/Profile)
Fix 6: Replace setState on PageView.onPageChanged with ValueNotifier
  so only the carousel dots widget rebuilds on swipe
Fix 7: Wrap animated tab glider in RepaintBoundary
Fix 8: Replace shrinkWrap:true ListView with ConstrainedBox(maxHeight)
  to eliminate O(n) layout pass in search results
Fix 9: Increase image cache to 200MB / 500 images in main()
This commit is contained in:
2026-03-18 15:39:42 +05:30
parent 50caad21a5
commit 2aa05366ad
4 changed files with 107 additions and 51 deletions

View File

@@ -1357,7 +1357,7 @@ class _ContributeScreenState extends State<ContributeScreen>
// ─────────────────────────────────────────────────────────────────────────
// Segmented Tabs (4 tabs)
// ─────────────────────────────────────────────────────────────────────────
static const Curve _bouncyCurve = Cubic(0.37, 1.95, 0.66, 0.56);
static const Curve _bouncyCurve = Curves.easeInOutCubic;
static const List<IconData> _tabIcons = [
Icons.edit_outlined,
@@ -1376,7 +1376,8 @@ class _ContributeScreenState extends State<ContributeScreen>
const double padding = 5.0;
final tabWidth = (constraints.maxWidth - padding * 2) / tabs.length;
return ClipRRect(
return RepaintBoundary(
child: ClipRRect(
borderRadius: BorderRadius.circular(16),
child: Container(
height: 52,
@@ -1389,7 +1390,7 @@ class _ContributeScreenState extends State<ContributeScreen>
children: [
// Sliding glider
AnimatedPositioned(
duration: const Duration(milliseconds: 450),
duration: const Duration(milliseconds: 280),
curve: _bouncyCurve,
left: padding + _activeTab * tabWidth,
top: padding,
@@ -1444,7 +1445,7 @@ class _ContributeScreenState extends State<ContributeScreen>
],
),
),
);
)); // RepaintBoundary
},
),
);