item_home_last_news.dart 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:cpt_main/modules/feedback/feedback_page.dart';
  2. import 'package:cs_resources/theme/app_colors_theme.dart';
  3. import 'package:flutter/material.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. class LastNewsItem extends StatelessWidget {
  8. final Map<String, dynamic> lastNews;
  9. LastNewsItem({required this.lastNews});
  10. @override
  11. Widget build(BuildContext context) {
  12. return Column(
  13. crossAxisAlignment: CrossAxisAlignment.start,
  14. mainAxisAlignment: MainAxisAlignment.start,
  15. children: [
  16. MyTextView(
  17. lastNews['category_name'],
  18. marginLeft: 9,
  19. marginTop: 9,
  20. fontSize: 14,
  21. isFontMedium: true,
  22. textColor: context.appColors.tabTextUnSelectedPrimary,
  23. ),
  24. const Spacer(),
  25. Row(
  26. mainAxisAlignment: MainAxisAlignment.end, // 对齐到右侧
  27. children: [
  28. Padding(
  29. padding: EdgeInsets.only(right: lastNews['margin_right']), // 控制边距
  30. child: MyAssetImage(
  31. lastNews['category_icon'],
  32. width: (lastNews['icon_width'] as num).toDouble(),
  33. height: (lastNews['icon_height'] as num).toDouble(),
  34. fit: BoxFit.cover, // 调整 fit 参数
  35. ),
  36. ),
  37. ],
  38. ),
  39. ],
  40. // ),
  41. )
  42. .decorated(
  43. color: context.appColors.whiteBG,
  44. borderRadius: BorderRadius.circular(5.0), // 5个圆角
  45. boxShadow: [
  46. BoxShadow(
  47. color: const Color(0xFF656565).withOpacity(0.1), // 阴影颜色,并且设置透明度
  48. offset: const Offset(0, 1.5), // 阴影的偏移量
  49. blurRadius: 2.5, // 模糊半径
  50. spreadRadius: 1.5, // 扩散半径
  51. ),
  52. ],
  53. )
  54. .marginOnly(right: 5)
  55. .constrained(width: 86.5, height: 78.5);
  56. }
  57. }