Skip to content

Commit

Permalink
version 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Predidit committed Mar 30, 2024
1 parent b936bb0 commit 15b1306
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 122 deletions.
184 changes: 92 additions & 92 deletions lib/pages/my/my_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ class _MyPageState extends State<MyPage> {
color: Theme.of(context).colorScheme.primary,
)),
),
const InkWell(
child: SetSwitchItem(
title: '硬件解码',
setKey: SettingBoxKey.HAenable,
defaultVal: true,
),
),
// const InkWell(
// child: SetSwitchItem(
// title: '硬件解码',
// setKey: SettingBoxKey.HAenable,
// defaultVal: true,
// ),
// ),
const InkWell(
child: SetSwitchItem(
title: '自动播放',
Expand All @@ -158,8 +158,7 @@ class _MyPageState extends State<MyPage> {
),
const InkWell(
child: SetSwitchItem(
title: '精准匹配',
subTitle: '实验性',
title: '精准匹配',
setKey: SettingBoxKey.danmakuEnhance,
defaultVal: true,
),
Expand Down Expand Up @@ -226,7 +225,7 @@ class _MyPageState extends State<MyPage> {
},
dense: false,
title: const Text('弹幕区域'),
subtitle: Text('当前占据 $defaultDanmakuArea 屏幕',
trailing: Text('占据 $defaultDanmakuArea 屏幕',
style: Theme.of(context)
.textTheme
.labelMedium!
Expand All @@ -240,77 +239,16 @@ class _MyPageState extends State<MyPage> {
color: Theme.of(context).colorScheme.primary,
)),
),
ListTile(
onTap: () {
SmartDialog.show(
useAnimation: false,
builder: (context) {
return AlertDialog(
title: const Text('主题模式'),
content: StatefulBuilder(
builder:
(BuildContext context, StateSetter setState) {
return Wrap(
spacing: 8,
runSpacing: 2,
children: [
defaultThemeMode == 'system'
? FilledButton(
onPressed: () {
updateTheme('system');
SmartDialog.dismiss();
},
child: const Text("跟随系统"))
: FilledButton.tonal(
onPressed: () {
updateTheme('system');
SmartDialog.dismiss();
},
child: const Text("跟随系统")),
defaultThemeMode == 'light'
? FilledButton(
onPressed: () {
updateTheme('light');
SmartDialog.dismiss();
},
child: const Text("浅色"))
: FilledButton.tonal(
onPressed: () {
updateTheme('light');
SmartDialog.dismiss();
},
child: const Text("浅色")),
defaultThemeMode == 'dark'
? FilledButton(
onPressed: () {
updateTheme('dark');
SmartDialog.dismiss();
},
child: const Text("深色"))
: FilledButton.tonal(
onPressed: () {
updateTheme('dark');
SmartDialog.dismiss();
},
child: const Text("深色")),
],
);
},
),
);
});
},
dense: false,
title: const Text('主题模式'),
subtitle: Text(
defaultThemeMode == 'light'
? '浅色'
: (defaultThemeMode == 'dark' ? '深色' : '跟随系统'),
style: Theme.of(context)
.textTheme
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline)),
),
(popularController.libopencc != '' || !Platform.isWindows)
? const InkWell(
child: SetSwitchItem(
title: '搜索优化',
subTitle: '自动翻译关键词',
setKey: SettingBoxKey.searchEnhanceEnable,
defaultVal: true,
),
)
: Container(),
ListTile(
onTap: () async {
final List<Map<String, dynamic>> colorThemes = colorThemeTypes;
Expand Down Expand Up @@ -386,23 +324,85 @@ class _MyPageState extends State<MyPage> {
dense: false,
title: const Text('配色方案'),
),
(popularController.libopencc != '' || !Platform.isWindows)
? const InkWell(
child: SetSwitchItem(
title: '搜索优化',
subTitle: '自动翻译关键词',
setKey: SettingBoxKey.searchEnhanceEnable,
defaultVal: true,
),
)
: Container(),
ListTile(
onTap: () {
SmartDialog.show(
useAnimation: false,
builder: (context) {
return AlertDialog(
title: const Text('主题模式'),
content: StatefulBuilder(
builder:
(BuildContext context, StateSetter setState) {
return Wrap(
spacing: 8,
runSpacing: 2,
children: [
defaultThemeMode == 'system'
? FilledButton(
onPressed: () {
updateTheme('system');
SmartDialog.dismiss();
},
child: const Text("跟随系统"))
: FilledButton.tonal(
onPressed: () {
updateTheme('system');
SmartDialog.dismiss();
},
child: const Text("跟随系统")),
defaultThemeMode == 'light'
? FilledButton(
onPressed: () {
updateTheme('light');
SmartDialog.dismiss();
},
child: const Text("浅色"))
: FilledButton.tonal(
onPressed: () {
updateTheme('light');
SmartDialog.dismiss();
},
child: const Text("浅色")),
defaultThemeMode == 'dark'
? FilledButton(
onPressed: () {
updateTheme('dark');
SmartDialog.dismiss();
},
child: const Text("深色"))
: FilledButton.tonal(
onPressed: () {
updateTheme('dark');
SmartDialog.dismiss();
},
child: const Text("深色")),
],
);
},
),
);
});
},
dense: false,
title: const Text('主题模式'),
trailing: Text(
defaultThemeMode == 'light'
? '浅色'
: (defaultThemeMode == 'dark' ? '深色' : '跟随系统'),
style: Theme.of(context)
.textTheme
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline)),
),

ListTile(
onTap: () {
_mineController.checkUpdata();
},
dense: false,
title: const Text('检查更新'),
subtitle: Text('当前版本 ${Api.version}',
trailing: Text('当前版本 ${Api.version}',
style: Theme.of(context)
.textTheme
.labelMedium!
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/timeline/timeline_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ abstract class _TimelineController with Store {
@observable
String sessonName = '';

DateTime? selectedDate;
DateTime selectedDate = DateTime.now();

Future getSchedules() async {
schedules = await ListRequest.getAnimeScedule(selectedDate ?? DateTime.now());
schedules = await ListRequest.getAnimeScedule(selectedDate);
}
}
72 changes: 47 additions & 25 deletions lib/pages/timeline/timeline_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class _TimelinePageState extends State<TimelinePage>
DateTime generateDateTime(int year, String season) {
switch (season) {
case '冬':
return DateTime(year, 2, 1);
return DateTime(year, 1, 1);
case '春':
return DateTime(year, 5, 1);
return DateTime(year, 4, 1);
case '夏':
return DateTime(year, 8, 1);
return DateTime(year, 7, 1);
case '秋':
return DateTime(year, 11, 1);
return DateTime(year, 10, 1);
default:
return DateTime.now();
}
Expand Down Expand Up @@ -110,32 +110,54 @@ class _TimelinePageState extends State<TimelinePage>
DateTime.now().year - 2
])
for (final String selectedSeason in [
'冬',
'春',
'夏',
'秋',
'冬'
'秋'
])
FilledButton(
onPressed: () async {
if (generateDateTime(i, selectedSeason)
.isAfter(DateTime.now())) {
SmartDialog.showToast('这是禁止事项');
} else {
if (timelineController.selectedDate !=
generateDateTime(
i, selectedSeason)) {
timelineController.selectedDate =
DateTime.now().isAfter(
generateDateTime(i, selectedSeason))
? timelineController.selectedDate ==
generateDateTime(
i, selectedSeason);
timelineController.getSchedules();
}
}
i, selectedSeason)
? FilledButton(
onPressed: () async {
if (timelineController
.selectedDate !=
generateDateTime(
i, selectedSeason)) {
timelineController
.selectedDate =
generateDateTime(
i, selectedSeason);
timelineController
.getSchedules();
}
SmartDialog.dismiss();
},
child: Text(i.toString() +
selectedSeason.toString()),
)
: FilledButton.tonal(
onPressed: () async {
if (timelineController
.selectedDate !=
generateDateTime(
i, selectedSeason)) {
timelineController
.selectedDate =
generateDateTime(
i, selectedSeason);
timelineController
.getSchedules();
}

SmartDialog.dismiss();
},
child: Text(i.toString() +
selectedSeason.toString()),
),
SmartDialog.dismiss();
},
child: Text(i.toString() +
selectedSeason.toString()),
)
: Container(),
],
);
}),
Expand Down
4 changes: 4 additions & 0 deletions lib/pages/video/video_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ abstract class _VideoController with Store {
}

