mirror of
https://github.com/ZhuJHua/moodiary.git
synced 2026-04-05 16:39:01 +08:00
refactor(*): add category manager
This commit is contained in:
@@ -67,9 +67,4 @@ class DashboardLogic extends GetxController {
|
||||
Future<void> toDiaryManager() async {
|
||||
Get.toNamed(AppRoutes.diaryManagerPage);
|
||||
}
|
||||
|
||||
Future<void> toCategoryManager() async {
|
||||
await Get.toNamed(AppRoutes.categoryManagerPage);
|
||||
getCategoryCount();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,11 @@ void main() {
|
||||
runZonedGuarded(() {
|
||||
FlutterError.onError = (details) {
|
||||
Utils().logUtil.printError('Flutter error', error: details.exception, stackTrace: details.stack);
|
||||
Utils().noticeUtil.showBug();
|
||||
if (details.exceptionAsString().contains('Render')) {
|
||||
Utils().noticeUtil.showBug(message: '布局异常!');
|
||||
} else {
|
||||
Utils().noticeUtil.showBug(message: '出错了,请联系开发者!');
|
||||
}
|
||||
};
|
||||
initSystem().then((_) {
|
||||
return runApp(GetMaterialApp(
|
||||
@@ -99,6 +103,6 @@ void main() {
|
||||
});
|
||||
}, (error, stack) {
|
||||
Utils().logUtil.printWTF('Error', error: error, stackTrace: stack);
|
||||
Utils().noticeUtil.showBug();
|
||||
Utils().noticeUtil.showBug(message: '出错了,请联系开发者!');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:mood_diary/components/dashboard/dashboard_logic.dart';
|
||||
import 'package:mood_diary/pages/home/home_logic.dart';
|
||||
import 'package:mood_diary/router/app_routes.dart';
|
||||
import 'package:mood_diary/utils/utils.dart';
|
||||
@@ -91,6 +92,11 @@ class SettingLogic extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> toCategoryManager() async {
|
||||
await Get.toNamed(AppRoutes.categoryManagerPage);
|
||||
Bind.find<DashboardLogic>().getCategoryCount();
|
||||
}
|
||||
|
||||
//进入回收站
|
||||
void toRecyclePage() {
|
||||
Get.toNamed(AppRoutes.recyclePage);
|
||||
|
||||
@@ -30,7 +30,7 @@ class SettingPage extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: AppBorderRadius.mediumBorderRadius,
|
||||
child: Card(
|
||||
child: Card.outlined(
|
||||
color: colorScheme.surfaceContainerLow,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
@@ -38,7 +38,7 @@ class SettingPage extends StatelessWidget {
|
||||
icon,
|
||||
Text(
|
||||
text,
|
||||
style: textStyle.labelLarge,
|
||||
style: textStyle.labelSmall,
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -58,15 +58,21 @@ class SettingPage extends StatelessWidget {
|
||||
),
|
||||
GridView(
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: 120, childAspectRatio: 1.0),
|
||||
const SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: 100, childAspectRatio: 1.0),
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
buildAFeatureButton(
|
||||
icon: Icon(
|
||||
Icons.category_rounded,
|
||||
color: colorScheme.secondary,
|
||||
),
|
||||
text: '分类管理',
|
||||
onTap: logic.toCategoryManager),
|
||||
buildAFeatureButton(
|
||||
icon: FaIcon(
|
||||
FontAwesomeIcons.squarePollVertical,
|
||||
size: 24,
|
||||
color: colorScheme.secondary,
|
||||
),
|
||||
text: '分析统计',
|
||||
@@ -74,7 +80,6 @@ class SettingPage extends StatelessWidget {
|
||||
buildAFeatureButton(
|
||||
icon: FaIcon(
|
||||
FontAwesomeIcons.solidMap,
|
||||
size: 24,
|
||||
color: colorScheme.secondary,
|
||||
),
|
||||
text: '足迹地图',
|
||||
@@ -82,7 +87,6 @@ class SettingPage extends StatelessWidget {
|
||||
buildAFeatureButton(
|
||||
icon: FaIcon(
|
||||
FontAwesomeIcons.solidCommentDots,
|
||||
size: 24,
|
||||
color: colorScheme.secondary,
|
||||
),
|
||||
text: '智能助手',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -9,42 +10,46 @@ class NoticeUtil {
|
||||
_fToast.init(Get.overlayContext!);
|
||||
}
|
||||
|
||||
void showToast(String message) async {
|
||||
late final colorScheme = Theme.of(Get.context!).colorScheme;
|
||||
_fToast.removeCustomToast();
|
||||
_fToast.showToast(
|
||||
void showToast(String message) {
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
late final colorScheme = Theme.of(Get.context!).colorScheme;
|
||||
_fToast.removeCustomToast();
|
||||
_fToast.showToast(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
color: colorScheme.primaryContainer.withAlpha(240),
|
||||
),
|
||||
child: Text(
|
||||
message,
|
||||
style: TextStyle(fontSize: 16.0, color: colorScheme.onPrimaryContainer),
|
||||
),
|
||||
),
|
||||
gravity: ToastGravity.CENTER,
|
||||
isDismissable: true);
|
||||
});
|
||||
}
|
||||
|
||||
void showBug({required String message}) {
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
_fToast.removeCustomToast();
|
||||
_fToast.showToast(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
color: colorScheme.primaryContainer.withAlpha(240),
|
||||
color: Colors.redAccent.withAlpha((240)),
|
||||
),
|
||||
child: Text(
|
||||
message,
|
||||
style: TextStyle(fontSize: 16.0, color: colorScheme.onPrimaryContainer),
|
||||
style: TextStyle(fontSize: 16.0, color: Colors.white),
|
||||
),
|
||||
),
|
||||
gravity: ToastGravity.CENTER,
|
||||
isDismissable: true);
|
||||
}
|
||||
|
||||
void showBug() {
|
||||
_fToast.removeCustomToast();
|
||||
_fToast.showToast(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
color: Colors.redAccent.withAlpha((240)),
|
||||
),
|
||||
child: const Text(
|
||||
'出错了,请联系开发者!',
|
||||
style: TextStyle(fontSize: 16.0, color: Colors.white),
|
||||
),
|
||||
),
|
||||
gravity: ToastGravity.CENTER,
|
||||
isDismissable: false,
|
||||
toastDuration: const Duration(seconds: 2),
|
||||
);
|
||||
isDismissable: false,
|
||||
toastDuration: const Duration(seconds: 2),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
47
pubspec.lock
47
pubspec.lock
@@ -554,10 +554,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
|
||||
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
version: "7.0.1"
|
||||
file_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -667,11 +667,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.9.5"
|
||||
flutter_driver:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_highlight:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -895,11 +890,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
fuchsia_remote_debug_protocol:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
functions_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1116,11 +1106,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.2.1+1"
|
||||
integration_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1637,10 +1622,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
|
||||
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.5"
|
||||
version: "3.1.6"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1681,14 +1666,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.4.0"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: process
|
||||
sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.0.2"
|
||||
proj4dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -2189,14 +2166,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.8.1"
|
||||
sync_http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sync_http
|
||||
sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.3.1"
|
||||
syncfusion_flutter_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -2461,14 +2430,6 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
webdriver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webdriver
|
||||
sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.4"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -35,7 +35,7 @@ dependencies:
|
||||
path: 1.9.0
|
||||
path_provider: 2.1.5
|
||||
calendar_date_picker2: 1.1.7
|
||||
logger: ^2.5.0
|
||||
logger: 2.5.0
|
||||
flutter_drawing_board: 0.9.5
|
||||
flutter_displaymode: 0.6.0
|
||||
fl_chart: 0.69.0
|
||||
@@ -116,8 +116,6 @@ dev_dependencies:
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: 5.0.0
|
||||
integration_test:
|
||||
sdk: flutter
|
||||
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import 'package:integration_test/integration_test_driver.dart';
|
||||
|
||||
Future<void> main() => integrationDriver();
|
||||
Reference in New Issue
Block a user