细节修改

This commit is contained in:
Seven Tsui 2025-09-18 15:33:14 +08:00
parent dae777249e
commit a000a4aeea
7 changed files with 193 additions and 65 deletions

View File

@ -51,6 +51,7 @@ class ChatPageState extends State<ChatPage> {
// //
double posDX = 0.0; double posDX = 0.0;
double posDY = 0.0; double posDY = 0.0;
late RxInt followed = 0.obs; //
// //
Future<void> handleRefresh() async { Future<void> handleRefresh() async {
@ -102,17 +103,37 @@ class ChatPageState extends State<ChatPage> {
Get.toNamed('/vloger', arguments: {'memberId': value}); Get.toNamed('/vloger', arguments: {'memberId': value});
} }
// 广 //
checkFollowType(memberId) async {
/// 0
/// 1
/// 2
/// 3
final res = await ImService.instance.checkFollowType(userIDList: [memberId]);
if (res.success) {
final followType = res.data?.first.followType ?? 0;
logger.i(res.data?.first.toJson());
followed.value = followType;
logger.i(followed.value);
}
}
// 广IM互相关注逻辑
void _handlePromotionCode(String value) async { void _handlePromotionCode(String value) async {
try { await checkFollowType(value); //
print('处理推广码111: $value'); if(followed.value == 0 || followed.value == 2){
final res = await ImService.instance.followUser(userIDList: [value]);
if (res.success) {
followed.value = followed.value == 0 ? 1 : 3;
final res = await Http.post(ShopApi.bindSpreadCodeId, data: {"socialCode": value}); final res = await Http.post(ShopApi.bindSpreadCodeId, data: {"socialCode": value});
if (res != null && res['code'] == 200) { if (res != null && res['code'] == 200) {
MyDialog.toast('推广码绑定失败', icon: const Icon(Icons.check_circle), style: ToastStyle(backgroundColor: Colors.green.withAlpha(200))); MyDialog.toast('推广码绑定成功', icon: const Icon(Icons.check_circle), style: ToastStyle(backgroundColor: Colors.green.withAlpha(200)));
Get.toNamed('/vloger', arguments: {'memberId': value}); Get.toNamed('/vloger', arguments: {'memberId': value});
} }
} catch (e) { }
MyDialog.toast('推广码绑定失败'); }else{
Get.toNamed('/vloger', arguments: {'memberId': value});
} }
} }

View File

@ -274,9 +274,110 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
loadData(0); loadData(0);
} }
} catch (e) { } catch (e) {
logger.e('删除视频失败: $e');
} }
} }
//
void showDeleteConfirmDialog(String videoId) {
Get.dialog(
Dialog(
backgroundColor: Colors.white,
surfaceTintColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
//
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.red.withOpacity(0.1),
shape: BoxShape.circle,
),
child: Icon(
Icons.delete_outline,
color: Colors.red,
size: 30,
),
),
SizedBox(height: 16),
//
Text(
'删除视频',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
SizedBox(height: 8),
//
Text(
'确认要删除这个视频吗?\n删除后将无法恢复',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
height: 1.4,
),
),
SizedBox(height: 24),
//
Row(
children: [
//
Expanded(
child: OutlinedButton(
onPressed: () => Get.back(),
style: OutlinedButton.styleFrom(
backgroundColor: Colors.transparent,
foregroundColor: Colors.grey[700],
side: BorderSide(color: Colors.grey[300]!),
padding: EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Text('取消'),
),
),
SizedBox(width: 12),
//
Expanded(
child: ElevatedButton(
onPressed: () {
Get.back();
deletePersonalVideo(videoId);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
foregroundColor: Colors.white,
padding: EdgeInsets.symmetric(vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
elevation: 0,
),
child: Text('确认删除'),
),
),
],
),
],
),
),
),
barrierDismissible: true,
);
}
// //
void qrcodeAlertDialog(BuildContext context) { void qrcodeAlertDialog(BuildContext context) {
showDialog( showDialog(
@ -614,14 +715,7 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
title: const Text('删除视频', style: TextStyle(color: Colors.redAccent)), title: const Text('删除视频', style: TextStyle(color: Colors.redAccent)),
onTap: () async { onTap: () async {
Get.back(); Get.back();
final confirmed = await ConfirmDialog.show( showDeleteConfirmDialog(item['id']);
title: "提示",
content: "确认要删除吗?",
);
if (confirmed == true) {
Get.back();
deletePersonalVideo(item['id']);
}
}, },
), ),
], ],

View File