Future getDanDanmaku(String title, int episode) async {
// 极为糟糕的临时措施,但作者现在就要看高达
// if (title.contains('鋼彈')) {
// title = title.replaceAll('鋼彈', '高达');
// }
bool danmakuEnhance =
setting.get(SettingBoxKey.danmakuEnhance, defaultValue: true);
bangumiID = await DanmakuRequest.getBangumiID(title);
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/video/video_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ class _VideoPageState extends State<VideoPage> with WindowListener {
return;
}
SmartDialog.showToast(
'跳转到第 ${videoController.episode + 1} 话');
' ${videoController.episode + 1} 话');
videoController.changeEpisode(
videoController.episode + 1);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/request/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Api {
static const String domain = HttpString.baseUrl + '/';
static const String animeList = 'https://d1zquzjgwo9yb.cloudfront.net/';
static const String videoAPI = 'https://v.anime1.me/api';
static const String version = '1.1.1';
static const String version = '1.1.2';
static const String sourceUrl = "https://github.com/Predidit/oneAnime";
static const String aniDanmakuAPI = "https://ani.gamer.com.tw/ajax/danmuGet.php";
static const String aniSearch = "https://ani.gamer.com.tw/search.php";
Expand Down
1 change: 1 addition & 0 deletions lib/request/danmaku.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class DanmakuRequest {
}

static getBangumiJPName (String title) async {
// Bangumi API 文档要求的UA格式
var httpHeaders = {
'user-agent':
'Predidit/oneAnime/1.1.2 (Android) (https://github.com/Predidit/oneAnime)',
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.1+1
version: 1.1.2+1

environment:
sdk: '>=3.2.6 <4.0.0'
Expand Down

0 comments on commit 15b1306

Please sign in to comment.