favorite_video_item_widget.dart 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:go_router/go_router.dart';
  4. import 'package:news_app/constant/size_res.dart';
  5. import 'package:news_app/ui/video/video_detail_page.dart';
  6. import 'package:news_app/widget/auth_gesture_detector.dart';
  7. import 'package:news_app/widget/load_image.dart';
  8. import '../../constant/color_res.dart';
  9. import '../../gen/assets.gen.dart';
  10. import '../../model/video_new_model.dart';
  11. import '../../widget/my_txt.dart';
  12. /// @author: bo.zeng
  13. /// @email: cnhbwds@gmail.com
  14. /// @date: 2025 2025/4/9 16:00
  15. /// @description:
  16. class FavoriteVideoItemWidget extends StatelessWidget {
  17. final VideoNewModel? data;
  18. const FavoriteVideoItemWidget({super.key, this.data});
  19. @override
  20. Widget build(BuildContext context) {
  21. return AuthGestureDetector(
  22. onTap: () {
  23. context.push(
  24. '/video/detail',
  25. extra: VideoParam(
  26. id: data?.contentId ?? "",
  27. videoUrl: data?.url ?? "",
  28. ),
  29. );
  30. },
  31. child: Container(
  32. color: Colors.white,
  33. child: Column(
  34. crossAxisAlignment: CrossAxisAlignment.start,
  35. spacing: 5.h,
  36. children: [
  37. Stack(
  38. alignment: Alignment.center,
  39. children: [
  40. LoadImage(
  41. data?.coverImage ?? '',
  42. fit: BoxFit.cover,
  43. width: screenWidth,
  44. holderImg: 'none',
  45. ),
  46. Image.asset(
  47. Assets.images.playIcon.path,
  48. width: 40.w,
  49. height: 40.w,
  50. ),
  51. Positioned(
  52. bottom: 10.w,
  53. left: 10.w,
  54. child: Row(
  55. children: [
  56. myTxt(
  57. text: data?.createTime ?? "",
  58. fontSize: 12.sp,
  59. color: Colors.white,
  60. ),
  61. ],
  62. ),
  63. ),
  64. ],
  65. ),
  66. Padding(
  67. padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
  68. child: myTxt(
  69. text: data?.title ?? "",
  70. fontSize: 16.sp,
  71. fontWeight: FontWeight.bold,
  72. ),
  73. ),
  74. Padding(
  75. padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
  76. child: myTxt(text: "新华日报", fontSize: 14.sp, color: color666666),
  77. ),
  78. SizedBox(height: 10.h),
  79. ],
  80. ),
  81. ),
  82. );
  83. }
  84. }