newsfeed_card_content.dart 2.3 KB

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