Files
venera/lib/pages/settings/local_favorites.dart
pkuislm a1474ca9c3 更改安卓端的文件访问方式,优化导入逻辑 (#64)
* Refactor import function & Allow import local comics without copying them to local path.

* android: use file_picker instead, support directory access for android 10

* Improve import logic

* Fix sql query.

* Add ability to remove invalid favorite items.

* Perform sort before choosing cover

* Revert changes of "use file_picker instead".

* Try catch on "check update"

* Added module 'flutter_saf'

* gitignore

* remove unsupported arch in build.gradle

* Use flutter_saf to handle android's directory and files, improve import logic.

* revert changes of 'requestLegacyExternalStorage'

* fix cbz import

* openDirectoryPlatform

* Remove double check on source folder

* use openFilePlatform

* remove unused import

* improve local comic's path handling

* bump version

* fix pubspec format

* return null when comic folder is empty
2024-11-23 11:05:00 +08:00

55 lines
1.7 KiB
Dart

part of 'settings_page.dart';
class LocalFavoritesSettings extends StatefulWidget {
const LocalFavoritesSettings({super.key});
@override
State<LocalFavoritesSettings> createState() => _LocalFavoritesSettingsState();
}
class _LocalFavoritesSettingsState extends State<LocalFavoritesSettings> {
@override
Widget build(BuildContext context) {
return SmoothCustomScrollView(
slivers: [
SliverAppbar(title: Text("Local Favorites".tl)),
SelectSetting(
title: "Add new favorite to".tl,
settingKey: "newFavoriteAddTo",
optionTranslation: const {
"start": "Start",
"end": "End",
},
).toSliver(),
SelectSetting(
title: "Move favorite after reading".tl,
settingKey: "moveFavoriteAfterRead",
optionTranslation: const {
"none": "None",
"end": "End",
"start": "Start",
},
).toSliver(),
SelectSetting(
title: "Quick Favorite".tl,
settingKey: "quickFavorite",
help: "Long press on the favorite button to quickly add to this folder".tl,
optionTranslation: {
for (var e in LocalFavoritesManager().folderNames) e: e
},
).toSliver(),
_CallbackSetting(
title: "Delete all unavailable local favorite items".tl,
callback: () async {
var controller = showLoadingDialog(context);
var count = await LocalFavoritesManager().removeInvalid();
controller.close();
context.showMessage(message: "Deleted @a favorite items".tlParams({'a': count}));
},
actionTitle: 'Delete'.tl,
).toSliver(),
],
);
}
}