materialIcon static method
Default icon builder using Material Design icons.
Shows:
cloud_off(grey) when not authenticatedcloud_off(red) when errorCircularProgressIndicatorwhen syncingcloud_done(green) when up to date
Implementation
static Widget materialIcon(BuildContext context, LocordaStatusState state) {
final colorScheme = Theme.of(context).colorScheme;
if (!state.isAuthenticated) {
return Icon(Icons.cloud_off, color: colorScheme.onSurfaceVariant);
} else if (state.hasError) {
return Icon(Icons.cloud_off, color: colorScheme.error);
} else if (state.isSyncing) {
// Show explicit progress indicator for user-initiated syncs
final isUserInitiated = state.lastTrigger == SyncTrigger.manual ||
state.lastTrigger == SyncTrigger.pullToRefresh;
if (isUserInitiated) {
// Explicit progress for manual syncs - user expects feedback
return SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(colorScheme.primary),
),
);
} else {
// Subtle feedback for automatic syncs - don't make user think app is slow
return Icon(Icons.cloud_sync, color: colorScheme.primary);
}
} else {
return Icon(Icons.cloud_done, color: Colors.green);
}
}