Skip to content

Commit

Permalink
refactor(*): organize the project structure and use absolute paths un…
Browse files Browse the repository at this point in the history
…iformly
  • Loading branch information
ZhuJHua committed Jan 21, 2025
1 parent 581655b commit c4f5780
Show file tree
Hide file tree
Showing 162 changed files with 566 additions and 598 deletions.
20 changes: 10 additions & 10 deletions lib/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:latlong2/latlong.dart';
import 'package:mood_diary/common/models/geo.dart';
import 'package:mood_diary/common/models/github.dart';
import 'package:mood_diary/common/models/hitokoto.dart';
import 'package:mood_diary/common/models/hunyuan.dart';
import 'package:mood_diary/common/models/image.dart';
import 'package:mood_diary/common/models/weather.dart';
import 'package:mood_diary/main.dart';
import 'package:mood_diary/utils/http_util.dart';
import 'package:mood_diary/utils/notice_util.dart';
import 'package:mood_diary/utils/signature_util.dart';
import 'package:moodiary/common/models/geo.dart';
import 'package:moodiary/common/models/github.dart';
import 'package:moodiary/common/models/hitokoto.dart';
import 'package:moodiary/common/models/hunyuan.dart';
import 'package:moodiary/common/models/image.dart';
import 'package:moodiary/common/models/weather.dart';
import 'package:moodiary/main.dart';
import 'package:moodiary/utils/http_util.dart';
import 'package:moodiary/utils/notice_util.dart';
import 'package:moodiary/utils/signature_util.dart';
import 'package:refreshed/refreshed.dart';

import '../utils/data/pref.dart';
Expand Down
3 changes: 1 addition & 2 deletions lib/common/values/colors.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';

import '../../main.dart';
import 'package:moodiary/main.dart';

