mod: fav folder edit
This commit is contained in:
@ -53,6 +53,7 @@ class FavEditController extends GetxController {
|
||||
intro: intro,
|
||||
mediaId: mediaId!,
|
||||
cover: cover,
|
||||
privacy: privacy.value,
|
||||
);
|
||||
if (res['status']) {
|
||||
SmartDialog.showToast('编辑成功');
|
||||
@ -74,4 +75,14 @@ class FavEditController extends GetxController {
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
void togglePrivacy() {
|
||||
if (privacy.value == 0) {
|
||||
privacy.value = 1;
|
||||
SmartDialog.showToast('设置为私密后,只有自己可见');
|
||||
} else {
|
||||
privacy.value = 0;
|
||||
SmartDialog.showToast('设置为公开后,所有人可见');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,31 +21,22 @@ class _FavEditPageState extends State<FavEditPage> {
|
||||
appBar: AppBar(
|
||||
title: Obx(
|
||||
() => _favEditController.type.value == 'add'
|
||||
? Text(
|
||||
'新建收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
)
|
||||
: Text(
|
||||
'编辑收藏夹',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
? const Text('新建收藏夹')
|
||||
: const Text('编辑收藏夹'),
|
||||
),
|
||||
actions: [
|
||||
Obx(
|
||||
() => _favEditController.privacy.value == 0
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 1;
|
||||
},
|
||||
icon: const Icon(Icons.lock_open_outlined))
|
||||
: IconButton(
|
||||
onPressed: () {
|
||||
_favEditController.privacy.value = 0;
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.lock_outlined,
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
)),
|
||||
() => IconButton(
|
||||
onPressed: _favEditController.togglePrivacy,
|
||||
icon: Icon(
|
||||
_favEditController.privacy.value == 0
|
||||
? Icons.lock_open_outlined
|
||||
: Icons.lock_outlined,
|
||||
color: _favEditController.privacy.value == 0
|
||||
? null
|
||||
: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
||||
|
||||
Reference in New Issue
Block a user