66613857e8
- Removed the constant chapterPageSize and refactored ChapterListQuery to use a simpler approach for fetching chapters. - Updated the chapter list provider to handle fetching all chapters in a single request with pagination. - Enhanced error handling for fetching chapters by resolving canonical IDs when necessary. - Modified TTS functionality to ensure proper handling of Android fallback reading and improved error management. - Added a new setting to enable/disable TTS on sentence tap. - Updated UI components in the reader screen for better user experience and added navigation buttons for chapters. - Bumped version to 1.0.3+4 in pubspec.yaml.
84 lines
3.1 KiB
Dart
84 lines
3.1 KiB
Dart
class ReadingSettings {
|
|
const ReadingSettings({
|
|
this.fontSize = 18,
|
|
this.lineHeight = 1.8,
|
|
this.letterSpacing = 0,
|
|
this.fontFamily = 'serif',
|
|
this.themePreset = 'paper',
|
|
this.backgroundColorValue = 0xFFFFFEF8,
|
|
this.textColorValue = 0xFF111111,
|
|
this.horizontalPadding = 20,
|
|
this.paragraphSpacing = 24,
|
|
this.textAlign = 'left',
|
|
this.enableSentenceTapTts = false,
|
|
});
|
|
|
|
final double fontSize;
|
|
final double lineHeight;
|
|
final double letterSpacing;
|
|
final String fontFamily;
|
|
final String themePreset;
|
|
final int backgroundColorValue;
|
|
final int textColorValue;
|
|
final double horizontalPadding;
|
|
final double paragraphSpacing;
|
|
final String textAlign;
|
|
final bool enableSentenceTapTts;
|
|
|
|
ReadingSettings copyWith({
|
|
double? fontSize,
|
|
double? lineHeight,
|
|
double? letterSpacing,
|
|
String? fontFamily,
|
|
String? themePreset,
|
|
int? backgroundColorValue,
|
|
int? textColorValue,
|
|
double? horizontalPadding,
|
|
double? paragraphSpacing,
|
|
String? textAlign,
|
|
bool? enableSentenceTapTts,
|
|
}) =>
|
|
ReadingSettings(
|
|
fontSize: fontSize ?? this.fontSize,
|
|
lineHeight: lineHeight ?? this.lineHeight,
|
|
letterSpacing: letterSpacing ?? this.letterSpacing,
|
|
fontFamily: fontFamily ?? this.fontFamily,
|
|
themePreset: themePreset ?? this.themePreset,
|
|
backgroundColorValue: backgroundColorValue ?? this.backgroundColorValue,
|
|
textColorValue: textColorValue ?? this.textColorValue,
|
|
horizontalPadding: horizontalPadding ?? this.horizontalPadding,
|
|
paragraphSpacing: paragraphSpacing ?? this.paragraphSpacing,
|
|
textAlign: textAlign ?? this.textAlign,
|
|
enableSentenceTapTts: enableSentenceTapTts ?? this.enableSentenceTapTts,
|
|
);
|
|
|
|
factory ReadingSettings.fromJson(Map<String, dynamic> json) => ReadingSettings(
|
|
fontSize: (json['fontSize'] as num?)?.toDouble() ?? 18,
|
|
lineHeight: (json['lineHeight'] as num?)?.toDouble() ?? 1.8,
|
|
letterSpacing: (json['letterSpacing'] as num?)?.toDouble() ?? 0,
|
|
fontFamily: json['fontFamily'] as String? ?? 'serif',
|
|
themePreset: json['themePreset'] as String? ?? 'paper',
|
|
backgroundColorValue:
|
|
(json['backgroundColorValue'] as num?)?.toInt() ?? 0xFFFFFEF8,
|
|
textColorValue: (json['textColorValue'] as num?)?.toInt() ?? 0xFF111111,
|
|
horizontalPadding: (json['horizontalPadding'] as num?)?.toDouble() ?? 20,
|
|
paragraphSpacing: (json['paragraphSpacing'] as num?)?.toDouble() ?? 24,
|
|
textAlign: json['textAlign'] as String? ?? 'left',
|
|
enableSentenceTapTts: json['enableSentenceTapTts'] as bool? ?? false,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'fontSize': fontSize,
|
|
'lineHeight': lineHeight,
|
|
'letterSpacing': letterSpacing,
|
|
'fontFamily': fontFamily,
|
|
'themePreset': themePreset,
|
|
'backgroundColorValue': backgroundColorValue,
|
|
'textColorValue': textColorValue,
|
|
'horizontalPadding': horizontalPadding,
|
|
'paragraphSpacing': paragraphSpacing,
|
|
'textAlign': textAlign,
|
|
'enableSentenceTapTts': enableSentenceTapTts,
|
|
};
|
|
}
|