细节修改

This commit is contained in:
Seven Tsui 2025-09-17 18:09:07 +08:00
parent 6808729de1
commit dae777249e

View File

@ -6,6 +6,7 @@ import 'package:loopin/IM/controller/chat_controller.dart';
import 'package:loopin/IM/im_service.dart'; import 'package:loopin/IM/im_service.dart';
import 'package:loopin/service/http.dart'; import 'package:loopin/service/http.dart';
import 'package:loopin/components/custom_sticky_header.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/api/video_api.dart';
import 'package:loopin/components/network_or_asset_image.dart'; import 'package:loopin/components/network_or_asset_image.dart';
import 'package:loopin/components/only_down_scroll_physics.dart'; import 'package:loopin/components/only_down_scroll_physics.dart';
@ -66,7 +67,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
List tabList = [ List tabList = [
{'name': "作品"}, {'name': "作品"},
]; ];
late int vlogLikeCount = 0; //
late PageParams itemsParams; late PageParams itemsParams;
late PageParams favoriteParams; late PageParams favoriteParams;
@ -110,6 +111,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
tabController.addListener(tabListener); tabController.addListener(tabListener);
loadData(0); loadData(0);
getUserLikesCount();
} }
@override @override
@ -122,6 +124,18 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
super.dispose(); 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 { void loadData([int? tabIndex]) async {
final index = tabIndex ?? currentTabIndex.value; final index = tabIndex ?? currentTabIndex.value;
if (index == 0) { if (index == 0) {
@ -351,13 +365,81 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
sliver: SliverGrid( sliver: SliverGrid(
delegate: SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(context, index) { (context, index) {
return Container( final item = listToShow[index];
decoration: BoxDecoration( return GestureDetector(
color: Colors.blue[100 * ((index % 8) + 1)], onTap: () {
borderRadius: BorderRadius.circular(10.0), //
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, childCount: listToShow.length,
@ -366,7 +448,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
crossAxisCount: 3, crossAxisCount: 3,
crossAxisSpacing: 10.0, crossAxisSpacing: 10.0,
mainAxisSpacing: 10.0, mainAxisSpacing: 10.0,
childAspectRatio: 1.0, childAspectRatio: 0.7, //
), ),
), ),
), ),
@ -374,7 +456,9 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0), padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Center( child: Center(
child: params.hasMore ? const CircularProgressIndicator() : const Text('没有更多数据了'), child: params.hasMore
? const CircularProgressIndicator()
: const Text('没有更多数据了'),
), ),
), ),
), ),