mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: safearea
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -93,7 +93,11 @@ class _FavSortPageState extends State<FavSortPage> {
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
),
|
||||
body: _buildBody,
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: _buildBody,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,296 +75,319 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
body: refreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _favDetailController.onRefresh();
|
||||
},
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: _favDetailController.scrollController,
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
leading: _favDetailController.enableMultiSelect.value
|
||||
? IconButton(
|
||||
tooltip: '取消',
|
||||
onPressed: _favDetailController.handleSelect,
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
)
|
||||
: null,
|
||||
expandedHeight: 220 - MediaQuery.of(context).padding.top,
|
||||
pinned: true,
|
||||
title: _favDetailController.enableMultiSelect.value
|
||||
? Text(
|
||||
'已选: ${_favDetailController.checkedCount.value}',
|
||||
)
|
||||
: Obx(
|
||||
() => AnimatedOpacity(
|
||||
opacity:
|
||||
_favDetailController.titleCtr.value ? 1 : 0,
|
||||
curve: Curves.easeOut,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_favDetailController.item.value.title ?? '',
|
||||
style:
|
||||
Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
'共${_favDetailController.item.value.mediaCount}条视频',
|
||||
style:
|
||||
Theme.of(context).textTheme.labelMedium,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: _favDetailController.enableMultiSelect.value
|
||||
? [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () =>
|
||||
_favDetailController.handleSelect(true),
|
||||
child: const Text('全选'),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () {
|
||||
RequestUtils.onCopyOrMove<FavDetailData,
|
||||
FavDetailItemData>(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.mid,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'复制',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: refreshIndicator(
|
||||
onRefresh: () async {
|
||||
await _favDetailController.onRefresh();
|
||||
},
|
||||
child: CustomScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
controller: _favDetailController.scrollController,
|
||||
slivers: [
|
||||
SliverAppBar(
|
||||
leading: _favDetailController.enableMultiSelect.value
|
||||
? IconButton(
|
||||
tooltip: '取消',
|
||||
onPressed: _favDetailController.handleSelect,
|
||||
icon: const Icon(Icons.close_outlined),
|
||||
)
|
||||
: null,
|
||||
expandedHeight: 200 - MediaQuery.of(context).padding.top,
|
||||
pinned: true,
|
||||
title: _favDetailController.enableMultiSelect.value
|
||||
? Text(
|
||||
'已选: ${_favDetailController.checkedCount.value}',
|
||||
)
|
||||
: Obx(
|
||||
() => AnimatedOpacity(
|
||||
opacity:
|
||||
_favDetailController.titleCtr.value ? 1 : 0,
|
||||
curve: Curves.easeOut,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_favDetailController.item.value.title ?? '',
|
||||
style:
|
||||
Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
Text(
|
||||
'共${_favDetailController.item.value.mediaCount}条视频',
|
||||
style:
|
||||
Theme.of(context).textTheme.labelMedium,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () {
|
||||
RequestUtils.onCopyOrMove<FavDetailData,
|
||||
FavDetailItemData>(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.mid,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'移动',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
actions: _favDetailController.enableMultiSelect.value
|
||||
? [
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () =>
|
||||
_favDetailController.handleSelect(true),
|
||||
child: const Text('全选'),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () =>
|
||||
_favDetailController.onDelChecked(context),
|
||||
child: Text(
|
||||
'删除',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
]
|
||||
: [
|
||||
IconButton(
|
||||
tooltip: '搜索',
|
||||
onPressed: () => Get.toNamed(
|
||||
'/favSearch',
|
||||
arguments: {
|
||||
'type': 0,
|
||||
'mediaId': int.parse(mediaId),
|
||||
'title': _favDetailController.item.value.title,
|
||||
'count':
|
||||
_favDetailController.item.value.mediaCount,
|
||||
'isOwner': _favDetailController.isOwner.value,
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () {
|
||||
RequestUtils.onCopyOrMove<FavDetailData,
|
||||
FavDetailItemData>(
|
||||
context: context,
|
||||
isCopy: true,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.mid,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'复制',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
icon: const Icon(Icons.search_outlined),
|
||||
),
|
||||
Obx(
|
||||
() => _favDetailController.isOwner.value
|
||||
? PopupMenuButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
Get.toNamed(
|
||||
'/createFav',
|
||||
parameters: {'mediaId': mediaId},
|
||||
)?.then((res) {
|
||||
if (res is FavFolderItemData) {
|
||||
_favDetailController.item.value =
|
||||
res;
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text('编辑信息'),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
UserHttp.cleanFav(mediaId: mediaId)
|
||||
.then((data) {
|
||||
if (data['status']) {
|
||||
SmartDialog.showToast('清除成功');
|
||||
Future.delayed(
|
||||
const Duration(
|
||||
milliseconds: 200), () {
|
||||
_favDetailController.onReload();
|
||||
});
|
||||
} else {
|
||||
SmartDialog.showToast(
|
||||
data['msg']);
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text('清除失效内容'),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
if (_favDetailController.loadingState
|
||||
.value is Success &&
|
||||
((_favDetailController
|
||||
.loadingState
|
||||
.value as Success)
|
||||
.response as List?)
|
||||
?.isNotEmpty ==
|
||||
true) {
|
||||
if ((_favDetailController.item.value
|
||||
.mediaCount ??
|
||||
0) >
|
||||
1000) {
|
||||
SmartDialog.showToast(
|
||||
'内容太多啦!超过1000不支持排序');
|
||||
return;
|
||||
}
|
||||
Get.to(
|
||||
FavSortPage(
|
||||
favDetailController:
|
||||
_favDetailController),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text('排序'),
|
||||
),
|
||||
if (!Utils.isDefaultFav(
|
||||
_favDetailController
|
||||
.item.value.attr ??
|
||||
0))
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () {
|
||||
RequestUtils.onCopyOrMove<FavDetailData,
|
||||
FavDetailItemData>(
|
||||
context: context,
|
||||
isCopy: false,
|
||||
ctr: _favDetailController,
|
||||
mediaId: _favDetailController.mediaId,
|
||||
mid: _favDetailController.mid,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'移动',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
visualDensity:
|
||||
VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () =>
|
||||
_favDetailController.onDelChecked(context),
|
||||
child: Text(
|
||||
'删除',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
]
|
||||
: [
|
||||
IconButton(
|
||||
tooltip: '搜索',
|
||||
onPressed: () => Get.toNamed(
|
||||
'/favSearch',
|
||||
arguments: {
|
||||
'type': 0,
|
||||
'mediaId': int.parse(mediaId),
|
||||
'title':
|
||||
_favDetailController.item.value.title,
|
||||
'count': _favDetailController
|
||||
.item.value.mediaCount,
|
||||
'isOwner': _favDetailController.isOwner.value,
|
||||
},
|
||||
),
|
||||
icon: const Icon(Icons.search_outlined),
|
||||
),
|
||||
Obx(
|
||||
() => _favDetailController.isOwner.value
|
||||
? PopupMenuButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
showConfirmDialog(
|
||||
context: context,
|
||||
title: '确定删除该收藏夹?',
|
||||
onConfirm: () {
|
||||
UserHttp.deleteFolder(
|
||||
mediaIds: [mediaId])
|
||||
.then((data) {
|
||||
if (data['status']) {
|
||||
SmartDialog.showToast(
|
||||
'删除成功');
|
||||
Get.back(result: true);
|
||||
} else {
|
||||
SmartDialog.showToast(
|
||||
data['msg']);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
Get.toNamed(
|
||||
'/createFav',
|
||||
parameters: {'mediaId': mediaId},
|
||||
)?.then((res) {
|
||||
if (res is FavFolderItemData) {
|
||||
_favDetailController
|
||||
.item.value = res;
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'删除',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.error,
|
||||
child: Text('编辑信息'),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
UserHttp.cleanFav(mediaId: mediaId)
|
||||
.then((data) {
|
||||
if (data['status']) {
|
||||
SmartDialog.showToast('清除成功');
|
||||
Future.delayed(
|
||||
const Duration(
|
||||
milliseconds: 200), () {
|
||||
_favDetailController
|
||||
.onReload();
|
||||
});
|
||||
} else {
|
||||
SmartDialog.showToast(
|
||||
data['msg']);
|
||||
}
|
||||
});
|
||||
},
|
||||
child: Text('清除失效内容'),
|
||||
),
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
if (_favDetailController
|
||||
.loadingState
|
||||
.value is Success &&
|
||||
((_favDetailController
|
||||
.loadingState
|
||||
.value
|
||||
as Success)
|
||||
.response as List?)
|
||||
?.isNotEmpty ==
|
||||
true) {
|
||||
if ((_favDetailController.item
|
||||
.value.mediaCount ??
|
||||
0) >
|
||||
1000) {
|
||||
SmartDialog.showToast(
|
||||
'内容太多啦!超过1000不支持排序');
|
||||
return;
|
||||
}
|
||||
Get.to(
|
||||
FavSortPage(
|
||||
favDetailController:
|
||||
_favDetailController),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text('排序'),
|
||||
),
|
||||
if (!Utils.isDefaultFav(
|
||||
_favDetailController
|
||||
.item.value.attr ??
|
||||
0))
|
||||
PopupMenuItem(
|
||||
onTap: () {
|
||||
showConfirmDialog(
|
||||
context: context,
|
||||
title: '确定删除该收藏夹?',
|
||||
onConfirm: () {
|
||||
UserHttp.deleteFolder(
|
||||
mediaIds: [mediaId])
|
||||
.then((data) {
|
||||
if (data['status']) {
|
||||
SmartDialog.showToast(
|
||||
'删除成功');
|
||||
Get.back(result: true);
|
||||
} else {
|
||||
SmartDialog.showToast(
|
||||
data['msg']);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'删除',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.error,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: kTextTabBarHeight +
|
||||
MediaQuery.of(context).padding.top +
|
||||
10,
|
||||
left: 14,
|
||||
right: 20,
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 110,
|
||||
child: Obx(
|
||||
() => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Hero(
|
||||
tag: _favDetailController.heroTag,
|
||||
child: NetworkImgLayer(
|
||||
width: 180,
|
||||
height: 110,
|
||||
src: _favDetailController.item.value.cover,
|
||||
],
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
],
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: kTextTabBarHeight +
|
||||
MediaQuery.of(context).padding.top +
|
||||
10,
|
||||
left: 14,
|
||||
right: 20,
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 110,
|
||||
child: Obx(
|
||||
() => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Hero(
|
||||
tag: _favDetailController.heroTag,
|
||||
child: NetworkImgLayer(
|
||||
width: 180,
|
||||
height: 110,
|
||||
src: _favDetailController.item.value.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 110,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_favDetailController.item.value.title ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.fontSize,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (_favDetailController
|
||||
.item.value.intro?.isNotEmpty ==
|
||||
true)
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 110,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_favDetailController
|
||||
.item.value.intro ??
|
||||
.item.value.title ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.fontSize,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
if (_favDetailController
|
||||
.item.value.intro?.isNotEmpty ==
|
||||
true)
|
||||
Text(
|
||||
_favDetailController
|
||||
.item.value.intro ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall!
|
||||
.fontSize,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_favDetailController
|
||||
.item.value.upper?.name ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
@@ -375,48 +398,36 @@ class _FavDetailPageState extends State<FavDetailPage> {
|
||||
.colorScheme
|
||||
.outline),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_favDetailController
|
||||
.item.value.upper?.name ??
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall!
|
||||
.fontSize,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline),
|
||||
),
|
||||
const Spacer(),
|
||||
if (_favDetailController
|
||||
.item.value.attr !=
|
||||
null)
|
||||
Text(
|
||||
'共${_favDetailController.item.value.mediaCount}条视频 · ${Utils.isPublicFavText(_favDetailController.item.value.attr ?? 0)}',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall!
|
||||
.fontSize,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
if (_favDetailController
|
||||
.item.value.attr !=
|
||||
null)
|
||||
Text(
|
||||
'共${_favDetailController.item.value.mediaCount}条视频 · ${Utils.isPublicFavText(_favDetailController.item.value.attr ?? 0)}',
|
||||
style: TextStyle(
|
||||
fontSize: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall!
|
||||
.fontSize,
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(() => _buildBody(_favDetailController.loadingState.value)),
|
||||
],
|
||||
Obx(() =>
|
||||
_buildBody(_favDetailController.loadingState.value)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user