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/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/member.dart';
|
import 'package:PiliPlus/http/member.dart';
|
||||||
import 'package:PiliPlus/http/video.dart';
|
import 'package:PiliPlus/http/video.dart';
|
||||||
@@ -46,6 +48,14 @@ class MemberControllerNew extends CommonController
|
|||||||
int? silence;
|
int? silence;
|
||||||
String? endTime;
|
String? endTime;
|
||||||
|
|
||||||
|
late final implTabs = const [
|
||||||
|
'home',
|
||||||
|
'dynamic',
|
||||||
|
'contribute',
|
||||||
|
'favorite',
|
||||||
|
'bangumi',
|
||||||
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool customHandleResponse(Success response) {
|
bool customHandleResponse(Success response) {
|
||||||
Data data = response.response;
|
Data data = response.response;
|
||||||
@@ -90,11 +100,12 @@ class MemberControllerNew extends CommonController
|
|||||||
return item.param == data.defaultTab;
|
return item.param == data.defaultTab;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
tab2!.retainWhere((item) => implTabs.contains(item.param));
|
||||||
tabs = tab2!.map((item) => Tab(text: item.title ?? '')).toList();
|
tabs = tab2!.map((item) => Tab(text: item.title ?? '')).toList();
|
||||||
tabController = TabController(
|
tabController = TabController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
length: tab2!.length,
|
length: tabs.length,
|
||||||
initialIndex: initialIndex == -1 ? 0 : initialIndex,
|
initialIndex: max(0, initialIndex),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user