Skip to content

Commit

Permalink
fix font size change issue
Browse files Browse the repository at this point in the history
  • Loading branch information
arianneorpilla committed Jan 5, 2023
1 parent e39883d commit b5e99cb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion yuuna/lib/src/media/sources/reader_ttu_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ReaderTtuSource extends ReaderMediaSource {
' reader.',
icon: Icons.chrome_reader_mode_outlined,
implementsSearch: false,
implementsHistory: false,
implementsHistory: false,
);

/// Get the singleton instance of this media type.
Expand Down
2 changes: 1 addition & 1 deletion yuuna/lib/src/models/app_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2718,7 +2718,7 @@ class AppModel with ChangeNotifier {
SubtitleOptions get subtitleOptions {
int audioAllowance = _preferences.get('audio_allowance', defaultValue: 0);
int subtitleDelay = _preferences.get('subtitle_delay', defaultValue: 0);
double fontSize = _preferences.get('font_size', defaultValue: 20.0);
double fontSize = _preferences.get('font_size', defaultValue: 24.0);
String fontName = _preferences
.get('font_name/${targetLanguage.languageCode}', defaultValue: '');
String regexFilter = _preferences.get('regex_filter', defaultValue: '');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,28 +207,30 @@ class _SubtitleOptionsDialogPage
String newFontName = _fontNameController.text.trim();
String newRegexFilter = _regexFilterController.text.trim();

try {
if (newDelay != null && newAllowance != null && newFontSize != null) {
RegExp(newRegexFilter);
if (newDelay != null && newAllowance != null && newFontSize != null) {
RegExp(newRegexFilter);
try {
GoogleFonts.getFont(newFontName);
} catch (e) {
newFontName = '';
}

SubtitleOptions subtitleOptions = appModel.subtitleOptions;

subtitleOptions.subtitleDelay = newDelay;
subtitleOptions.audioAllowance = newAllowance;
subtitleOptions.regexFilter = newRegexFilter;
subtitleOptions.fontName = newFontName;
subtitleOptions.fontSize = newFontSize;
SubtitleOptions subtitleOptions = appModel.subtitleOptions;

widget.notifier.value = subtitleOptions;
subtitleOptions.subtitleDelay = newDelay;
subtitleOptions.audioAllowance = newAllowance;
subtitleOptions.regexFilter = newRegexFilter;
subtitleOptions.fontName = newFontName;
subtitleOptions.fontSize = newFontSize;

if (saveOptions) {
appModel.setSubtitleOptions(subtitleOptions);
}
widget.notifier.value = subtitleOptions;

Navigator.pop(context);
if (saveOptions) {
appModel.setSubtitleOptions(subtitleOptions);
}
} finally {}

Navigator.pop(context);
}
}

List<Widget> get actions => [
Expand Down

0 comments on commit b5e99cb

Please sign in to comment.