From 0947c45f1916cd9c394417ed87951a9f965ff7ee Mon Sep 17 00:00:00 2001 From: ZhuJHua <1624109111@qq.com> Date: Sun, 27 Oct 2024 23:46:20 +0800 Subject: [PATCH] style(*): code clean --- lib/common/values/media_type.dart | 7 +- .../audio_player/audio_player_logic.dart | 12 +- .../audio_player/audio_player_view.dart | 2 +- .../category_add/category_add_logic.dart | 2 - .../color_dialog/color_dialog_logic.dart | 17 +-- lib/components/dashboard/dashboard_logic.dart | 27 ++-- .../diary_tab_view/diary_tab_view_logic.dart | 14 -- .../diary_tab_view/diary_tab_view_state.dart | 3 - .../login_form/login_form_logic.dart | 7 - lib/components/mood_icon/mood_icon_logic.dart | 10 -- .../record_sheet/record_sheet_logic.dart | 2 - .../record_sheet/record_sheet_state.dart | 4 - .../register_form/register_form_logic.dart | 8 -- .../remove_password_logic.dart | 7 - .../search_card/search_card_logic.dart | 12 -- .../search_sheet/search_sheet_logic.dart | 7 - .../set_password/set_password_logic.dart | 14 -- lib/components/side_bar/side_bar_logic.dart | 16 +-- .../theme_mode_dialog_logic.dart | 18 --- lib/components/time_line/time_line_logic.dart | 12 -- .../update_dialog/update_dialog_logic.dart | 12 -- lib/components/wave_form/wave_form_logic.dart | 14 +- lib/components/wave_form/wave_form_state.dart | 6 +- lib/l10n/intl_en.arb | 1 + lib/l10n/intl_zh.arb | 1 + lib/pages/about/about_logic.dart | 8 -- lib/pages/about/about_state.dart | 2 - lib/pages/agreement/agreement_logic.dart | 12 -- lib/pages/analyse/analyse_logic.dart | 15 +- .../category_manager_logic.dart | 8 -- .../diary_details/diary_details_logic.dart | 13 -- .../diary_setting/diary_setting_logic.dart | 12 -- lib/pages/draw/draw_logic.dart | 7 - lib/pages/edit/edit_logic.dart | 1 - lib/pages/font/font_logic.dart | 20 --- lib/pages/home/assistant/assistant_state.dart | 3 - lib/pages/home/calendar/calendar_logic.dart | 6 - lib/pages/home/setting/setting_logic.dart | 2 - lib/pages/home/setting/setting_state.dart | 1 - lib/pages/home/setting/setting_view.dart | 1 - lib/pages/image/image_logic.dart | 12 -- lib/pages/laboratory/laboratory_logic.dart | 2 - lib/pages/lock/lock_logic.dart | 7 - lib/pages/login/login_logic.dart | 12 -- lib/pages/map/map_logic.dart | 6 - lib/pages/map/map_view.dart | 4 +- lib/pages/privacy/privacy_logic.dart | 12 -- lib/pages/recycle/recycle_logic.dart | 9 -- lib/pages/start/start_logic.dart | 19 --- lib/pages/user/user_logic.dart | 12 -- pubspec.lock | 134 ++++++++++++++++-- pubspec.yaml | 17 ++- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 54 files changed, 160 insertions(+), 436 deletions(-) diff --git a/lib/common/values/media_type.dart b/lib/common/values/media_type.dart index 50b3b2b..449fe5f 100644 --- a/lib/common/values/media_type.dart +++ b/lib/common/values/media_type.dart @@ -1,8 +1,7 @@ -enum MediaType{ - +enum MediaType { image(0, 'image'), audio(1, 'audio'), - video(2,'video'); + video(2, 'video'); const MediaType(this.number, this.value); @@ -10,4 +9,4 @@ enum MediaType{ final String value; static MediaType getType(int number) => MediaType.values.firstWhere((e) => e.number == number); -} \ No newline at end of file +} diff --git a/lib/components/audio_player/audio_player_logic.dart b/lib/components/audio_player/audio_player_logic.dart index c0e72c1..34c83a0 100644 --- a/lib/components/audio_player/audio_player_logic.dart +++ b/lib/components/audio_player/audio_player_logic.dart @@ -14,8 +14,7 @@ class AudioPlayerLogic extends GetxController with GetSingleTickerProviderStateM late final EditLogic editLogic = Bind.find(); @override - void onInit() { - // TODO: implement onInit + void onReady() { audioPlayer.eventStream.listen((event) { //读取时间完成 if (event.eventType == AudioEventType.duration) { @@ -34,20 +33,11 @@ class AudioPlayerLogic extends GetxController with GetSingleTickerProviderStateM state.currentDuration.value = duration; } }); - - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); } @override void onClose() { - // TODO: implement onClose animationController.dispose(); audioPlayer.dispose(); super.onClose(); diff --git a/lib/components/audio_player/audio_player_view.dart b/lib/components/audio_player/audio_player_view.dart index fb8ce5c..2ed5099 100644 --- a/lib/components/audio_player/audio_player_view.dart +++ b/lib/components/audio_player/audio_player_view.dart @@ -5,7 +5,7 @@ import 'package:get/get.dart'; import 'audio_player_logic.dart'; class AudioPlayerComponent extends StatelessWidget { - const AudioPlayerComponent({super.key, required this.path, this.isEdit = false}); + const AudioPlayerComponent({super.key, required this.path, this.isEdit = false}); final String path; diff --git a/lib/components/category_add/category_add_logic.dart b/lib/components/category_add/category_add_logic.dart index 589f058..2d64a7c 100644 --- a/lib/components/category_add/category_add_logic.dart +++ b/lib/components/category_add/category_add_logic.dart @@ -15,14 +15,12 @@ class CategoryAddLogic extends GetxController { @override void onReady() { - // TODO: implement onReady getCategory(); super.onReady(); } @override void onClose() { - // TODO: implement onClose textEditingController.dispose(); super.onClose(); } diff --git a/lib/components/color_dialog/color_dialog_logic.dart b/lib/components/color_dialog/color_dialog_logic.dart index f7f0e80..c11183b 100644 --- a/lib/components/color_dialog/color_dialog_logic.dart +++ b/lib/components/color_dialog/color_dialog_logic.dart @@ -12,27 +12,14 @@ class ColorDialogLogic extends GetxController { late SettingLogic settingLogic = Bind.find(); @override - void onInit() async { - // TODO: implement onInit + void onReady() async { //如果支持系统颜色,获取系统颜色 if (state.supportDynamic.value) { state.systemColor.value = await Utils().themeUtil.getDynamicColor(); } - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady super.onReady(); } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - + //更改主题色 Future changeSeedColor(index) async { await Utils().prefUtil.setValue('color', index); diff --git a/lib/components/dashboard/dashboard_logic.dart b/lib/components/dashboard/dashboard_logic.dart index 302b022..0665f50 100644 --- a/lib/components/dashboard/dashboard_logic.dart +++ b/lib/components/dashboard/dashboard_logic.dart @@ -1,3 +1,5 @@ +import 'dart:async'; + import 'package:flutter/foundation.dart'; import 'package:get/get.dart'; import 'package:mood_diary/router/app_routes.dart'; @@ -9,19 +11,12 @@ class DashboardLogic extends GetxController { final DashboardState state = DashboardState(); @override - void onInit() { - // TODO: implement onInit - getUseTime(); - getDiaryCount(); - getMoodAndWeatherByRange(state.dateRange[0], state.dateRange[1]); - getCountContent(); - getCategoryCount(); - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady + void onReady() async { + unawaited(getUseTime()); + unawaited(getDiaryCount()); + unawaited(getMoodAndWeatherByRange(state.dateRange[0], state.dateRange[1])); + unawaited(getCountContent()); + unawaited(getCategoryCount()); super.onReady(); } @@ -81,10 +76,4 @@ class DashboardLogic extends GetxController { await Get.toNamed(AppRoutes.categoryManagerPage); await getCategoryCount(); } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } } diff --git a/lib/components/diary_tab_view/diary_tab_view_logic.dart b/lib/components/diary_tab_view/diary_tab_view_logic.dart index 43fa331..d67f1ba 100644 --- a/lib/components/diary_tab_view/diary_tab_view_logic.dart +++ b/lib/components/diary_tab_view/diary_tab_view_logic.dart @@ -12,26 +12,12 @@ class DiaryTabViewLogic extends GetxController { DiaryTabViewLogic({required this.categoryId}); - @override - void onInit() { - // TODO: implement onInit - - super.onInit(); - } - @override void onReady() async { await getDiary(); super.onReady(); } - @override - void onClose() { - // TODO: implement onClose - - super.onClose(); - } - Future getDiary() async { state.isFetching.value = true; state.diaryList.value = await Utils().isarUtil.getDiaryByCategory(categoryId, 0, state.initLen); diff --git a/lib/components/diary_tab_view/diary_tab_view_state.dart b/lib/components/diary_tab_view/diary_tab_view_state.dart index 5b88d75..947fbc1 100644 --- a/lib/components/diary_tab_view/diary_tab_view_state.dart +++ b/lib/components/diary_tab_view/diary_tab_view_state.dart @@ -6,15 +6,12 @@ class DiaryTabViewState { late RxBool isFetching; - //首次加载的个数 late int initLen; //分页的个数 late int pageLen; - - DiaryTabViewState() { diaryList = [].obs; isFetching = false.obs; diff --git a/lib/components/login_form/login_form_logic.dart b/lib/components/login_form/login_form_logic.dart index 7d346f2..0e1563a 100644 --- a/lib/components/login_form/login_form_logic.dart +++ b/lib/components/login_form/login_form_logic.dart @@ -14,15 +14,8 @@ class LoginFormLogic extends GetxController { final FocusNode emailFocusNode = FocusNode(); final FocusNode passwordFocusNode = FocusNode(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { - // TODO: implement onClose emailFocusNode.dispose(); passwordFocusNode.dispose(); diff --git a/lib/components/mood_icon/mood_icon_logic.dart b/lib/components/mood_icon/mood_icon_logic.dart index 6f42eb5..75baab7 100644 --- a/lib/components/mood_icon/mood_icon_logic.dart +++ b/lib/components/mood_icon/mood_icon_logic.dart @@ -5,15 +5,5 @@ import 'mood_icon_state.dart'; class MoodIconLogic extends GetxController { final MoodIconState state = MoodIconState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } } diff --git a/lib/components/record_sheet/record_sheet_logic.dart b/lib/components/record_sheet/record_sheet_logic.dart index cb610ca..2ead257 100644 --- a/lib/components/record_sheet/record_sheet_logic.dart +++ b/lib/components/record_sheet/record_sheet_logic.dart @@ -27,7 +27,6 @@ class RecordSheetLogic extends GetxController with GetTickerProviderStateMixin { @override void onReady() { - // TODO: implement onReady //启动监听 listenAmplitude(); super.onReady(); @@ -35,7 +34,6 @@ class RecordSheetLogic extends GetxController with GetTickerProviderStateMixin { @override void onClose() async { - // TODO: implement onClose if (state.isStop == false) { await audioRecorder.cancel(); } diff --git a/lib/components/record_sheet/record_sheet_state.dart b/lib/components/record_sheet/record_sheet_state.dart index 14d8a59..a64f084 100644 --- a/lib/components/record_sheet/record_sheet_state.dart +++ b/lib/components/record_sheet/record_sheet_state.dart @@ -1,7 +1,6 @@ import 'package:get/get.dart'; class RecordSheetState { - late Rx durationTime; late RxBool isRecording; late RxBool isStarted; @@ -11,10 +10,7 @@ class RecordSheetState { late double maxWidth; late bool isStop; - - RecordSheetState() { - isRecording = false.obs; isStarted = false.obs; fileName = ''; diff --git a/lib/components/register_form/register_form_logic.dart b/lib/components/register_form/register_form_logic.dart index ab7a90e..287313f 100644 --- a/lib/components/register_form/register_form_logic.dart +++ b/lib/components/register_form/register_form_logic.dart @@ -13,16 +13,8 @@ class RegisterFormLogic extends GetxController { final FocusNode rePasswordFocusNode = FocusNode(); late final loginLogic = Bind.find(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { - // TODO: implement onClose - emailFocusNode.dispose(); passwordFocusNode.dispose(); rePasswordFocusNode.dispose(); diff --git a/lib/components/remove_password/remove_password_logic.dart b/lib/components/remove_password/remove_password_logic.dart index c32f09e..e0495b0 100644 --- a/lib/components/remove_password/remove_password_logic.dart +++ b/lib/components/remove_password/remove_password_logic.dart @@ -15,15 +15,8 @@ class RemovePasswordLogic extends GetxController with GetSingleTickerProviderSta late final settingLogic = Bind.find(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { - // TODO: implement onClose animationController.dispose(); super.onClose(); } diff --git a/lib/components/search_card/search_card_logic.dart b/lib/components/search_card/search_card_logic.dart index 05458e5..399a264 100644 --- a/lib/components/search_card/search_card_logic.dart +++ b/lib/components/search_card/search_card_logic.dart @@ -7,18 +7,6 @@ import 'search_card_state.dart'; class SearchCardLogic extends GetxController { final SearchCardState state = SearchCardState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - //选中卡片后跳转到详情页,直接携带Diary作为参数 Future toDiaryPage(Diary diary) async { await Get.toNamed(AppRoutes.diaryPage, arguments: [diary, false]); diff --git a/lib/components/search_sheet/search_sheet_logic.dart b/lib/components/search_sheet/search_sheet_logic.dart index 143066b..522940d 100644 --- a/lib/components/search_sheet/search_sheet_logic.dart +++ b/lib/components/search_sheet/search_sheet_logic.dart @@ -9,15 +9,8 @@ class SearchSheetLogic extends GetxController { late TextEditingController textEditingController = TextEditingController(); late FocusNode focusNode = FocusNode(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { - // TODO: implement onClose textEditingController.dispose(); focusNode.dispose(); super.onClose(); diff --git a/lib/components/set_password/set_password_logic.dart b/lib/components/set_password/set_password_logic.dart index 03cf12a..d36ef28 100644 --- a/lib/components/set_password/set_password_logic.dart +++ b/lib/components/set_password/set_password_logic.dart @@ -16,22 +16,8 @@ class SetPasswordLogic extends GetxController with GetSingleTickerProviderStateM late final settingLogic = Bind.find(); - @override - void onInit() { - // TODO: implement onInit - - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { - // TODO: implement onClose animationController.dispose(); super.onClose(); } diff --git a/lib/components/side_bar/side_bar_logic.dart b/lib/components/side_bar/side_bar_logic.dart index 87d9b32..c12dcf1 100644 --- a/lib/components/side_bar/side_bar_logic.dart +++ b/lib/components/side_bar/side_bar_logic.dart @@ -15,19 +15,11 @@ class SideBarLogic extends GetxController { late HomeLogic homeLogic = Bind.find(); @override - void onInit() { - // TODO: implement onInit + void onReady() { getHitokoto(); getImage(); getInfo(); getWeather(); - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); } @@ -46,12 +38,6 @@ class SideBarLogic extends GetxController { } } - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - Future getImage() async { var url = await Utils().cacheUtil.getCacheList('bingImage', Api().updateImageUrl, maxAgeMillis: 6 * 60 * 60000); if (url != null) { diff --git a/lib/components/theme_mode_dialog/theme_mode_dialog_logic.dart b/lib/components/theme_mode_dialog/theme_mode_dialog_logic.dart index 30ca256..ffa1384 100644 --- a/lib/components/theme_mode_dialog/theme_mode_dialog_logic.dart +++ b/lib/components/theme_mode_dialog/theme_mode_dialog_logic.dart @@ -9,24 +9,6 @@ class ThemeModeDialogLogic extends GetxController { final ThemeModeDialogState state = ThemeModeDialogState(); late final settingLogic = Bind.find(); - @override - void onInit() { - // TODO: implement onInit - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - //修改颜色模式 Future changeThemeMode(int value) async { await Utils().prefUtil.setValue('themeMode', value); diff --git a/lib/components/time_line/time_line_logic.dart b/lib/components/time_line/time_line_logic.dart index c0901c9..030150a 100644 --- a/lib/components/time_line/time_line_logic.dart +++ b/lib/components/time_line/time_line_logic.dart @@ -4,16 +4,4 @@ import 'time_line_state.dart'; class TimeLineLogic extends GetxController { final TimeLineState state = TimeLineState(); - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } } diff --git a/lib/components/update_dialog/update_dialog_logic.dart b/lib/components/update_dialog/update_dialog_logic.dart index 3a19b5c..df43e7d 100644 --- a/lib/components/update_dialog/update_dialog_logic.dart +++ b/lib/components/update_dialog/update_dialog_logic.dart @@ -7,18 +7,6 @@ import 'update_dialog_state.dart'; class UpdateDialogLogic extends GetxController { final UpdateDialogState state = UpdateDialogState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - Future toDownload(GithubRelease githubRelease) async { await launchUrl(Uri.parse(githubRelease.htmlUrl!), mode: LaunchMode.platformDefault); } diff --git a/lib/components/wave_form/wave_form_logic.dart b/lib/components/wave_form/wave_form_logic.dart index 90e5d56..8c929c5 100644 --- a/lib/components/wave_form/wave_form_logic.dart +++ b/lib/components/wave_form/wave_form_logic.dart @@ -5,19 +5,7 @@ import 'wave_form_state.dart'; class WaveFormLogic extends GetxController { final WaveFormState state = WaveFormState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - - void maxLengthAdd(value,maxWidth) { + void maxLengthAdd(value, maxWidth) { if (state.amplitudes.length > maxWidth ~/ (state.barWidth + state.spaceWidth)) { state.amplitudes.removeAt(0); } diff --git a/lib/components/wave_form/wave_form_state.dart b/lib/components/wave_form/wave_form_state.dart index 8ef9f6e..c24cb42 100644 --- a/lib/components/wave_form/wave_form_state.dart +++ b/lib/components/wave_form/wave_form_state.dart @@ -4,10 +4,12 @@ class WaveFormState { late double barWidth; late double spaceWidth; late RxList amplitudes; + WaveFormState() { amplitudes = [].obs; - barWidth=2.0; - spaceWidth=2.0; + barWidth = 2.0; + spaceWidth = 2.0; + ///Initialize variables } } diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index b72fff5..1ce8075 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -30,6 +30,7 @@ "settingImportDes": "Only supports files exported from this app", "settingClean": "Clear Cache", "settingDisplay": "Display and Personalization", + "settingDiary": "Diary", "settingThemeMode": "Theme Mode", "settingColor": "Color Scheme", "settingAutoPlay": "Homepage Card Auto-Play", diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index b3466b6..bf055e8 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -30,6 +30,7 @@ "settingImportDes": "仅支持本应用导出的文件", "settingClean": "清理缓存", "settingDisplay": "显示与个性", + "settingDiary": "日记", "settingThemeMode": "主题模式", "settingColor": "配色方案", "settingAutoPlay": "首页卡片自动轮播", diff --git a/lib/pages/about/about_logic.dart b/lib/pages/about/about_logic.dart index 31d5259..b52ba73 100644 --- a/lib/pages/about/about_logic.dart +++ b/lib/pages/about/about_logic.dart @@ -14,12 +14,6 @@ class AboutLogic extends GetxController { super.onReady(); } - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - Future getInfo() async { var packageInfo = await Utils().packageUtil.getPackageInfo(); state.appName = packageInfo.appName; @@ -47,8 +41,6 @@ class AboutLogic extends GetxController { await launchUrl(uri, mode: LaunchMode.platformDefault); } - - void toPrivacy() { Get.toNamed(AppRoutes.privacyPage); } diff --git a/lib/pages/about/about_state.dart b/lib/pages/about/about_state.dart index e4fac99..83da6f7 100644 --- a/lib/pages/about/about_state.dart +++ b/lib/pages/about/about_state.dart @@ -1,5 +1,3 @@ - - class AboutState { late String appName; diff --git a/lib/pages/agreement/agreement_logic.dart b/lib/pages/agreement/agreement_logic.dart index 727ccbf..86801bf 100644 --- a/lib/pages/agreement/agreement_logic.dart +++ b/lib/pages/agreement/agreement_logic.dart @@ -4,16 +4,4 @@ import 'agreement_state.dart'; class AgreementLogic extends GetxController { final AgreementState state = AgreementState(); - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } } diff --git a/lib/pages/analyse/analyse_logic.dart b/lib/pages/analyse/analyse_logic.dart index 091627f..f751ec8 100644 --- a/lib/pages/analyse/analyse_logic.dart +++ b/lib/pages/analyse/analyse_logic.dart @@ -14,22 +14,9 @@ class AnalyseLogic extends GetxController { @override void onReady() { - // TODO: implement onReady - - super.onReady(); - } - - @override - void onInit() { - // TODO: implement onInit getMoodAndWeatherByRange(state.dateRange[0], state.dateRange[1]); - super.onInit(); - } - @override - void onClose() { - // TODO: implement onClose - super.onClose(); + super.onReady(); } //选中两个日期后,查询指定范围内的日记 diff --git a/lib/pages/category_manager/category_manager_logic.dart b/lib/pages/category_manager/category_manager_logic.dart index 283e1ef..25c3d79 100644 --- a/lib/pages/category_manager/category_manager_logic.dart +++ b/lib/pages/category_manager/category_manager_logic.dart @@ -13,13 +13,6 @@ class CategoryManagerLogic extends GetxController { late DiaryLogic diaryLogic = Bind.find(); - @override - void onInit() { - // TODO: implement onInit - - super.onInit(); - } - @override void onReady() async { await getCategory(); @@ -28,7 +21,6 @@ class CategoryManagerLogic extends GetxController { @override void onClose() { - // TODO: implement onClose textEditingController.dispose(); super.onClose(); } diff --git a/lib/pages/diary_details/diary_details_logic.dart b/lib/pages/diary_details/diary_details_logic.dart index 232b38b..fe8b6ad 100644 --- a/lib/pages/diary_details/diary_details_logic.dart +++ b/lib/pages/diary_details/diary_details_logic.dart @@ -20,19 +20,6 @@ class DiaryDetailsLogic extends GetxController { selection: const TextSelection.collapsed(offset: 0), ); - @override - void onInit() { - // TODO: implement onInit - - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { quillController.dispose(); diff --git a/lib/pages/diary_setting/diary_setting_logic.dart b/lib/pages/diary_setting/diary_setting_logic.dart index 326ce90..c28050f 100644 --- a/lib/pages/diary_setting/diary_setting_logic.dart +++ b/lib/pages/diary_setting/diary_setting_logic.dart @@ -6,18 +6,6 @@ import 'diary_setting_state.dart'; class DiarySettingLogic extends GetxController { final DiarySettingState state = DiarySettingState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - //图片质量 Future quality(int value) async { Get.backLegacy(); diff --git a/lib/pages/draw/draw_logic.dart b/lib/pages/draw/draw_logic.dart index a2dd470..ffc47fb 100644 --- a/lib/pages/draw/draw_logic.dart +++ b/lib/pages/draw/draw_logic.dart @@ -11,15 +11,8 @@ class DrawLogic extends GetxController { late DrawingController drawingController = DrawingController()..setStyle(color: state.pickerColor); late final editLogic = Bind.find(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { - // TODO: implement onClose drawingController.dispose(); super.onClose(); } diff --git a/lib/pages/edit/edit_logic.dart b/lib/pages/edit/edit_logic.dart index ca7c8cd..41acde9 100644 --- a/lib/pages/edit/edit_logic.dart +++ b/lib/pages/edit/edit_logic.dart @@ -123,7 +123,6 @@ class EditLogic extends GetxController with WidgetsBindingObserver { @override void onClose() { - // TODO: implement onClose WidgetsBinding.instance.removeObserver(this); tagTextEditingController.dispose(); titleTextEditingController.dispose(); diff --git a/lib/pages/font/font_logic.dart b/lib/pages/font/font_logic.dart index ba50f45..53353c7 100644 --- a/lib/pages/font/font_logic.dart +++ b/lib/pages/font/font_logic.dart @@ -7,26 +7,6 @@ import 'font_state.dart'; class FontLogic extends GetxController with GetSingleTickerProviderStateMixin { final FontState state = FontState(); - @override - void onInit() { - // TODO: implement onInit - - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady - - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - void changeFontScale(value) { state.fontScale = value; update(); diff --git a/lib/pages/home/assistant/assistant_state.dart b/lib/pages/home/assistant/assistant_state.dart index bcde9d1..1c2effd 100644 --- a/lib/pages/home/assistant/assistant_state.dart +++ b/lib/pages/home/assistant/assistant_state.dart @@ -13,15 +13,12 @@ class AssistantState { late int totalToken; - - AssistantState() { messages = {}; modelVersion = 0.obs; keyboardState = KeyboardState.closed; - ///Initialize variables } } diff --git a/lib/pages/home/calendar/calendar_logic.dart b/lib/pages/home/calendar/calendar_logic.dart index 40a2ed8..77a6750 100644 --- a/lib/pages/home/calendar/calendar_logic.dart +++ b/lib/pages/home/calendar/calendar_logic.dart @@ -13,12 +13,6 @@ class CalendarLogic extends GetxController { super.onReady(); } - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - Future getDateHasDiary(DateTime value) async { state.currentMonth.value = value; state.dateHasDiary.value = await Utils().isarUtil.getDiaryDateByMonth(value.year, value.month); diff --git a/lib/pages/home/setting/setting_logic.dart b/lib/pages/home/setting/setting_logic.dart index 660ff2c..04d9170 100644 --- a/lib/pages/home/setting/setting_logic.dart +++ b/lib/pages/home/setting/setting_logic.dart @@ -55,8 +55,6 @@ class SettingLogic extends GetxController { state.dynamicColor.value = value; } - - //本地化 Future local(bool value) async { await Utils().prefUtil.setValue('local', value); diff --git a/lib/pages/home/setting/setting_state.dart b/lib/pages/home/setting/setting_state.dart index 3b1a384..3acc8a6 100644 --- a/lib/pages/home/setting/setting_state.dart +++ b/lib/pages/home/setting/setting_state.dart @@ -11,7 +11,6 @@ class SettingState { late RxBool dynamicColor; - late RxInt fontTheme; late RxBool getWeather; diff --git a/lib/pages/home/setting/setting_view.dart b/lib/pages/home/setting/setting_view.dart index cea1ff9..a6b4edb 100644 --- a/lib/pages/home/setting/setting_view.dart +++ b/lib/pages/home/setting/setting_view.dart @@ -221,7 +221,6 @@ class SettingPage extends StatelessWidget { // switch (state.fontTheme.value) { // 0 => '思源黑体', // 1 => '思源宋体', - // // TODO: Handle this case. // int() => throw UnimplementedError(), // }, // style: textStyle.bodySmall!.copyWith( diff --git a/lib/pages/image/image_logic.dart b/lib/pages/image/image_logic.dart index b9e690d..f92e48e 100644 --- a/lib/pages/image/image_logic.dart +++ b/lib/pages/image/image_logic.dart @@ -5,18 +5,6 @@ import 'image_state.dart'; class ImageLogic extends GetxController { final ImageState state = ImageState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - void changePage(int index) { state.imageIndex = index; update(); diff --git a/lib/pages/laboratory/laboratory_logic.dart b/lib/pages/laboratory/laboratory_logic.dart index a6263b7..10f04c5 100644 --- a/lib/pages/laboratory/laboratory_logic.dart +++ b/lib/pages/laboratory/laboratory_logic.dart @@ -14,14 +14,12 @@ class LaboratoryLogic extends GetxController { @override void onReady() { - // TODO: implement onReady initInfo(); super.onReady(); } @override void onClose() { - // TODO: implement onClose idTextEditingController.dispose(); qweatherTextEditingController.dispose(); keyTextEditingController.dispose(); diff --git a/lib/pages/lock/lock_logic.dart b/lib/pages/lock/lock_logic.dart index 773b3e7..35b7f90 100644 --- a/lib/pages/lock/lock_logic.dart +++ b/lib/pages/lock/lock_logic.dart @@ -12,15 +12,8 @@ class LockLogic extends GetxController with GetSingleTickerProviderStateMixin { late Animation animation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(parent: animationController, curve: Curves.easeInOut)); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { - // TODO: implement onClose animationController.dispose(); super.onClose(); } diff --git a/lib/pages/login/login_logic.dart b/lib/pages/login/login_logic.dart index 4ae0f6d..edb6328 100644 --- a/lib/pages/login/login_logic.dart +++ b/lib/pages/login/login_logic.dart @@ -5,18 +5,6 @@ import 'login_state.dart'; class LoginLogic extends GetxController { final LoginState state = LoginState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - //切换登录注册 void changeForm() { state.isLogin = !state.isLogin; diff --git a/lib/pages/map/map_logic.dart b/lib/pages/map/map_logic.dart index 670155b..73cded8 100644 --- a/lib/pages/map/map_logic.dart +++ b/lib/pages/map/map_logic.dart @@ -8,12 +8,6 @@ class MapLogic extends GetxController { late final MapController mapController = MapController(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - @override void onClose() { mapController.dispose(); diff --git a/lib/pages/map/map_view.dart b/lib/pages/map/map_view.dart index cf34177..28abebf 100644 --- a/lib/pages/map/map_view.dart +++ b/lib/pages/map/map_view.dart @@ -10,12 +10,12 @@ class MapPage extends StatelessWidget { @override Widget build(BuildContext context) { final logic = Bind.find(); - final state = Bind.find().state; + //final state = Bind.find().state; return FlutterMap( - children: [TileLayer()], mapController: logic.mapController, options: const MapOptions(), + children: [TileLayer()], ); } } diff --git a/lib/pages/privacy/privacy_logic.dart b/lib/pages/privacy/privacy_logic.dart index b0fbbb6..9783212 100644 --- a/lib/pages/privacy/privacy_logic.dart +++ b/lib/pages/privacy/privacy_logic.dart @@ -4,16 +4,4 @@ import 'privacy_state.dart'; class PrivacyLogic extends GetxController { final PrivacyState state = PrivacyState(); - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } } diff --git a/lib/pages/recycle/recycle_logic.dart b/lib/pages/recycle/recycle_logic.dart index 6516223..2338307 100644 --- a/lib/pages/recycle/recycle_logic.dart +++ b/lib/pages/recycle/recycle_logic.dart @@ -12,7 +12,6 @@ class RecycleLogic extends GetxController { @override void onReady() { - // TODO: implement onReady getDiaryList(); super.onReady(); } @@ -53,12 +52,4 @@ class RecycleLogic extends GetxController { await diaryLogic.updateDiary(diary.categoryId); Utils().noticeUtil.showToast('已恢复'); } - - @override - void onClose() { - // TODO: implement onClose - //退出后调用主页刷新 - - super.onClose(); - } } diff --git a/lib/pages/start/start_logic.dart b/lib/pages/start/start_logic.dart index 910d92e..a0c2a1d 100644 --- a/lib/pages/start/start_logic.dart +++ b/lib/pages/start/start_logic.dart @@ -13,25 +13,6 @@ import 'start_state.dart'; class StartLogic extends GetxController { final StartState state = StartState(); - @override - void onInit() { - // TODO: implement onInit - //如果不是首次启动,直接进入 - super.onInit(); - } - - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - void toPrivacy() { Get.toNamed(AppRoutes.privacyPage); } diff --git a/lib/pages/user/user_logic.dart b/lib/pages/user/user_logic.dart index d7bb46d..9271546 100644 --- a/lib/pages/user/user_logic.dart +++ b/lib/pages/user/user_logic.dart @@ -7,18 +7,6 @@ import 'user_state.dart'; class UserLogic extends GetxController { final UserState state = UserState(); - @override - void onReady() { - // TODO: implement onReady - super.onReady(); - } - - @override - void onClose() { - // TODO: implement onClose - super.onClose(); - } - Future signOut() async { await Utils().supabaseUtil.signOut(); Get.offAndToNamed(AppRoutes.loginPage); diff --git a/pubspec.lock b/pubspec.lock index d1ecd24..0589e5a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -382,6 +382,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.8" + dart_earcut: + dependency: transitive + description: + name: dart_earcut + sha256: "41b493147e30a051efb2da1e3acb7f38fe0db60afba24ac1ea5684cee272721e" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.1.0" dart_quill_delta: dependency: transitive description: @@ -506,10 +514,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: "167bb619cdddaa10ef2907609feb8a79c16dfa479d3afaf960f8e223f754bf12" + sha256: aac85f20436608e01a6ffd1fdd4e746a7f33c93a2c83752e626bdfaea139b877 url: "https://pub.flutter-io.cn" source: hosted - version: "8.1.2" + version: "8.1.3" file_selector_linux: dependency: transitive description: @@ -558,6 +566,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.69.0" + flat_buffers: + dependency: transitive + description: + name: flat_buffers + sha256: "380bdcba5664a718bfd4ea20a45d39e13684f5318fcd8883066a55e21f37f4c3" + url: "https://pub.flutter-io.cn" + source: hosted + version: "23.5.26" flutter: dependency: "direct main" description: flutter @@ -717,6 +733,22 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_map: + dependency: "direct main" + description: + name: flutter_map + sha256: "2ecb34619a4be19df6f40c2f8dce1591675b4eff7a6857bd8f533706977385da" + url: "https://pub.flutter-io.cn" + source: hosted + version: "7.0.2" + flutter_map_tile_caching: + dependency: "direct main" + description: + name: flutter_map_tile_caching + sha256: "8f37d72546d8f0ad716142c4f44bf5a1cca3bbe8b1dbfa83cd5d49c9b97b8ae7" + url: "https://pub.flutter-io.cn" + source: hosted + version: "9.1.3" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -729,10 +761,10 @@ packages: dependency: "direct main" description: name: flutter_quill - sha256: f7ccfb2a97d0117a5f757770a762a2cfe945bacc77fc80ac21287a7096e286bd + sha256: "6274834823e61291c0cedee9dd7f73fc7836ea07a12596de8f5fa08598b5eb74" url: "https://pub.flutter-io.cn" source: hosted - version: "10.8.4" + version: "10.8.5" flutter_quill_delta_from_html: dependency: transitive description: @@ -952,10 +984,10 @@ packages: dependency: transitive description: name: image_picker_android - sha256: d34e0d9e024e81321b2aeed7b202ec6181cc282e6a1c0c0b4e6ad07ef1065d82 + sha256: "8faba09ba361d4b246dc0a17cb4289b3324c2b9f6db7b3d457ee69106a86bd32" url: "https://pub.flutter-io.cn" source: hosted - version: "0.8.12+16" + version: "0.8.12+17" image_picker_for_web: dependency: transitive description: @@ -1065,6 +1097,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.3.1" + latlong2: + dependency: "direct main" + description: + name: latlong2 + sha256: "98227922caf49e6056f91b6c56945ea1c7b166f28ffcd5fb8e72fc0b453cc8fe" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.9.1" leak_tracker: dependency: transitive description: @@ -1097,6 +1137,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "5.1.0" + lists: + dependency: transitive + description: + name: lists + sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" local_auth: dependency: "direct main" description: @@ -1281,14 +1329,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.15.0" - mime: + mgrs_dart: dependency: transitive + description: + name: mgrs_dart + sha256: fb89ae62f05fa0bb90f70c31fc870bcbcfd516c843fb554452ab3396f78586f7 + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" + mime: + dependency: "direct overridden" description: name: mime - sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.6" + version: "2.0.0" msix: dependency: "direct dev" description: @@ -1297,6 +1353,22 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.16.8" + objectbox: + dependency: transitive + description: + name: objectbox + sha256: ea823f4bf1d0a636e7aa50b43daabb64dd0fbd80b85a033016ccc1bc4f76f432 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.3" + objectbox_flutter_libs: + dependency: transitive + description: + name: objectbox_flutter_libs + sha256: c91350bbbce5e6c2038255760b5be988faead004c814f833c2cd137445c6ae70 + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.0.3" octo_image: dependency: transitive description: @@ -1465,6 +1537,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.8" + polylabel: + dependency: transitive + description: + name: polylabel + sha256: "41b9099afb2aa6c1730bdd8a0fab1400d287694ec7615dd8516935fa3144214b" + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.1" pool: dependency: transitive description: @@ -1489,6 +1569,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "5.0.2" + proj4dart: + dependency: transitive + description: + name: proj4dart + sha256: c8a659ac9b6864aa47c171e78d41bbe6f5e1d7bd790a5814249e6b68bc44324e + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.1.0" pub_semver: dependency: transitive description: @@ -1725,10 +1813,10 @@ packages: dependency: "direct main" description: name: share_plus - sha256: "334fcdf0ef9c0df0e3b428faebcac9568f35c747d59831474b2fc56e156d244e" + sha256: "3af2cda1752e5c24f2fc04b6083b40f013ffe84fb90472f30c6499a9213d5442" url: "https://pub.flutter-io.cn" source: hosted - version: "10.1.0" + version: "10.1.1" share_plus_platform_interface: dependency: transitive description: @@ -1998,6 +2086,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.4.0" + unicode: + dependency: transitive + description: + name: unicode + sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.3.1" universal_platform: dependency: transitive description: @@ -2026,10 +2122,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2" + sha256: "0dea215895a4d254401730ca0ba8204b29109a34a99fb06ae559a2b60988d2de" url: "https://pub.flutter-io.cn" source: hosted - version: "6.3.12" + version: "6.3.13" url_launcher_ios: dependency: transitive description: @@ -2178,10 +2274,10 @@ packages: dependency: transitive description: name: win32 - sha256: "2294c64768987ea280b43a3d8357d42d5679f3e2b5b69b602be45b2abbd165b0" + sha256: e1d0cc62e65dc2561f5071fcbccecf58ff20c344f8f3dc7d4922df372a11df1f url: "https://pub.flutter-io.cn" source: hosted - version: "5.6.1" + version: "5.7.1" win32_registry: dependency: transitive description: @@ -2190,6 +2286,14 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.1.5" + wkt_parser: + dependency: transitive + description: + name: wkt_parser + sha256: "8a555fc60de3116c00aad67891bcab20f81a958e4219cc106e3c037aa3937f13" + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 30d00e2..7e67930 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,18 +39,18 @@ dependencies: flutter_drawing_board: 0.9.4 flutter_displaymode: 0.6.0 fl_chart: 0.69.0 - file_picker: 8.1.2 + file_picker: 8.1.3 local_auth: 2.3.0 local_auth_android: 1.0.46 permission_handler: 11.3.1 image_picker: 1.1.2 - device_info_plus: ^11.1.0 + device_info_plus: 11.1.0 flutter_image_compress: 2.3.0 photo_view: 0.15.0 - package_info_plus: ^8.1.0 + package_info_plus: 8.1.0 uuid: 4.5.1 - flutter_quill: 10.8.4 - share_plus: ^10.1.0 + flutter_quill: 10.8.5 + share_plus: 10.1.1 url_launcher: 6.3.1 archive: 3.6.1 crypto: 3.0.6 @@ -82,11 +82,16 @@ dependencies: flutter_adaptive_scaffold: 0.3.1 cross_file: 0.3.4+2 fc_native_video_thumbnail: 0.16.1 + flutter_map: 7.0.2 + flutter_map_tile_caching: 9.1.3 + latlong2: 0.9.1 + flutter_localizations: sdk: flutter - +dependency_overrides: + mime: 2.0.0 dev_dependencies: flutter_test: sdk: flutter diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index b37c077..a2340b5 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi")); MediaKitVideoPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); + ObjectboxFlutterLibsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ObjectboxFlutterLibsPlugin")); PermissionHandlerWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); RecordWindowsPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 2da1cf2..1a10d5d 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -14,6 +14,7 @@ list(APPEND FLUTTER_PLUGIN_LIST local_auth_windows media_kit_libs_windows_video media_kit_video + objectbox_flutter_libs permission_handler_windows record_windows screen_brightness_windows