mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 18:16:54 +08:00
opt fan item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -51,6 +51,7 @@ class _FansPageState extends State<FansPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context).colorScheme;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: widget.mid != null
|
appBar: widget.mid != null
|
||||||
@@ -64,7 +65,7 @@ class _FansPageState extends State<FansPage> {
|
|||||||
slivers: [
|
slivers: [
|
||||||
ViewSliverSafeArea(
|
ViewSliverSafeArea(
|
||||||
sliver: Obx(
|
sliver: Obx(
|
||||||
() => _buildBody(_fansController.loadingState.value),
|
() => _buildBody(theme, _fansController.loadingState.value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -78,7 +79,10 @@ class _FansPageState extends State<FansPage> {
|
|||||||
mainAxisExtent: 66,
|
mainAxisExtent: 66,
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildBody(LoadingState<List<FansItemModel>?> loadingState) {
|
Widget _buildBody(
|
||||||
|
ColorScheme theme,
|
||||||
|
LoadingState<List<FansItemModel>?> loadingState,
|
||||||
|
) {
|
||||||
return switch (loadingState) {
|
return switch (loadingState) {
|
||||||
Loading() => SliverGrid.builder(
|
Loading() => SliverGrid.builder(
|
||||||
gridDelegate: gridDelegate,
|
gridDelegate: gridDelegate,
|
||||||
@@ -93,7 +97,19 @@ class _FansPageState extends State<FansPage> {
|
|||||||
if (index == response.length - 1) {
|
if (index == response.length - 1) {
|
||||||
_fansController.onLoadMore();
|
_fansController.onLoadMore();
|
||||||
}
|
}
|
||||||
final item = response[index];
|
return _buildItem(theme, index, response[index]);
|
||||||
|
},
|
||||||
|
itemCount: response!.length,
|
||||||
|
)
|
||||||
|
: HttpError(onReload: _fansController.onReload),
|
||||||
|
Error(:var errMsg) => HttpError(
|
||||||
|
errMsg: errMsg,
|
||||||
|
onReload: _fansController.onReload,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildItem(ColorScheme theme, int index, FansItemModel item) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 66,
|
height: 66,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
@@ -116,8 +132,7 @@ class _FansPageState extends State<FansPage> {
|
|||||||
? () => showConfirmDialog(
|
? () => showConfirmDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: '确定移除 ${item.uname} ?',
|
title: '确定移除 ${item.uname} ?',
|
||||||
onConfirm: () =>
|
onConfirm: () => _fansController.onRemoveFan(index, item.mid!),
|
||||||
_fansController.onRemoveFan(index, item.mid!),
|
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -136,7 +151,8 @@ class _FansPageState extends State<FansPage> {
|
|||||||
src: item.face,
|
src: item.face,
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
spacing: 5,
|
spacing: 4,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.uname!,
|
item.uname!,
|
||||||
@@ -146,6 +162,7 @@ class _FansPageState extends State<FansPage> {
|
|||||||
item.sign ?? '',
|
item.sign ?? '',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: TextStyle(fontSize: 13, color: theme.outline),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -154,14 +171,5 @@ class _FansPageState extends State<FansPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
itemCount: response!.length,
|
|
||||||
)
|
|
||||||
: HttpError(onReload: _fansController.onReload),
|
|
||||||
Error(:var errMsg) => HttpError(
|
|
||||||
errMsg: errMsg,
|
|
||||||
onReload: _fansController.onReload,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user