defaultColors static method

SafaehSyncChipColors defaultColors(
  1. BuildContext context,
  2. SafaehSyncState state
)

Container colors, as Hisab's sync chip uses: primary container when saved, tertiary container while syncing, error container when offline or failed. Hosts that want other colors pass colorsBuilder.

Implementation

static SafaehSyncChipColors defaultColors(
  BuildContext context,
  SafaehSyncState state,
) {
  final scheme = Theme.of(context).colorScheme;
  return switch (state) {
    SafaehSyncState.saved => (
      background: scheme.primaryContainer,
      foreground: scheme.onPrimaryContainer,
    ),
    SafaehSyncState.syncing => (
      background: scheme.tertiaryContainer,
      foreground: scheme.onTertiaryContainer,
    ),
    SafaehSyncState.offline || SafaehSyncState.failed => (
      background: scheme.errorContainer,
      foreground: scheme.onErrorContainer,
    ),
  };
}