mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-05 09:37:52 +08:00
@@ -38,17 +38,40 @@ class FollowChildPage extends StatefulWidget {
|
||||
|
||||
class _FollowChildPageState extends State<FollowChildPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
late final FollowChildController _followController;
|
||||
late String _tag;
|
||||
late FollowChildController _followController;
|
||||
|
||||
String get _newTag =>
|
||||
'${widget.tag ?? Utils.generateRandomString(8)}${widget.tagid}';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initController();
|
||||
}
|
||||
|
||||
void _initController() {
|
||||
_tag = _newTag;
|
||||
_followController = Get.put(
|
||||
FollowChildController(widget.controller, widget.mid, widget.tagid),
|
||||
tag: '${widget.tag ?? Utils.generateRandomString(8)}${widget.tagid}',
|
||||
tag: _tag,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(FollowChildPage oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.tagid != widget.tagid) {
|
||||
final newTag = _newTag;
|
||||
if (Get.isRegistered<FollowChildController>(tag: newTag)) {
|
||||
_followController = Get.find<FollowChildController>(tag: newTag);
|
||||
} else {
|
||||
Get.delete<FollowChildController>(tag: _tag);
|
||||
_initController();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:PiliPlus/models/member/tags.dart';
|
||||
import 'package:PiliPlus/pages/follow/child/child_controller.dart';
|
||||
import 'package:PiliPlus/pages/follow/child/child_view.dart';
|
||||
import 'package:PiliPlus/pages/follow/controller.dart';
|
||||
import 'package:PiliPlus/pages/follow_tag_sort/view.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -71,6 +72,16 @@ class _FollowPageState extends State<FollowPage> {
|
||||
icon: const Icon(Icons.add),
|
||||
tooltip: '新建分组',
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (_followController.followState.value is! Success) {
|
||||
return;
|
||||
}
|
||||
Get.to(FollowTagSortPage(controller: _followController));
|
||||
},
|
||||
icon: const Icon(Icons.sort),
|
||||
tooltip: '分组排序',
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () => Get.toNamed(
|
||||
'/followSearch',
|
||||
@@ -87,10 +98,10 @@ class _FollowPageState extends State<FollowPage> {
|
||||
PopupMenuItem(
|
||||
onTap: () => Get.toNamed('/blackListPage'),
|
||||
child: const Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
spacing: 10,
|
||||
mainAxisSize: .min,
|
||||
children: [
|
||||
Icon(Icons.block, size: 19),
|
||||
SizedBox(width: 10),
|
||||
Text('黑名单管理'),
|
||||
],
|
||||
),
|
||||
@@ -109,10 +120,6 @@ class _FollowPageState extends State<FollowPage> {
|
||||
tagid: item?.tagid,
|
||||
);
|
||||
|
||||
bool _isCustomTag(int? tagid) {
|
||||
return tagid != null && tagid != 0 && tagid != -10 && tagid != -2;
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => m3eLoading,
|
||||
@@ -128,7 +135,7 @@ class _FollowPageState extends State<FollowPage> {
|
||||
return Obx(() {
|
||||
final item = _followController.tabs[index];
|
||||
int? count = item.count;
|
||||
if (_isCustomTag(item.tagid)) {
|
||||
if (Utils.isCustomFollowTag(item.tagid)) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onLongPress: () {
|
||||
|
||||
Reference in New Issue
Block a user