Skip to content

Commit 02cb9f1

Browse files
authored
🔀 Merge pull request #13 from ChenXu233/dev
🔖 V0.6.0 ### 更新日志 ✨ #### 🛠️ 修复与优化 1. **Windows 构建修复** 修复了 Windows 平台的构建问题,确保应用在该环境下可稳定编译与运行。 [查看提交](72619fa) #### ♻️ 代码重构 2. **组件模块化重构** 将 Pomodoro 对话框组件重构至独立文件,提升了代码的组织结构与可维护性。 [查看提交](c3c2fd1) #### 🎵 背景音乐功能增强 3. **背景音乐播放支持** 新增背景音乐播放功能,并为番茄钟添加了自动播放设置选项,提升专注氛围。 [查看提交1](https://github.com/ChenXu233/ToDoTimeSquare/commit/3caebfe22bf35ec9ded47ed0d3322a6a6febb714)|[查看提交2](https://github.com/ChenXu233/ToDoTimeSquare/commit/4ef57a7047887e9a8ce6a8d8ba487c03b249e3f5) 4. **音乐服务与内容更新** 更新了默认背景音乐曲目,优化了音乐解析服务,并改进了电台播放列表的获取逻辑与 Windows 平台代码格式。 [查看提交1](https://github.com/ChenXu233/ToDoTimeSquare/commit/e69c582d9a09dfb294d2839b0f9993b40dcbe369)|[查看提交2](https://github.com/ChenXu233/ToDoTimeSquare/commit/b3315506b4eba4bd269a421d0c44a82b0e14fb30)
2 parents c00def2 + 9c1e414 commit 02cb9f1

26 files changed

Lines changed: 1981 additions & 280 deletions

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
"C_Cpp_Runner.msvcSecureNoWarnings": false,
6464
"cmake.ignoreCMakeListsMissing": true,
6565
"editor.quickSuggestions": {
66-
"other": true,
67-
"comments": true,
68-
"strings": true
69-
}
66+
"other": true,
67+
"comments": true,
68+
"strings": true
69+
}
7070
}

