细节修改
This commit is contained in:
parent
6808729de1
commit
dae777249e
@ -6,6 +6,7 @@ import 'package:loopin/IM/controller/chat_controller.dart';
|
||||
import 'package:loopin/IM/im_service.dart';
|
||||
import 'package:loopin/service/http.dart';
|
||||
import 'package:loopin/components/custom_sticky_header.dart';
|
||||
import 'package:loopin/api/common_api.dart';
|
||||
import 'package:loopin/api/video_api.dart';
|
||||
import 'package:loopin/components/network_or_asset_image.dart';
|
||||
import 'package:loopin/components/only_down_scroll_physics.dart';
|
||||
@ -66,7 +67,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
||||
List tabList = [
|
||||
{'name': "作品"},
|
||||
];
|
||||
|
||||
late int vlogLikeCount = 0; // 点赞数量
|
||||
late PageParams itemsParams;
|
||||
late PageParams favoriteParams;
|
||||
|
||||
@ -110,6 +111,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
||||
tabController.addListener(tabListener);
|
||||
|
||||
loadData(0);
|
||||
getUserLikesCount();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -122,6 +124,18 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// 获取用户的所有视频的点赞数量
|
||||
void getUserLikesCount() async {
|
||||
try {
|
||||
final resData = await Http.get(CommonApi.accountInfo+'?memberId=${args['memberId']}');
|
||||
print('aaaaaaaaaaaaaaaaaaa${resData}');
|
||||
if(resData != null && resData['code'] == 200){
|
||||
vlogLikeCount = resData['data']['vlogLikeCount']??0;
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
}
|
||||
void loadData([int? tabIndex]) async {
|
||||
final index = tabIndex ?? currentTabIndex.value;
|
||||
if (index == 0) {
|
||||
@ -351,13 +365,81 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
||||
sliver: SliverGrid(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue[100 * ((index % 8) + 1)],
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
final item = listToShow[index];
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
// 点击跳转到视频播放详情页面
|
||||
Get.toNamed('/videoDetail', arguments: {'videoId': item['id']});
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
// 视频封面图片
|
||||
NetworkOrAssetImage(
|
||||
imageUrl: item['firstFrameImg'] ?? item['cover'],
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
// placeholderAsset: 'assets/images/video_placeholder.png',
|
||||
),
|
||||
// 半透明渐变底部背景
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
colors: [
|
||||
Colors.black.withOpacity(0.6),
|
||||
Colors.transparent,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 右下角点赞数
|
||||
Positioned(
|
||||
right: 8,
|
||||
bottom: 8,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.favorite,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${item['likeCounts'] ?? 0}',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(listToShow[index], style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
);
|
||||
},
|
||||
childCount: listToShow.length,
|
||||
@ -366,7 +448,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
||||
crossAxisCount: 3,
|
||||
crossAxisSpacing: 10.0,
|
||||
mainAxisSpacing: 10.0,
|
||||
childAspectRatio: 1.0,
|
||||
childAspectRatio: 0.7, // 调整为更适合视频封面的比例
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -374,7 +456,9 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||
child: Center(
|
||||
child: params.hasMore ? const CircularProgressIndicator() : const Text('没有更多数据了'),
|
||||
child: params.hasMore
|
||||
? const CircularProgressIndicator()
|
||||
: const Text('没有更多数据了'),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user