mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 20:12:35 +08:00
@@ -18,15 +18,17 @@ class MemberOpusController
|
||||
final int mid;
|
||||
|
||||
String offset = '';
|
||||
Rx<SpaceTabFilter> type =
|
||||
const SpaceTabFilter(text: "全部图文", meta: "all", tabName: "图文").obs;
|
||||
Rx<SpaceTabFilter> type = const SpaceTabFilter(
|
||||
text: "全部图文",
|
||||
meta: "all",
|
||||
tabName: "图文",
|
||||
).obs;
|
||||
List<SpaceTabFilter>? filter;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
filter = Get.find<MemberController>(tag: heroTag)
|
||||
.tab2
|
||||
filter = Get.find<MemberController>(tag: heroTag).tab2
|
||||
?.firstWhereOrNull((e) => e.param == 'contribute')
|
||||
?.items
|
||||
?.firstWhereOrNull((e) => e.param == 'opus')
|
||||
@@ -51,9 +53,9 @@ class MemberOpusController
|
||||
|
||||
@override
|
||||
Future<LoadingState<SpaceOpusData>> customGetData() => MemberHttp.spaceOpus(
|
||||
hostMid: mid,
|
||||
page: page,
|
||||
offset: offset,
|
||||
type: type.value.meta,
|
||||
);
|
||||
hostMid: mid,
|
||||
page: page,
|
||||
offset: offset,
|
||||
type: type.value.meta,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ class _MemberOpusState extends State<MemberOpus>
|
||||
..onReload();
|
||||
},
|
||||
tileColor: e == _controller.type.value
|
||||
? Theme.of(context)
|
||||
.colorScheme
|
||||
.onInverseSurface
|
||||
? Theme.of(
|
||||
context,
|
||||
).colorScheme.onInverseSurface
|
||||
: null,
|
||||
dense: true,
|
||||
title: Text(
|
||||
@@ -117,34 +117,36 @@ class _MemberOpusState extends State<MemberOpus>
|
||||
Widget _buildBody(LoadingState<List<SpaceOpusItemModel>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverWaterfallFlow.extent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
children: List.generate(10, (_) => const SpaceOpusSkeleton()),
|
||||
),
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? SliverWaterfallFlow.extent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
lastChildLayoutTypeBuilder: (index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return index == response.length
|
||||
? LastChildLayoutType.foot
|
||||
: LastChildLayoutType.none;
|
||||
},
|
||||
children:
|
||||
response!.map((item) => SpaceOpusItem(item: item)).toList(),
|
||||
)
|
||||
: HttpError(
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
children: List.generate(10, (_) => const SpaceOpusSkeleton()),
|
||||
),
|
||||
Success(:var response) =>
|
||||
response?.isNotEmpty == true
|
||||
? SliverWaterfallFlow.extent(
|
||||
maxCrossAxisExtent: Grid.smallCardWidth,
|
||||
mainAxisSpacing: StyleString.safeSpace,
|
||||
crossAxisSpacing: StyleString.safeSpace,
|
||||
lastChildLayoutTypeBuilder: (index) {
|
||||
if (index == response.length - 1) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
return index == response.length
|
||||
? LastChildLayoutType.foot
|
||||
: LastChildLayoutType.none;
|
||||
},
|
||||
children: response!
|
||||
.map((item) => SpaceOpusItem(item: item))
|
||||
.toList(),
|
||||
)
|
||||
: HttpError(
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
Error(:var errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,10 @@ class SpaceOpusItem extends StatelessWidget {
|
||||
),
|
||||
if (item.content?.isNotEmpty == true)
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 10,
|
||||
),
|
||||
child: Text(
|
||||
item.content!,
|
||||
maxLines: hasPic ? 4 : 6,
|
||||
|
||||
Reference in New Issue
Block a user