diff --git a/lib/common/models/isar/diary.dart b/lib/common/models/isar/diary.dart index 85bd41c..e1cd296 100644 --- a/lib/common/models/isar/diary.dart +++ b/lib/common/models/isar/diary.dart @@ -114,6 +114,27 @@ class Diary { Diary(); + // 深拷贝方法 + Diary clone() { + return Diary() + ..id = id + ..categoryId = categoryId + ..title = title + ..content = content + ..contentText = contentText + ..time = DateTime.fromMillisecondsSinceEpoch(time.millisecondsSinceEpoch) + ..show = show + ..mood = mood + ..weather = List.from(weather) + ..imageName = List.from(imageName) + ..audioName = List.from(audioName) + ..videoName = List.from(videoName) + ..tags = List.from(tags) + ..position = List.from(position) + ..imageColor = imageColor + ..aspect = aspect; + } + // 将 Diary 对象转换为 JSON Map toJson() { return { diff --git a/lib/components/audio_player/audio_player_view.dart b/lib/components/audio_player/audio_player_view.dart index a87890e..b96b681 100644 --- a/lib/components/audio_player/audio_player_view.dart +++ b/lib/components/audio_player/audio_player_view.dart @@ -22,6 +22,7 @@ class AudioPlayerComponent extends StatelessWidget { initState: (_) async { await logic.initAudioPlayer(path); }, + assignId: true, builder: (_) { return ConstrainedBox( constraints: const BoxConstraints(maxWidth: 400), diff --git a/lib/components/category_add/category_add_logic.dart b/lib/components/category_add/category_add_logic.dart index 2d64a7c..565d50d 100644 --- a/lib/components/category_add/category_add_logic.dart +++ b/lib/components/category_add/category_add_logic.dart @@ -51,10 +51,12 @@ class CategoryAddLogic extends GetxController { void selectCategory(int index) { Get.backLegacy(); editLogic.selectCategory(state.categoryList.value[index].id); + editLogic.update(['CategoryName']); } void cancelCategory() { Get.backLegacy(); editLogic.selectCategory(null); + editLogic.update(['CategoryName']); } } diff --git a/lib/components/category_add/category_add_view.dart b/lib/components/category_add/category_add_view.dart index 45f3e34..c224574 100644 --- a/lib/components/category_add/category_add_view.dart +++ b/lib/components/category_add/category_add_view.dart @@ -16,6 +16,7 @@ class CategoryAddComponent extends StatelessWidget { final i18n = AppLocalizations.of(context)!; return GetBuilder( + assignId: true, builder: (_) { return Padding( padding: const EdgeInsets.all(16.0), diff --git a/lib/components/color_dialog/color_dialog_view.dart b/lib/components/color_dialog/color_dialog_view.dart index 8481b2e..7865f0a 100644 --- a/lib/components/color_dialog/color_dialog_view.dart +++ b/lib/components/color_dialog/color_dialog_view.dart @@ -67,6 +67,7 @@ class ColorDialogComponent extends StatelessWidget { } return GetBuilder( + assignId: true, builder: (_) { return SimpleDialog( title: Text(i18n.settingColor), diff --git a/lib/components/diary_card/basic_diary_card/basic_card_logic.dart b/lib/components/diary_card/basic_diary_card/basic_card_logic.dart index 6d91aa6..b7a68df 100644 --- a/lib/components/diary_card/basic_diary_card/basic_card_logic.dart +++ b/lib/components/diary_card/basic_diary_card/basic_card_logic.dart @@ -11,48 +11,48 @@ mixin BasicCardLogic { Future toDiary(Diary diary) async { HapticFeedback.mediumImpact(); Bind.lazyPut(() => DiaryDetailsLogic(), tag: diary.id); - var res = await Get.toNamed(AppRoutes.diaryPage, arguments: [diary, true]); - var oldCategoryId = diary.categoryId; + var res = await Get.toNamed(AppRoutes.diaryPage, arguments: [diary.clone(), true]); if (res == 'delete') { //如果分类为空,删除主页即可,如果分类不为空,双删除 if (diary.categoryId != null && Bind.isRegistered(tag: diary.categoryId)) { Bind.find(tag: diary.categoryId).state.diaryList.removeWhere((e) => e.id == diary.id); + Bind.find(tag: diary.categoryId).update(['TabView']); } Bind.find(tag: 'default').state.diaryList.removeWhere((e) => e.id == diary.id); + Bind.find(tag: 'default').update(['TabView']); } else { - //重新获取日记 var newDiary = await Utils().isarUtil.getDiaryByID(diary.isarId); - if (newDiary != null) { - var newCategoryId = newDiary.categoryId; - //如果没修改 - if (diary == newDiary) { - return; - } - //如果修改了但是没有修改分类,就替换掉原来的 - if (oldCategoryId == newCategoryId) { - //替换掉全部分类中的 - var oldIndex = - Bind.find(tag: 'default').state.diaryList.indexWhere((e) => e.id == diary.id); - Bind.find(tag: 'default').state.diaryList.replaceRange(oldIndex, oldIndex + 1, [newDiary]); - - //如果注册了控制器 - if (diary.categoryId != null && Bind.isRegistered(tag: diary.categoryId)) { - var oldIndex = - Bind.find(tag: diary.categoryId).state.diaryList.indexWhere((e) => e.id == diary.id); - Bind.find(tag: diary.categoryId) - .state - .diaryList - .replaceRange(oldIndex, oldIndex + 1, [newDiary]); - } - - //await Bind.find().updateDiary(oldCategoryId); - } else { - //如果修改了分类 - //再去新的分类 - await Bind.find().updateDiary(newCategoryId); - //先改旧分类 - await Bind.find().updateDiary(oldCategoryId, jump: false); + if (diary == newDiary) { + return; + } + var newCategoryId = newDiary!.categoryId; + var oldCategoryId = diary.categoryId; + //如果修改了但是没有修改分类,就替换掉原来的 + if (oldCategoryId == newCategoryId) { + //替换掉全部分类中的 + var oldIndex = + Bind.find(tag: 'default').state.diaryList.indexWhere((e) => e.id == newDiary.id); + Bind.find(tag: 'default').state.diaryList.replaceRange(oldIndex, oldIndex + 1, [newDiary]); + Bind.find(tag: 'default').update(['TabView']); + //如果注册了控制器 + if (newDiary.categoryId != null && Bind.isRegistered(tag: newDiary.categoryId)) { + var oldIndex = Bind.find(tag: newDiary.categoryId) + .state + .diaryList + .indexWhere((e) => e.id == newDiary.id); + Bind.find(tag: newDiary.categoryId) + .state + .diaryList + .replaceRange(oldIndex, oldIndex + 1, [newDiary]); + Bind.find(tag: newDiary.categoryId).update(['TabView']); } + //await Bind.find().updateDiary(oldCategoryId); + } else { + //如果修改了分类 + //再去新的分类 + await Bind.find().updateDiary(newCategoryId); + //先改旧分类 + await Bind.find().updateDiary(oldCategoryId, jump: false); } } } @@ -62,7 +62,7 @@ mixin BasicCardLogic { Bind.lazyPut(() => DiaryDetailsLogic(), tag: diary.id); await Get.toNamed( AppRoutes.diaryPage, - arguments: [diary, false], + arguments: [diary.clone(), false], ); } diff --git a/lib/components/diary_card/large_diary_card/large_diary_card_view.dart b/lib/components/diary_card/large_diary_card/large_diary_card_view.dart index f1b6a47..3fa6237 100644 --- a/lib/components/diary_card/large_diary_card/large_diary_card_view.dart +++ b/lib/components/diary_card/large_diary_card/large_diary_card_view.dart @@ -32,8 +32,8 @@ class LargeDiaryCardComponent extends StatelessWidget with BasicCardLogic { return InkWell( borderRadius: AppBorderRadius.mediumBorderRadius, - onTap: () async { - await toDiary(diary); + onTap: () { + toDiary(diary); }, child: Card.filled( color: colorScheme.surfaceContainerLow, diff --git a/lib/components/record_sheet/record_sheet_view.dart b/lib/components/record_sheet/record_sheet_view.dart index 22c51d0..60c1ded 100644 --- a/lib/components/record_sheet/record_sheet_view.dart +++ b/lib/components/record_sheet/record_sheet_view.dart @@ -15,6 +15,7 @@ class RecordSheetComponent extends StatelessWidget { return LayoutBuilder(builder: (context, constrains) { return GetBuilder( + assignId: true, initState: (_) { logic.initMaxWidth(constrains.maxWidth); }, diff --git a/lib/components/remove_password/remove_password_view.dart b/lib/components/remove_password/remove_password_view.dart index c34c879..e2c33b6 100644 --- a/lib/components/remove_password/remove_password_view.dart +++ b/lib/components/remove_password/remove_password_view.dart @@ -79,62 +79,67 @@ class RemovePasswordComponent extends StatelessWidget { }); } - return Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisSize: MainAxisSize.min, - spacing: 16.0, - children: [ - Text( - '请输入密码', - style: textStyle.titleMedium, - ), - GetBuilder(builder: (_) { - return AnimatedBuilder( - animation: logic.animation, - builder: (context, child) { - return Transform.translate( - offset: Offset(logic.interpolate(logic.animation.value), 0), - child: Wrap( - spacing: 16.0, - children: buildPasswordIndicator(), - ), - ); - }, - ); - }), - Row( - mainAxisAlignment: MainAxisAlignment.center, + return GetBuilder( + assignId: true, + builder: (_) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisSize: MainAxisSize.min, + spacing: 16.0, children: [ - SizedBox( - width: buttonSize * 3 + 20, - height: buttonSize * 4 + 30, - child: GridView.count( - crossAxisCount: 3, - childAspectRatio: 1.0, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - physics: const NeverScrollableScrollPhysics(), - children: [ - buildNumButton('1'), - buildNumButton('2'), - buildNumButton('3'), - buildNumButton('4'), - buildNumButton('5'), - buildNumButton('6'), - buildNumButton('7'), - buildNumButton('8'), - buildNumButton('9'), - buildBiometricsButton(), - buildNumButton('0'), - buildDeleteButton() - ], - ), + Text( + '请输入密码', + style: textStyle.titleMedium, + ), + GetBuilder(builder: (_) { + return AnimatedBuilder( + animation: logic.animation, + builder: (context, child) { + return Transform.translate( + offset: Offset(logic.interpolate(logic.animation.value), 0), + child: Wrap( + spacing: 16.0, + children: buildPasswordIndicator(), + ), + ); + }, + ); + }), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: buttonSize * 3 + 20, + height: buttonSize * 4 + 30, + child: GridView.count( + crossAxisCount: 3, + childAspectRatio: 1.0, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + physics: const NeverScrollableScrollPhysics(), + children: [ + buildNumButton('1'), + buildNumButton('2'), + buildNumButton('3'), + buildNumButton('4'), + buildNumButton('5'), + buildNumButton('6'), + buildNumButton('7'), + buildNumButton('8'), + buildNumButton('9'), + buildBiometricsButton(), + buildNumButton('0'), + buildDeleteButton() + ], + ), + ), + ], ), ], ), - ], - ), + ); + }, ); } } diff --git a/lib/components/search_card/search_card_logic.dart b/lib/components/search_card/search_card_logic.dart index 399a264..f5c2c15 100644 --- a/lib/components/search_card/search_card_logic.dart +++ b/lib/components/search_card/search_card_logic.dart @@ -1,5 +1,6 @@ import 'package:get/get.dart'; import 'package:mood_diary/common/models/isar/diary.dart'; +import 'package:mood_diary/pages/diary_details/diary_details_logic.dart'; import 'package:mood_diary/router/app_routes.dart'; import 'search_card_state.dart'; @@ -9,6 +10,7 @@ class SearchCardLogic extends GetxController { //选中卡片后跳转到详情页,直接携带Diary作为参数 Future toDiaryPage(Diary diary) async { - await Get.toNamed(AppRoutes.diaryPage, arguments: [diary, false]); + Bind.lazyPut(() => DiaryDetailsLogic(), tag: diary.id); + await Get.toNamed(AppRoutes.diaryPage, arguments: [diary.clone(), false]); } } diff --git a/lib/components/set_password/set_password_view.dart b/lib/components/set_password/set_password_view.dart index 1931562..7fd42c2 100644 --- a/lib/components/set_password/set_password_view.dart +++ b/lib/components/set_password/set_password_view.dart @@ -49,78 +49,79 @@ class SetPasswordComponent extends StatelessWidget { List buildPasswordIndicator() { return List.generate(4, (index) { - return Obx(() { - return Icon( - Icons.circle, - size: 16, - color: Color.lerp( - state.password.length > index ? colorScheme.onSurface : colorScheme.surfaceContainerHighest, - Colors.red, - logic.animation.value), - ); - }); + return Icon( + Icons.circle, + size: 16, + color: Color.lerp(state.password.length > index ? colorScheme.onSurface : colorScheme.surfaceContainerHighest, + Colors.red, logic.animation.value), + ); }); } - return Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisSize: MainAxisSize.min, - spacing: 16.0, - children: [ - GetBuilder(builder: (_) { - return Text( - state.checkPassword.isEmpty ? '请输入密码' : '请确认密码', - style: textStyle.titleMedium, - ); - }), - GetBuilder(builder: (_) { - return AnimatedBuilder( - animation: logic.animation, - builder: (context, child) { - return Transform.translate( - offset: Offset(logic.interpolate(logic.animation.value), 0), - child: Wrap( - spacing: 16.0, - children: buildPasswordIndicator(), - ), - ); - }, - ); - }), - Row( - mainAxisAlignment: MainAxisAlignment.center, + return GetBuilder( + assignId: true, + builder: (_) { + return Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + mainAxisSize: MainAxisSize.min, + spacing: 16.0, children: [ - SizedBox( - width: buttonSize * 3 + 20, - height: buttonSize * 4 + 30, - child: GridView.count( - crossAxisCount: 3, - childAspectRatio: 1.0, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - physics: const NeverScrollableScrollPhysics(), - shrinkWrap: true, - children: [ - buildNumButton('1'), - buildNumButton('2'), - buildNumButton('3'), - buildNumButton('4'), - buildNumButton('5'), - buildNumButton('6'), - buildNumButton('7'), - buildNumButton('8'), - buildNumButton('9'), - const SizedBox(), - buildNumButton('0'), - buildDeleteButton() - ], - ), + GetBuilder(builder: (_) { + return Text( + state.checkPassword.isEmpty ? '请输入密码' : '请确认密码', + style: textStyle.titleMedium, + ); + }), + GetBuilder(builder: (_) { + return AnimatedBuilder( + animation: logic.animation, + builder: (context, child) { + return Transform.translate( + offset: Offset(logic.interpolate(logic.animation.value), 0), + child: Wrap( + spacing: 16.0, + children: buildPasswordIndicator(), + ), + ); + }, + ); + }), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: buttonSize * 3 + 20, + height: buttonSize * 4 + 30, + child: GridView.count( + crossAxisCount: 3, + childAspectRatio: 1.0, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + children: [ + buildNumButton('1'), + buildNumButton('2'), + buildNumButton('3'), + buildNumButton('4'), + buildNumButton('5'), + buildNumButton('6'), + buildNumButton('7'), + buildNumButton('8'), + buildNumButton('9'), + const SizedBox(), + buildNumButton('0'), + buildDeleteButton() + ], + ), + ), + ], ), ], ), - ], - ), + ); + }, ); } } diff --git a/lib/components/theme_mode_dialog/theme_mode_dialog_view.dart b/lib/components/theme_mode_dialog/theme_mode_dialog_view.dart index 991069d..866dc50 100644 --- a/lib/components/theme_mode_dialog/theme_mode_dialog_view.dart +++ b/lib/components/theme_mode_dialog/theme_mode_dialog_view.dart @@ -14,6 +14,7 @@ class ThemeModeDialogComponent extends StatelessWidget { final i18n = AppLocalizations.of(context)!; return GetBuilder( + assignId: true, builder: (_) { return SimpleDialog( title: Text(i18n.settingThemeMode), diff --git a/lib/components/update_dialog/update_dialog_view.dart b/lib/components/update_dialog/update_dialog_view.dart index 08bb177..1601dcb 100644 --- a/lib/components/update_dialog/update_dialog_view.dart +++ b/lib/components/update_dialog/update_dialog_view.dart @@ -16,6 +16,7 @@ class UpdateDialogComponent extends StatelessWidget { final i18n = AppLocalizations.of(context)!; final colorScheme = Theme.of(context).colorScheme; return GetBuilder( + assignId: true, builder: (_) { return AlertDialog( title: Wrap( diff --git a/lib/components/wave_form/wave_form_view.dart b/lib/components/wave_form/wave_form_view.dart index f42b462..633d97d 100644 --- a/lib/components/wave_form/wave_form_view.dart +++ b/lib/components/wave_form/wave_form_view.dart @@ -47,6 +47,7 @@ class WaveFormComponent extends StatelessWidget { final state = Bind.find().state; final colorScheme = Theme.of(context).colorScheme; return GetBuilder( + assignId: true, builder: (_) { return Obx(() { return CustomPaint( diff --git a/lib/components/window_buttons/window_buttons.dart b/lib/components/window_buttons/window_buttons.dart index ba01f32..f1bc4e2 100644 --- a/lib/components/window_buttons/window_buttons.dart +++ b/lib/components/window_buttons/window_buttons.dart @@ -1,13 +1,31 @@ +import 'dart:io'; + import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:mood_diary/api/api.dart'; +import 'package:mood_diary/utils/utils.dart'; class WindowButtons extends StatelessWidget { final ColorScheme colorScheme; - const WindowButtons({super.key, required this.colorScheme}); + final RxString hitokoto = ''.obs; + + //获取一言 + Future getHitokoto() async { + if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) { + var res = await Utils().cacheUtil.getCacheList('hitokoto', Api().updateHitokoto, maxAgeMillis: 15 * 60000); + if (res != null) { + hitokoto.value = res.first; + } + } + } + + WindowButtons({super.key, required this.colorScheme}); @override Widget build(BuildContext context) { + getHitokoto(); final buttonColors = WindowButtonColors( iconNormal: colorScheme.secondary, mouseDown: colorScheme.secondaryContainer, @@ -28,13 +46,15 @@ class WindowButtons extends StatelessWidget { return Container( color: colorScheme.surface, height: appWindow.titleBarHeight, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - MinimizeWindowButton(colors: buttonColors), - MaximizeWindowButton(colors: buttonColors), - CloseWindowButton(colors: closeButtonColors), - ], + child: MoveWindow( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + MinimizeWindowButton(colors: buttonColors), + MaximizeWindowButton(colors: buttonColors), + CloseWindowButton(colors: closeButtonColors), + ], + ), ), ); } diff --git a/lib/main.dart b/lib/main.dart index b5f80ad..08ed235 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -75,15 +75,14 @@ void main() { ); // 根据平台决定是否需要 MoveWindow final windowChild = (Platform.isWindows || Platform.isMacOS || Platform.isWindows) - ? MoveWindow( - child: Column( + ? Column( children: [ WindowButtons( colorScheme: colorScheme, ), Expanded(child: mediaQuery), ], - )) + ) : mediaQuery; return windowChild; }, diff --git a/lib/pages/diary_details/diary_details_view.dart b/lib/pages/diary_details/diary_details_view.dart index 2e93521..75fdf35 100644 --- a/lib/pages/diary_details/diary_details_view.dart +++ b/lib/pages/diary_details/diary_details_view.dart @@ -17,12 +17,14 @@ import 'package:mood_diary/utils/utils.dart'; import 'diary_details_logic.dart'; class DiaryDetailsPage extends StatelessWidget { - const DiaryDetailsPage({super.key}); + DiaryDetailsPage({super.key}); + + final tag = (Get.arguments[0] as Diary).id; @override Widget build(BuildContext context) { - final logic = Bind.find(tag: (Get.arguments[0] as Diary).id); - final state = Bind.find(tag: (Get.arguments[0] as Diary).id).state; + final logic = Bind.find(tag: tag); + final state = Bind.find(tag: tag).state; final size = MediaQuery.sizeOf(context); final textStyle = Theme.of(context).textTheme; final colorScheme = Theme.of(context).colorScheme; diff --git a/lib/pages/edit/edit_logic.dart b/lib/pages/edit/edit_logic.dart index 8304240..d2aa20c 100644 --- a/lib/pages/edit/edit_logic.dart +++ b/lib/pages/edit/edit_logic.dart @@ -317,7 +317,8 @@ class EditLogic extends GetxController with WidgetsBindingObserver { ..imageColor = await getCoverColor() ..aspect = await getCoverAspect(); await Utils().isarUtil.updateADiary(state.currentDiary); - Get.close(); + Utils().logUtil.printInfo(state.currentDiary.toJson()); + Get.backLegacy(); state.isNew ? Get.backLegacy(result: state.currentDiary.categoryId ?? '') : Get.backLegacy(result: 'changed'); Utils().noticeUtil.showToast(state.isNew ? '保存成功' : '修改成功'); } @@ -451,19 +452,15 @@ class EditLogic extends GetxController with WidgetsBindingObserver { void selectCategory(String? id) { state.currentDiary.categoryId = id; - Utils().logUtil.printInfo(id); if (id == null) { state.categoryName = ''; } else { var category = Utils().isarUtil.getCategoryName(id); if (category != null) { state.categoryName = category.categoryName; - update(['Category']); } - - Utils().logUtil.printInfo(state.categoryName); } - update(['Category']); + update(['CategoryName']); } void selectTabView(index) { diff --git a/lib/pages/edit/edit_view.dart b/lib/pages/edit/edit_view.dart index 1ce3217..3106e16 100644 --- a/lib/pages/edit/edit_view.dart +++ b/lib/pages/edit/edit_view.dart @@ -436,9 +436,8 @@ class EditPage extends StatelessWidget { ); }), GetBuilder( - id: 'Category', + id: 'CategoryName', builder: (_) { - Utils().logUtil.printInfo('1'); return ListTile( title: const Text('分类'), subtitle: state.categoryName.isNotEmpty ? Text(state.categoryName) : null, diff --git a/lib/pages/home/calendar/calendar_state.dart b/lib/pages/home/calendar/calendar_state.dart index caeedb2..d95e034 100644 --- a/lib/pages/home/calendar/calendar_state.dart +++ b/lib/pages/home/calendar/calendar_state.dart @@ -22,7 +22,7 @@ class CalendarState { currentMonth = now.obs; dateHasDiary = [].obs; diaryList = [].obs; - isExpanded = true.obs; + isExpanded = false.obs; ///Initialize variables } diff --git a/lib/pages/home/home_logic.dart b/lib/pages/home/home_logic.dart index 01a54fb..268cd80 100644 --- a/lib/pages/home/home_logic.dart +++ b/lib/pages/home/home_logic.dart @@ -47,17 +47,6 @@ class HomeLogic extends GetxController with GetTickerProviderStateMixin { super.onClose(); } - // //获取一言 - // Future getHitokoto() async { - // if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) { - // var res = await Utils().cacheUtil.getCacheList('hitokoto', Api().updateHitokoto, maxAgeMillis: 15 * 60000); - // if (res != null) { - // state.hitokoto = res.first; - // } - // update(['DesktopBar']); - // } - // } - //打开fab Future openFab() async { await HapticFeedback.vibrate(); diff --git a/lib/pages/map/map_logic.dart b/lib/pages/map/map_logic.dart index b12469f..08a4dac 100644 --- a/lib/pages/map/map_logic.dart +++ b/lib/pages/map/map_logic.dart @@ -57,7 +57,7 @@ class MapLogic extends GetxController { Bind.lazyPut(() => DiaryDetailsLogic(), tag: diary!.id); await Get.toNamed( AppRoutes.diaryPage, - arguments: [diary, false], + arguments: [diary.clone(), false], ); } } diff --git a/lib/router/app_pages.dart b/lib/router/app_pages.dart index 0c70636..e90e9b8 100644 --- a/lib/router/app_pages.dart +++ b/lib/router/app_pages.dart @@ -71,7 +71,7 @@ class AppPages { //日记页路由 GetPage( name: AppRoutes.diaryPage, - page: () => const DiaryDetailsPage(), + page: () => DiaryDetailsPage(), ), //图片路由 GetPage(