lib/i18n/app_en.arb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@
244244
"@reminderMode": {
245245
"description": "Label for reminder mode setting"
246246
},
247+
"autoPlayBackgroundMusic": "Auto-play background music",
248+
"@autoPlayBackgroundMusic": {
249+
"description": "Label for auto-play background music setting"
250+
},
251+
"autoPlayBackgroundMusicSubtitle": "Resume/pause background music when timer starts or pauses",
252+
"@autoPlayBackgroundMusicSubtitle": {
253+
"description": "Subtitle/description for auto-play background music setting"
254+
},
247255
"reminderNone": "None",
248256
"@reminderNone": {
249257
"description": "Label for no reminder"

lib/i18n/app_zh.arb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@
6262
"appdetails": "ToDoTimeSquare是一款专为偏好灵活与开放的认知风格(MBTI中的P型人格)设计的生产力应用,其核心创新在于将非结构化的动态任务池与标准番茄工作法深度结合,形成一套“自由选择,专注执行”的循环系统:应用提供一个无强制性排序、可随时增删的开放式待办清单作为“任务储备库”,用户无需提前规划全天日程,而是根据当下状态与兴趣从中即时挑选单一任务,随即启动一个定制的番茄钟(如25分钟专注+5分钟休息),进入受保护的心流冲刺阶段;每个番茄钟完成后,系统提供即时视觉反馈与数据统计,任务自动标记完成,用户既可延续同一任务进行下一轮冲刺,也可毫无负担地返回清单自由选择新目标。这一设计通过将宏观的计划压力分解为微观的自主行动单元,有效降低了决策门槛与拖延倾向,使灵活散漫的思维方式转化为可持续的专注生产力,让时间管理不再是束缚探索的框架,而是支持即兴创造的工具。",
6363
"statistics": "统计",
6464
"reminderMode": "提醒模式",
65+
"autoPlayBackgroundMusic": "背景音乐随番茄钟自动播放",
66+
"@autoPlayBackgroundMusic": {
67+
"description": "背景音乐随番茄钟自动播放的设置标签"
68+
},
69+
"autoPlayBackgroundMusicSubtitle": "开始/暂停计时器时同时恢复/暂停背景音乐",
70+
"@autoPlayBackgroundMusicSubtitle": {
71+
"description": "背景音乐随番茄钟自动播放设置的说明性文字"
72+
},
6573
"reminderNone": "无",
6674
"reminderNotification": "仅通知",
6775
"reminderAlarm": "仅闹铃",

lib/i18n/i18n.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,18 @@ abstract class APPi18n {
463463
/// **'Reminder Mode'**
464464
String get reminderMode;
465465

466+
/// Label for auto-play background music setting
467+
///
468+
/// In en, this message translates to:
469+
/// **'Auto-play background music'**
470+
String get autoPlayBackgroundMusic;
471+
472+
/// Subtitle/description for auto-play background music setting
473+
///
474+
/// In en, this message translates to:
475+
/// **'Resume/pause background music when timer starts or pauses'**
476+
String get autoPlayBackgroundMusicSubtitle;
477+
466478
/// Label for no reminder
467479
///
468480
/// In en, this message translates to:

lib/i18n/i18n_en.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ class APPi18nEn extends APPi18n {
195195
@override
196196
String get reminderMode => 'Reminder Mode';
197197

198+
@override
199+
String get autoPlayBackgroundMusic => 'Auto-play background music';
200+
201+
@override
202+
String get autoPlayBackgroundMusicSubtitle =>
203+
'Resume/pause background music when timer starts or pauses';
204+
198205
@override
199206
String get reminderNone => 'None';
200207

lib/i18n/i18n_zh.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ class APPi18nZh extends APPi18n {
194194
@override
195195
String get reminderMode => '提醒模式';
196196

197+
@override
198+
String get autoPlayBackgroundMusic => '背景音乐随番茄钟自动播放';
199+
200+
@override
201+
String get autoPlayBackgroundMusicSubtitle => '开始/暂停计时器时同时恢复/暂停背景音乐';
202+
197203
@override
198204
String get reminderNone => '无';
199205

lib/main.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'routes/app_router.dart'; // 导入路由配置
1010
import 'i18n/i18n.dart'; // 导入生成的国际化文件
1111
import 'providers/theme_provider.dart';
1212
import 'providers/pomodoro_provider.dart';
13+
import 'providers/background_music_provider.dart';
1314
import 'providers/todo_provider.dart';
1415
import 'providers/statistics_provider.dart';
1516
import 'widgets/window/window_title_bar.dart';
@@ -73,10 +74,16 @@ class MyApp extends StatelessWidget {
7374
ChangeNotifierProvider(create: (_) => ThemeProvider()),
7475
ChangeNotifierProvider(create: (_) => StatisticsProvider()),
7576
ChangeNotifierProvider(create: (_) => TodoProvider()),
76-
ChangeNotifierProxyProvider<StatisticsProvider, PomodoroProvider>(
77+
ChangeNotifierProvider(create: (_) => BackgroundMusicProvider()),
78+
ChangeNotifierProxyProvider2<
79+
StatisticsProvider,
80+
BackgroundMusicProvider,
81+
PomodoroProvider
82+
>(
7783
create: (_) => PomodoroProvider(),
78-
update: (_, stats, pomodoro) =>
79-
pomodoro!..setStatisticsProvider(stats),
84+
update: (_, stats, bgMusic, pomodoro) => pomodoro!
85+
..setStatisticsProvider(stats)
86+
..setBackgroundMusicProvider(bgMusic),
8087
),
8188
],
8289
child: Consumer<ThemeProvider>(

lib/models/music_track.dart

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
class MusicTrack {
2+
final String id;
3+
final String title;
4+
final String artist;
5+
final String sourceUrl; // URL for remote, path for local
6+
final bool isLocal;
7+
final bool isRadio;
8+
String? localPath; // Path if downloaded or imported
9+
10+
MusicTrack({
11+
required this.id,
12+
required this.title,
13+
required this.artist,
14+
required this.sourceUrl,
15+
this.isLocal = false,
16+
this.isRadio = false,
17+
this.localPath,
18+
});
19+
20+
factory MusicTrack.fromJson(Map<String, dynamic> json) {
21+
return MusicTrack(
22+
id: json['id'] as String,
23+
title: json['title'] as String,
24+
artist: json['artist'] as String,
25+
sourceUrl: json['sourceUrl'] as String,
26+
isLocal: json['isLocal'] as bool? ?? false,
27+
isRadio: json['isRadio'] as bool? ?? false,
28+
localPath: json['localPath'] as String?,
29+
);
30+
}
31+
32+
Map<String, dynamic> toJson() {
33+
return {
34+
'id': id,
35+
'title': title,
36+
'artist': artist,
37+
'sourceUrl': sourceUrl,
38+
'isLocal': isLocal,
39+
'isRadio': isRadio,
40+
'localPath': localPath,
41+
};
42+
}
43+
44+
MusicTrack copyWith({
45+
String? id,
46+
String? title,
47+
String? artist,
48+
String? sourceUrl,
49+
bool? isLocal,
50+
bool? isRadio,
51+
String? localPath,
52+
}) {
53+
return MusicTrack(
54+
id: id ?? this.id,
55+
title: title ?? this.title,
56+
artist: artist ?? this.artist,
57+
sourceUrl: sourceUrl ?? this.sourceUrl,
58+
isLocal: isLocal ?? this.isLocal,
59+
isRadio: isRadio ?? this.isRadio,
60+
localPath: localPath ?? this.localPath,
61+
);
62+
}
63+
}

0 commit comments

Comments
 (0)