view.dart 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. import 'package:electronic_assistant/base/base_page.dart';
  2. import 'package:electronic_assistant/resource/assets.gen.dart';
  3. import 'package:electronic_assistant/resource/colors.gen.dart';
  4. import 'package:flutter/cupertino.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:flutter_screenutil/flutter_screenutil.dart';
  7. import 'package:get/get.dart';
  8. import 'package:get/get_core/src/get_main.dart';
  9. class FileSearchPage extends BasePage {
  10. const FileSearchPage({super.key});
  11. @override
  12. Widget buildBody(BuildContext context) {
  13. return Column(children: [
  14. Row(
  15. children: [
  16. Expanded(
  17. child: Padding(
  18. padding: EdgeInsets.only(left: 12.w),
  19. child: CupertinoSearchTextField(
  20. placeholder: '搜索所有文件标题 / 内容',
  21. prefixIcon:
  22. ImageIcon(Assets.images.iconSearch.provider(), size: 20.w),
  23. backgroundColor: const Color(0xFFF6F6F6),
  24. style:
  25. TextStyle(fontSize: 14.w, color: ColorName.primaryTextColor),
  26. placeholderStyle:
  27. TextStyle(fontSize: 14.w, color: const Color(0xFFAFAFAF)),
  28. ),
  29. )),
  30. TextButton(
  31. onPressed: () {
  32. Get.back();
  33. },
  34. child: Text('取消',
  35. style: TextStyle(
  36. fontSize: 14.w, color: ColorName.secondaryTextColor))),
  37. ],
  38. ),
  39. Padding(
  40. padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.w),
  41. child: Row(children: [
  42. Text(
  43. "搜索结果",
  44. style: TextStyle(
  45. fontSize: 15.w,
  46. color: ColorName.primaryTextColor,
  47. fontWeight: FontWeight.bold),
  48. ),
  49. Expanded(
  50. child: Row(
  51. mainAxisAlignment: MainAxisAlignment.end,
  52. children: [
  53. Text("更新时间排序",
  54. style: TextStyle(
  55. fontSize: 14.w,
  56. fontWeight: FontWeight.bold,
  57. color: ColorName.primaryTextColor)),
  58. Image(
  59. image: Assets.images.iconArrowDown.provider(),
  60. width: 16.w,
  61. height: 16.w)
  62. ],
  63. ))
  64. ]),
  65. ),
  66. Visibility(
  67. visible: true,
  68. child: Expanded(
  69. child: Stack(
  70. fit: StackFit.expand,
  71. children: [
  72. Padding(
  73. padding: EdgeInsets.symmetric(horizontal: 12.w),
  74. child: CustomScrollView(
  75. slivers: [
  76. SliverToBoxAdapter(
  77. child: Text("文件夹",
  78. style: TextStyle(
  79. fontSize: 14.w,
  80. color: ColorName.secondaryTextColor))),
  81. SliverAnimatedList(
  82. itemBuilder: _dirItemBuilder,
  83. initialItemCount: 5,
  84. ),
  85. SliverToBoxAdapter(
  86. child: Container(
  87. margin: EdgeInsets.only(top: 8.w),
  88. child: Text("谈话",
  89. style: TextStyle(
  90. fontSize: 14.w,
  91. color: ColorName.secondaryTextColor)),
  92. )),
  93. SliverAnimatedList(
  94. itemBuilder: _fileItemBuilder,
  95. initialItemCount: 5,
  96. ),
  97. ],
  98. ),
  99. ),
  100. Visibility(
  101. visible: false,
  102. child: Stack(
  103. children: [
  104. Container(
  105. color: ColorName.black55,
  106. ),
  107. Container(
  108. // color: ColorName.white,
  109. width: double.infinity,
  110. decoration: BoxDecoration(
  111. color: ColorName.white,
  112. borderRadius: BorderRadius.only(
  113. bottomLeft: Radius.circular(16.w),
  114. bottomRight: Radius.circular(16.w))),
  115. child: Padding(
  116. padding:
  117. EdgeInsets.symmetric(horizontal: 12.w, vertical: 12
  118. .w),
  119. child: IntrinsicHeight(
  120. child: Column(
  121. children: [
  122. Container(
  123. margin: EdgeInsets.only(bottom: 22.w),
  124. child: Row(
  125. children: [
  126. const Expanded(
  127. child: Text('更新时间排序',
  128. style: TextStyle(
  129. fontSize: 14,
  130. fontWeight: FontWeight.bold,
  131. color: ColorName
  132. .colorPrimary))),
  133. ImageIcon(
  134. Assets.images.iconFilesOrderSelected
  135. .provider(),
  136. size: 20.w,
  137. color: ColorName.colorPrimary)
  138. ],
  139. ),
  140. ),
  141. Container(
  142. margin: EdgeInsets.only(bottom: 6.w),
  143. child: Row(
  144. children: [
  145. const Expanded(
  146. child: Text('创建时间排序')),
  147. ImageIcon(
  148. Assets.images.iconFilesOrderSelected
  149. .provider(),
  150. size: 20.w)
  151. ],
  152. ),
  153. )
  154. ],
  155. ),
  156. ),
  157. ),
  158. )
  159. ],
  160. ),
  161. )
  162. ],
  163. )),
  164. )
  165. ]);
  166. }
  167. @override
  168. bool immersive() {
  169. return false;
  170. }
  171. Widget _dirItemBuilder(BuildContext context, int index,
  172. Animation<double> animation) {
  173. return Padding(
  174. padding: EdgeInsets.symmetric(vertical: 12.w),
  175. child: Row(
  176. crossAxisAlignment: CrossAxisAlignment.center,
  177. children: [
  178. Image(
  179. image: Assets.images.iconFilesDir.provider(),
  180. width: 32.w,
  181. height: 32.w,
  182. ),
  183. Expanded(
  184. child: Container(
  185. margin: EdgeInsets.only(left: 8.w),
  186. child: Column(
  187. mainAxisAlignment: MainAxisAlignment.center,
  188. crossAxisAlignment: CrossAxisAlignment.start,
  189. children: [
  190. Text('文件夹 $index',
  191. maxLines: 1,
  192. style: TextStyle(
  193. fontSize: 15.w,
  194. color: ColorName.primaryTextColor,
  195. fontWeight: FontWeight.bold,
  196. overflow: TextOverflow.ellipsis)),
  197. Text('日期 $index',
  198. maxLines: 1,
  199. style: TextStyle(
  200. fontSize: 12.w,
  201. color: ColorName.secondaryTextColor,
  202. overflow: TextOverflow.ellipsis)),
  203. ],
  204. ),
  205. ),
  206. )
  207. ],
  208. ),
  209. );
  210. }
  211. Widget _fileItemBuilder(BuildContext context, int index,
  212. Animation<double> animation) {
  213. return Padding(
  214. padding: EdgeInsets.symmetric(vertical: 12.w),
  215. child: Row(
  216. crossAxisAlignment: CrossAxisAlignment.start,
  217. children: [
  218. Image(
  219. image: Assets.images.iconFilesFile.provider(),
  220. width: 32.w,
  221. height: 32.w,
  222. ),
  223. Expanded(
  224. child: Container(
  225. margin: EdgeInsets.only(left: 8.w),
  226. child: Column(
  227. mainAxisAlignment: MainAxisAlignment.center,
  228. crossAxisAlignment: CrossAxisAlignment.start,
  229. children: [
  230. Text('文件夹 $index',
  231. maxLines: 1,
  232. style: TextStyle(
  233. fontSize: 15.w,
  234. color: ColorName.primaryTextColor,
  235. fontWeight: FontWeight.bold,
  236. overflow: TextOverflow.ellipsis)),
  237. Text('缩略 $index',
  238. maxLines: 1,
  239. style: TextStyle(
  240. fontSize: 12.w,
  241. color: ColorName.secondaryTextColor,
  242. overflow: TextOverflow.ellipsis)),
  243. Container(
  244. margin: EdgeInsets.only(top: 6.w),
  245. child: Row(
  246. children: [
  247. Text('1m12s',
  248. maxLines: 1,
  249. style: TextStyle(
  250. fontSize: 12.w, color: ColorName
  251. .tertiaryTextColor)),
  252. Text(' | ',
  253. maxLines: 1,
  254. style: TextStyle(
  255. fontSize: 12.w, color: ColorName
  256. .tertiaryTextColor)),
  257. Text('2024-04-15 10:04',
  258. maxLines: 1,
  259. style: TextStyle(
  260. fontSize: 12.w, color: ColorName
  261. .tertiaryTextColor)),
  262. ],
  263. ),
  264. )
  265. ],
  266. ),
  267. ),
  268. )
  269. ],
  270. ),
  271. );
  272. }
  273. }