初始化
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/extension/extensions.dart';
|
||||
import 'package:hgdj/hj_page/user_center_page/user_center_logic.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/global_store/store.dart';
|
||||
import 'package:hgdj/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 [
|
||||
FollowButton(
|
||||
mediaId: (logic.model?.uid ?? 0).toString(),
|
||||
followType: FollowEnum.user,
|
||||
isFollow: logic.model?.isFollow,
|
||||
successsAction: logic.onUserFollowSuccess,
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user