newsfeed_card_content.dart 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/widgets.dart';
  3. import 'package:shared/utils/color_utils.dart';
  4. import 'package:widgets/my_text_view.dart';
  5. // 'id':1,
  6. // 'avator': Assets.communityCamera,
  7. // 'title': 'William Jefferson',
  8. // 'isFollow': false,
  9. // 'content': 'She said YES and our lives changed.Thank you all for coming to my propose today.We hope everyone can ……[More]',
  10. // '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'],
  11. // 'time': 'June 17,2016 at 7:23 p.m.',
  12. // 'likeno': 12
  13. class NewsFeedCardContent extends StatelessWidget {
  14. const NewsFeedCardContent({
  15. Key? key,
  16. required this.content,
  17. this.imageUrls,
  18. }) : super(key: key);
  19. final String content;
  20. final List? imageUrls;
  21. @override
  22. Widget build(BuildContext context) {
  23. return Container(
  24. padding: const EdgeInsets.symmetric(horizontal: 16),
  25. child: Column(
  26. children: [
  27. Expanded(
  28. child: MyTextView(
  29. content,
  30. textColor: ColorUtils.string2Color('#000000'),
  31. fontSize: 15,
  32. maxLines: 3,
  33. isTextEllipsis: true,
  34. ),
  35. ),
  36. const SizedBox(height: 12),
  37. // 图片
  38. if (imageUrls != null && imageUrls!.isNotEmpty)
  39. Container(
  40. width: double.infinity,
  41. height: 87,
  42. child: Row(
  43. mainAxisAlignment: MainAxisAlignment.center,
  44. children: [
  45. for (var item in imageUrls!)
  46. Expanded(
  47. child: Container(
  48. // width: 87,
  49. // height: 87,
  50. // margin: const EdgeInsets.only(right: 30),
  51. margin: const EdgeInsets.only(left: 15,right: 18),
  52. color: ColorUtils.string2Color("#F2F3F6"),
  53. ),
  54. )
  55. ],
  56. ),
  57. )
  58. ]
  59. ),
  60. );
  61. }
  62. }