buildIcon static method
Constrói o ícone apropriado baseado no status e conectividade
Implementation
static Widget buildIcon(SyncStatus status, bool isOnline, bool isCompact) {
final theme = SyncThemeProvider.current;
if (!isOnline) {
return Icon(
Icons.cloud_off,
size: isCompact ? 14 : 16,
color: theme.error,
);
}
switch (status) {
case SyncStatus.idle:
return Icon(
Icons.cloud_done,
size: isCompact ? 14 : 16,
color: theme.success,
);
case SyncStatus.syncing:
return SizedBox(
width: isCompact ? 14 : 16,
height: isCompact ? 14 : 16,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(theme.primary),
),
);
case SyncStatus.success:
return Icon(
Icons.cloud_done,
size: isCompact ? 14 : 16,
color: theme.success,
);
case SyncStatus.error:
return Icon(
Icons.cloud_off,
size: isCompact ? 14 : 16,
color: theme.error,
);
case SyncStatus.offline:
return Icon(
Icons.cloud_off,
size: isCompact ? 14 : 16,
color: theme.error,
);
case SyncStatus.degraded:
return Icon(
Icons.cloud_queue,
size: isCompact ? 14 : 16,
color: theme.warning,
);
case SyncStatus.recovery:
return Icon(
Icons.refresh,
size: isCompact ? 14 : 16,
color: theme.warning,
);
}
}