Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-03-17 17:09:24 +08:00
parent 7f2682bb7b
commit d1497115da
27 changed files with 118 additions and 141 deletions

View File

@@ -5,7 +5,6 @@ import 'package:PiliPlus/common/widgets/dynamic_sliver_app_bar/dynamic_sliver_ap
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models_new/space/space/data.dart';
import 'package:PiliPlus/pages/coin_log/controller.dart';
import 'package:PiliPlus/pages/exp_log/controller.dart';
import 'package:PiliPlus/pages/log_table/view.dart';
@@ -68,48 +67,74 @@ class _MemberPageState extends State<MemberPage> {
return Material(
color: theme.surface,
child: Obx(
() {
if (_userController.loadingState.value.isSuccess) {
return ExtendedNestedScrollView(
key: _userController.key,
onlyOneScrollInBody: true,
pinnedHeaderSliverHeightBuilder: () =>
kToolbarHeight + MediaQuery.viewPaddingOf(context).top,
headerSliverBuilder: (context, innerBoxIsScrolled) {
() => switch (_userController.loadingState.value) {
Loading() => circularLoading,
Success(:final response) => ExtendedNestedScrollView(
key: _userController.key,
onlyOneScrollInBody: true,
pinnedHeaderSliverHeightBuilder: () =>
kToolbarHeight + MediaQuery.viewPaddingOf(context).top,
headerSliverBuilder: (context, innerBoxIsScrolled) {
if (response != null) {
return [
_buildUserInfo(theme, _userController.loadingState.value),
];
},
body: _userController.tab2?.isNotEmpty == true
? Padding(
padding: EdgeInsets.only(
left: padding.left,
right: padding.right,
DynamicSliverAppBar.medium(
actions: _actions(theme),
title: Text(_userController.username ?? ''),
flexibleSpace: Obx(
() => UserInfoCard(
isOwner:
_userController.mid == _userController.account.mid,
relation: _userController.relation.value,
card: response.card!,
images: response.images!,
onFollow: () => _userController.onFollow(context),
live: _userController.live,
silence: _userController.silence,
headerControllerBuilder: getHeaderController,
),
child: Column(
children: [
if ((_userController.tab2?.length ?? 0) > 1)
SizedBox(
height: 45,
child: TabBar(
controller: _userController.tabController,
tabs: _userController.tabs,
onTap: _userController.onTapTab,
dividerColor: theme.outline.withValues(
alpha: 0.2,
),
),
),
];
}
return [
SliverAppBar(
pinned: true,
actions: _actions(theme),
title: GestureDetector(
onTap: _userController.onReload,
behavior: HitTestBehavior.opaque,
child: Text(_userController.username ?? ''),
),
),
];
},
body: _userController.tab2?.isNotEmpty == true
? Padding(
padding: .only(left: padding.left, right: padding.right),
child: Column(
children: [
if ((_userController.tab2?.length ?? 0) > 1)
SizedBox(
height: 45,
child: TabBar(
controller: _userController.tabController,
tabs: _userController.tabs,
onTap: _userController.onTapTab,
dividerColor: theme.outline.withValues(
alpha: 0.2,
),
),
Expanded(child: _buildBody),
],
),
)
: const Center(child: Text('EMPTY')),
);
}
return Center(
child: _buildUserInfo(theme, _userController.loadingState.value),
);
),
Expanded(child: _buildBody),
],
),
)
: scrollableError,
),
Error(:final errMsg) => scrollErrorWidget(
errMsg: errMsg,
onReload: _userController.onReload,
),
},
),
);
@@ -346,47 +371,4 @@ class _MemberPageState extends State<MemberPage> {
};
}).toList(),
);
Widget _buildUserInfo(
ColorScheme theme,
LoadingState<SpaceData?> userState,
) {
switch (userState) {
case Loading():
return const CircularProgressIndicator();
case Success<SpaceData?>(:final response):
if (response != null) {
return DynamicSliverAppBar.medium(
actions: _actions(theme),
title: Text(_userController.username ?? ''),
flexibleSpace: Obx(
() => UserInfoCard(
isOwner: _userController.mid == _userController.account.mid,
relation: _userController.relation.value,
card: response.card!,
images: response.images!,
onFollow: () => _userController.onFollow(context),
live: _userController.live,
silence: _userController.silence,
headerControllerBuilder: getHeaderController,
),
),
);
}
return SliverAppBar(
pinned: true,
actions: _actions(theme),
title: GestureDetector(
onTap: _userController.onReload,
behavior: HitTestBehavior.opaque,
child: Text(_userController.username ?? ''),
),
);
case Error(:final errMsg):
return scrollErrorWidget(
errMsg: errMsg,
onReload: _userController.onReload,
);
}
}
}