withSafaehAccentStyle function

ThemeData withSafaehAccentStyle(
  1. ThemeData theme, {
  2. required bool subtleAccents,
})

Applies SafaehAccentStyle without dropping other theme extensions.

Implementation

ThemeData withSafaehAccentStyle(ThemeData theme, {required bool subtleAccents}) {
  final exts = List<ThemeExtension<dynamic>>.from(
    theme.extensions.values.where((e) => e is! SafaehAccentStyle),
  )..add(SafaehAccentStyle(subtleAccents: subtleAccents));
  return theme.copyWith(extensions: exts);
}