mod: 合集
This commit is contained in:
@ -192,12 +192,17 @@ class MemberController extends GetxController {
|
|||||||
Share.share('${memberInfo.value.name} - https://space.bilibili.com/$mid');
|
Share.share('${memberInfo.value.name} - https://space.bilibili.com/$mid');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求专栏
|
// 请求合集
|
||||||
Future getMemberSeasons() async {
|
Future getMemberSeasons() async {
|
||||||
if (userInfo == null) return;
|
if (userInfo == null) return;
|
||||||
var res = await MemberHttp.getMemberSeasons(mid, 1, 10);
|
var res = await MemberHttp.getMemberSeasons(mid, 1, 10);
|
||||||
if (!res['status']) {
|
if (!res['status']) {
|
||||||
SmartDialog.showToast("用户专栏请求异常:${res['msg']}");
|
SmartDialog.showToast("用户专栏请求异常:${res['msg']}");
|
||||||
|
} else {
|
||||||
|
// 只取前四个专栏
|
||||||
|
res['data'].seasonsList.map((e) {
|
||||||
|
e.archives = e.archives!.sublist(0, 4);
|
||||||
|
}).toList();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -178,39 +178,37 @@ class _MemberPageState extends State<MemberPage>
|
|||||||
|
|
||||||
/// 专栏
|
/// 专栏
|
||||||
const ListTile(title: Text('Ta的专栏')),
|
const ListTile(title: Text('Ta的专栏')),
|
||||||
|
const Divider(height: 1, thickness: 0.1),
|
||||||
|
|
||||||
|
/// 合集
|
||||||
|
const ListTile(title: Text('Ta的合集')),
|
||||||
MediaQuery.removePadding(
|
MediaQuery.removePadding(
|
||||||
removeTop: true,
|
removeTop: true,
|
||||||
removeBottom: true,
|
removeBottom: true,
|
||||||
context: context,
|
context: context,
|
||||||
child: Padding(
|
child: FutureBuilder(
|
||||||
padding: const EdgeInsets.only(
|
future: _memberSeasonsFuture,
|
||||||
left: StyleString.safeSpace,
|
builder: (context, snapshot) {
|
||||||
right: StyleString.safeSpace,
|
if (snapshot.connectionState ==
|
||||||
),
|
ConnectionState.done) {
|
||||||
child: FutureBuilder(
|
if (snapshot.data == null) {
|
||||||
future: _memberSeasonsFuture,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState ==
|
|
||||||
ConnectionState.done) {
|
|
||||||
if (snapshot.data == null) {
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
if (snapshot.data['status']) {
|
|
||||||
Map data = snapshot.data as Map;
|
|
||||||
if (data['data'].seasonsList.isEmpty) {
|
|
||||||
return commenWidget('用户没有设置专栏');
|
|
||||||
} else {
|
|
||||||
return MemberSeasonsPanel(data: data['data']);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 请求错误
|
|
||||||
return const SizedBox();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
},
|
if (snapshot.data['status']) {
|
||||||
),
|
Map data = snapshot.data as Map;
|
||||||
|
if (data['data'].seasonsList.isEmpty) {
|
||||||
|
return commenWidget('用户没有设置合集');
|
||||||
|
} else {
|
||||||
|
return MemberSeasonsPanel(data: data['data']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 请求错误
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class MemberSeasonsPanel extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => Get.toNamed(
|
onTap: () => Get.toNamed(
|
||||||
'/memberSeasons?mid=${item.meta!.mid}&seasonId=${item.meta!.seasonId}'),
|
'/memberSeasons?mid=${item.meta!.mid}&seasonId=${item.meta!.seasonId}&seasonName=${item.meta!.name}'),
|
||||||
title: Text(
|
title: Text(
|
||||||
item.meta!.name!,
|
item.meta!.name!,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
@ -44,24 +44,30 @@ class MemberSeasonsPanel extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
LayoutBuilder(
|
Padding(
|
||||||
builder: (context, boxConstraints) {
|
padding: const EdgeInsets.only(
|
||||||
return GridView.builder(
|
left: StyleString.safeSpace,
|
||||||
gridDelegate:
|
right: StyleString.safeSpace,
|
||||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
),
|
||||||
crossAxisCount: 2, // Use a fixed count for GridView
|
child: LayoutBuilder(
|
||||||
crossAxisSpacing: StyleString.safeSpace,
|
builder: (context, boxConstraints) {
|
||||||
mainAxisSpacing: StyleString.safeSpace,
|
return GridView.builder(
|
||||||
childAspectRatio: 0.94,
|
gridDelegate:
|
||||||
),
|
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
crossAxisCount: 2, // Use a fixed count for GridView
|
||||||
shrinkWrap: true,
|
crossAxisSpacing: StyleString.safeSpace,
|
||||||
itemCount: item.archives!.length,
|
mainAxisSpacing: StyleString.safeSpace,
|
||||||
itemBuilder: (context, i) {
|
childAspectRatio: 0.94,
|
||||||
return MemberSeasonsItem(seasonItem: item.archives![i]);
|
),
|
||||||
},
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
);
|
shrinkWrap: true,
|
||||||
},
|
itemCount: item.archives!.length,
|
||||||
|
itemBuilder: (context, i) {
|
||||||
|
return MemberSeasonsItem(seasonItem: item.archives![i]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -43,7 +43,8 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Text('他的专栏', style: Theme.of(context).textTheme.titleMedium),
|
title: Text(Get.parameters['seasonName']!,
|
||||||
|
style: Theme.of(context).textTheme.titleMedium),
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
|
Reference in New Issue
Block a user