mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-14 09:46:01 -07:00
Init repo
This commit is contained in:
commit
764b6034e3
566 changed files with 212335 additions and 0 deletions
40
lib/providers/settings/subtitle_settings_provider.dart
Normal file
40
lib/providers/settings/subtitle_settings_provider.dart
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:fladder/models/settings/subtitle_settings_model.dart';
|
||||
import 'package:fladder/providers/shared_provider.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
final subtitleSettingsProvider = StateNotifierProvider<SubtitleSettingsNotifier, SubtitleSettingsModel>((ref) {
|
||||
return SubtitleSettingsNotifier(ref);
|
||||
});
|
||||
|
||||
class SubtitleSettingsNotifier extends StateNotifier<SubtitleSettingsModel> {
|
||||
SubtitleSettingsNotifier(this.ref) : super(const SubtitleSettingsModel());
|
||||
|
||||
final Ref ref;
|
||||
|
||||
@override
|
||||
set state(SubtitleSettingsModel value) {
|
||||
super.state = value;
|
||||
ref.read(sharedUtilityProvider).subtitleSettings = value;
|
||||
}
|
||||
|
||||
void setFontSize(double value) => state = state.copyWith(fontSize: value);
|
||||
|
||||
void setVerticalOffset(double value) => state = state.copyWith(verticalOffset: value);
|
||||
|
||||
void setSubColor(Color color) => state = state.copyWith(color: color);
|
||||
|
||||
void setOutlineColor(Color e) => state = state.copyWith(outlineColor: e);
|
||||
|
||||
setOutlineThickness(double value) => state = state.copyWith(outlineSize: value);
|
||||
|
||||
void resetSettings({SubtitleSettingsModel? value}) => state = value ?? const SubtitleSettingsModel();
|
||||
|
||||
void setFontWeight(FontWeight? value) => state = state.copyWith(fontWeight: value);
|
||||
|
||||
setBackGroundOpacity(double value) =>
|
||||
state = state.copyWith(backGroundColor: state.backGroundColor.withOpacity(value));
|
||||
|
||||
setShadowIntensity(double value) => state = state.copyWith(shadow: value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue