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 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 toJson() => { 'fontSize': fontSize, 'lineHeight': lineHeight, 'letterSpacing': letterSpacing, 'fontFamily': fontFamily, 'themePreset': themePreset, 'backgroundColorValue': backgroundColorValue, 'textColorValue': textColorValue, 'horizontalPadding': horizontalPadding, 'paragraphSpacing': paragraphSpacing, 'textAlign': textAlign, 'enableSentenceTapTts': enableSentenceTapTts, }; }