notifyThemeChanged method

Future<bool> notifyThemeChanged(
  1. ThemeData theme
)

Implementation

Future<bool> notifyThemeChanged(ThemeData theme) async {
  final controller = state.controller;
  if (controller == null) return false;

  final settings = await controller.getSettings();
  if (settings == null) return false;

  pullToRefreshController
    ..setColor(theme.colorScheme.onSurface)
    ..setBackgroundColor(theme.colorScheme.surfaceContainerLowest);

  settings.forceDark =
      theme.brightness.isLight ? ForceDark.OFF : ForceDark.ON;

  await controller.setSettings(settings: settings);
  return true;
}