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

@@ -31,7 +31,7 @@ Future<User> user(UserRef ref, String id) async {
final userAsync = ref.watch(userProvider('123'));
userAsync.when(
data: (user) => Text(user.name),
loading: () => CircularProgressIndicator(),
loading: () => const CustomLoadingIndicator(),
error: (e, _) => Text('Error: $e'),
);
```
@@ -202,7 +202,7 @@ final newValue = ref.refresh(userProvider);
```dart
asyncValue.when(
data: (value) => Text(value),
loading: () => CircularProgressIndicator(),
loading: () => const CustomLoadingIndicator(),
error: (error, stack) => Text('Error: $error'),
);
```
@@ -215,7 +215,7 @@ switch (asyncValue) {
case AsyncError(:final error):
return Text('Error: $error');
case AsyncLoading():
return CircularProgressIndicator();
return const CustomLoadingIndicator();
}
```

View File

@@ -30,7 +30,7 @@ Connectivity connectivity(Ref ref) {
/// final connectivityState = ref.watch(connectivityStreamProvider);
/// connectivityState.when(
/// data: (status) => Text('Status: $status'),
/// loading: () => CircularProgressIndicator(),
/// loading: () => const CustomLoadingIndicator(),
/// error: (error, _) => Text('Error: $error'),
/// );
/// ```
@@ -83,7 +83,7 @@ Future<ConnectivityStatus> currentConnectivity(Ref ref) async {
/// final isOnlineAsync = ref.watch(isOnlineProvider);
/// isOnlineAsync.when(
/// data: (isOnline) => isOnline ? Text('Online') : Text('Offline'),
/// loading: () => CircularProgressIndicator(),
/// loading: () => const CustomLoadingIndicator(),
/// error: (error, _) => Text('Error: $error'),
/// );
/// ```

View File

@@ -428,7 +428,7 @@ final version = ref.watch(appVersionProvider);
final userData = ref.watch(userDataProvider);
userData.when(
data: (data) => Text(data),
loading: () => CircularProgressIndicator(),
loading: () => const CustomLoadingIndicator(),
error: (error, stack) => Text('Error: $error'),
);
@@ -466,7 +466,7 @@ switch (profileState) {
case AsyncError(:final error):
return Text('Error: $error');
case AsyncLoading():
return CircularProgressIndicator();
return const CustomLoadingIndicator();
}
*/