|
|
@@ -1,5 +1,8 @@
|
|
|
import 'package:electronic_assistant/base/base_page.dart';
|
|
|
import 'package:electronic_assistant/data/bean/talks.dart';
|
|
|
+import 'package:electronic_assistant/dialog/rename_dialog.dart';
|
|
|
+import 'package:electronic_assistant/dialog/talk_delete_dialog.dart';
|
|
|
+import 'package:electronic_assistant/popup/talk_popup.dart';
|
|
|
import 'package:electronic_assistant/resource/assets.gen.dart';
|
|
|
import 'package:electronic_assistant/resource/colors.gen.dart';
|
|
|
import 'package:electronic_assistant/resource/string.gen.dart';
|
|
|
@@ -307,77 +310,88 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
Animation<double> animation, TalkBean item) {
|
|
|
return FadeTransition(
|
|
|
opacity: animation,
|
|
|
- child: _buildTalkView(item),
|
|
|
+ child: _buildTalkView(item, onLongPressStart: (details) {
|
|
|
+ showTalkPopup(details.globalPosition, Alignment.bottomRight,
|
|
|
+ onRename: () {
|
|
|
+ showRenameTalkDialog(item);
|
|
|
+ }, onDelete: () {
|
|
|
+ showDeleteTalkDialog(item);
|
|
|
+ });
|
|
|
+ }),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _buildTalkView(TalkBean item) {
|
|
|
- return Container(
|
|
|
- width: 258.w,
|
|
|
- margin: EdgeInsets.only(right: 8.w),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- border: Border.all(color: '#F0F0F0'.toColor(), width: 1),
|
|
|
- borderRadius: BorderRadius.circular(8),
|
|
|
- ),
|
|
|
- height: double.infinity,
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
- child: Column(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Row(
|
|
|
- children: [
|
|
|
- Visibility(
|
|
|
- visible: item.isExample.isTrue,
|
|
|
- child: Container(
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 6).w,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: '#DFE4FC'.toColor(),
|
|
|
- borderRadius: BorderRadius.circular(4),
|
|
|
- ),
|
|
|
- child: Text(
|
|
|
- StringName.homeTalkExample.tr,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.colorPrimary),
|
|
|
- )),
|
|
|
- ),
|
|
|
- SizedBox(width: 6.w),
|
|
|
- Text(item.title.orEmpty,
|
|
|
- maxLines: 1,
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 15.sp,
|
|
|
- color: ColorName.colorPrimary,
|
|
|
- fontWeight: FontWeight.bold))
|
|
|
- ],
|
|
|
- ),
|
|
|
- SizedBox(height: 5.h),
|
|
|
- Text(
|
|
|
- item.summary.orEmpty,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.secondaryTextColor),
|
|
|
- overflow: TextOverflow.ellipsis,
|
|
|
- maxLines: 2,
|
|
|
- ),
|
|
|
- SizedBox(height: 8.h),
|
|
|
- Row(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Text(item.duration.toFormattedDuration(),
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.tertiaryTextColor)),
|
|
|
- SizedBox(width: 6.w),
|
|
|
- Container(
|
|
|
- width: 1, height: 9, color: ColorName.tertiaryTextColor),
|
|
|
- SizedBox(width: 6.w),
|
|
|
- Text(item.createTime.orEmpty,
|
|
|
- style: TextStyle(
|
|
|
- fontSize: 12.sp, color: ColorName.tertiaryTextColor))
|
|
|
- ],
|
|
|
- )
|
|
|
- ],
|
|
|
- ));
|
|
|
+ Widget _buildTalkView(TalkBean item,
|
|
|
+ {GestureLongPressStartCallback? onLongPressStart}) {
|
|
|
+ return GestureDetector(
|
|
|
+ onLongPressStart: onLongPressStart,
|
|
|
+ child: Container(
|
|
|
+ width: 258.w,
|
|
|
+ margin: EdgeInsets.only(right: 8.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ border: Border.all(color: '#F0F0F0'.toColor(), width: 1),
|
|
|
+ borderRadius: BorderRadius.circular(8),
|
|
|
+ ),
|
|
|
+ height: double.infinity,
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
|
+ child: Column(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Visibility(
|
|
|
+ visible: item.isExample.isTrue,
|
|
|
+ child: Container(
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 6).w,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: '#DFE4FC'.toColor(),
|
|
|
+ borderRadius: BorderRadius.circular(4),
|
|
|
+ ),
|
|
|
+ child: Text(
|
|
|
+ StringName.homeTalkExample.tr,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.colorPrimary),
|
|
|
+ )),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Text(item.title.orEmpty,
|
|
|
+ maxLines: 1,
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 15.sp,
|
|
|
+ color: ColorName.colorPrimary,
|
|
|
+ fontWeight: FontWeight.bold))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 5.h),
|
|
|
+ Text(
|
|
|
+ item.summary.orEmpty,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.secondaryTextColor),
|
|
|
+ overflow: TextOverflow.ellipsis,
|
|
|
+ maxLines: 2,
|
|
|
+ ),
|
|
|
+ SizedBox(height: 8.h),
|
|
|
+ Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text(item.duration.toFormattedDuration(),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.tertiaryTextColor)),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Container(
|
|
|
+ width: 1, height: 9, color: ColorName.tertiaryTextColor),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Text(item.createTime.orEmpty,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 12.sp, color: ColorName.tertiaryTextColor))
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ )),
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
Widget _buildInsertTodoItem(BuildContext context, int index,
|
|
|
@@ -385,17 +399,21 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
HomePageController controller = Get.find();
|
|
|
return FadeTransition(
|
|
|
opacity: animation,
|
|
|
- child: taskItemView(item, onCheckClick: () {
|
|
|
- controller.agendaList.remove(
|
|
|
- index,
|
|
|
- (context, animation, item) =>
|
|
|
- _buildRemoveTodoItem(context, index, animation, item));
|
|
|
- }),
|
|
|
+ child: taskItemView(
|
|
|
+ item,
|
|
|
+ onCheckClick: () {
|
|
|
+ controller.agendaList.remove(
|
|
|
+ index,
|
|
|
+ (context, animation, item) =>
|
|
|
+ _buildRemoveTodoItem(context, index, animation, item));
|
|
|
+ },
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
Widget _buildRemoveTodoItem(BuildContext context, int index,
|
|
|
Animation<double> animation, Agenda item) {
|
|
|
+ item.isDone = true;
|
|
|
return SizeTransition(sizeFactor: animation, child: taskItemView(item));
|
|
|
}
|
|
|
|
|
|
@@ -439,10 +457,10 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- attachDialog(BuildContext? context, Alignment alignment) {
|
|
|
+ void showUnfinishedRecordPopup() {
|
|
|
SmartDialog.showAttach(
|
|
|
- targetContext: context,
|
|
|
- alignment: alignment,
|
|
|
+ targetContext: todoTargetContext,
|
|
|
+ alignment: Alignment.bottomRight,
|
|
|
animationType: SmartAnimationType.fade,
|
|
|
clickMaskDismiss: true,
|
|
|
maskColor: Colors.transparent,
|
|
|
@@ -468,7 +486,17 @@ class HomePage extends BasePage<HomePageController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- void showUnfinishedRecordPopup() {
|
|
|
- attachDialog(todoTargetContext, Alignment.bottomRight);
|
|
|
+ void showRenameTalkDialog(TalkBean item) {
|
|
|
+ reNameDialog(StringName.talkRenameTitle.tr, item.title,
|
|
|
+ hintTxt: StringName.talkRenameTitleHint.tr,
|
|
|
+ maxLength: 15, returnBuilder: (newName) {
|
|
|
+ controller.requestName(newName, item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ void showDeleteTalkDialog(TalkBean item) {
|
|
|
+ talkDeleteDialog(item.id, item.title, returnBuilder: () {
|
|
|
+ controller.requestDelete(item);
|
|
|
+ });
|
|
|
}
|
|
|
}
|