feedback_page.dart 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import 'package:cs_resources/generated/assets.dart';
  2. import 'package:cs_resources/generated/l10n.dart';
  3. import 'package:cs_resources/theme/app_colors_theme.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:auto_route/auto_route.dart';
  6. import 'package:widgets/ext/ex_widget.dart';
  7. import 'package:widgets/my_appbar.dart';
  8. import 'package:widgets/my_load_image.dart';
  9. import 'package:widgets/my_text_view.dart';
  10. import '../../router/page/main_page_router.dart';
  11. @RoutePage()
  12. class FeedbackPage extends StatelessWidget {
  13. const FeedbackPage({Key? key}) : super(key: key);
  14. @override
  15. Widget build(BuildContext context) {
  16. return Scaffold(
  17. appBar: MyAppBar.appBar(
  18. context,
  19. S.current.feedback,
  20. showBackButton: false,
  21. backgroundColor: context.appColors.whiteBG,
  22. ),
  23. backgroundColor: context.appColors.backgroundDark,
  24. body: AutoTabsRouter.pageView(
  25. routes: const [
  26. FeedbackSendPageRoute(),
  27. FeedbackProgressPageRoute(),
  28. FeedbackHistoryPageRoute(),
  29. ],
  30. builder: (context, child, pageController) {
  31. final tabsRouter = AutoTabsRouter.of(context);
  32. return Column(
  33. children: [
  34. Container(
  35. color: context.appColors.whiteBG,
  36. height: 120,
  37. child: Row(
  38. mainAxisAlignment: MainAxisAlignment.spaceAround,
  39. children: [
  40. _buildFeedbackCategory(
  41. context,
  42. Assets.mainFeedbackSend,
  43. 45,
  44. 51.5,
  45. S.current.sent,
  46. tabsRouter.activeIndex == 0,
  47. ).onTap(
  48. () {
  49. tabsRouter.setActiveIndex(0);
  50. },
  51. ),
  52. _buildFeedbackCategory(
  53. context,
  54. Assets.mainFeedbackInProgress,
  55. 48,
  56. 46.5,
  57. S.current.in_progress,
  58. tabsRouter.activeIndex == 1,
  59. ).onTap(
  60. () {
  61. tabsRouter.setActiveIndex(1);
  62. },
  63. ),
  64. _buildFeedbackCategory(
  65. context,
  66. Assets.mainFeedbackHistory,
  67. 38,
  68. 45.5,
  69. S.current.history,
  70. tabsRouter.activeIndex == 2,
  71. ).onTap(
  72. () {
  73. tabsRouter.setActiveIndex(2);
  74. },
  75. ),
  76. ],
  77. ),
  78. ),
  79. Expanded(
  80. child: child,
  81. ),
  82. ],
  83. );
  84. },
  85. ),
  86. );
  87. }
  88. //顶部的Tab布局
  89. Widget _buildFeedbackCategory(BuildContext context, String iconPath, double iconWidth, double iconHeight, String title, bool isSelected) {
  90. return Column(
  91. mainAxisAlignment: MainAxisAlignment.center,
  92. crossAxisAlignment: CrossAxisAlignment.center,
  93. children: <Widget>[
  94. Container(
  95. width: 70,
  96. height: 70,
  97. decoration: BoxDecoration(
  98. color: context.appColors.lightBlueBg, // 设置圆形背景颜色
  99. shape: BoxShape.circle, // 设置为圆形
  100. boxShadow: isSelected
  101. ? [
  102. BoxShadow(
  103. color: context.appColors.tabLightBlueShadow, // 设置阴影颜色
  104. blurRadius: 5, // 设置模糊半径
  105. spreadRadius: 0.05, // 控制阴影扩散
  106. offset: const Offset(0, 4), // 设置阴影偏移量
  107. ),
  108. ]
  109. : [], // 未选中时无阴影,
  110. ),
  111. child: Center(
  112. child: MyAssetImage(iconPath, width: iconWidth, height: iconHeight),
  113. ),
  114. ),
  115. const SizedBox(height: 7),
  116. MyTextView(
  117. title,
  118. fontSize: 15,
  119. isFontMedium: true,
  120. textColor: isSelected ? context.appColors.tabTextSelectedDefault : context.appColors.tabTextUnSelectedDefault,
  121. ),
  122. ],
  123. );
  124. }
  125. }