鸿蒙端提交

This commit is contained in:
Developer
2026-06-11 18:51:13 +08:00
parent 016ad3cea1
commit bc202ca5bf
7 changed files with 138 additions and 83 deletions

View File

@@ -17,6 +17,8 @@ import 'package:pro_image_editor/pro_image_editor.dart' as pro;
import 'package:xianyan/core/storage/kv_storage.dart';
import 'package:xianyan/core/router/app_nav_extension.dart';
import 'package:xianyan/core/router/app_routes.dart';
import 'package:xianyan/core/utils/platform/platform_utils.dart' as pu;
import 'package:xianyan/shared/widgets/feedback/app_toast.dart';
import 'package:xianyan/core/router/editor_router.dart';
import 'package:xianyan/editor/services/core/pro_editor_bridge.dart';
import 'package:xianyan/editor/services/core/editor_theme_notifier.dart';
@@ -207,6 +209,11 @@ class ProEditorPageState extends State<ProEditorPage>
child: const Text('查看实验功能'),
onPressed: () {
Navigator.pop(ctx);
// 鸿蒙端暂不支持弹出toast提示
if (pu.isOhos) {
AppToast.showInfo('敬请期待');
return;
}
context.appPush(AppRoutes.experimentalFeatures);
},
),

View File

@@ -16,6 +16,8 @@ import 'package:pro_image_editor/pro_image_editor.dart' as pro;
import 'package:xianyan/core/storage/kv_storage.dart';
import 'package:xianyan/core/router/app_nav_extension.dart';
import 'package:xianyan/core/router/app_routes.dart';
import 'package:xianyan/core/utils/platform/platform_utils.dart' as pu;
import 'package:xianyan/shared/widgets/feedback/app_toast.dart';
import 'package:xianyan/editor/services/core/color_tokens.dart';
import 'package:xianyan/editor/services/core/editor_theme_notifier.dart';
import 'package:xianyan/editor/widgets/controls/editor_icon.dart';
@@ -522,6 +524,11 @@ class _EditorBottomToolbarV2State extends State<EditorBottomToolbarV2>
child: const Text('查看实验功能'),
onPressed: () {
Navigator.pop(ctx);
// 鸿蒙端暂不支持弹出toast提示
if (pu.isOhos) {
AppToast.showInfo('敬请期待');
return;
}
context.appPush(AppRoutes.experimentalFeatures);
},
),

View File

