Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class App extends StatelessWidget {
previous.compactMenuMode != current.compactMenuMode ||
previous.compactMenuModeIsSet != current.compactMenuModeIsSet ||
previous.followSystemTheme != current.followSystemTheme ||
previous.lightReaderPageInDarkMode !=
current.lightReaderPageInDarkMode ||
previous.isDarkMode != current.isDarkMode;
},
builder: (context, settingsState) {
Expand All @@ -65,6 +67,11 @@ class App extends StatelessWidget {
final compact = state.compactMenuModeFor(
isSmallWindow: isSmallWindow,
);
final lightTheme = AppThemeData.light(
lightColorScheme,
compactMenuMode: compact,
variant: AppThemeVariant.ofSeed(state.seedColor),
);
return ValueListenableBuilder<bool>(
valueListenable: DeveloperDiagnostics.instance.performanceOverlay,
builder: (context, showPerformanceOverlay, _) => MaterialApp(
Expand All @@ -82,11 +89,7 @@ class App extends StatelessWidget {
title: 'אוצריא',
// פס הגלילה בימין הפיזי, ברצועה משלו, בכל האפליקציה (AppScrollbar).
scrollBehavior: const EdgeScrollbarBehavior.right(),
theme: AppThemeData.light(
lightColorScheme,
compactMenuMode: compact,
variant: AppThemeVariant.ofSeed(state.seedColor),
),
theme: lightTheme,
darkTheme: AppThemeData.dark(
darkColorScheme,
compactMenuMode: compact,
Expand All @@ -113,6 +116,10 @@ class App extends StatelessWidget {
child: navigator,
),
);
content = ReaderPageTheme(
light: state.lightReaderPageInDarkMode ? lightTheme : null,
child: content,
);

// קביעת צבע אייקוני פס הסטטוס לפי התמה הפעילה.
// האפליקציה אינה משתמשת ב-AppBar רגיל, ולכן systemOverlayStyle
Expand Down
21 changes: 12 additions & 9 deletions lib/pdf_book/view/pdf_book_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,8 @@ class _PdfBookScreenState extends State<PdfBookScreen>
coverPage: layoutMode.hasCoverPage,
);
}
final page = ReaderPageTheme.of(context);
final pageScheme = page.colorScheme;

return PdfViewerParams(
isVisible: _isPdfVisible,
Expand Down Expand Up @@ -1348,7 +1350,7 @@ class _PdfBookScreenState extends State<PdfBookScreen>
);
},
backgroundColor: _pdfViewerBgColor(),
pageImageColorFilter: pdfPageColorFilter(Theme.of(context).brightness),
pageImageColorFilter: pdfPageColorFilter(page.brightness),
pageDropShadow: _pageDropShadow,
sizeDelegateProvider: pdfSizeDelegateProviderForLayoutMode(layoutMode),
maxImageBytesCachedOnMemory: pdfImageCacheBytesForPanes(
Expand Down Expand Up @@ -1430,14 +1432,13 @@ class _PdfBookScreenState extends State<PdfBookScreen>
),
),
// קישורים מצוירים על הקנבס: ווידג'ט לכל קישור נבנה מחדש בכל פריים גלילה.
matchTextColor: AppSurfaces.pdfSearchHit(Theme.of(context).colorScheme),
activeMatchTextColor: AppSurfaces.pdfSearchHitCurrent(
Theme.of(context).colorScheme,
),
// הסימונים על העמוד בגווני הדף, שבהיר גם בממשק כהה כשההגדרה דולקת.
matchTextColor: AppSurfaces.pdfSearchHit(pageScheme),
activeMatchTextColor: AppSurfaces.pdfSearchHitCurrent(pageScheme),
linkHandlerParams: PdfLinkHandlerParams(
onLinkTap: _onPdfLinkTap,
linkColor: Colors.transparent,
linkHoverColor: AppSurfaces.pdfLinkHover(Theme.of(context).colorScheme),
linkHoverColor: AppSurfaces.pdfLinkHover(pageScheme),
),
pagePaintCallbacks: textSearcher != null
? [textSearcher!.pageTextMatchPaintCallback]
Expand Down Expand Up @@ -2007,7 +2008,7 @@ class _PdfBookScreenState extends State<PdfBookScreen>
child: CustomPaint(
painter: _BookViewViewportMaskPainter(
spreadViewportRect,
color: pdfPageColor(Theme.of(context).brightness),
color: pdfPageColor(ReaderPageTheme.of(context).brightness),
),
),
),
Expand Down Expand Up @@ -3186,7 +3187,7 @@ class _PdfBookScreenState extends State<PdfBookScreen>
canvas.clipRect(canvasRect, doAntiAlias: false);

