|
|
@@ -1,5 +1,5 @@
|
|
|
import 'package:electronic_assistant/base/base_page.dart';
|
|
|
-import 'package:electronic_assistant/module/task/task_item_view.dart';
|
|
|
+import 'package:electronic_assistant/module/agenda/task_item_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';
|
|
|
@@ -8,13 +8,20 @@ import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/services.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
+import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
|
|
+import '../../data/bean/agenda.dart';
|
|
|
+import '../../data/repositories/account_repository.dart';
|
|
|
+import '../../popup/common_popup.dart';
|
|
|
+import '../../popup/template_utils.dart';
|
|
|
import '../../resource/assets.gen.dart';
|
|
|
+import '../chat/view.dart';
|
|
|
import 'controller.dart';
|
|
|
|
|
|
-class TaskPage extends BasePage<TaskController> {
|
|
|
- const TaskPage({super.key});
|
|
|
+class AgendaPage extends BasePage<AgendaController> {
|
|
|
+ const AgendaPage({super.key});
|
|
|
|
|
|
@override
|
|
|
Widget buildBody(BuildContext context) {
|
|
|
@@ -79,7 +86,7 @@ class TaskPage extends BasePage<TaskController> {
|
|
|
SizedBox(height: 2.h),
|
|
|
// Add some space between the image and text
|
|
|
Text(
|
|
|
- '筛选',
|
|
|
+ StringName.agendaSift.tr,
|
|
|
style: TextStyle(
|
|
|
fontSize: 10.sp, color: ColorName.primaryTextColor),
|
|
|
),
|
|
|
@@ -114,32 +121,103 @@ class TaskPage extends BasePage<TaskController> {
|
|
|
),
|
|
|
SizedBox(width: 7.h),
|
|
|
Expanded(
|
|
|
- child: CustomScrollView(slivers: [
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: taskGroupItem(StringName.taskItemTodo.tr, 3, false),
|
|
|
+ child: SmartRefresher(
|
|
|
+ footer: const ClassicFooter(
|
|
|
+ noDataText: '',
|
|
|
),
|
|
|
- SliverAnimatedList(
|
|
|
- itemBuilder: _buildTodoItem, initialItemCount: 4),
|
|
|
- SliverToBoxAdapter(
|
|
|
- child: taskGroupItem(StringName.taskItemDone.tr, 16, false),
|
|
|
- ),
|
|
|
- SliverAnimatedList(
|
|
|
- itemBuilder: _buildDoneItem, initialItemCount: 10),
|
|
|
- ]))
|
|
|
+ onLoading: controller.onLoadMoreDoneData,
|
|
|
+ enablePullDown: false,
|
|
|
+ enablePullUp: true,
|
|
|
+ controller: controller.refreshController,
|
|
|
+ child: CustomScrollView(slivers: [
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: Obx(() {
|
|
|
+ return taskGroupItem(
|
|
|
+ StringName.taskItemTodo.tr,
|
|
|
+ controller.agendaTodoList.length,
|
|
|
+ controller.todoIsExpanded.value, itemClick: () {
|
|
|
+ controller.onClickTodoGroup();
|
|
|
+ });
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ Obx(() {
|
|
|
+ return SliverList.builder(
|
|
|
+ itemBuilder: _buildTodoItem,
|
|
|
+ itemCount: controller.todoIsExpanded.value
|
|
|
+ ? controller.agendaTodoList.length
|
|
|
+ : 0);
|
|
|
+ }),
|
|
|
+ SliverToBoxAdapter(
|
|
|
+ child: Obx(() {
|
|
|
+ return taskGroupItem(
|
|
|
+ StringName.taskItemDone.tr,
|
|
|
+ controller.agendaDoneList.length,
|
|
|
+ controller.doneIsExpanded.value, itemClick: () {
|
|
|
+ controller.onClickDoneGroup();
|
|
|
+ });
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ Obx(() {
|
|
|
+ return SliverList.builder(
|
|
|
+ itemBuilder: _buildDoneItem,
|
|
|
+ itemCount: controller.doneIsExpanded.value
|
|
|
+ ? controller.agendaDoneList.length
|
|
|
+ : 0);
|
|
|
+ })
|
|
|
+ ]),
|
|
|
+ ))
|
|
|
],
|
|
|
)
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _buildTodoItem(
|
|
|
- BuildContext context, int index, Animation<double> animation) {
|
|
|
- return Container();
|
|
|
+ Widget _buildTodoItem(BuildContext context, int index) {
|
|
|
+ Agenda item = controller.agendaTodoList[index];
|
|
|
+ return Builder(builder: (context) {
|
|
|
+ return GestureDetector(
|
|
|
+ onLongPressStart: (details) {
|
|
|
+ if (!accountRepository.isLogin.value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ showCommonPopup(details.globalPosition, Alignment.bottomRight,
|
|
|
+ _buildListUpdatePopupView(item, controller.agendaDetailPopupTag),
|
|
|
+ tag: controller.agendaDetailPopupTag);
|
|
|
+ },
|
|
|
+ child: taskItemView(
|
|
|
+ item,
|
|
|
+ onCheckClick: () {
|
|
|
+ controller.agendaComplete(item, true);
|
|
|
+ },
|
|
|
+ onThinkingClick: () {
|
|
|
+ ChatPage.startByTalkId(item.talkId, agenda: item);
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- Widget _buildDoneItem(
|
|
|
- BuildContext context, int index, Animation<double> animation) {
|
|
|
- return Container();
|
|
|
+ List<Widget> _buildListUpdatePopupView(Agenda item, String tag) {
|
|
|
+ return [
|
|
|
+ createNormalPopupItem(StringName.agendaDetailPopupCancel.tr,
|
|
|
+ onItemClick: () {
|
|
|
+ SmartDialog.dismiss(tag: tag);
|
|
|
+ controller.onAgendaCancel(item);
|
|
|
+ }),
|
|
|
+ createPopupDivider(),
|
|
|
+ createNormalPopupItem(StringName.agendaDetailPopupUpdate.tr,
|
|
|
+ onItemClick: () {
|
|
|
+ SmartDialog.dismiss(tag: tag);
|
|
|
+ controller.onAgendaUpdate(item);
|
|
|
+ }),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _buildDoneItem(BuildContext context, int index) {
|
|
|
+ Agenda item = controller.agendaDoneList[index];
|
|
|
+ return taskItemView(item, onCheckClick: () {
|
|
|
+ controller.agendaComplete(item, false);
|
|
|
+ }, isShowAnalyse: false);
|
|
|
}
|
|
|
|
|
|
Container buildTopGradient() {
|
|
|
@@ -170,30 +248,37 @@ class TaskPage extends BasePage<TaskController> {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- Widget taskGroupItem(String groupName, int count, bool isExpanded) {
|
|
|
- return Padding(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 12.w),
|
|
|
- child: Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Text(groupName,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 14.sp, color: ColorName.secondaryTextColor)),
|
|
|
- //占位填充
|
|
|
- const Spacer(),
|
|
|
- Row(
|
|
|
- children: [
|
|
|
- Text('$count${StringName.taskItemDesc.tr}',
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.secondaryTextColor)),
|
|
|
- SizedBox(width: 4.w),
|
|
|
- SizedBox(
|
|
|
- width: 16.w,
|
|
|
- height: 16.h,
|
|
|
- child: Assets.images.iconTalkCollapse.image())
|
|
|
- ],
|
|
|
- )
|
|
|
- ],
|
|
|
+ Widget taskGroupItem(String groupName, int count, bool isExpanded,
|
|
|
+ {VoidCallback? itemClick}) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: itemClick,
|
|
|
+ child: Container(
|
|
|
+ color: Colors.transparent,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 12.h, horizontal: 12.w),
|
|
|
+ child: Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text(groupName,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 14.sp, color: ColorName.secondaryTextColor)),
|
|
|
+ //占位填充
|
|
|
+ const Spacer(),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Text('$count${StringName.taskItemDesc.tr}',
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.secondaryTextColor)),
|
|
|
+ SizedBox(width: 4.w),
|
|
|
+ SizedBox(
|
|
|
+ width: 16.w,
|
|
|
+ height: 16.h,
|
|
|
+ child: isExpanded
|
|
|
+ ? Assets.images.iconTalkExpand.image()
|
|
|
+ : Assets.images.iconTalkCollapse.image())
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|