newsfeed_card_content.dart 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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://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'],
  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: Container(
  29. // color: Colors.red,
  30. child: MyTextView(
  31. content,
  32. textColor: ColorUtils.string2Color('#000000'),
  33. fontSize: 15,
  34. maxLines: 3,
  35. isTextEllipsis: true,
  36. ),
  37. ),
  38. ),
  39. const SizedBox(height: 12),
  40. // 图片
  41. if (imageUrls != null && imageUrls!.isNotEmpty)
  42. Container(
  43. width: double.infinity,
  44. height: 87,
  45. child: Row(
  46. mainAxisAlignment: MainAxisAlignment.center,
  47. children: [
  48. for (var item in imageUrls!)
  49. Expanded(
  50. child: Container(
  51. // width: 87,
  52. // height: 87,
  53. // margin: const EdgeInsets.only(right: 30),
  54. margin: const EdgeInsets.only(left: 15,right: 18),
  55. color: ColorUtils.string2Color("#F2F3F6"),
  56. ),
  57. )
  58. ],
  59. ),
  60. )
  61. ]
  62. ),
  63. );
  64. }
  65. }