enum AppColorType {
common(0),
Expand Down
2 changes: 1 addition & 1 deletion lib/common/values/language.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:mood_diary/main.dart';
import 'package:moodiary/main.dart';

enum Language {
system('system'),
Expand Down
6 changes: 3 additions & 3 deletions lib/components/ask_question/ask_question_logic.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/common/values/keyboard_state.dart';
import 'package:mood_diary/utils/literunner.dart';
import 'package:mood_diary/utils/tokenization.dart';
import 'package:moodiary/common/values/keyboard_state.dart';
import 'package:moodiary/utils/literunner.dart';
import 'package:moodiary/utils/tokenization.dart';
import 'package:refreshed/refreshed.dart';

import 'ask_question_state.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/components/ask_question/ask_question_state.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:mood_diary/common/values/keyboard_state.dart';
import 'package:moodiary/common/values/keyboard_state.dart';
import 'package:refreshed/refreshed.dart';

class AskQuestionState {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/ask_question/ask_question_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/common/values/border.dart';
import 'package:moodiary/common/values/border.dart';
import 'package:refreshed/refreshed.dart';

import 'ask_question_logic.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/components/audio_player/audio_player_logic.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/animation.dart';
import 'package:mood_diary/pages/edit/edit_logic.dart';
import 'package:moodiary/pages/edit/edit_logic.dart';
import 'package:refreshed/refreshed.dart';

import 'audio_player_state.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/components/base/button.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:mood_diary/main.dart';
import 'package:moodiary/main.dart';
import 'package:refreshed/refreshed.dart';

class FrostedGlassButton extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/base/sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:math';

import 'package:flutter/material.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'package:mood_diary/common/values/border.dart';
import 'package:moodiary/common/values/border.dart';

class FloatingModal extends StatelessWidget {
final Widget child;
Expand Down
4 changes: 2 additions & 2 deletions lib/components/base/text.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/components/base/marquee.dart';
import 'package:mood_diary/utils/data/pref.dart';
import 'package:moodiary/components/base/marquee.dart';
import 'package:moodiary/utils/data/pref.dart';

Widget buildAdaptiveText({
required String text,
Expand Down
10 changes: 5 additions & 5 deletions lib/components/category_add/category_add_logic.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/common/models/isar/category.dart';
import 'package:mood_diary/pages/edit/edit_logic.dart';
import 'package:mood_diary/pages/home/diary/diary_logic.dart';
import 'package:moodiary/common/models/isar/category.dart';
import 'package:moodiary/pages/edit/edit_logic.dart';
import 'package:moodiary/pages/home/diary/diary_logic.dart';
import 'package:moodiary/utils/data/isar.dart';
import 'package:moodiary/utils/notice_util.dart';
import 'package:refreshed/refreshed.dart';

import '../../utils/data/isar.dart';
import '../../utils/notice_util.dart';
import 'category_add_state.dart';

class CategoryAddLogic extends GetxController {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/category_add/category_add_state.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:mood_diary/common/models/isar/category.dart';
import 'package:moodiary/common/models/isar/category.dart';
import 'package:refreshed/refreshed.dart';

class CategoryAddState {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/category_add/category_add_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter/material.dart';
import 'package:mood_diary/main.dart';
import 'package:moodiary/main.dart';
import 'package:refreshed/refreshed.dart';

import 'category_add_logic.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/router/app_routes.dart';
import 'package:moodiary/pages/home/diary/diary_logic.dart';
import 'package:moodiary/router/app_routes.dart';
import 'package:moodiary/utils/data/isar.dart';
import 'package:refreshed/refreshed.dart';

import '../../pages/home/diary/diary_logic.dart';
import '../../utils/data/isar.dart';
import 'category_choice_sheet_state.dart';

class CategoryChoiceSheetLogic extends GetxController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:moodiary/common/models/isar/category.dart';
import 'package:refreshed/refreshed.dart';

import '../../common/models/isar/category.dart';

class CategoryChoiceSheetState {
RxList<Category> categoryList = <Category>[].obs;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/components/loading/loading.dart';
import 'package:mood_diary/main.dart';
import 'package:moodiary/components/loading/loading.dart';
import 'package:moodiary/main.dart';
import 'package:refreshed/refreshed.dart';

import 'category_choice_sheet_logic.dart';
Expand Down
6 changes: 3 additions & 3 deletions lib/components/color_dialog/color_dialog_logic.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:ui';

import 'package:mood_diary/pages/home/setting/setting_logic.dart';
import 'package:mood_diary/utils/theme_util.dart';
import 'package:moodiary/pages/home/setting/setting_logic.dart';
import 'package:moodiary/utils/data/pref.dart';
import 'package:moodiary/utils/theme_util.dart';
import 'package:refreshed/refreshed.dart';

import '../../utils/data/pref.dart';
import 'color_dialog_state.dart';

class ColorDialogLogic extends GetxController {
Expand Down
3 changes: 1 addition & 2 deletions lib/components/color_dialog/color_dialog_state.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';

import '../../utils/data/pref.dart';
import 'package:moodiary/utils/data/pref.dart';

class ColorDialogState {
bool supportDynamic = PrefUtil.getValue<bool>('supportDynamicColor')!;
Expand Down
4 changes: 2 additions & 2 deletions lib/components/color_dialog/color_dialog_view.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/common/values/colors.dart';
import 'package:moodiary/common/values/colors.dart';
import 'package:moodiary/main.dart';
import 'package:refreshed/refreshed.dart';

import '../../main.dart';
import 'color_dialog_logic.dart';

class ColorDialogComponent extends StatelessWidget {
Expand Down
6 changes: 3 additions & 3 deletions lib/components/color_sheet/color_sheet_logic.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:ui';

import 'package:moodiary/pages/home/setting/setting_logic.dart';
import 'package:moodiary/utils/data/pref.dart';
import 'package:moodiary/utils/theme_util.dart';
import 'package:refreshed/refreshed.dart';

import '../../pages/home/setting/setting_logic.dart';
import '../../utils/data/pref.dart';
import '../../utils/theme_util.dart';
import 'color_sheet_state.dart';

class ColorSheetLogic extends GetxController {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/color_sheet/color_sheet_state.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:ui';

import '../../utils/data/pref.dart';
import 'package:moodiary/utils/data/pref.dart';

class ColorSheetState {
bool supportDynamic = PrefUtil.getValue<bool>('supportDynamicColor')!;
Expand Down
10 changes: 5 additions & 5 deletions lib/components/color_sheet/color_sheet_view.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:mood_diary/common/values/colors.dart';
import 'package:mood_diary/components/base/marquee.dart';
import 'package:mood_diary/main.dart';
import 'package:moodiary/common/values/border.dart';
import 'package:moodiary/common/values/colors.dart';
import 'package:moodiary/components/base/marquee.dart';
import 'package:moodiary/main.dart';
import 'package:moodiary/utils/data/pref.dart';
import 'package:refreshed/refreshed.dart';

import '../../common/values/border.dart';
import '../../utils/data/pref.dart';
import 'color_sheet_logic.dart';
import 'color_sheet_state.dart';

Expand Down
9 changes: 4 additions & 5 deletions lib/components/dashboard/dashboard_logic.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:mood_diary/router/app_routes.dart';
import 'package:moodiary/router/app_routes.dart';
import 'package:moodiary/utils/array_util.dart';
import 'package:moodiary/utils/data/isar.dart';
import 'package:moodiary/utils/data/pref.dart';
import 'package:refreshed/refreshed.dart';

import '../../utils/array_util.dart';
import '../../utils/data/isar.dart';
import '../../utils/data/pref.dart';

class DashboardLogic extends GetxController {
//日记数量
RxString diaryCount = ''.obs;
Expand Down
4 changes: 2 additions & 2 deletions lib/components/dashboard/dashboard_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/components/base/text.dart';
import 'package:mood_diary/main.dart';
import 'package:moodiary/components/base/text.dart';
import 'package:moodiary/main.dart';
import 'package:refreshed/refreshed.dart';

import 'dashboard_logic.dart';
Expand Down
3 changes: 1 addition & 2 deletions lib/components/dialog/dialog.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';

import '../../common/values/border.dart';
import 'package:moodiary/common/values/border.dart';

class OptionDialog extends StatelessWidget {
final String title;
Expand Down
13 changes: 6 additions & 7 deletions lib/components/diary_card/basic_card_logic.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'package:flutter/services.dart';
import 'package:mood_diary/common/models/isar/diary.dart';
import 'package:mood_diary/components/diary_tab_view/diary_tab_view_logic.dart';
import 'package:mood_diary/pages/diary_details/diary_details_logic.dart';
import 'package:mood_diary/pages/home/diary/diary_logic.dart';
import 'package:mood_diary/router/app_routes.dart';
import 'package:moodiary/common/models/isar/diary.dart';
import 'package:moodiary/components/diary_tab_view/diary_tab_view_logic.dart';
import 'package:moodiary/pages/diary_details/diary_details_logic.dart';
import 'package:moodiary/pages/home/diary/diary_logic.dart';
import 'package:moodiary/router/app_routes.dart';
import 'package:moodiary/utils/data/isar.dart';
import 'package:refreshed/refreshed.dart';

import '../../utils/data/isar.dart';

mixin BasicCardLogic {
Future<void> toDiary(Diary diary) async {
HapticFeedback.mediumImpact();
Expand Down
9 changes: 4 additions & 5 deletions lib/components/diary_card/calendar_diary_card_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:mood_diary/common/models/isar/diary.dart';
import 'package:mood_diary/common/values/border.dart';
import 'package:mood_diary/components/diary_card/basic_card_logic.dart';

import '../../utils/file_util.dart';
import 'package:moodiary/common/models/isar/diary.dart';
import 'package:moodiary/common/values/border.dart';
import 'package:moodiary/components/diary_card/basic_card_logic.dart';
import 'package:moodiary/utils/file_util.dart';

class CalendarDiaryCardComponent extends StatelessWidget with BasicCardLogic {
const CalendarDiaryCardComponent({super.key, required this.diary});
Expand Down
9 changes: 4 additions & 5 deletions lib/components/diary_card/grid_diary_card_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:mood_diary/common/models/isar/diary.dart';
import 'package:mood_diary/common/values/border.dart';
import 'package:mood_diary/components/diary_card/basic_card_logic.dart';

import '../../utils/file_util.dart';
import 'package:moodiary/common/models/isar/diary.dart';
import 'package:moodiary/common/values/border.dart';
import 'package:moodiary/components/diary_card/basic_card_logic.dart';
import 'package:moodiary/utils/file_util.dart';

class GirdDiaryCardComponent extends StatelessWidget with BasicCardLogic {
const GirdDiaryCardComponent({super.key, required this.diary});
Expand Down
9 changes: 4 additions & 5 deletions lib/components/diary_card/list_diary_card_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:mood_diary/common/models/isar/diary.dart';
import 'package:mood_diary/common/values/border.dart';
import 'package:mood_diary/components/diary_card/basic_card_logic.dart';

import '../../utils/file_util.dart';
import 'package:moodiary/common/models/isar/diary.dart';
import 'package:moodiary/common/values/border.dart';
import 'package:moodiary/components/diary_card/basic_card_logic.dart';
import 'package:moodiary/utils/file_util.dart';

class ListDiaryCardComponent extends StatelessWidget with BasicCardLogic {
const ListDiaryCardComponent(
Expand Down
4 changes: 2 additions & 2 deletions lib/components/diary_tab_view/diary_tab_view_logic.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:mood_diary/pages/home/diary/diary_logic.dart';
import 'package:moodiary/pages/home/diary/diary_logic.dart';
import 'package:moodiary/utils/data/isar.dart';
import 'package:refreshed/refreshed.dart';

import '../../utils/data/isar.dart';
import 'diary_tab_view_state.dart';

class DiaryTabViewLogic extends GetxController {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/diary_tab_view/diary_tab_view_state.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:mood_diary/common/models/isar/diary.dart';
import 'package:moodiary/common/models/isar/diary.dart';

class DiaryTabViewState {
List<Diary> diaryList = <Diary>[];
Expand Down
10 changes: 5 additions & 5 deletions lib/components/diary_tab_view/diary_tab_view_view.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:flutter/material.dart';
import 'package:mood_diary/common/values/view_mode.dart';
import 'package:mood_diary/components/diary_card/grid_diary_card_view.dart';
import 'package:mood_diary/components/diary_card/list_diary_card_view.dart';
import 'package:mood_diary/components/loading/loading.dart';
import 'package:moodiary/common/values/view_mode.dart';
import 'package:moodiary/components/diary_card/grid_diary_card_view.dart';
import 'package:moodiary/components/diary_card/list_diary_card_view.dart';
import 'package:moodiary/components/loading/loading.dart';
import 'package:moodiary/main.dart';
import 'package:refreshed/refreshed.dart';
import 'package:sliver_tools/sliver_tools.dart';
import 'package:waterfall_flow/waterfall_flow.dart';

import '../../main.dart';
import 'diary_tab_view_logic.dart';

class DiaryTabViewComponent extends StatelessWidget {
Expand Down
3 changes: 1 addition & 2 deletions lib/components/keyboard_listener/keyboard_listener.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:ui';

import 'package:flutter/widgets.dart';

import '../../common/values/keyboard_state.dart';
import 'package:moodiary/common/values/keyboard_state.dart';

class KeyboardObserver with WidgetsBindingObserver {
/// 键盘高度变化回调
Expand Down
6 changes: 3 additions & 3 deletions lib/components/language_dialog/language_dialog_logic.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:intl/find_locale.dart';
import 'package:intl/intl.dart';
import 'package:mood_diary/common/values/language.dart';
import 'package:mood_diary/pages/home/setting/setting_logic.dart';
import 'package:mood_diary/utils/data/pref.dart';
import 'package:moodiary/common/values/language.dart';
import 'package:moodiary/pages/home/setting/setting_logic.dart';
import 'package:moodiary/utils/data/pref.dart';
import 'package:refreshed/refreshed.dart';

class LanguageDialogLogic extends GetxController {
Expand Down
Loading

0 comments on commit c4f5780

Please sign in to comment.