// רק תוכן העמודים עובר את מסנן המצב הכהה, כמו בצפיין החי.
final brightness = Theme.of(context).brightness;
final brightness = ReaderPageTheme.of(context).brightness;

canvas.drawRect(canvasRect, Paint()..color = _pdfViewerBgColor());

Expand Down Expand Up @@ -4529,7 +4530,9 @@ class _PdfBookScreenState extends State<PdfBookScreen>
state is PdfBookLoading && state.isSlow;
return Positioned.fill(
child: ColoredBox(
color: pdfPageColor(Theme.of(context).brightness),
color: pdfPageColor(
ReaderPageTheme.of(context).brightness,
),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
Expand Down
10 changes: 10 additions & 0 deletions lib/settings/engine/settings_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
on<LoadSettings>(_onLoadSettings);
on<UpdateDarkMode>(_onUpdateDarkMode);
on<UpdateFollowSystemTheme>(_onUpdateFollowSystemTheme);
on<UpdateLightReaderPageInDarkMode>(_onUpdateLightReaderPageInDarkMode);
on<UpdateThemeMode>(_onUpdateThemeMode);
on<UpdateSeedColor>(_onUpdateSeedColor);
on<UpdateDarkSeedColor>(_onUpdateDarkSeedColor);
Expand Down Expand Up @@ -188,6 +189,7 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
return SettingsState(
isDarkMode: settings['isDarkMode'],
followSystemTheme: settings['followSystemTheme'] ?? false,
lightReaderPageInDarkMode: settings['lightReaderPageInDarkMode'] ?? false,
seedColor: settings['seedColor'],
darkSeedColor: settings['darkSeedColor'],
textMaxWidth: settings['textMaxWidth'],
Expand Down Expand Up @@ -553,6 +555,14 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
emit(state.copyWith(isDarkMode: event.isDarkMode));
}

Future<void> _onUpdateLightReaderPageInDarkMode(
UpdateLightReaderPageInDarkMode event,
Emitter<SettingsState> emit,
) async {
await _repository.updateLightReaderPageInDarkMode(event.enabled);
emit(state.copyWith(lightReaderPageInDarkMode: event.enabled));
}

Future<void> _onUpdateFollowSystemTheme(
UpdateFollowSystemTheme event,
Emitter<SettingsState> emit,
Expand Down
10 changes: 10 additions & 0 deletions lib/settings/engine/settings_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ class UpdateDarkMode extends SettingsEvent {
List<Object?> get props => [isDarkMode];
}

/// דף הספר בהיר גם כשהממשק כהה (issue #2435).
class UpdateLightReaderPageInDarkMode extends SettingsEvent {
final bool enabled;

const UpdateLightReaderPageInDarkMode(this.enabled);

@override
List<Object?> get props => [enabled];
}

class UpdateFollowSystemTheme extends SettingsEvent {
final bool followSystemTheme;

Expand Down
14 changes: 14 additions & 0 deletions lib/settings/engine/settings_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import 'dart:convert';
class SettingsRepository {
static const String keyDarkMode = 'key-dark-mode';
static const String keyFollowSystemTheme = 'key-follow-system-theme';

/// דף הספר בהיר גם כשהממשק כהה (issue #2435).
static const String keyLightReaderPageInDarkMode =
'key-light-reader-page-in-dark-mode';
static const String keySwatchColor = 'key-swatch-color';
static const String keyDarkSwatchColor = 'key-dark-swatch-color';
// לא key-text-max-width: ערכיו (אחוזים/פיקסלים יחסיים למסך) אינם רוחב יעד.
Expand Down Expand Up @@ -292,6 +296,7 @@ class SettingsRepository {
static const List<String> allKeys = [
keyDarkMode,
keyFollowSystemTheme,
keyLightReaderPageInDarkMode,
keySwatchColor,
keyDarkSwatchColor,
keyTextColumnWidth,
Expand Down Expand Up @@ -448,6 +453,10 @@ class SettingsRepository {
keyFollowSystemTheme,
defaultValue: false,
),
'lightReaderPageInDarkMode': _settings.getValue<bool>(
keyLightReaderPageInDarkMode,
defaultValue: false,
),
'seedColor': Color(
_settings.getValue<int>(
keySwatchColor,
Expand Down Expand Up @@ -805,6 +814,10 @@ class SettingsRepository {
await _settings.setValue(keyFollowSystemTheme, value);
}

Future<void> updateLightReaderPageInDarkMode(bool value) async {
await _settings.setValue(keyLightReaderPageInDarkMode, value);
}

Future<void> updateSeedColor(Color value) async {
await _settings.setValue(keySwatchColor, value.toARGB32());
}
Expand Down Expand Up @@ -1412,6 +1425,7 @@ class SettingsRepository {
/// Write all default settings to persistent storage
Future<void> _writeDefaultsToStorage() async {
await _settings.setValue(keyDarkMode, false);
await _settings.setValue(keyLightReaderPageInDarkMode, false);
await _settings.setValue(
keySwatchColor,
AppSeedColors.defaultLight.toARGB32(),
Expand Down
8 changes: 8 additions & 0 deletions lib/settings/engine/settings_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import 'package:otzaria/utils/text/text_manipulation.dart' show HolyNameStyle;
class SettingsState extends Equatable {
final bool isDarkMode;
final bool followSystemTheme;

/// דף הספר בהיר גם כשהממשק כהה (issue #2435).
final bool lightReaderPageInDarkMode;
final Color seedColor;
final Color darkSeedColor;
// רוחב מקסימלי לטקסט: שלילי = רמה באחוזים (-2 = 90%), 0 = ללא הגבלה,
Expand Down Expand Up @@ -154,6 +157,7 @@ class SettingsState extends Equatable {
SettingsState({
required this.isDarkMode,
required this.followSystemTheme,
this.lightReaderPageInDarkMode = false,
required this.seedColor,
required this.darkSeedColor,
required this.textMaxWidth,
Expand Down Expand Up @@ -268,6 +272,7 @@ class SettingsState extends Equatable {
SettingsState copyWith({
bool? isDarkMode,
bool? followSystemTheme,
bool? lightReaderPageInDarkMode,
Color? seedColor,
Color? darkSeedColor,
double? textMaxWidth,
Expand Down Expand Up @@ -364,6 +369,8 @@ class SettingsState extends Equatable {
textDisplayPolicy: policy,
isDarkMode: isDarkMode ?? this.isDarkMode,
followSystemTheme: followSystemTheme ?? this.followSystemTheme,
lightReaderPageInDarkMode:
lightReaderPageInDarkMode ?? this.lightReaderPageInDarkMode,
seedColor: seedColor ?? this.seedColor,
darkSeedColor: darkSeedColor ?? this.darkSeedColor,
textMaxWidth: textMaxWidth ?? this.textMaxWidth,
Expand Down Expand Up @@ -472,6 +479,7 @@ class SettingsState extends Equatable {
List<Object?> get props => [
isDarkMode,
followSystemTheme,
lightReaderPageInDarkMode,
seedColor,
darkSeedColor,
textMaxWidth,
Expand Down
5 changes: 5 additions & 0 deletions lib/settings/l10n/settings_catalogs.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/settings/l10n/settings_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"התוכנה תתאים את המראה באופן אוטומטי להגדרות מערכת ההפעלה": "Otzaria will match your system's theme automatically",
"כהה": "Dark",
"התוכנה תשתמש בצבעים כהים": "The system will use dark colors",
"דף הספר בהיר גם במצב כהה": "Light sefer page in dark mode",
"רקע לבן וטקסט כהה בדף הספר, והממשק שסביבו כהה": "White background and dark text on the sefer page, with a dark interface around it",
"פעיל רק כשהממשק כהה": "Applies only when the interface is dark",
"דף הספר בהיר, והסרגלים והחלוניות כהים": "The sefer page is light; toolbars and panels stay dark",
"דף הספר כהה כמו שאר הממשק": "The sefer page is dark like the rest of the interface",
"תצוגה": "Display",
"צפיפות ממשק": "Toolbar Density",
"רגיל": "Normal",
Expand Down
25 changes: 25 additions & 0 deletions lib/settings/tabs/design_settings_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ class DesignSettingsTab extends StatelessWidget {
'לא מופעל',
],
),
SettingsSearchEntry(
id: 'design.theme.light_reader_page',
title: 'דף הספר בהיר גם במצב כהה',
subtitle: 'רקע לבן וטקסט כהה בדף הספר, והממשק שסביבו כהה',
tab: SettingsTab.design,
cardId: 'design.theme',
keywords: ['ערכת נושא', 'מצב כהה', 'רקע לבן', 'דף', 'PDF'],
),
SettingsSearchEntry(
id: 'design.theme.seed_color',
title: 'צבע בסיס',
Expand Down Expand Up @@ -269,6 +277,23 @@ class DesignSettingsTab extends StatelessWidget {
}),
),
),
// רלוונטי רק כשהממשק כהה בפועל, גם במצב "מערכת".
SettingsSwitchTile(
icon: FluentIcons.document_24_regular,
title: context.settingsText('דף הספר בהיר גם במצב כהה'),
subtitle: context.settingsText(
Theme.of(context).brightness != Brightness.dark
? 'פעיל רק כשהממשק כהה'
: state.lightReaderPageInDarkMode
? 'דף הספר בהיר, והסרגלים והחלוניות כהים'
: 'דף הספר כהה כמו שאר הממשק',
),
value: state.lightReaderPageInDarkMode,
enabled: Theme.of(context).brightness == Brightness.dark,
onChanged: (value) => context.read<SettingsBloc>().add(
UpdateLightReaderPageInDarkMode(value),
),
),
ColorPickerTile(
key: ValueKey(
'color-picker-${Theme.of(context).brightness == Brightness.dark ? 'dark' : 'light'}',
Expand Down
9 changes: 6 additions & 3 deletions lib/text_book/view/text_book_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:otzaria/text_book/view/reader_export_actions.dart';
import 'package:otzaria/text_book/view/reader_print_actions.dart';
import 'package:otzaria/text_book/view/reader_shamor_zachor_actions.dart';
import 'package:otzaria/theme/app_density.dart';
import 'package:otzaria/theme/app_surface_colors.dart';
import 'package:otzaria/theme/app_fonts.dart';
import 'package:otzaria/theme/app_motion.dart';
import 'package:otzaria/core/messages/common_messages.dart';
Expand Down Expand Up @@ -2346,9 +2347,11 @@ class _TextBookViewerBlocState extends State<TextBookViewerBloc>
host: _searchHost,
child: _NavPanelTourTargetBuilder(child: _buildLeftPaneContent(state)),
),
mainContent: CtrlWheelZoom(
onZoom: _zoomFromWheel,
child: _buildHTMLViewer(state),
mainContent: ReaderPageScope(
child: CtrlWheelZoom(
onZoom: _zoomFromWheel,
child: _buildHTMLViewer(state),
),
),
isResizable: true,
minPaneWidth: 200,
Expand Down
Loading
Loading