@ -8,6 +8,7 @@ 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/common_api.dart';
import 'package:loopin/api/video_api.dart'; import 'package:loopin/api/video_api.dart';
import 'package:loopin/utils/index.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';
import 'package:loopin/styles/index.dart'; import 'package:loopin/styles/index.dart';
@ -565,7 +566,7 @@ class MyPageState extends State<Vloger> with SingleTickerProviderStateMixin {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Column(children: [Text('9999', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), SizedBox(height: 3.0), Text('获赞')]), Column(children: [Text('${Utils.graceNumber(vlogLikeCount)}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), SizedBox(height: 3.0), Text('获赞')]),
Column(children: [ Column(children: [
Text('${followInfo.value.followingCount}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), Text('${followInfo.value.followingCount}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)),
SizedBox(height: 3.0), SizedBox(height: 3.0),

View File

@ -509,6 +509,9 @@ class _SearchResultPageState extends State<SearchResultPage> with SingleTickerPr
} }
// //
//
//
//
Widget _buildVideoItem(Map<String, dynamic> video) { Widget _buildVideoItem(Map<String, dynamic> video) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
@ -531,65 +534,71 @@ class _SearchResultPageState extends State<SearchResultPage> with SingleTickerPr
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// - 100% // -
ClipRRect( ClipRRect(
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
topLeft: Radius.circular(_itemCornerRadius), topLeft: Radius.circular(_itemCornerRadius),
topRight: Radius.circular(_itemCornerRadius), topRight: Radius.circular(_itemCornerRadius),
), ),
child: AspectRatio(
aspectRatio: 0.8, // 1:1.2
child: Container( child: Container(
width: double.infinity,
color: Colors.grey[200], color: Colors.grey[200],
child: video['firstFrameImg'] != null && video['firstFrameImg'].toString().isNotEmpty child: video['firstFrameImg'] != null && video['firstFrameImg'].toString().isNotEmpty
? Image.network( ? Image.network(
video['firstFrameImg'].toString(), video['firstFrameImg'].toString(),
fit: BoxFit.cover, fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,
errorBuilder: (context, error, stackTrace) { errorBuilder: (context, error, stackTrace) {
return Container( return Container(
height: 120, color: Colors.grey[200],
alignment: Alignment.center, child: const Center(
child: const Icon( child: Icon(
Icons.videocam, Icons.videocam,
color: Colors.grey, color: Colors.grey,
size: 40, // size: 32,
),
), ),
); );
}, },
) )
: Container( : Container(
height: 200, color: Colors.grey[200],
alignment: Alignment.center, child: const Center(
child: LayoutBuilder( child: Icon(
builder: (context, constraints) {
return Icon(
Icons.videocam, Icons.videocam,
color: Colors.grey, color: Colors.grey,
); size: 32,
},
), ),
), ),
), ),
), ),
// - ),
),
// 使Expanded将信息区域推到底部
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end, // mainAxisAlignment: MainAxisAlignment.spaceBetween, //
children: [ children: [
// - 1
Text( Text(
video['title']?.toString() ?? '无标题', video['title']?.toString() ?? '无标题',
style: const TextStyle( style: const TextStyle(
fontSize: 11, fontSize: 11,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
height: 1.2,
), ),
maxLines: 1, // 1 maxLines: 1, // 1
overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
), ),
const SizedBox(height: 4), // -
Row( Row(
children: [ children: [
//
Container( Container(
width: 18, width: 18,
height: 18, height: 18,
@ -603,9 +612,12 @@ class _SearchResultPageState extends State<SearchResultPage> with SingleTickerPr
) )
: null, : null,
), ),
child: video['avatar'] == null || video['avatar'].toString().isEmpty ? const Icon(Icons.person, size: 10, color: Colors.grey) : null, child: video['avatar'] == null || video['avatar'].toString().isEmpty
? const Icon(Icons.person, size: 10, color: Colors.grey)
: null,
), ),
const SizedBox(width: 4), const SizedBox(width: 6),
//
Expanded( Expanded(
child: Text( child: Text(
video['nickname']?.toString() ?? '未知作者', video['nickname']?.toString() ?? '未知作者',
@ -617,7 +629,7 @@ class _SearchResultPageState extends State<SearchResultPage> with SingleTickerPr
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
const SizedBox(width: 6), //
Row( Row(
children: [ children: [
const Icon(Icons.favorite_border, size: 10, color: Colors.grey), const Icon(Icons.favorite_border, size: 10, color: Colors.grey),

View File

@ -1295,7 +1295,7 @@ class _AttentionModuleState extends State<AttentionModule> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'@${videoList[videoModuleController.videoPlayIndex.value]['commentUserNickname'] ?? '未知'}', '@${videoList[videoModuleController.videoPlayIndex.value]['nickname'] ?? '未知'}',
style: const TextStyle(color: Colors.white, fontSize: 16.0), style: const TextStyle(color: Colors.white, fontSize: 16.0),
), ),
LayoutBuilder( LayoutBuilder(

View File

@ -1300,7 +1300,7 @@ class _FriendModuleState extends State<FriendModule> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'@${videoList[videoModuleController.videoPlayIndex.value]['commentUserNickname'] ?? '未知'}', '@${videoList[videoModuleController.videoPlayIndex.value]['nickname'] ?? '未知'}',
style: const TextStyle(color: Colors.white, fontSize: 16.0), style: const TextStyle(color: Colors.white, fontSize: 16.0),
), ),
LayoutBuilder( LayoutBuilder(

View File

@ -1301,7 +1301,7 @@ class _RecommendModuleState extends State<RecommendModule> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'@${videoList[videoModuleController.videoPlayIndex.value]['commentUserNickname'] ?? '未知'}', '@${videoList[videoModuleController.videoPlayIndex.value]['nickname'] ?? '未知'}',
style: const TextStyle(color: Colors.white, fontSize: 16.0), style: const TextStyle(color: Colors.white, fontSize: 16.0),
), ),
LayoutBuilder( LayoutBuilder(