Initial commit: 91dj android client dev_1.0.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jydj/assets_tool/app_colors.dart';
|
||||
import 'package:jydj/assets_tool/images.dart';
|
||||
import 'package:jydj/extension/extensions.dart';
|
||||
import 'package:jydj/hj_page/user_center_page/user_center_logic.dart';
|
||||
import 'package:jydj/hj_utils/screen.dart';
|
||||
import 'package:jydj/hj_utils/widget_util.dart';
|
||||
import 'package:jydj/tools_base/global_store/store.dart';
|
||||
import 'package:jydj/tools_base/widget/follow_button.dart';
|
||||
|
||||
import '../../../tools_base/widget/net_image_widget.dart';
|
||||
|
||||
/// 用户中心头部:背景图 + 头像 + 昵称 / 作品粉丝数 / 简介
|
||||
class UserCenterHeader extends StatelessWidget {
|
||||
final UserCenterController logic;
|
||||
|
||||
const UserCenterHeader({super.key, required this.logic});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.black,
|
||||
child: Stack(
|
||||
children: [
|
||||
//背景图,foregroundDecoration 是压在图上的暗色遮罩
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
height: 190,
|
||||
foregroundDecoration: BoxDecoration(color: const Color(0xff151515).withValues(alpha: 0.1)),
|
||||
child: Image.asset("user_center_bg.webp".mineImgPath, fit: BoxFit.fill),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
//背景图 190 高,头像下沿压过来 24,与背景交叠
|
||||
(190 - 24).sizeBoxH,
|
||||
//头像 + 私信/关注按钮
|
||||
SizedBox(
|
||||
height: 80,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Container(
|
||||
height: 80,
|
||||
width: 80,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: const Color(0xff030F18)),
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
child: NetworkImageLoader(
|
||||
imageUrl: logic.model?.portrait ?? "",
|
||||
height: 74,
|
||||
width: 74,
|
||||
borderRadius: 40,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
if (!globalStore.isMe(logic.model?.uid)) ..._actionButtons(),
|
||||
],
|
||||
),
|
||||
),
|
||||
12.sizeBoxH,
|
||||
//昵称
|
||||
Text(
|
||||
logic.model?.name ?? "",
|
||||
style: const TextStyle(
|
||||
color: Color(0xffEFEFEF),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
6.sizeBoxH,
|
||||
//作品数 / 粉丝数
|
||||
Text(
|
||||
"${logic.model?.totalWorkCount ?? "0"} 作品 ${logic.model?.fans?.countStr ?? "0"}粉丝",
|
||||
style: const TextStyle(color: Color(0xff656565), fontSize: 12),
|
||||
),
|
||||
24.sizeBoxH,
|
||||
//个人简介
|
||||
if (logic.model?.summary?.isNotEmpty == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
child: Text(
|
||||
logic.model?.summary ?? "",
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(color: Color(0x99FFFFFF), fontSize: 12, height: 1.5),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
//私信 + 关注,仅他人主页展示
|
||||
List<Widget> _actionButtons() {
|
||||
return [
|
||||
InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: logic.gotoPrivateChat,
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 24,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
color: const Color(0x1AF68804),
|
||||
),
|
||||
child: Text('私信', style: textStyle(10, AppColors.actionRed, FontWeight.w400)),
|
||||
),
|
||||
),
|
||||
12.sizeBoxW,
|
||||
FollowButton(
|
||||
mediaId: (logic.model?.uid ?? 0).toString(),
|
||||
followType: FollowEnum.user,
|
||||
isFollow: logic.model?.isFollow,
|
||||
onSuccess: logic.onUserFollowSuccess,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user