right_action_widget.dart 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_riverpod/flutter_riverpod.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import '../constant/color_res.dart';
  5. import 'auth_gesture_detector.dart';
  6. import 'my_txt.dart';
  7. /// @author: bo.zeng
  8. /// @email: cnhbwds@gmail.com
  9. /// @date: 2025 2025/4/29 0:47
  10. /// @description:
  11. class RightActionWidget extends ConsumerWidget {
  12. final bool isLike;
  13. final bool isFavorite;
  14. //0 点赞 1 收藏 2 分享
  15. final Function(int) tap;
  16. const RightActionWidget({
  17. super.key,
  18. required this.isLike,
  19. required this.isFavorite,
  20. required this.tap,
  21. });
  22. @override
  23. Widget build(BuildContext context, WidgetRef ref) {
  24. return Row(
  25. children: [
  26. AuthGestureDetector(
  27. onTap: () {
  28. tap.call(0);
  29. },
  30. child: Row(
  31. children: [
  32. Icon(
  33. isLike ? Icons.thumb_up_alt : Icons.thumb_up_alt_outlined,
  34. color: isLike ? Colors.red : color7788A0,
  35. size: 13.w,
  36. ),
  37. SizedBox(width: 1.w),
  38. myTxt(text: "点赞", color: color7788A0, fontSize: 13.sp),
  39. ],
  40. ),
  41. ),
  42. SizedBox(width: 5.h),
  43. AuthGestureDetector(
  44. onTap: () {
  45. tap.call(1);
  46. },
  47. child: Row(
  48. children: [
  49. Icon(
  50. isFavorite ? Icons.star : Icons.star_outline,
  51. color: isFavorite ? Colors.orange : color7788A0,
  52. size: 17.w,
  53. ),
  54. SizedBox(width: 1.w),
  55. myTxt(text: "收藏", color: color7788A0, fontSize: 13.sp),
  56. ],
  57. ),
  58. ),
  59. SizedBox(width: 5.h),
  60. GestureDetector(
  61. onTap: () {
  62. tap.call(2);
  63. },
  64. child: Row(
  65. children: [
  66. Icon(Icons.ios_share, color: color7788A0, size: 13.w),
  67. myTxt(text: "分享", color: color7788A0, fontSize: 13.sp),
  68. ],
  69. ),
  70. ),
  71. ],
  72. );
  73. }
  74. }