- 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.
40 lines
1.0 KiB
Dart
40 lines
1.0 KiB
Dart
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
/// Vertical continuous scroll vs horizontal page turns.
|
|
enum ReaderMode {
|
|
webtoon,
|
|
paged;
|
|
|
|
String get storageValue => this == ReaderMode.paged ? 'paged' : 'webtoon';
|
|
|
|
static ReaderMode fromStorage(String? raw) {
|
|
return raw == 'paged' ? ReaderMode.paged : ReaderMode.webtoon;
|
|
}
|
|
}
|
|
|
|
/// Global / per-title paged-reader tap/swipe direction.
|
|
enum ReadingDirection {
|
|
ltr,
|
|
rtl;
|
|
|
|
String get storageValue => name;
|
|
|
|
static ReadingDirection fromStorage(String? raw) {
|
|
return raw == 'rtl' ? ReadingDirection.rtl : ReadingDirection.ltr;
|
|
}
|
|
}
|
|
|
|
class ReaderDirection {
|
|
static const prefKey = 'reader_reading_direction';
|
|
|
|
static Future<ReadingDirection> load() async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
return ReadingDirection.fromStorage(prefs.getString(prefKey));
|
|
}
|
|
|
|
static Future<void> save(ReadingDirection direction) async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
await prefs.setString(prefKey, direction.storageValue);
|
|
}
|
|
}
|