perf: defer initial data fetching to microtasks and update loading placeholders for smoother screen transitions
This commit is contained in:
@@ -206,7 +206,8 @@ class _AboutState {
|
||||
|
||||
class _AboutNotifier extends StateNotifier<_AboutState> {
|
||||
_AboutNotifier() : super(const _AboutState()) {
|
||||
_load();
|
||||
// Defer CMS fetch so the first frame paints before the HTTP request
|
||||
Future.microtask(_load);
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
@@ -304,9 +305,18 @@ class AboutScreen extends ConsumerWidget {
|
||||
final state = ref.watch(_aboutProvider);
|
||||
|
||||
if (state.isLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.accentOrange,
|
||||
// Full-size placeholder so slide-in transition doesn't pop blank
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
alignment: Alignment.topCenter,
|
||||
padding: const EdgeInsets.only(top: 120),
|
||||
child: const SizedBox(
|
||||
width: 28,
|
||||
height: 28,
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.accentOrange,
|
||||
strokeWidth: 2.5,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user