newfeed_card_header.dart 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/widgets.dart';
  3. import 'package:shared/utils/color_utils.dart';
  4. import 'package:widgets/ext/ex_widget.dart';
  5. import 'package:widgets/my_load_image.dart';
  6. import 'package:widgets/my_text_view.dart';
  7. // 'id':1,
  8. // 'avator': Assets.communityCamera,
  9. // 'title': 'William Jefferson',
  10. // 'isFollow': false,
  11. // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
  12. // 'imageUrls': ['https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg','https://img.alicdn.com/tfs/TB1h.o9O4MPMeJjy1XaXXcSsFXa-640-360.jpg'],
  13. // 'time': 'June 17,2016 at 7:23 p.m.',
  14. // 'likeno': 12
  15. class NewsFeedCardHeader extends StatelessWidget {
  16. final String title;
  17. final String avator;
  18. final String time;
  19. final VoidCallback? onTap;
  20. const NewsFeedCardHeader({
  21. Key? key,
  22. required this.title,
  23. required this.avator,
  24. required this.time,
  25. this.onTap,
  26. }) : super(key: key);
  27. @override
  28. Widget build(BuildContext context) {
  29. return Container(
  30. padding: const EdgeInsets.only(left: 16,right: 60),
  31. child: Row(
  32. mainAxisAlignment: MainAxisAlignment.start,
  33. crossAxisAlignment: CrossAxisAlignment.start,
  34. children: [
  35. MyLoadImage(
  36. avator,
  37. width: 45,
  38. height: 45,
  39. isCircle: true,
  40. fit: BoxFit.cover,
  41. ).onTap(() {
  42. // 点击头像
  43. onTap?.call();
  44. }),
  45. Expanded(
  46. child: Container(
  47. padding: const EdgeInsets.only(left:15, right: 40),
  48. // color: Colors.red,
  49. child: Column(
  50. mainAxisAlignment: MainAxisAlignment.start,
  51. crossAxisAlignment: CrossAxisAlignment.start,
  52. children: [
  53. MyTextView(
  54. title,
  55. isFontMedium: true,
  56. fontSize: 18,
  57. textColor: ColorUtils.string2Color('#000000'),
  58. maxLines: 1,
  59. isTextEllipsis: true,
  60. ),
  61. MyTextView(
  62. time,
  63. isFontRegular: true,
  64. fontSize: 13,
  65. marginTop: 8,
  66. textColor: ColorUtils.string2Color('#767676'),
  67. maxLines: 1,
  68. isTextEllipsis: true,
  69. ),
  70. ],
  71. ),
  72. ),
  73. ),
  74. ],
  75. ),
  76. );
  77. }
  78. }