Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-24 18:07:08 +08:00
parent 68872f7b14
commit e9b5cffa91
18 changed files with 326 additions and 366 deletions

View File

@@ -37,9 +37,9 @@ class _LaterPageState extends State<LaterPage>
);
}
final sortKey = GlobalKey();
final _sortKey = GlobalKey();
void listener() {
(sortKey.currentContext as Element?)?.markNeedsBuild();
(_sortKey.currentContext as Element?)?.markNeedsBuild();
}
@override
@@ -77,9 +77,7 @@ class _LaterPageState extends State<LaterPage>
appBar: _buildAppbar(enableMultiSelect),
floatingActionButtonLocation: const CustomFabLocation(),
floatingActionButton: Padding(
padding: const EdgeInsets.only(
right: kFloatingActionButtonMargin,
),
padding: const .only(right: kFloatingActionButtonMargin),
child: Obx(
() => currCtr().loadingState.value.isSuccess
? AnimatedSlide(
@@ -126,10 +124,8 @@ class _LaterPageState extends State<LaterPage>
onTap: (_) {
if (!_tabController.indexIsChanging) {
currCtr().scrollController.animToTop();
} else {
if (enableMultiSelect) {
currCtr(_tabController.previousIndex).handleSelect();
}
} else if (enableMultiSelect) {
currCtr(_tabController.previousIndex).handleSelect();
}
},
),
@@ -164,9 +160,7 @@ class _LaterPageState extends State<LaterPage>
ctr: currCtr(),
actions: [
TextButton(
style: TextButton.styleFrom(
visualDensity: VisualDensity.compact,
),
style: TextButton.styleFrom(visualDensity: .compact),
onPressed: () {
final ctr = currCtr();
RequestUtils.onCopyOrMove<LaterData, LaterItemModel>(
@@ -179,15 +173,11 @@ class _LaterPageState extends State<LaterPage>
},
child: Text(
'复制',
style: TextStyle(
color: theme.colorScheme.onSurfaceVariant,
),
style: TextStyle(color: theme.colorScheme.onSurfaceVariant),
),
),
TextButton(
style: TextButton.styleFrom(
visualDensity: VisualDensity.compact,
),
style: TextButton.styleFrom(visualDensity: .compact),
onPressed: () {
final ctr = currCtr();
RequestUtils.onCopyOrMove<LaterData, LaterItemModel>(
@@ -200,9 +190,7 @@ class _LaterPageState extends State<LaterPage>
},
child: Text(
'移动',
style: TextStyle(
color: theme.colorScheme.onSurfaceVariant,
),
style: TextStyle(color: theme.colorScheme.onSurfaceVariant),
),
),
],
@@ -226,113 +214,97 @@ class _LaterPageState extends State<LaterPage>
},
icon: const Icon(Icons.search),
),
Material(
clipBehavior: Clip.hardEdge,
type: MaterialType.transparency,
borderRadius: const BorderRadius.all(Radius.circular(20)),
child: Builder(
key: sortKey,
builder: (context) {
final value = currCtr().asc.value;
return PopupMenuButton(
initialValue: value,
tooltip: '排序',
onSelected: (value) {
currCtr()
..asc.value = value
..onReload();
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
Builder(
key: _sortKey,
builder: (context) {
final value = currCtr().asc.value;
return PopupMenuButton(
initialValue: value,
tooltip: '排序',
onSelected: (value) => currCtr()
..asc.value = value
..onReload(),
borderRadius: const .all(.circular(20)),
child: Padding(
padding: const .symmetric(horizontal: 12, vertical: 6),
child: Text.rich(
style: TextStyle(fontSize: 14, height: 1, color: color),
strutStyle: const StrutStyle(
leading: 0,
height: 1,
fontSize: 14,
),
child: Text.rich(
style: TextStyle(fontSize: 14, height: 1, color: color),
strutStyle: const StrutStyle(
leading: 0,
height: 1,
fontSize: 14,
),
TextSpan(
children: [
TextSpan(text: value ? '最早添加' : '最近添加'),
WidgetSpan(
alignment: .middle,
child: Icon(
size: 14,
MdiIcons.unfoldMoreHorizontal,
color: color,
),
TextSpan(
children: [
TextSpan(text: value ? '最早添加' : '最近添加'),
WidgetSpan(
alignment: .middle,
child: Icon(
size: 14,
MdiIcons.unfoldMoreHorizontal,
color: color,
),
],
style: TextStyle(color: color),
),
),
],
style: TextStyle(color: color),
),
),
itemBuilder: (BuildContext context) => [
const PopupMenuItem(
value: false,
child: Text('最近添加'),
),
const PopupMenuItem(
value: true,
child: Text('最早添加'),
),
itemBuilder: (_) => [
const PopupMenuItem(
value: false,
child: Text('最近添加'),
),
const PopupMenuItem(
value: true,
child: Text('最早添加'),
),
],
);
},
),
PopupMenuButton(
tooltip: '清空',
borderRadius: const .all(.circular(20)),
child: Padding(
padding: const .symmetric(horizontal: 12, vertical: 6),
child: Text.rich(
style: TextStyle(fontSize: 14, height: 1, color: color),
strutStyle: const StrutStyle(
leading: 0,
height: 1,
fontSize: 14,
),
TextSpan(
children: [
const TextSpan(text: '清空'),
WidgetSpan(
alignment: .middle,
child: Icon(
size: 14,
MdiIcons.unfoldMoreHorizontal,
color: color,
),
),
],
);
},
),
),
Material(
clipBehavior: Clip.hardEdge,
type: MaterialType.transparency,
borderRadius: const BorderRadius.all(Radius.circular(20)),
child: PopupMenuButton(
tooltip: '清空',
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
child: Text.rich(
style: TextStyle(fontSize: 14, height: 1, color: color),
strutStyle: const StrutStyle(
leading: 0,
height: 1,
fontSize: 14,
),
TextSpan(
children: [
const TextSpan(text: '清空'),
WidgetSpan(
alignment: .middle,
child: Icon(
size: 14,
MdiIcons.unfoldMoreHorizontal,
color: color,
),
),
],
style: TextStyle(color: color),
),
style: TextStyle(color: color),
),
),
itemBuilder: (BuildContext context) => [
PopupMenuItem(
onTap: () => currCtr().toViewClear(context, 1),
child: const Text('清空失效'),
),
PopupMenuItem(
onTap: () => currCtr().toViewClear(context, 2),
child: const Text('清空看完'),
),
PopupMenuItem(
onTap: () => currCtr().toViewClear(context),
child: const Text('清空全部'),
),
],
),
itemBuilder: (_) => [
PopupMenuItem(
onTap: () => currCtr().toViewClear(context, 1),
child: const Text('清空失效'),
),
PopupMenuItem(
onTap: () => currCtr().toViewClear(context, 2),
child: const Text('清空看完'),
),
PopupMenuItem(
onTap: () => currCtr().toViewClear(context),
child: const Text('清空全部'),
),
],
),
const SizedBox(width: 8),
],