update loaing
This commit is contained in:
@@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 */,
|
||||
);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user