情景推荐
This commit is contained in:
@@ -270,18 +270,20 @@ class _PopularPageState extends State<PopularPage>
|
||||
NetworkEventType.noteUpdate,
|
||||
data: noteId,
|
||||
);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('已创建笔记')));
|
||||
}
|
||||
Get.snackbar(
|
||||
'成功',
|
||||
'已创建笔记',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
colorText: _themeController.currentThemeColor,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('创建笔记失败: $e')));
|
||||
}
|
||||
Get.snackbar(
|
||||
'错误',
|
||||
'创建笔记失败: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
colorText: _themeController.currentThemeColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -684,18 +684,20 @@ class _CorrPageState extends State<CorrPage>
|
||||
NetworkEventType.noteUpdate,
|
||||
data: noteId,
|
||||
);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('已创建笔记')));
|
||||
}
|
||||
Get.snackbar(
|
||||
'成功',
|
||||
'已创建笔记',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
colorText: _themeController.currentThemeColor,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('创建笔记失败: $e')));
|
||||
}
|
||||
Get.snackbar(
|
||||
'错误',
|
||||
'创建笔记失败: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
colorText: _themeController.currentThemeColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -670,19 +670,21 @@ class AllListPageState extends State<AllListPage> {
|
||||
NetworkEventType.noteUpdate,
|
||||
data: noteId,
|
||||
);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('已创建笔记')));
|
||||
}
|
||||
Get.snackbar(
|
||||
'成功',
|
||||
'已创建笔记',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
colorText: _themeController.currentThemeColor,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('创建笔记失败: $e');
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text('创建笔记失败: $e')));
|
||||
}
|
||||
Get.snackbar(
|
||||
'错误',
|
||||
'创建笔记失败: $e',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
colorText: _themeController.currentThemeColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,66 @@
|
||||
/// 时间: 2026-04-02
|
||||
/// 功能: 关怀模式相关组件
|
||||
/// 介绍: 包含关怀按钮和开关的UI组件
|
||||
/// 最新变化: 2026-04-02 初始创建
|
||||
/// 最新变化: 2026-04-09 添加情景推荐按钮组件
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import '../../../services/get/care_controller.dart';
|
||||
import 'care-page.dart';
|
||||
import '../components/pre-page.dart';
|
||||
|
||||
/// 情景推荐按钮组件
|
||||
class PrePageButton extends StatelessWidget {
|
||||
const PrePageButton({super.key, required this.isDark});
|
||||
|
||||
final bool isDark;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final primaryColor = themeController.currentThemeColor;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const PrePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withAlpha(isDark ? 40 : 20),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.auto_stories, color: primaryColor, size: 20),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'情景推荐',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.white : Colors.black87,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 关怀按钮组件
|
||||
class CareButton extends StatelessWidget {
|
||||
|
||||
1229
lib/views/home/components/pre-page.dart
Normal file
1229
lib/views/home/components/pre-page.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -124,15 +124,8 @@ class _HomePageState extends State<HomePage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
// 关怀按钮 - 左上角
|
||||
Positioned(
|
||||
top: 8,
|
||||
left: 16,
|
||||
child: CareButton(
|
||||
onTap: _careController.toggleCareButtonVisibility,
|
||||
isDark: isDark,
|
||||
),
|
||||
),
|
||||
// 情景推荐按钮 - 左上角
|
||||
Positioned(top: 8, left: 16, child: PrePageButton(isDark: isDark)),
|
||||
// 关怀模式开关
|
||||
Obx(
|
||||
() => _careController.isCareButtonVisible.value
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'dart:ui';
|
||||
import 'dart:io' as io show Platform;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -10,6 +9,7 @@ import '../../../config/app_config.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../models/colors/theme_colors.dart';
|
||||
import '../../../controllers/shared_preferences_storage_controller.dart';
|
||||
import '../../../controllers/settings/is_platform.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
|
||||
/// 时间: 2026-03-26
|
||||
@@ -398,20 +398,17 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
) {
|
||||
String buildSdk = 'Unknown';
|
||||
try {
|
||||
final String osName = io.Platform.operatingSystem;
|
||||
if (osName == 'ohos' ||
|
||||
osName == 'harmonyos' ||
|
||||
osName == 'openharmony') {
|
||||
if (PlatformUtils.isHarmonyOS) {
|
||||
buildSdk = 'Deveco API 23';
|
||||
} else if (io.Platform.isAndroid) {
|
||||
} else if (PlatformUtils.isAndroid) {
|
||||
buildSdk = 'Android Target 36';
|
||||
} else if (io.Platform.isWindows) {
|
||||
} else if (PlatformUtils.isWindows) {
|
||||
buildSdk = 'Win10 SDK';
|
||||
} else if (io.Platform.isIOS) {
|
||||
} else if (PlatformUtils.isIOS) {
|
||||
buildSdk = 'iOS 26';
|
||||
} else if (io.Platform.isMacOS) {
|
||||
} else if (PlatformUtils.isMacOS) {
|
||||
buildSdk = 'macOS 18';
|
||||
} else if (io.Platform.isLinux) {
|
||||
} else if (PlatformUtils.isLinux) {
|
||||
buildSdk = 'Linux 20';
|
||||
} else {
|
||||
buildSdk = 'PHP 7.4';
|
||||
@@ -700,32 +697,30 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
String platformName = 'Unknown';
|
||||
|
||||
try {
|
||||
final String osName = io.Platform.operatingSystem;
|
||||
final String osVersion = io.Platform.operatingSystemVersion.toLowerCase();
|
||||
|
||||
if (osName == 'ohos' || osName == 'harmonyos' || osName == 'harmonyos') {
|
||||
if (PlatformUtils.isHarmonyOS) {
|
||||
platformName = 'HarmonyOS';
|
||||
isHarmonyOS = true;
|
||||
} else if (io.Platform.isAndroid) {
|
||||
} else if (PlatformUtils.isAndroid) {
|
||||
platformName = 'Android';
|
||||
final osVersion = PlatformUtils.operatingSystemVersion.toLowerCase();
|
||||
if (osVersion.contains('harmony') ||
|
||||
osVersion.contains('ohos') ||
|
||||
osVersion.contains('openharmony')) {
|
||||
platformName = 'HarmonyOS';
|
||||
isHarmonyOS = true;
|
||||
}
|
||||
} else if (io.Platform.isIOS) {
|
||||
} else if (PlatformUtils.isIOS) {
|
||||
platformName = 'iOS';
|
||||
} else if (io.Platform.isMacOS) {
|
||||
} else if (PlatformUtils.isMacOS) {
|
||||
platformName = 'macOS';
|
||||
} else if (io.Platform.isWindows) {
|
||||
} else if (PlatformUtils.isWindows) {
|
||||
platformName = 'Windows';
|
||||
} else if (io.Platform.isLinux) {
|
||||
} else if (PlatformUtils.isLinux) {
|
||||
platformName = 'Linux';
|
||||
} else if (io.Platform.isFuchsia) {
|
||||
} else if (PlatformUtils.isFuchsia) {
|
||||
platformName = 'Fuchsia';
|
||||
} else {
|
||||
platformName = osName[0].toUpperCase() + osName.substring(1);
|
||||
platformName = PlatformUtils.platformShortName;
|
||||
}
|
||||
} catch (e) {
|
||||
platformName = switch (platform.operatingSystem) {
|
||||
@@ -749,7 +744,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
|
||||
String deviceType = '未知设备';
|
||||
if (isHarmonyOS) {
|
||||
final String osName = io.Platform.operatingSystem;
|
||||
final osName = PlatformUtils.operatingSystem.toLowerCase();
|
||||
if (osName == 'ohos') {
|
||||
deviceType = 'OHOS';
|
||||
} else if (osName == 'harmonyos') {
|
||||
|
||||
1171
lib/views/profile/components/jinrishici_sdk_page.dart
Normal file
1171
lib/views/profile/components/jinrishici_sdk_page.dart
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../models/colors/app_colors.dart';
|
||||
import '../../../services/isweb/wakelock_service.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import '../../../controllers/settings/is_platform.dart';
|
||||
import '../guide/beginner_page.dart';
|
||||
import 'dart:io' as io;
|
||||
import 'jinrishici_sdk_page.dart';
|
||||
import '../../home/care/care-page.dart';
|
||||
|
||||
class PopMenu extends StatelessWidget {
|
||||
final VoidCallback? onRefresh;
|
||||
@@ -51,7 +52,7 @@ class PopMenu extends StatelessWidget {
|
||||
|
||||
static Future<void> toggleScreenWake(BuildContext context) async {
|
||||
// Web 平台不支持 wakelock_plus
|
||||
if (kIsWeb) {
|
||||
if (PlatformUtils.isWeb) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
@@ -61,9 +62,9 @@ class PopMenu extends StatelessWidget {
|
||||
}
|
||||
|
||||
try {
|
||||
// 使用 io.Platform 检测平台
|
||||
final String osName = io.Platform.operatingSystem;
|
||||
final String osVersion = io.Platform.operatingSystemVersion;
|
||||
// 获取平台信息
|
||||
final String osName = PlatformUtils.operatingSystem;
|
||||
final String osVersion = PlatformUtils.operatingSystemVersion;
|
||||
print('Current platform: $osName, version: $osVersion');
|
||||
|
||||
// 直接尝试启用屏幕常亮
|
||||
@@ -93,7 +94,10 @@ class PopMenu extends StatelessWidget {
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: AppColors.surface,
|
||||
title: Text('提示', style: TextStyle(color: AppColors.primaryText)),
|
||||
content: Text(errorMessage, style: TextStyle(color: AppColors.secondaryText)),
|
||||
content: Text(
|
||||
errorMessage,
|
||||
style: TextStyle(color: AppColors.secondaryText),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
@@ -186,10 +190,21 @@ class PopMenu extends StatelessWidget {
|
||||
}),
|
||||
_buildBottomSheetItem(
|
||||
context,
|
||||
'取消',
|
||||
Icons.settings,
|
||||
onSettings,
|
||||
'今日诗词SDK',
|
||||
Icons.book_outlined,
|
||||
() {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => const JinrishiciSdkPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
_buildBottomSheetItem(context, '关怀模式', Icons.people, () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(builder: (_) => const CarePage()),
|
||||
);
|
||||
}),
|
||||
const SizedBox(height: 20),
|
||||
_buildBottomSheetItem(context, '返回桌面', Icons.exit_to_app, () {
|
||||
SystemNavigator.pop();
|
||||
@@ -210,14 +225,8 @@ class PopMenu extends StatelessWidget {
|
||||
VoidCallback? onTap,
|
||||
) {
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
icon,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(color: AppColors.primaryText),
|
||||
),
|
||||
leading: Icon(icon, color: AppColors.primary),
|
||||
title: Text(title, style: TextStyle(color: AppColors.primaryText)),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
HapticFeedback.lightImpact();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'dart:io' as io;
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -6,6 +5,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../utils/http/http_client.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import '../../../controllers/settings/is_platform.dart';
|
||||
import 'tougao.dart';
|
||||
|
||||
/// 时间: 2026-03-30
|
||||
@@ -55,28 +55,7 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
|
||||
}
|
||||
|
||||
String _getPlatform() {
|
||||
try {
|
||||
final String osName = io.Platform.operatingSystem;
|
||||
if (osName == 'ohos' ||
|
||||
osName == 'harmonyos' ||
|
||||
osName == 'openharmony') {
|
||||
return 'HarmonyOS Flutter';
|
||||
} else if (io.Platform.isAndroid) {
|
||||
return 'Android Flutter';
|
||||
} else if (io.Platform.isIOS) {
|
||||
return 'iOS Flutter';
|
||||
} else if (io.Platform.isWindows) {
|
||||
return 'Windows Flutter';
|
||||
} else if (io.Platform.isMacOS) {
|
||||
return 'macOS Flutter';
|
||||
} else if (io.Platform.isLinux) {
|
||||
return 'Linux Flutter';
|
||||
} else {
|
||||
return 'Flutter';
|
||||
}
|
||||
} catch (e) {
|
||||
return 'Flutter';
|
||||
}
|
||||
return PlatformUtils.platformDisplayName;
|
||||
}
|
||||
|
||||
Future<void> _loadCategories() async {
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import '../../../controllers/settings/is_platform.dart';
|
||||
|
||||
/// 时间: 2026-03-27
|
||||
/// 功能: 应用数据管理页面
|
||||
@@ -95,7 +96,7 @@ class _AppDataPageState extends State<AppDataPage> {
|
||||
if (await parentDir.exists()) {
|
||||
await for (FileSystemEntity entity in parentDir.list()) {
|
||||
if (entity is Directory) {
|
||||
final dirName = entity.path.split(Platform.pathSeparator).last;
|
||||
final dirName = entity.path.split(PlatformUtils.pathSeparator).last;
|
||||
if (!dirName.startsWith('.')) {
|
||||
totalSize += await _getDirectorySize(entity);
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ import 'dart:io' as io;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constants/app_constants.dart';
|
||||
import '../../config/app_config.dart';
|
||||
import '../../models/colors/theme_colors.dart';
|
||||
import '../../controllers/settings/is_platform.dart';
|
||||
import 'history_page.dart';
|
||||
import 'per_card.dart';
|
||||
import 'settings/app_fun.dart';
|
||||
@@ -697,7 +697,7 @@ class ProfilePage extends StatelessWidget {
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
if (kIsWeb) {
|
||||
if (PlatformUtils.isWeb) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user