@@ -31,6 +31,7 @@ import 'package:xianyan/shared/widgets/feedback/share_sheet.dart';
import 'package:xianyan/features/home/providers/daily_card_style_provider.dart';
import 'package:xianyan/features/mine/user_center/providers/interaction_provider.dart';
import 'package:xianyan/core/utils/logger.dart';
import 'package:xianyan/core/utils/platform/platform_utils.dart' as pu;
import 'package:xianyan/core/services/audio/tts_service.dart';
import 'package:xianyan/shared/widgets/media/tts_player_bar.dart';
import 'package:xianyan/core/services/search/search_engine_service.dart';
@@ -196,7 +197,14 @@ class _SentenceDetailContentState
/// 是否为医疗健康相关频道
bool get _isMedicalFeed {
const medicalTypes = {'drug', 'herbal', 'illness', 'prescription', 'tisana', 'jiufang'};
const medicalTypes = {
'drug',
'herbal',
'illness',
'prescription',
'tisana',
'jiufang',
};
return medicalTypes.contains(sentence.feedType ?? sentence.type);
}
@@ -215,18 +223,12 @@ class _SentenceDetailContentState
),
child: Row(
children: [
Icon(
CupertinoIcons.info_circle,
size: 14,
color: ext.textSecondary,
),
Icon(CupertinoIcons.info_circle, size: 14, color: ext.textSecondary),
const SizedBox(width: AppSpacing.xs),
Expanded(
child: Text(
'内容仅供参考,不构成医疗建议',
style: AppTypography.caption2.copyWith(
color: ext.textSecondary,
),
style: AppTypography.caption2.copyWith(color: ext.textSecondary),
),
),
],
@@ -298,11 +300,17 @@ class _SentenceDetailContentState
return Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(CupertinoIcons.eye_fill, size: 11, color: ext.textHint),
Icon(
CupertinoIcons.eye_fill,
size: 11,
color: ext.textHint,
),
const SizedBox(width: 3),
Text(
NumberFormatter.formatCount(views),
style: AppTypography.caption2.copyWith(color: ext.textHint),
style: AppTypography.caption2.copyWith(
color: ext.textHint,
),
),
],
);
@@ -346,11 +354,23 @@ class _SentenceDetailContentState
spacing: 8,
children: [
if (likeCount > 0)
_StatChip(icon: CupertinoIcons.hand_thumbsup_fill, label: NumberFormatter.formatCount(likeCount), ext: ext),
_StatChip(
icon: CupertinoIcons.hand_thumbsup_fill,
label: NumberFormatter.formatCount(likeCount),
ext: ext,
),
if (favCount > 0)
_StatChip(icon: CupertinoIcons.star_fill, label: NumberFormatter.formatCount(favCount), ext: ext),
_StatChip(
icon: CupertinoIcons.star_fill,
label: NumberFormatter.formatCount(favCount),
ext: ext,
),
if (cmtCount > 0)
_StatChip(icon: CupertinoIcons.chat_bubble_fill, label: NumberFormatter.formatCount(cmtCount), ext: ext),
_StatChip(
icon: CupertinoIcons.chat_bubble_fill,
label: NumberFormatter.formatCount(cmtCount),
ext: ext,
),
],
),
);
@@ -533,7 +553,9 @@ class _SentenceDetailContentState
children: [
Expanded(
child: _QuickActionBtn(
icon: sentence.isLiked ? CupertinoIcons.heart_fill : CupertinoIcons.hand_thumbsup,
icon: sentence.isLiked
? CupertinoIcons.heart_fill
: CupertinoIcons.hand_thumbsup,
label: sentence.isLiked
? t.home.sentenceDetail.liked
: t.home.sentenceDetail.like,
@@ -651,7 +673,9 @@ class _SentenceDetailContentState
final isBookmarked = result?['status'] == 'added';
HapticService.light();
AppToast.showSuccess(
isBookmarked ? t.home.sentenceDetail.bookmarkAdded : t.home.sentenceDetail.bookmarkRemoved,
isBookmarked
? t.home.sentenceDetail.bookmarkAdded
: t.home.sentenceDetail.bookmarkRemoved,
);
}
},
@@ -669,7 +693,10 @@ class _SentenceDetailContentState
onPressed: () {
_showTagDialog(feedId, targetType);
},
child: Text(t.home.sentenceDetail.tag, style: TextStyle(color: ext.textPrimary)),
child: Text(
t.home.sentenceDetail.tag,
style: TextStyle(color: ext.textPrimary),
),
),
),
const SizedBox(width: 8),
@@ -800,7 +827,9 @@ class _SentenceDetailContentState
);
if (mounted) {
AppToast.showSuccess(
ok ? t.home.sentenceDetail.tagAdded : t.home.sentenceDetail.tagAddFailed,
ok
? t.home.sentenceDetail.tagAdded
: t.home.sentenceDetail.tagAddFailed,
);
}
},
@@ -856,6 +885,11 @@ class _SentenceDetailContentState
color: ext.accent,
borderRadius: AppRadius.mdBorder,
onPressed: () {
// 鸿蒙端暂不支持编辑器弹出toast提示
if (pu.isOhos) {
AppToast.showInfo('敬请期待');
return;
}
Navigator.pop(context);
context.appPush('/editor?text=${Uri.encodeComponent(sentence.text)}');
},
@@ -954,7 +988,6 @@ class _SentenceDetailContentState
if (sentenceSummary.isNotEmpty) return sentenceSummary;
return '';
}
}
class _StatChip extends StatelessWidget {

View File

@@ -9,6 +9,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../../core/utils/platform/platform_utils.dart' as pu;
import '../../../../shared/widgets/feedback/app_toast.dart';
import '../../../../core/services/feature/feature_flag_provider.dart';
import '../../../../core/services/feature/feature_flag_service.dart';
import '../../../../core/theme/app_theme.dart';
@@ -34,6 +37,16 @@ class _ExperimentalFeaturesPageState
@override
void initState() {
super.initState();
// 鸿蒙端拦截跳转弹出toast并返回
if (pu.isOhos) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
AppToast.showInfo('敬请期待');
Navigator.pop(context);
}
});
return;
}
_pageController = PageController(initialPage: _selectedTab);
}

