Complete refactor to clean up project
This commit is contained in:
37
lib/core/models/config.dart
Normal file
37
lib/core/models/config.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
/// 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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user