Skip to content

Commit

Permalink
version 1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Predidit committed Mar 23, 2024
1 parent 8f9fd98 commit b81a301
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 121 deletions.
3 changes: 2 additions & 1 deletion lib/pages/player/player_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ abstract class _PlayerController with Store {
mode,
overlays: SystemUiOverlay.values,
);
await SystemChrome.setPreferredOrientations([]);
// await SystemChrome.setPreferredOrientations([]);
verticalScreen();
} else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
await const MethodChannel('com.alexmercerind/media_kit_video')
.invokeMethod(
Expand Down
235 changes: 117 additions & 118 deletions lib/pages/video/video_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,121 +170,115 @@ class _VideoPageState extends State<VideoPage> with WindowListener {
1.75,
2.0
];
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('播放速度'),
content: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Wrap(
spacing: 8,
runSpacing: 2,
children: [
for (final double i in speedsList) ...<Widget>[
if (i == currentSpeed) ...<Widget>[
FilledButton(
onPressed: () async {
await videoController.setPlaybackSpeed(i);
Modular.to.pop();
},
child: Text(i.toString()),
),
] else ...[
FilledButton.tonal(
onPressed: () async {
await videoController.setPlaybackSpeed(i);
Modular.to.pop();
},
child: Text(i.toString()),
),
]
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: [
for (final double i in speedsList) ...<Widget>[
if (i == currentSpeed) ...<Widget>[
FilledButton(
onPressed: () async {
await videoController.setPlaybackSpeed(i);
SmartDialog.dismiss();
},
child: Text(i.toString()),
),
] else ...[
FilledButton.tonal(
onPressed: () async {
await videoController.setPlaybackSpeed(i);
SmartDialog.dismiss();
},
child: Text(i.toString()),
),
]
],
);
}),
actions: <Widget>[
TextButton(
onPressed: () => Modular.to.pop(),
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton(
onPressed: () async {
await videoController.setPlaybackSpeed(1.0);
Modular.to.pop();
},
child: const Text('默认速度'),
]
],
);
}),
actions: <Widget>[
TextButton(
onPressed: () => SmartDialog.dismiss(),
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
],
);
},
);
),
TextButton(
onPressed: () async {
await videoController.setPlaybackSpeed(1.0);
SmartDialog.dismiss();
},
child: const Text('默认速度'),
),
],
);
});
}

/// 发送弹幕 由于接口限制, 暂时未提交云端
void showShootDanmakuSheet() {
final TextEditingController textController = TextEditingController();
bool isSending = false; // 追踪是否正在发送
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('发送弹幕'),
content: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return TextField(
controller: textController,
);
}),
actions: [
TextButton(
onPressed: () => Modular.to.pop(),
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
SmartDialog.show(useAnimation: false, builder: (context) {
return AlertDialog(
title: const Text('发送弹幕'),
content: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return TextField(
controller: textController,
);
}),
actions: [
TextButton(
onPressed: () => SmartDialog.dismiss(),
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return TextButton(
onPressed: isSending
? null
: () async {
final String msg = textController.text;
if (msg.isEmpty) {
SmartDialog.showToast('弹幕内容不能为空');
return;
} else if (msg.length > 100) {
SmartDialog.showToast('弹幕内容不能超过100个字符');
return;
}
setState(() {
isSending = true; // 开始发送,更新状态
});
// Todo 接口方限制
),
StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return TextButton(
onPressed: isSending
? null
: () async {
final String msg = textController.text;
if (msg.isEmpty) {
SmartDialog.showToast('弹幕内容不能为空');
return;
} else if (msg.length > 100) {
SmartDialog.showToast('弹幕内容不能超过100个字符');
return;
}
setState(() {
isSending = true; // 开始发送,更新状态
});
// Todo 接口方限制

setState(() {
isSending = false; // 发送结束,更新状态
});
SmartDialog.showToast('发送成功');
danmakuController.addItems([
DanmakuItem(
msg,
// color: Colors.purple,
)
]);
Modular.to.pop();
},
child: Text(isSending ? '发送中...' : '发送'),
);
})
],
);
},
);
setState(() {
isSending = false; // 发送结束,更新状态
});
SmartDialog.showToast('发送成功');
danmakuController.addItems([
DanmakuItem(
msg,
// color: Colors.purple,
)
]);
SmartDialog.dismiss();
},
child: Text(isSending ? '发送中...' : '发送'),
);
})
],
);
});
}

@override
Expand Down Expand Up @@ -637,19 +631,24 @@ class _VideoPageState extends State<VideoPage> with WindowListener {
},
),
),
IconButton(
color: Colors.white,
icon: const Icon(Icons.notes),
onPressed: () {
if (videoController
.danDanmakus.length ==
0) {
SmartDialog.showToast('当前剧集不支持弹幕发送的说');
return;
}
showShootDanmakuSheet();
},
),
(videoController.androidFullscreen ==
true &&
videoController.danmakuOn == true)
? IconButton(
color: Colors.white,
icon: const Icon(Icons.notes),
onPressed: () {
if (videoController
.danDanmakus.length ==
0) {
SmartDialog.showToast(
'当前剧集不支持弹幕发送的说');
return;
}
showShootDanmakuSheet();
},
)
: Container(),
IconButton(
color: Colors.white,
icon: Icon(videoController.danmakuOn
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.0.6';
static const String version = '1.0.7';
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
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.0.6+1
version: 1.0.7+1

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

0 comments on commit b81a301

Please sign in to comment.