chore: 批量更新v6.5.21版本,整合多项功能修复与优化
主要变更: 1. 新增多风格音效资源与管理文档 2. 修复翻译服务空响应处理与Dio日志异常捕获 3. 完善Web端平台适配与路径获取Stub 4. 优化设备配对与文件传输功能 5. 新增角色命名常量与摇一摇检测器 6. 修复Riverpod dispose与鸿蒙导航路由 7. 新增每日通知服务与流体着色器 8. 优化备份服务与数据管理页面 9. 新增隐私设置附近设备发现选项 10. 重构诗词提供者支持历史记录 11. 完善桌面端构建配置与开发脚本 12. 清理旧版工具部署脚本
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/// ============================================================
|
||||
/// 闲言APP — 桌面小部件类型定义
|
||||
/// 创建时间: 2026-05-19
|
||||
/// 更新时间: 2026-05-19
|
||||
/// 更新时间: 2026-05-20
|
||||
/// 作用: 定义所有桌面小部件的类型、元数据和平台标识
|
||||
/// 上次更新: 新增qualifiedAndroidName属性,修复Android端ClassNotFoundException
|
||||
/// 上次更新: 新增dailyWithCharacter拾光角色小组件类型
|
||||
/// ============================================================
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -17,6 +17,7 @@ enum WidgetType {
|
||||
pomodoro,
|
||||
solarTerm,
|
||||
checkin,
|
||||
dailyWithCharacter,
|
||||
}
|
||||
|
||||
extension WidgetTypeX on WidgetType {
|
||||
@@ -31,6 +32,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => '番茄钟',
|
||||
WidgetType.solarTerm => '节气诗词',
|
||||
WidgetType.checkin => '每日签到',
|
||||
WidgetType.dailyWithCharacter => '拾光每日一句',
|
||||
};
|
||||
|
||||
String get subtitle => switch (this) {
|
||||
@@ -42,6 +44,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => '桌面快捷专注计时',
|
||||
WidgetType.solarTerm => '当前节气与对应诗词',
|
||||
WidgetType.checkin => '连续签到天数和快捷签到',
|
||||
WidgetType.dailyWithCharacter => '拾光角色+每日推荐句子',
|
||||
};
|
||||
|
||||
IconData get icon => switch (this) {
|
||||
@@ -53,6 +56,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => CupertinoIcons.timer,
|
||||
WidgetType.solarTerm => CupertinoIcons.arrow_3_trianglepath,
|
||||
WidgetType.checkin => CupertinoIcons.checkmark_seal_fill,
|
||||
WidgetType.dailyWithCharacter => CupertinoIcons.sparkles,
|
||||
};
|
||||
|
||||
String get androidProviderName => switch (this) {
|
||||
@@ -64,6 +68,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => 'PomodoroProvider',
|
||||
WidgetType.solarTerm => 'SolarTermProvider',
|
||||
WidgetType.checkin => 'CheckinProvider',
|
||||
WidgetType.dailyWithCharacter => 'DailyWithCharacterProvider',
|
||||
};
|
||||
|
||||
String get qualifiedAndroidName =>
|
||||
@@ -78,6 +83,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => 'PomodoroWidget',
|
||||
WidgetType.solarTerm => 'SolarTermWidget',
|
||||
WidgetType.checkin => 'CheckinWidget',
|
||||
WidgetType.dailyWithCharacter => 'DailyWithCharacterWidget',
|
||||
};
|
||||
|
||||
String get ohosFormName => switch (this) {
|
||||
@@ -89,6 +95,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => 'pomodoro',
|
||||
WidgetType.solarTerm => 'solarTerm',
|
||||
WidgetType.checkin => 'checkin',
|
||||
WidgetType.dailyWithCharacter => 'dailyWithCharacter',
|
||||
};
|
||||
|
||||
int get priority => switch (this) {
|
||||
@@ -100,22 +107,26 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => 3,
|
||||
WidgetType.solarTerm => 3,
|
||||
WidgetType.checkin => 3,
|
||||
WidgetType.dailyWithCharacter => 1,
|
||||
};
|
||||
|
||||
bool get isInteractive => switch (this) {
|
||||
WidgetType.pomodoro => true,
|
||||
WidgetType.checkin => true,
|
||||
WidgetType.dailyWithCharacter => false,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
bool get supportsIosInteractive => switch (this) {
|
||||
WidgetType.pomodoro => false,
|
||||
WidgetType.checkin => true,
|
||||
WidgetType.dailyWithCharacter => false,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
bool get supportsOhos => switch (this) {
|
||||
WidgetType.pomodoro => false,
|
||||
WidgetType.dailyWithCharacter => true,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
@@ -128,6 +139,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => '/widget-management',
|
||||
WidgetType.solarTerm => '/inspiration',
|
||||
WidgetType.checkin => '/signin',
|
||||
WidgetType.dailyWithCharacter => '/home',
|
||||
};
|
||||
|
||||
String get dataKeyPrefix => switch (this) {
|
||||
@@ -139,6 +151,7 @@ extension WidgetTypeX on WidgetType {
|
||||
WidgetType.pomodoro => 'pomodoro',
|
||||
WidgetType.solarTerm => 'solar_term',
|
||||
WidgetType.checkin => 'checkin',
|
||||
WidgetType.dailyWithCharacter => 'daily_with_character',
|
||||
};
|
||||
|
||||
String get themeKey => '${dataKeyPrefix}_theme';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// 创建时间: 2026-05-19
|
||||
/// 更新时间: 2026-05-19
|
||||
/// 作用: 管理桌面小部件的安装、数据推送、主题和平台兼容说明
|
||||
/// 上次更新: 优化分组展示+动态主题+深度链接+调试区
|
||||
/// 上次更新: 修复Android/鸿蒙端添加小部件无反应,改用requestPinWidget+手动指引
|
||||
/// ============================================================
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -13,6 +13,7 @@ import '../../../core/theme/app_theme.dart';
|
||||
import '../../../core/theme/app_spacing.dart';
|
||||
import '../../../core/theme/app_typography.dart';
|
||||
import '../../../core/theme/app_radius.dart';
|
||||
import '../../../core/utils/platform_helper.dart';
|
||||
import '../../../shared/widgets/glass_container.dart';
|
||||
import '../../../shared/widgets/responsive_layout.dart';
|
||||
import '../../../shared/widgets/app_toast.dart';
|
||||
@@ -177,13 +178,94 @@ class _WidgetManagementPageState extends ConsumerState<WidgetManagementPage> {
|
||||
_ => '趣味小部件',
|
||||
};
|
||||
|
||||
void _handleAddWidget(WidgetType type) {
|
||||
void _handleAddWidget(WidgetType type) async {
|
||||
final success = await ref.read(wp.widgetProvider.notifier).requestPinWidget(type);
|
||||
if (!success) {
|
||||
if (!mounted) return;
|
||||
_showManualAddGuide(type);
|
||||
return;
|
||||
}
|
||||
ref.read(wp.widgetProvider.notifier).addWidget(type);
|
||||
AppToast.showInfo('${type.title} 数据已推送');
|
||||
AppToast.showInfo('${type.title} 已添加到桌面');
|
||||
}
|
||||
|
||||
void _handlePinWidget(WidgetType type) {
|
||||
ref.read(wp.widgetProvider.notifier).requestPinWidget(type);
|
||||
void _handlePinWidget(WidgetType type) async {
|
||||
final success = await ref.read(wp.widgetProvider.notifier).requestPinWidget(type);
|
||||
if (!success) {
|
||||
if (!mounted) return;
|
||||
_showManualAddGuide(type);
|
||||
return;
|
||||
}
|
||||
ref.read(wp.widgetProvider.notifier).addWidget(type);
|
||||
}
|
||||
|
||||
void _showManualAddGuide(WidgetType type) {
|
||||
final ext = AppTheme.ext(context);
|
||||
final steps = PlatformHelper.isHarmonyOS
|
||||
? [
|
||||
'1️⃣ 长按桌面空白处',
|
||||
'2️⃣ 选择「服务卡片」',
|
||||
'3️⃣ 找到「闲言」',
|
||||
'4️⃣ 选择「${type.title}」并添加到桌面',
|
||||
]
|
||||
: PlatformHelper.isAndroid
|
||||
? [
|
||||
'1️⃣ 长按桌面空白处',
|
||||
'2️⃣ 选择「小部件」',
|
||||
'3️⃣ 找到「闲言」',
|
||||
'4️⃣ 选择「${type.title}」拖动到桌面',
|
||||
]
|
||||
: [
|
||||
'1️⃣ 向右滑动到今日视图',
|
||||
'2️⃣ 滚动到底部点击「编辑」',
|
||||
'3️⃣ 找到「闲言」',
|
||||
'4️⃣ 选择「${type.title}」并添加',
|
||||
];
|
||||
|
||||
showCupertinoDialog<void>(
|
||||
context: context,
|
||||
builder: (ctx) => CupertinoAlertDialog(
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(bottom: AppSpacing.sm),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(CupertinoIcons.square_grid_2x2_fill, size: 20, color: ext.accent),
|
||||
const SizedBox(width: AppSpacing.xs),
|
||||
Text('添加「${type.title}」'),
|
||||
],
|
||||
),
|
||||
),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'当前设备不支持快捷添加,请按以下步骤手动添加到桌面:',
|
||||
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,
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
child: const Text('知道了'),
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +545,7 @@ class _WidgetCard extends StatelessWidget {
|
||||
minimumSize: Size.zero,
|
||||
borderRadius: AppRadius.pillBorder,
|
||||
color: ext.accent,
|
||||
onPressed: onPin,
|
||||
onPressed: onAdd,
|
||||
child: Text(
|
||||
'添加',
|
||||
style: AppTypography.caption2.copyWith(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// 创建时间: 2026-05-19
|
||||
/// 更新时间: 2026-05-19
|
||||
/// 作用: 管理小部件安装状态、数据推送和交互
|
||||
/// 上次更新: requestPinWidget增加qualifiedAndroidName参数,修复Android类名拼接错误
|
||||
/// 上次更新: requestPinWidget返回bool,修复Android/鸿蒙端添加小部件无反应
|
||||
/// ============================================================
|
||||
|
||||
import 'dart:ui';
|
||||
@@ -89,7 +89,7 @@ class WidgetNotifier extends Notifier<WidgetState> {
|
||||
Log.i('WidgetNotifier: 移除小部件 ${type.title}');
|
||||
}
|
||||
|
||||
Future<void> requestPinWidget(WidgetType type) async {
|
||||
Future<bool> requestPinWidget(WidgetType type) async {
|
||||
try {
|
||||
await HomeWidget.requestPinWidget(
|
||||
qualifiedAndroidName: type.qualifiedAndroidName,
|
||||
@@ -97,8 +97,10 @@ class WidgetNotifier extends Notifier<WidgetState> {
|
||||
ohosName: type.ohosFormName,
|
||||
);
|
||||
Log.i('WidgetNotifier: 请求固定小部件 ${type.title}');
|
||||
return true;
|
||||
} catch (e) {
|
||||
Log.e('WidgetNotifier: 请求固定小部件失败', e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user