View File

@@ -49,10 +49,7 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
}
/// 开发中弹窗提示,支持"不再提醒"
/// 鸿蒙端不显示此弹窗
void _showDevDialogIfNeeded() {
// 鸿蒙端不显示Beta弹窗
if (PlatformHelper.isHarmonyOS) return;
final dismissed = KvStorage.getBool('widget_dev_dismissed') ?? false;
if (dismissed) return;
showCupertinoDialog<void>(
@@ -111,6 +108,11 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
child: const Text('查看实验功能'),
onPressed: () {
Navigator.pop(ctx);
// 鸿蒙端暂不支持弹出toast提示
if (PlatformHelper.isHarmonyOS) {
AppToast.showInfo('敬请期待');
return;
}
context.appPush(AppRoutes.experimentalFeatures);
},
),
@@ -268,7 +270,10 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
try {
final notifier = ref.read(wp.widgetProvider.notifier);
final wasInstalled = ref.read(wp.widgetProvider).installedWidgets.contains(type);
final wasInstalled = ref
.read(wp.widgetProvider)
.installedWidgets
.contains(type);
final result = await notifier.requestPinWidget(type);
@@ -289,7 +294,10 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
if (!mounted) return;
await notifier.loadInstalledWidgets();
final nowInstalled = ref.read(wp.widgetProvider).installedWidgets.contains(type);
final nowInstalled = ref
.read(wp.widgetProvider)
.installedWidgets
.contains(type);
if (nowInstalled && !wasInstalled) {
AppToast.showInfo('${type.title} 已添加到桌面');
} else if (!nowInstalled) {
@@ -325,7 +333,10 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
if (!mounted) return;
await notifier.loadInstalledWidgets();
final nowInstalled = ref.read(wp.widgetProvider).installedWidgets.contains(type);
final nowInstalled = ref
.read(wp.widgetProvider)
.installedWidgets
.contains(type);
if (!nowInstalled) {
_showManualAddGuide(type, isUnsupported: false);
}
@@ -344,18 +355,18 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
'4⃣ 选择「${type.title}」并添加到桌面',
]
: PlatformHelper.isAndroid
? [
'1⃣ 长按桌面空白处',
'2⃣ 选择「小部件」',
'3⃣ 找到「闲言」',
'4⃣ 选择「${type.title}」拖动到桌面',
]
: [
'1⃣ 向右滑动到今日视图',
'2⃣ 滚动到底部点击「编辑」',
'3⃣ 找到「闲言」',
'4⃣ 选择「${type.title}」并添加',
];
? [
'1⃣ 长按桌面空白处',
'2⃣ 选择「小部件」',
'3⃣ 找到「闲言」',
'4⃣ 选择「${type.title}」拖动到桌面',
]
: [
'1⃣ 向右滑动到今日视图',
'2⃣ 滚动到底部点击「编辑」',
'3⃣ 找到「闲言」',
'4⃣ 选择「${type.title}」并添加',
];
final guideReason = isUnsupported
? '当前设备不支持快捷添加,请按以下步骤手动添加到桌面:'
@@ -369,7 +380,11 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(CupertinoIcons.square_grid_2x2_fill, size: 20, color: ext.accent),
Icon(
CupertinoIcons.square_grid_2x2_fill,
size: 20,
color: ext.accent,
),
const SizedBox(width: AppSpacing.xs),
Text('添加「${type.title}'),
],
@@ -380,20 +395,18 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
children: [
Text(
guideReason,
style: AppTypography.footnote.copyWith(
color: ext.textSecondary,
),
style: AppTypography.footnote.copyWith(color: ext.textSecondary),
),
const SizedBox(height: AppSpacing.md),
...steps.map((s) => Padding(
padding: const EdgeInsets.only(bottom: AppSpacing.xs),
child: Text(
s,
style: AppTypography.subhead.copyWith(
color: ext.textPrimary,
...steps.map(
(s) => Padding(
padding: const EdgeInsets.only(bottom: AppSpacing.xs),
child: Text(
s,
style: AppTypography.subhead.copyWith(color: ext.textPrimary),
),
),
)),
),
],
),
actions: [
@@ -928,9 +941,9 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> {
setState(() => _loading = true);
try {
final service = ref.read(homeWidgetServiceProvider);
await service.updateWidget(widget.type).timeout(
const Duration(seconds: 5),
);
await service
.updateWidget(widget.type)
.timeout(const Duration(seconds: 5));
await _loadPreview();
} on TimeoutException {
if (_disposed || !mounted) return;
@@ -945,24 +958,16 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> {
String _getPreviewText() {
return switch (widget.type) {
WidgetType.dailySentence =>
'${_data['daily_sentence'] ?? '暂无数据'}',
WidgetType.readlater =>
'未读 ${_data['readlater_count'] ?? 0}',
WidgetType.dailyFortune =>
'${_data['fortune_text'] ?? '暂无数据'}',
WidgetType.countdown =>
'${_data['countdown_title'] ?? '暂无数据'}',
WidgetType.pomodoro =>
'剩余 ${_data['pomodoro_remaining'] ?? 0}s',
WidgetType.solarTerm =>
'${_data['solar_term_name'] ?? '暂无数据'}',
WidgetType.checkin =>
'连续 ${_data['checkin_days'] ?? 0}',
WidgetType.dailySentence => '${_data['daily_sentence'] ?? '暂无数据'}',
WidgetType.readlater => '未读 ${_data['readlater_count'] ?? 0}',
WidgetType.dailyFortune => '${_data['fortune_text'] ?? '暂无数据'}',
WidgetType.countdown => '${_data['countdown_title'] ?? '暂无数据'}',
WidgetType.pomodoro => '剩余 ${_data['pomodoro_remaining'] ?? 0}s',
WidgetType.solarTerm => '${_data['solar_term_name'] ?? '暂无数据'}',
WidgetType.checkin => '连续 ${_data['checkin_days'] ?? 0}',
WidgetType.dailyWithCharacter =>
'${_data['daily_with_character_content'] ?? '暂无数据'}',
WidgetType.dailyCard =>
'日签卡片',
WidgetType.dailyCard => '日签卡片',
};
}
@@ -980,11 +985,7 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> {
children: [
Row(
children: [
Icon(
CupertinoIcons.eye_fill,
size: 12,
color: ext.textSecondary,
),
Icon(CupertinoIcons.eye_fill, size: 12, color: ext.textSecondary),
const SizedBox(width: 4),
Text(
'数据预览',
@@ -999,11 +1000,7 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
CupertinoIcons.refresh,
size: 12,
color: ext.accent,
),
Icon(CupertinoIcons.refresh, size: 12, color: ext.accent),
const SizedBox(width: 2),
Text(
'刷新',
@@ -1033,9 +1030,7 @@ class _WidgetDataPreviewState extends ConsumerState<_WidgetDataPreview> {
),
child: Text(
_getPreviewText(),
style: AppTypography.footnote.copyWith(
color: ext.textPrimary,
),
style: AppTypography.footnote.copyWith(color: ext.textPrimary),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),

View File

@@ -17,7 +17,7 @@ import flutter_app_group_directory
import flutter_image_compress_macos
import flutter_inappwebview_macos
import flutter_local_notifications
import flutter_secure_storage_darwin
import flutter_secure_storage_macos
import flutter_tts
import flutter_webrtc
import gal
@@ -55,7 +55,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
FlutterSecureStorageDarwinPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageDarwinPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin"))

View File

@@ -20,7 +20,7 @@
name: xianyan
description: "闲言 — 灵感语录更纯粹。每日拾句 + 壁纸创作 APP"
publish_to: 'none'
version: 6.6.8+2606082
version: 6.6.12+2606123
# 年月日-次 7位
environment: