mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: member tab
Closes #260 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/member.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
@@ -46,6 +48,14 @@ class MemberControllerNew extends CommonController
|
||||
int? silence;
|
||||
String? endTime;
|
||||
|
||||
late final implTabs = const [
|
||||
'home',
|
||||
'dynamic',
|
||||
'contribute',
|
||||
'favorite',
|
||||
'bangumi',
|
||||
];
|
||||
|
||||
@override
|
||||
bool customHandleResponse(Success response) {
|
||||
Data data = response.response;
|
||||
@@ -90,11 +100,12 @@ class MemberControllerNew extends CommonController
|
||||
return item.param == data.defaultTab;
|
||||
});
|
||||
}
|
||||
tab2!.retainWhere((item) => implTabs.contains(item.param));
|
||||
tabs = tab2!.map((item) => Tab(text: item.title ?? '')).toList();
|
||||
tabController = TabController(
|
||||
vsync: this,
|
||||
length: tab2!.length,
|
||||
initialIndex: initialIndex == -1 ? 0 : initialIndex,
|
||||
length: tabs.length,
|
||||
initialIndex: max(0, initialIndex),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user