38 lines
990 B
Dart
38 lines
990 B
Dart
/// Application configuration model.
|
|
///
|
|
/// Stores user preferences that are persisted across sessions,
|
|
/// such as display mode and fullscreen settings.
|
|
class Config {
|
|
/// Storage keys for persistence
|
|
static const String keyTwoPageMode = 'twoPageMode';
|
|
static const String keyFullscreen = 'fullscreen';
|
|
|
|
/// Whether to display two pages side-by-side (for tablets/landscape).
|
|
bool twoPageMode;
|
|
|
|
/// Whether the app is in fullscreen mode.
|
|
bool fullscreen;
|
|
|
|
Config({
|
|
required this.twoPageMode,
|
|
required this.fullscreen,
|
|
});
|
|
|
|
/// Creates a default configuration with all options disabled.
|
|
factory Config.defaultConfig() => Config(
|
|
twoPageMode: false,
|
|
fullscreen: false,
|
|
);
|
|
|
|
/// Creates a copy of this config with optional overrides.
|
|
Config copyWith({
|
|
bool? twoPageMode,
|
|
bool? fullscreen,
|
|
}) {
|
|
return Config(
|
|
twoPageMode: twoPageMode ?? this.twoPageMode,
|
|
fullscreen: fullscreen ?? this.fullscreen,
|
|
);
|
|
}
|
|
}
|