import 'package:cs_resources/theme/app_colors_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:shared/utils/color_utils.dart';
import 'package:widgets/ext/ex_widget.dart';
import 'package:widgets/my_load_image.dart';
import 'package:widgets/my_text_view.dart';

// 'id':1,
// 'avator': Assets.communityCamera,
// 'title': 'William Jefferson',
// 'isFollow': false,
// 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
// 'imageUrls': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500','https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
// 'time': 'June 17,2016 at 7:23 p.m.',
// 'likeno': 12

class NewsFeedCardHeader extends StatelessWidget {
  final String title;
  final String avator;
  final String time;
  final VoidCallback? onTap;

  const NewsFeedCardHeader({
    Key? key,
    required this.title,
    required this.avator,
    required this.time,
    this.onTap,
  }) : super(key: key);



  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.only(left: 0,right: 10,),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          MyLoadImage(
            avator,
            width: 45,
            height: 45,
            isCircle: true,
            fit: BoxFit.cover,
          ).onTap(() {
            // 点击头像
            onTap?.call();
          }),
          Expanded(
            child: Container(
              padding: const EdgeInsets.only(left:10, right: 0),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  MyTextView(
                    title,
                    isFontMedium: true,
                    fontSize: 18,
                    textColor: context.appColors.textBlack,
                    maxLines: 1,
                    isTextEllipsis: true,
                  ),
                  MyTextView(
                    time,
                    isFontRegular: true,
                    fontSize: 13,
                    marginTop: 8,
                    textColor: ColorUtils.string2Color('#767676'),
                    maxLines: 1,
                    isTextEllipsis: true,
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}