perf: fix remaining 11 performance issues across 5 screens

Critical — Image.network → CachedNetworkImage:
- home_screen.dart: hero/carousel banner image now cached with placeholder
- profile_screen.dart: avatar and event list tile images now cached
- calendar_screen.dart: event card images now cached with placeholder

High:
- profile_screen.dart: TextEditingControllers in dialogs now properly
  disposed via .then() and after await to prevent memory leaks

Medium:
- search_screen.dart: shrinkWrap:true → ConstrainedBox(maxHeight:320) +
  ClampingScrollPhysics for smooth search result scrolling
- learn_more_screen.dart: MediaQuery.of(context) cached once per method
  instead of being called multiple times on every frame
This commit is contained in:
2026-03-18 16:28:32 +05:30
parent 2aa05366ad
commit 002ed3ee98
5 changed files with 47 additions and 15 deletions

View File

@@ -223,9 +223,10 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> {
);
}
final screenHeight = MediaQuery.of(context).size.height;
final mediaQuery = MediaQuery.of(context);
final screenHeight = mediaQuery.size.height;
final imageHeight = screenHeight * 0.45;
final topPadding = MediaQuery.of(context).padding.top;
final topPadding = mediaQuery.padding.top;
return Scaffold(
backgroundColor: theme.scaffoldBackgroundColor,
@@ -355,6 +356,7 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> {
// ---------------------------------------------------------------------------
Widget _buildLoadingShimmer(ThemeData theme) {
final shimmerHeight = MediaQuery.of(context).size.height;
return SafeArea(
child: Padding(
padding: const EdgeInsets.all(20),
@@ -363,7 +365,7 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> {
children: [
// Placeholder image
Container(
height: MediaQuery.of(context).size.height * 0.42,
height: shimmerHeight * 0.42,
decoration: BoxDecoration(
color: theme.dividerColor.withOpacity(0.3),
borderRadius: BorderRadius.circular(28),