mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
wip
This commit is contained in:
@@ -22,6 +22,7 @@ class MemberControllerNew extends CommonController
|
||||
late final List<Tab> tabs;
|
||||
List<Tab2>? tab2;
|
||||
RxInt contributeInitialIndex = 0.obs;
|
||||
double? top;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
|
||||
@@ -30,8 +30,6 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
String? _heroTag;
|
||||
late final MemberControllerNew _userController;
|
||||
|
||||
late double _top;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -49,11 +47,8 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_top = MediaQuery.of(context).padding.top;
|
||||
return MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
child: Scaffold(
|
||||
_userController.top ??= MediaQuery.of(context).padding.top;
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Obx(
|
||||
() => _userController.loadingState.value is Success
|
||||
@@ -101,14 +96,19 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
left: false,
|
||||
bottom: false,
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: _top),
|
||||
SizedBox(height: _userController.top),
|
||||
_buildTab,
|
||||
Expanded(child: _buildBody),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -118,7 +118,6 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
child: _buildUserInfo(_userController.loadingState.value),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -154,15 +153,19 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
Widget _buildAppBar([bool needTab = true]) => DynamicSliverAppBar(
|
||||
Widget _buildAppBar([bool needTab = true]) => MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
removeRight: true,
|
||||
child: DynamicSliverAppBar(
|
||||
leading: Padding(
|
||||
padding: EdgeInsets.only(top: _top),
|
||||
padding: EdgeInsets.only(top: _userController.top ?? 0),
|
||||
child: const BackButton(),
|
||||
),
|
||||
title: Obx(() => _userController.scrollRatio.value == 1 &&
|
||||
_userController.username != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(top: _top),
|
||||
padding: EdgeInsets.only(top: _userController.top ?? 0),
|
||||
child: Text(_userController.username!),
|
||||
)
|
||||
: const SizedBox.shrink()),
|
||||
@@ -181,7 +184,7 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
: null,
|
||||
actions: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: _top),
|
||||
padding: EdgeInsets.only(top: _userController.top ?? 0),
|
||||
child: IconButton(
|
||||
tooltip: '搜索',
|
||||
onPressed: () => Get.toNamed(
|
||||
@@ -190,7 +193,7 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: _top),
|
||||
padding: EdgeInsets.only(top: _userController.top ?? 0),
|
||||
child: PopupMenuButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
|
||||
@@ -264,6 +267,7 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Widget _errorWidget(msg) {
|
||||
@@ -275,7 +279,8 @@ class _MemberPageNewState extends State<MemberPageNew>
|
||||
fn: () {
|
||||
_userController.loadingState.value = LoadingState.loading();
|
||||
_userController.onRefresh();
|
||||
})
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,15 @@ class MemberDynamicsController extends GetxController {
|
||||
bool hasMore = true;
|
||||
RxList<DynamicItemModel> dynamicsList = <DynamicItemModel>[].obs;
|
||||
|
||||
// TODO: refactor
|
||||
late Future futureBuilderFuture;
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
futureBuilderFuture = getMemberDynamic('onRefresh');
|
||||
}
|
||||
|
||||
Future getMemberDynamic(type) async {
|
||||
if (type == 'onRefresh') {
|
||||
offset = '';
|
||||
|
||||
@@ -23,7 +23,6 @@ class MemberDynamicsPage extends StatefulWidget {
|
||||
class _MemberDynamicsPageState extends State<MemberDynamicsPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
late MemberDynamicsController _memberDynamicController;
|
||||
late Future _futureBuilderFuture;
|
||||
late int mid;
|
||||
late bool dynamicsWaterfallFlow;
|
||||
|
||||
@@ -37,8 +36,6 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage>
|
||||
final String heroTag = Utils.makeHeroTag(mid);
|
||||
_memberDynamicController =
|
||||
Get.put(MemberDynamicsController(widget.mid), tag: heroTag);
|
||||
_futureBuilderFuture =
|
||||
_memberDynamicController.getMemberDynamic('onRefresh');
|
||||
// _memberDynamicController.scrollController.addListener(
|
||||
// () {
|
||||
// if (_memberDynamicController.scrollController.position.pixels >=
|
||||
@@ -83,7 +80,7 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage>
|
||||
// controller: _memberDynamicController.scrollController,
|
||||
slivers: [
|
||||
FutureBuilder(
|
||||
future: _futureBuilderFuture,
|
||||
future: _memberDynamicController.futureBuilderFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.data != null) {
|
||||
|
||||
@@ -37,7 +37,7 @@ class HotKeyword extends StatelessWidget {
|
||||
message: i.keyword!,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(6, 5, 0, 5),
|
||||
child: Text(
|
||||
|
||||
Reference in New Issue
Block a user