mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-24 20:35:50 +08:00
@@ -82,8 +82,11 @@ class _MediaPageState extends CommonPageState<MediaPage, MediaController>
|
||||
color: primary,
|
||||
),
|
||||
),
|
||||
contentPadding:
|
||||
const EdgeInsets.only(left: 15, top: 2, bottom: 2),
|
||||
contentPadding: const EdgeInsets.only(
|
||||
left: 15,
|
||||
top: 2,
|
||||
bottom: 2,
|
||||
),
|
||||
minLeadingWidth: 0,
|
||||
title: Text(
|
||||
item.title,
|
||||
@@ -94,7 +97,7 @@ class _MediaPageState extends CommonPageState<MediaPage, MediaController>
|
||||
() => controller.loadingState.value is Loading
|
||||
? const SizedBox.shrink()
|
||||
: favFolder(theme),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -127,8 +130,9 @@ class _MediaPageState extends CommonPageState<MediaPage, MediaController>
|
||||
TextSpan(
|
||||
text: '我的收藏 ',
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.titleMedium!.fontSize,
|
||||
fontWeight: FontWeight.bold),
|
||||
fontSize: theme.textTheme.titleMedium!.fontSize,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
if (count != -1)
|
||||
TextSpan(
|
||||
@@ -171,69 +175,71 @@ class _MediaPageState extends CommonPageState<MediaPage, MediaController>
|
||||
return switch (loadingState) {
|
||||
Loading() => const SizedBox.shrink(),
|
||||
Success(:var response) => Builder(
|
||||
builder: (context) {
|
||||
List<FavFolderInfo>? favFolderList = response.list;
|
||||
if (favFolderList.isNullOrEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
bool flag = controller.count.value > favFolderList!.length;
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.only(left: 20),
|
||||
itemCount: response.list.length + (flag ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (flag && index == favFolderList.length) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 14, bottom: 35),
|
||||
child: Center(
|
||||
child: IconButton(
|
||||
tooltip: '查看更多',
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
backgroundColor:
|
||||
WidgetStateProperty.resolveWith((states) {
|
||||
return theme.colorScheme.primaryContainer
|
||||
.withValues(alpha: 0.5);
|
||||
}),
|
||||
),
|
||||
onPressed: () async {
|
||||
await Get.toNamed('/fav');
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
controller.onRefresh();
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
builder: (context) {
|
||||
List<FavFolderInfo>? favFolderList = response.list;
|
||||
if (favFolderList.isNullOrEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
bool flag = controller.count.value > favFolderList!.length;
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.only(left: 20),
|
||||
itemCount: response.list.length + (flag ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (flag && index == favFolderList.length) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 14, bottom: 35),
|
||||
child: Center(
|
||||
child: IconButton(
|
||||
tooltip: '查看更多',
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
backgroundColor: WidgetStateProperty.resolveWith((
|
||||
states,
|
||||
) {
|
||||
return theme.colorScheme.primaryContainer.withValues(
|
||||
alpha: 0.5,
|
||||
);
|
||||
}),
|
||||
),
|
||||
onPressed: () async {
|
||||
await Get.toNamed('/fav');
|
||||
Future.delayed(const Duration(milliseconds: 150), () {
|
||||
controller.onRefresh();
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return FavFolderItem(
|
||||
heroTag: Utils.generateRandomString(8),
|
||||
item: response.list[index],
|
||||
callback: () => Future.delayed(
|
||||
const Duration(milliseconds: 150),
|
||||
controller.onRefresh,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
scrollDirection: Axis.horizontal,
|
||||
separatorBuilder: (context, index) => const SizedBox(width: 14),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return FavFolderItem(
|
||||
heroTag: Utils.generateRandomString(8),
|
||||
item: response.list[index],
|
||||
callback: () => Future.delayed(
|
||||
const Duration(milliseconds: 150),
|
||||
controller.onRefresh,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
scrollDirection: Axis.horizontal,
|
||||
separatorBuilder: (context, index) => const SizedBox(width: 14),
|
||||
);
|
||||
},
|
||||
),
|
||||
Error(:var errMsg) => SizedBox(
|
||||
height: 160,
|
||||
child: Center(
|
||||
child: Text(
|
||||
errMsg ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
height: 160,
|
||||
child: Center(
|
||||
child: Text(
|
||||
errMsg ?? '',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user