setTextSize method

Future<void> setTextSize(
  1. TextSizePreference size
)

Changes the text size preference

Implementation

Future<void> setTextSize(TextSizePreference size) async {
  final old = state.textSize;
  emit(state.copyWith(textSize: size));

  final result = await _repository.setTextSize(size);
  result.fold(
    (failure) => emit(state.copyWith(textSize: old)),
    (_) async {
      // Also save to full preferences
      await _repository.saveAppPreferences(state.toAppPreferences());
    },
  );
}