|
|
@@ -1,11 +1,17 @@
|
|
|
import 'package:electronic_assistant/base/base_page.dart';
|
|
|
+import 'package:electronic_assistant/data/bean/talks.dart';
|
|
|
+import 'package:electronic_assistant/dialog/alert_dialog.dart';
|
|
|
import 'package:electronic_assistant/module/files/controller.dart';
|
|
|
+import 'package:electronic_assistant/module/talk/view.dart';
|
|
|
import 'package:electronic_assistant/resource/colors.gen.dart';
|
|
|
+import 'package:electronic_assistant/resource/string.gen.dart';
|
|
|
import 'package:electronic_assistant/router/app_pages.dart';
|
|
|
+import 'package:electronic_assistant/utils/expand.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import 'package:get/get_core/src/get_main.dart';
|
|
|
+import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
|
|
import '../../resource/assets.gen.dart';
|
|
|
|
|
|
@@ -22,83 +28,93 @@ class FilesPage extends BasePage<FilesController> {
|
|
|
return Scaffold(
|
|
|
backgroundColor: const Color.fromRGBO(246, 245, 248, 1),
|
|
|
appBar: AppBar(
|
|
|
- title: const Text('文件夹'),
|
|
|
+ title: Text(StringName.talkAll.tr),
|
|
|
backgroundColor: const Color.fromRGBO(246, 245, 248, 1),
|
|
|
scrolledUnderElevation: 0,
|
|
|
- actions: [
|
|
|
- IconButton(
|
|
|
- onPressed: () {},
|
|
|
- icon: ImageIcon(Assets.images.iconFilesNewDir.provider()),
|
|
|
- ),
|
|
|
- IconButton(
|
|
|
- onPressed: () {},
|
|
|
- icon: ImageIcon(Assets.images.iconMore.provider()),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ // actions: [
|
|
|
+ // IconButton(
|
|
|
+ // onPressed: () {},
|
|
|
+ // icon: ImageIcon(Assets.images.iconFilesNewDir.provider()),
|
|
|
+ // ),
|
|
|
+ // IconButton(
|
|
|
+ // onPressed: () {},
|
|
|
+ // icon: ImageIcon(Assets.images.iconMore.provider()),
|
|
|
+ // ),
|
|
|
+ // ],
|
|
|
),
|
|
|
body: Column(
|
|
|
children: [
|
|
|
- Column(
|
|
|
- children: [
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- Get.toNamed(RoutePath.fileSearch);
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
- padding:
|
|
|
- EdgeInsets.symmetric(horizontal: 10.w, vertical: 8.w),
|
|
|
- height: 36.w,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.circular(8.w),
|
|
|
- ),
|
|
|
- child: TextField(
|
|
|
- maxLines: 1,
|
|
|
- textAlignVertical: TextAlignVertical.center,
|
|
|
- textInputAction: TextInputAction.search,
|
|
|
- decoration: InputDecoration(
|
|
|
- hintText: '搜索所有文件标题 / 内容',
|
|
|
- border: InputBorder.none,
|
|
|
- icon: ImageIcon(Assets.images.iconSearch.provider()),
|
|
|
- iconColor: const Color.fromRGBO(95, 95, 97, 1),
|
|
|
- enabled: false),
|
|
|
- style: TextStyle(fontSize: 14.sp),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ // Column(
|
|
|
+ // children: [
|
|
|
+ // GestureDetector(
|
|
|
+ // onTap: () {
|
|
|
+ // Get.toNamed(RoutePath.fileSearch);
|
|
|
+ // },
|
|
|
+ // child: Container(
|
|
|
+ // margin: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
+ // padding:
|
|
|
+ // EdgeInsets.symmetric(horizontal: 10.w, vertical: 8.w),
|
|
|
+ // height: 36.w,
|
|
|
+ // decoration: BoxDecoration(
|
|
|
+ // color: Colors.white,
|
|
|
+ // borderRadius: BorderRadius.circular(8.w),
|
|
|
+ // ),
|
|
|
+ // child: TextField(
|
|
|
+ // maxLines: 1,
|
|
|
+ // textAlignVertical: TextAlignVertical.center,
|
|
|
+ // textInputAction: TextInputAction.search,
|
|
|
+ // decoration: InputDecoration(
|
|
|
+ // hintText: '搜索所有文件标题 / 内容',
|
|
|
+ // border: InputBorder.none,
|
|
|
+ // icon: ImageIcon(Assets.images.iconSearch.provider()),
|
|
|
+ // iconColor: const Color.fromRGBO(95, 95, 97, 1),
|
|
|
+ // enabled: false),
|
|
|
+ // style: TextStyle(fontSize: 14.sp),
|
|
|
+ // ),
|
|
|
+ // ),
|
|
|
+ // ),
|
|
|
+ // ],
|
|
|
+ // ),
|
|
|
Expanded(
|
|
|
child: Padding(
|
|
|
- padding: EdgeInsets.only(top: 16.w, left: 12.w, right: 12.w),
|
|
|
- child: CustomScrollView(
|
|
|
- slivers: [
|
|
|
- SliverAnimatedGrid(
|
|
|
- itemBuilder: _buildDirItem,
|
|
|
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
- crossAxisCount: 2,
|
|
|
- crossAxisSpacing: 8.w,
|
|
|
- mainAxisSpacing: 8.w,
|
|
|
- childAspectRatio: 164 / 65,
|
|
|
- ),
|
|
|
- initialItemCount: 10,
|
|
|
- ),
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: Padding(
|
|
|
- padding: EdgeInsets.only(top: 20.w, bottom: 12.w),
|
|
|
- child: Text('全部谈话',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14.sp,
|
|
|
- color: ColorName.secondaryTextColor,
|
|
|
- fontWeight: FontWeight.bold))),
|
|
|
- ),
|
|
|
- SliverAnimatedList(
|
|
|
+ // padding: EdgeInsets.only(top: 16.w, left: 12.w, right: 12.w),
|
|
|
+ padding: EdgeInsets.only(left: 12.w, right: 12.w),
|
|
|
+ child: SmartRefresher(
|
|
|
+ enablePullUp: true,
|
|
|
+ enablePullDown: true,
|
|
|
+ controller: controller.refreshController,
|
|
|
+ onRefresh: controller.onRefreshData,
|
|
|
+ onLoading: controller.onLoadMoreTalkData,
|
|
|
+ child: CustomScrollView(
|
|
|
+ slivers: [
|
|
|
+ // SliverAnimatedGrid(
|
|
|
+ // itemBuilder: _buildDirItem,
|
|
|
+ // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
+ // crossAxisCount: 2,
|
|
|
+ // crossAxisSpacing: 8.w,
|
|
|
+ // mainAxisSpacing: 8.w,
|
|
|
+ // childAspectRatio: 164 / 65,
|
|
|
+ // ),
|
|
|
+ // initialItemCount: 10,
|
|
|
+ // ),
|
|
|
+ // SliverToBoxAdapter(
|
|
|
+ // child: Padding(
|
|
|
+ // padding: EdgeInsets.only(top: 20.w, bottom: 12.w),
|
|
|
+ // child: Text(StringName.talkAll.tr,
|
|
|
+ // style: TextStyle(
|
|
|
+ // fontSize: 14.sp,
|
|
|
+ // color: ColorName.secondaryTextColor,
|
|
|
+ // fontWeight: FontWeight.bold))),
|
|
|
+ // ),
|
|
|
+ Obx(() {
|
|
|
+ return SliverList.builder(
|
|
|
itemBuilder: _buildFileItem,
|
|
|
- initialItemCount: 20,
|
|
|
- )
|
|
|
- ],
|
|
|
- )))
|
|
|
+ itemCount: controller.talkList.length);
|
|
|
+ }),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ))
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
@@ -146,68 +162,80 @@ class FilesPage extends BasePage<FilesController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _buildFileItem(
|
|
|
- BuildContext context, int index, Animation<double> animation) {
|
|
|
+ Widget _buildFileItem(BuildContext context, int index) {
|
|
|
+ TalkBean? talkBean = controller.talkList[index].value;
|
|
|
+ if (talkBean == null) {
|
|
|
+ return Container();
|
|
|
+ }
|
|
|
return Padding(
|
|
|
padding: EdgeInsets.only(bottom: 8.w),
|
|
|
- child: Container(
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.circular(8.w),
|
|
|
- ),
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 14.w),
|
|
|
- child: Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Image(
|
|
|
- image: Assets.images.iconFilesFile.provider(),
|
|
|
- width: 28.w,
|
|
|
- height: 32.w),
|
|
|
- Expanded(
|
|
|
- child: Padding(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 8.w),
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Text('文件标题',
|
|
|
- maxLines: 1,
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14.sp,
|
|
|
- color: ColorName.primaryTextColor,
|
|
|
- fontWeight: FontWeight.bold)),
|
|
|
- Text(
|
|
|
- '这个群,现在由我管理。目的是把你们训练成一个个社会高薪人士,从本周起,hhhhhhhhhhhhh已经开始执行军事化理...',
|
|
|
- maxLines: 2,
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: ColorName.secondaryTextColor)),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.only(top: 6.w),
|
|
|
- child: Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Text("1m12s",
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: ColorName.tertiaryTextColor)),
|
|
|
- Text(" | ",
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: ColorName.tertiaryTextColor,
|
|
|
- fontWeight: FontWeight.bold)),
|
|
|
- Text("2021-09-09 12:00:00",
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp,
|
|
|
- color: ColorName.tertiaryTextColor)),
|
|
|
- ],
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- )),
|
|
|
- ],
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ TalkPage.start(talkBean);
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.circular(8.w),
|
|
|
+ ),
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 14.w),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Image(
|
|
|
+ image: (talkBean.status == TalkStatus.analysing ||
|
|
|
+ talkBean.status == TalkStatus.waitAnalysis)
|
|
|
+ ? Assets.images.iconTalkAnalysis.provider()
|
|
|
+ : Assets.images.iconFilesFile.provider(),
|
|
|
+ width: 28.w,
|
|
|
+ height: 32.w),
|
|
|
+ Expanded(
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 8.w),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(talkBean.title.orEmpty,
|
|
|
+ maxLines: 1,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp,
|
|
|
+ color: ColorName.primaryTextColor,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ Text(talkBean.summary.orEmpty,
|
|
|
+ maxLines: 2,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: talkBean.status == TalkStatus.analysisFail
|
|
|
+ ? "#F5574E".toColor()
|
|
|
+ : ColorName.secondaryTextColor)),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(top: 6.w),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text(talkBean.duration.toFormattedDuration(),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.tertiaryTextColor)),
|
|
|
+ Text(" | ",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.tertiaryTextColor,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ Text(talkBean.createTime.orEmpty,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.tertiaryTextColor)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
));
|
|
|
}
|