view.dart 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. import 'package:electronic_assistant/base/base_page.dart';
  2. import 'package:electronic_assistant/module/files/controller.dart';
  3. import 'package:electronic_assistant/resource/colors.gen.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_screenutil/flutter_screenutil.dart';
  6. import '../../resource/assets.gen.dart';
  7. class FilesPage extends BasePage<FilesController> {
  8. const FilesPage({super.key});
  9. @override
  10. bool immersive() {
  11. return true;
  12. }
  13. @override
  14. Widget buildBody(BuildContext context) {
  15. return Scaffold(
  16. backgroundColor: const Color.fromRGBO(246, 245, 248, 1),
  17. appBar: AppBar(
  18. title: const Text('文件夹'),
  19. backgroundColor: const Color.fromRGBO(246, 245, 248, 1),
  20. scrolledUnderElevation: 0,
  21. actions: [
  22. IconButton(
  23. onPressed: () {},
  24. icon: ImageIcon(Assets.images.iconFilesNewDir.provider()),
  25. ),
  26. IconButton(
  27. onPressed: () {},
  28. icon: ImageIcon(Assets.images.iconMore.provider()),
  29. ),
  30. ],
  31. ),
  32. body: Column(
  33. children: [
  34. Column(
  35. children: [
  36. Container(
  37. margin: EdgeInsets.symmetric(horizontal: 12.w),
  38. padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 8.w),
  39. height: 36.w,
  40. decoration: BoxDecoration(
  41. color: Colors.white,
  42. borderRadius: BorderRadius.circular(8.w),
  43. ),
  44. child: TextField(
  45. maxLines: 1,
  46. textAlignVertical: TextAlignVertical.center,
  47. textInputAction: TextInputAction.search,
  48. decoration: InputDecoration(
  49. hintText: '搜索所有文件标题 / 内容',
  50. border: InputBorder.none,
  51. icon: ImageIcon(Assets.images.iconSearch.provider()),
  52. iconColor: const Color.fromRGBO(95, 95, 97, 1)
  53. ),
  54. style: TextStyle(fontSize: 14.sp),
  55. ),
  56. ),
  57. ],
  58. ),
  59. Expanded(
  60. child: Padding(
  61. padding: EdgeInsets.only(top: 16.w, left: 12.w, right: 12.w),
  62. child: CustomScrollView(
  63. slivers: [
  64. SliverAnimatedGrid(
  65. itemBuilder: _buildDirItem,
  66. gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  67. crossAxisCount: 2,
  68. crossAxisSpacing: 8.w,
  69. mainAxisSpacing: 8.w,
  70. childAspectRatio: 164 / 65,
  71. ),
  72. initialItemCount: 10,
  73. ),
  74. SliverToBoxAdapter(
  75. child: Padding(
  76. padding: EdgeInsets.only(top: 20.w, bottom: 12.w),
  77. child: Text('全部谈话',
  78. style: TextStyle(
  79. fontSize: 14.sp,
  80. color: ColorName.secondaryTextColor,
  81. fontWeight: FontWeight.bold))),
  82. ),
  83. SliverAnimatedList(
  84. itemBuilder: _buildFileItem,
  85. initialItemCount: 20,
  86. )
  87. ],
  88. )))
  89. ],
  90. ),
  91. );
  92. }
  93. Widget _buildDirItem(
  94. BuildContext context, int index, Animation<double> animation) {
  95. return Container(
  96. decoration: BoxDecoration(
  97. color: Colors.white,
  98. borderRadius: BorderRadius.circular(8.w),
  99. ),
  100. padding: EdgeInsets.only(left: 8.w),
  101. child: Row(
  102. crossAxisAlignment: CrossAxisAlignment.center,
  103. children: [
  104. Image(
  105. image: Assets.images.iconFilesDir.provider(),
  106. width: 32.w,
  107. height: 32.w),
  108. Expanded(
  109. child: Padding(
  110. padding: EdgeInsets.symmetric(horizontal: 8.w),
  111. child: Column(
  112. mainAxisAlignment: MainAxisAlignment.center,
  113. crossAxisAlignment: CrossAxisAlignment.start,
  114. children: [
  115. Text('文件夹',
  116. maxLines: 1,
  117. overflow: TextOverflow.ellipsis,
  118. style: TextStyle(
  119. fontSize: 14.sp,
  120. color: ColorName.primaryTextColor,
  121. fontWeight: FontWeight.bold)),
  122. Text('2021-09-09 12:00:00',
  123. maxLines: 1,
  124. overflow: TextOverflow.ellipsis,
  125. style: TextStyle(
  126. fontSize: 12.sp, color: ColorName.secondaryTextColor)),
  127. ],
  128. ),
  129. ))
  130. ],
  131. ),
  132. );
  133. }
  134. Widget _buildFileItem(
  135. BuildContext context, int index, Animation<double> animation) {
  136. return Padding(
  137. padding: EdgeInsets.only(bottom: 8.w),
  138. child: Container(
  139. decoration: BoxDecoration(
  140. color: Colors.white,
  141. borderRadius: BorderRadius.circular(8.w),
  142. ),
  143. padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 14.w),
  144. child: Row(
  145. crossAxisAlignment: CrossAxisAlignment.start,
  146. children: [
  147. Image(
  148. image: Assets.images.iconFilesFile.provider(),
  149. width: 28.w,
  150. height: 32.w),
  151. Expanded(
  152. child: Padding(
  153. padding: EdgeInsets.symmetric(horizontal: 8.w),
  154. child: Column(
  155. crossAxisAlignment: CrossAxisAlignment.start,
  156. children: [
  157. Text('文件标题',
  158. maxLines: 1,
  159. overflow: TextOverflow.ellipsis,
  160. style: TextStyle(
  161. fontSize: 14.sp,
  162. color: ColorName.primaryTextColor,
  163. fontWeight: FontWeight.bold)),
  164. Text(
  165. '这个群,现在由我管理。目的是把你们训练成一个个社会高薪人士,从本周起,hhhhhhhhhhhhh已经开始执行军事化理...',
  166. maxLines: 2,
  167. overflow: TextOverflow.ellipsis,
  168. style: TextStyle(
  169. fontSize: 12.sp,
  170. color: ColorName.secondaryTextColor)),
  171. Container(
  172. margin: EdgeInsets.only(top: 6.w),
  173. child: Row(
  174. crossAxisAlignment: CrossAxisAlignment.center,
  175. children: [
  176. Text("1m12s",
  177. style: TextStyle(
  178. fontSize: 12.sp,
  179. color: ColorName.tertiaryTextColor)),
  180. Text(" | ",
  181. style: TextStyle(
  182. fontSize: 12.sp,
  183. color: ColorName.tertiaryTextColor,
  184. fontWeight: FontWeight.bold)),
  185. Text("2021-09-09 12:00:00",
  186. style: TextStyle(
  187. fontSize: 12.sp,
  188. color: ColorName.tertiaryTextColor)),
  189. ],
  190. ),
  191. )
  192. ],
  193. ),
  194. )),
  195. ],
  196. ),
  197. ));
  198. }
  199. }