- Introduced a new Flutter project for the cxyz Android manga/comic reader, including essential files such as pubspec.yaml, AndroidManifest.xml, and Gradle configuration. - Added .gitignore files to exclude unnecessary files and directories for both the main project and Android-specific files. - Implemented initial README.md with project description, features, setup instructions, and API details for ComicLand, MangaRead, and MangaTown. - Configured analysis options and dependencies in pubspec.yaml to support Flutter development. - Established a pnpm workspace and lockfile for dependency management. - Included various Android resources such as icons, styles, and launch backgrounds for a complete application setup.
54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import '../sources/source.dart';
|
|
import 'reader_direction.dart';
|
|
|
|
/// Built-in reader prefs per catalog source (used when a title has no override).
|
|
class SourceReaderDefaults {
|
|
const SourceReaderDefaults._();
|
|
|
|
/// ComicLand → vertical webtoon; MangaRead / MangaTown → horizontal paged.
|
|
static ReaderMode modeFor(String sourceId) {
|
|
switch (SourceId.tryParse(sourceId)) {
|
|
case SourceId.mangaread:
|
|
case SourceId.mangatown:
|
|
return ReaderMode.paged;
|
|
case SourceId.comicland:
|
|
case null:
|
|
return ReaderMode.webtoon;
|
|
}
|
|
}
|
|
|
|
/// MangaRead / MangaTown → RTL; ComicLand falls back to global Settings.
|
|
static ReadingDirection? directionFor(String sourceId) {
|
|
switch (SourceId.tryParse(sourceId)) {
|
|
case SourceId.mangaread:
|
|
case SourceId.mangatown:
|
|
return ReadingDirection.rtl;
|
|
case SourceId.comicland:
|
|
case null:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// Resolve stored title mode, else [modeFor].
|
|
static ReaderMode resolveMode(String sourceId, String? storedMode) {
|
|
final raw = storedMode?.trim() ?? '';
|
|
if (raw == 'paged' || raw == 'webtoon') {
|
|
return ReaderMode.fromStorage(raw);
|
|
}
|
|
return modeFor(sourceId);
|
|
}
|
|
|
|
/// Resolve stored title direction, else [directionFor], else [globalFallback].
|
|
static ReadingDirection resolveDirection(
|
|
String sourceId,
|
|
String? storedDirection, {
|
|
required ReadingDirection globalFallback,
|
|
}) {
|
|
final raw = storedDirection?.trim() ?? '';
|
|
if (raw == 'ltr' || raw == 'rtl') {
|
|
return ReadingDirection.fromStorage(raw);
|
|
}
|
|
return directionFor(sourceId) ?? globalFallback;
|
|
}
|
|
}
|