update loaing

This commit is contained in:
Phuoc Nguyen
2025-12-02 18:09:20 +07:00
parent fc9b5e967f
commit 19d9a3dc2d
75 changed files with 216 additions and 292 deletions

View File

@@ -219,7 +219,7 @@ class _CartPageState extends ConsumerState<CartPage> {
}
: null,
child: _isSyncing
? CircularProgressIndicator() // Show loading while syncing
? const CustomLoadingIndicator() // Show loading while syncing
: Text('Tiến hành đặt hàng'),
);
}

View File

@@ -768,5 +768,5 @@ end
- ✅ Vietnamese localization
- ✅ CachedNetworkImage for all remote images
- ✅ Proper error handling
- ✅ Loading states (CircularProgressIndicator)
- ✅ Loading states (CustomLoadingIndicator)
- ✅ Empty states with helpful messages

View File

@@ -257,7 +257,7 @@ int stars = apiRatingToStars(0.8); // 4
- Added date formatting function (`_formatDate`)
**States**:
1. **Loading**: Shows CircularProgressIndicator
1. **Loading**: Shows CustomLoadingIndicator
2. **Error**: Shows error icon and message
3. **Empty**: Shows "Chưa có đánh giá nào" with call-to-action
4. **Data**: Shows rating overview and review list
@@ -553,7 +553,7 @@ Widget build(BuildContext context, WidgetRef ref) {
},
);
},
loading: () => CircularProgressIndicator(),
loading: () => const CustomLoadingIndicator(),
error: (error, stack) => Text('Error: $error'),
);
}

View File

@@ -416,7 +416,7 @@ RatingProvider CountProvider in UI components)
```
1. Initial State (Loading)
├─► productReviewsProvider returns AsyncValue.loading()
└─► UI shows CircularProgressIndicator
└─► UI shows CustomLoadingIndicator
2. Loading State → Data State
├─► API call succeeds

View File

@@ -60,7 +60,7 @@ class ReviewsListPage extends ConsumerWidget {
);
},
loading: () => const Center(
child: CircularProgressIndicator(),
child: const CustomLoadingIndicator(),
),
error: (error, stack) => Center(
child: Text('Error: $error'),
@@ -263,7 +263,7 @@ class _SimpleReviewFormState extends ConsumerState<SimpleReviewForm> {
child: ElevatedButton(
onPressed: _isSubmitting ? null : _submitReview,
child: _isSubmitting
? const CircularProgressIndicator()
? const const CustomLoadingIndicator()
: const Text('Submit Review'),
),
),
@@ -351,7 +351,7 @@ class _PaginatedReviewsListState
padding: const EdgeInsets.all(16),
child: Center(
child: _isLoading
? const CircularProgressIndicator()
? const const CustomLoadingIndicator()
: ElevatedButton(
onPressed: _loadMoreReviews,
child: const Text('Load More'),
@@ -430,7 +430,7 @@ class RefreshableReviewsList extends ConsumerWidget {
Center(
child: Padding(
padding: EdgeInsets.all(40),
child: CircularProgressIndicator(),
child: const CustomLoadingIndicator(),
),
),
],
@@ -540,7 +540,7 @@ class _FilteredReviewsListState extends ConsumerState<FilteredReviewsList> {
);
},
loading: () => const Center(
child: CircularProgressIndicator(),
child: const CustomLoadingIndicator(),
),
error: (error, stack) => Center(
child: Text('Error: $error'),
@@ -662,7 +662,7 @@ class ReviewsWithRetry extends ConsumerWidget {
);
},
loading: () => const Center(
child: CircularProgressIndicator(),
child: const CustomLoadingIndicator(),
),
error: (error, stack) => Center(
child: Column(

View File

@@ -30,7 +30,7 @@ final reviewsAsync = ref.watch(productReviewsProvider(itemId));
reviewsAsync.when(
data: (reviews) => /* show reviews */,
loading: () => CircularProgressIndicator(),
loading: () => const CustomLoadingIndicator(),
error: (error, stack) => /* show error */,
);
```