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:
@@ -305,9 +305,11 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
child: Center(child: Text('No results found', style: TextStyle(color: Colors.grey[500]))),
|
||||
)
|
||||
else
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 320),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: false,
|
||||
physics: const ClampingScrollPhysics(),
|
||||
itemCount: _searchResults.length,
|
||||
separatorBuilder: (_, __) => Divider(color: Colors.grey[200], height: 1),
|
||||
itemBuilder: (ctx, idx) {
|
||||
@@ -326,6 +328,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
] else ...[
|
||||
const Text('Popular Cities', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: Color(0xFF1A1A2E))),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
Reference in New Issue
Block a user