import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ProfileHeaderBlock extends StatelessWidget {
  final String username;
  final String welcomeText;

  const ProfileHeaderBlock({
    super.key,
    required this.username,
    required this.welcomeText,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      color: Colors.white,
      padding: EdgeInsets.only(left: 28.w, right: 28.w, top: ScreenUtil().statusBarHeight + 20.h, bottom: 32.h),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            '我的',
            style: TextStyle(
              fontSize: 32.sp,
              fontWeight: FontWeight.w500,
              color: Colors.black,
            ),
          ),
          SizedBox(height: 40.h),
          Row(
            children: [
              ClipOval(
                child: Image.asset(
                  'lib/assets/icon/user_head.jpg',
                  width: 100.r,
                  height: 100.r,
                  fit: BoxFit.cover,
                  errorBuilder: (context, error, stackTrace) {
                    return Container(
                      width: 100.r,
                      height: 100.r,
                      color: const Color.fromRGBO(235, 244, 255, 1.0),
                      child: Icon(
                        Icons.person,
                        size: 48.sp,
                        color: const Color.fromRGBO(66, 165, 245, 1.0),
                      ),
                    );
                  },
                ),
              ),
              SizedBox(width: 24.w),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    username,
                    style: TextStyle(
                      fontSize: 32.sp,
                      fontWeight: FontWeight.bold,
                      color: Colors.black,
                    ),
                  ),
                  SizedBox(height: 12.h),
                  Text(
                    welcomeText,
                    style: TextStyle(
                      fontSize: 26.sp,
                      color: const Color.fromRGBO(100, 116, 139, 1.0),
                    ),
                  ),
                ],
              ),
            ],
          ),
        ],
      ),
    );
  }
}