view.dart 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. import 'package:electronic_assistant/base/base_page.dart';
  2. import 'package:electronic_assistant/module/task/task_item_view.dart';
  3. import 'package:electronic_assistant/resource/colors.gen.dart';
  4. import 'package:electronic_assistant/resource/string.gen.dart';
  5. import 'package:electronic_assistant/router/app_pages.dart';
  6. import 'package:electronic_assistant/utils/expand.dart';
  7. import 'package:flutter/cupertino.dart';
  8. import 'package:flutter/material.dart';
  9. import 'package:flutter/services.dart';
  10. import 'package:flutter_screenutil/flutter_screenutil.dart';
  11. import 'package:get/get.dart';
  12. import '../../resource/assets.gen.dart';
  13. import 'controller.dart';
  14. class TaskPage extends BasePage<TaskController> {
  15. const TaskPage({super.key});
  16. @override
  17. Widget buildBody(BuildContext context) {
  18. return Stack(
  19. children: [
  20. buildBgBox(),
  21. buildTopGradient(),
  22. Column(
  23. crossAxisAlignment: CrossAxisAlignment.start,
  24. children: [
  25. AppBar(
  26. systemOverlayStyle: SystemUiOverlayStyle.dark,
  27. backgroundColor: Colors.transparent,
  28. leading: IconButton(
  29. icon: SizedBox(
  30. width: 24.w,
  31. height: 24.w,
  32. child: Assets.images.iconBack.image()),
  33. // Custom icon
  34. onPressed: () {
  35. Get.back();
  36. },
  37. ),
  38. title: Text(StringName.taskTitle.tr,
  39. style: TextStyle(
  40. fontSize: 17.sp,
  41. fontWeight: FontWeight.bold,
  42. color: ColorName.primaryTextColor)),
  43. centerTitle: true,
  44. ),
  45. Row(
  46. children: [
  47. Expanded(
  48. child: Padding(
  49. padding: EdgeInsets.only(left: 12.w),
  50. child: CupertinoSearchTextField(
  51. enabled: false,
  52. onTap: () {
  53. Get.toNamed(RoutePath.taskSearch);
  54. },
  55. placeholder: StringName.searchHint.tr,
  56. prefixIcon: ImageIcon(Assets.images.iconSearch.provider(),
  57. size: 20.w),
  58. backgroundColor: Colors.white,
  59. style: TextStyle(
  60. fontSize: 14.w, color: ColorName.primaryTextColor),
  61. placeholderStyle: TextStyle(
  62. fontSize: 14.w, color: const Color(0xFFAFAFAF)),
  63. ),
  64. )),
  65. GestureDetector(
  66. onTap: () {},
  67. child: Column(
  68. mainAxisAlignment: MainAxisAlignment.center,
  69. children: [
  70. Container(
  71. margin: EdgeInsets.symmetric(horizontal: 16.w),
  72. width: 20.w,
  73. height: 20.w,
  74. child: Assets.images.iconSift.image()),
  75. // Replace with your image asset
  76. SizedBox(height: 2.h),
  77. // Add some space between the image and text
  78. Text(
  79. '筛选',
  80. style: TextStyle(
  81. fontSize: 10.sp, color: ColorName.primaryTextColor),
  82. ),
  83. ],
  84. ),
  85. )
  86. ],
  87. ),
  88. SizedBox(height: 12.h),
  89. Container(
  90. margin: EdgeInsets.only(left: 12.w),
  91. padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h),
  92. decoration: BoxDecoration(
  93. color: const Color(0xFFE9E9E9),
  94. borderRadius: BorderRadius.circular(8.w)),
  95. child: IntrinsicWidth(
  96. child: Row(
  97. children: [
  98. Text(controller.filterTxt,
  99. style: TextStyle(
  100. fontSize: 13.sp,
  101. color: ColorName.secondaryTextColor)),
  102. SizedBox(width: 6.w),
  103. Opacity(
  104. opacity: 0.7,
  105. child: ImageIcon(
  106. Assets.images.iconTaskFilterClose.provider(),
  107. size: 16.w))
  108. ],
  109. ),
  110. ),
  111. ),
  112. SizedBox(width: 7.h),
  113. Expanded(
  114. child: CustomScrollView(slivers: [
  115. SliverToBoxAdapter(
  116. child: taskGroupItem(StringName.taskItemTodo.tr, 3, false),
  117. ),
  118. SliverAnimatedList(
  119. itemBuilder: _buildTodoItem, initialItemCount: 4),
  120. SliverToBoxAdapter(
  121. child: taskGroupItem(StringName.taskItemDone.tr, 16, false),
  122. ),
  123. SliverAnimatedList(
  124. itemBuilder: _buildDoneItem, initialItemCount: 10),
  125. ]))
  126. ],
  127. )
  128. ],
  129. );
  130. }
  131. Widget _buildTodoItem(
  132. BuildContext context, int index, Animation<double> animation) {
  133. return Container();
  134. }
  135. Widget _buildDoneItem(
  136. BuildContext context, int index, Animation<double> animation) {
  137. return Container();
  138. }
  139. Container buildTopGradient() {
  140. return Container(
  141. width: 1.sw,
  142. height: 112.h,
  143. decoration: BoxDecoration(
  144. gradient: LinearGradient(
  145. colors: ['#E8EBFF'.toColor(), '#00E8EBFF'.toColor()],
  146. begin: Alignment.topCenter,
  147. end: Alignment.bottomCenter,
  148. stops: const [0.3, 1.0],
  149. ),
  150. ) // 其他子小部件
  151. );
  152. }
  153. DecoratedBox buildBgBox() {
  154. return DecoratedBox(
  155. decoration: BoxDecoration(color: '#F6F6F6'.toColor()),
  156. child: Container(
  157. height: double.infinity,
  158. ));
  159. }
  160. @override
  161. bool immersive() {
  162. return true;
  163. }
  164. Widget taskGroupItem(String groupName, int count, bool isExpanded) {
  165. return Padding(
  166. padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 12.w),
  167. child: Row(
  168. crossAxisAlignment: CrossAxisAlignment.center,
  169. children: [
  170. Text(groupName,
  171. style: TextStyle(
  172. fontSize: 14.sp, color: ColorName.secondaryTextColor)),
  173. //占位填充
  174. const Spacer(),
  175. Row(
  176. children: [
  177. Text('$count${StringName.taskItemDesc.tr}',
  178. style: TextStyle(
  179. fontSize: 12.sp, color: ColorName.secondaryTextColor)),
  180. SizedBox(width: 4.w),
  181. SizedBox(
  182. width: 16.w,
  183. height: 16.h,
  184. child: Assets.images.iconTalkCollapse.image())
  185. ],
  186. )
  187. ],
  188. ),
  189. );
  190. }
  191. }