Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix incorrect widget nesting

Predidit390662875921
diff --git a/lib/pages/favorite/favorite_page.dart b/lib/pages/favorite/favorite_page.dart
index 871a89a1..7f7d095c 100644
--- a/lib/pages/favorite/favorite_page.dart
+++ b/lib/pages/favorite/favorite_page.dart
@@ -49,8 +49,7 @@ class _FavoritePageState extends State<FavoritePage> {
onBackPressed(context);
},
child: Scaffold(
- appBar: const SysAppBar(
- title: Text('追番'), backgroundColor: Colors.transparent),
+ appBar: const SysAppBar(title: Text('追番')),
body: favoriteController.favorites.isEmpty
? const Center(
child: Text('啊咧(⊙.⊙) 没有追番的说'),
diff --git a/lib/pages/player/player_item.dart b/lib/pages/player/player_item.dart
index 1511ea70..69e7e08d 100644
--- a/lib/pages/player/player_item.dart
+++ b/lib/pages/player/player_item.dart
@@ -599,708 +599,685 @@ class _PlayerItemState extends State<PlayerItem>
}
onBackPressed(context);
},
- child: SafeArea(
- child: Scaffold(
- body: Observer(builder: (context) {
- return ClipRect(
- child: Container(
- color: Colors.black,
- child: MouseRegion(
- cursor:
- (videoPageController.androidFullscreen && !showPositioned)
- ? SystemMouseCursors.none
- : SystemMouseCursors.basic,
- onHover: (_) {
- // workaround for android.
- // I don't konw why, but android tap event will trigger onHover event.
- if (Utils.isDesktop()) {
- _handleHove();
- }
- },
- child: FocusTraversalGroup(
- child: FocusScope(
- node: FocusScopeNode(),
- child: Listener(
- onPointerSignal: (pointerSignal) {
- if (pointerSignal is PointerScrollEvent) {
- _handleMouseScroller();
- final scrollDelta = pointerSignal.scrollDelta;
- // debugPrint('滚轮滑动距离: ${scrollDelta.dy}');
- final double volume =
- playerController.volume - scrollDelta.dy / 6000;
- final double result = volume.clamp(0.0, 1.0);
- setVolume(result);
- playerController.volume = result;
+ child: Observer(builder: (context) {
+ return ClipRect(
+ child: Container(
+ color: Colors.black,
+ child: MouseRegion(
+ cursor: (videoPageController.androidFullscreen && !showPositioned)
+ ? SystemMouseCursors.none
+ : SystemMouseCursors.basic,
+ onHover: (_) {
+ // workaround for android.
+ // I don't konw why, but android tap event will trigger onHover event.
+ if (Utils.isDesktop()) {
+ _handleHove();
+ }
+ },
+ child: FocusTraversalGroup(
+ child: FocusScope(
+ node: FocusScopeNode(),
+ child: Listener(
+ onPointerSignal: (pointerSignal) {
+ if (pointerSignal is PointerScrollEvent) {
+ _handleMouseScroller();
+ final scrollDelta = pointerSignal.scrollDelta;
+ // debugPrint('滚轮滑动距离: ${scrollDelta.dy}');
+ final double volume =
+ playerController.volume - scrollDelta.dy / 6000;
+ final double result = volume.clamp(0.0, 1.0);
+ setVolume(result);
+ playerController.volume = result;
+ }
+ },
+ child: KeyboardListener(
+ autofocus: true,
+ focusNode: _focusNode,
+ onKeyEvent: (KeyEvent event) {
+ if (event is KeyDownEvent) {
+ _handleHove();
+ // 当空格键被按下时
+ if (event.logicalKey == LogicalKeyboardKey.space) {
+ try {
+ playerController.playOrPause();
+ } catch (e) {
+ KazumiLogger()
+ .log(Level.error, '播放器内部错误 ${e.toString()}');
+ }
}
- },
- child: KeyboardListener(
- autofocus: true,
- focusNode: _focusNode,
- onKeyEvent: (KeyEvent event) {
- if (event is KeyDownEvent) {
- _handleHove();
- // 当空格键被按下时
- if (event.logicalKey ==
- LogicalKeyboardKey.space) {
- try {
- playerController.playOrPause();
- } catch (e) {
- KazumiLogger().log(
- Level.error, '播放器内部错误 ${e.toString()}');
- }
- }
- // 右方向键被按下
- if (event.logicalKey ==
- LogicalKeyboardKey.arrowRight) {
- try {
- if (playerTimer != null) {
- playerTimer!.cancel();
- }
- playerController.currentPosition = Duration(
- seconds: playerController
- .currentPosition.inSeconds +
- 10);
- playerController
- .seek(playerController.currentPosition);
- playerTimer = getPlayerTimer();
- } catch (e) {
- KazumiLogger().log(
- Level.error, '播放器内部错误 ${e.toString()}');
- }
- }
- // 左方向键被按下
- if (event.logicalKey ==
- LogicalKeyboardKey.arrowLeft) {
- if (playerController.currentPosition.inSeconds >
- 10) {
- try {
- if (playerTimer != null) {
- playerTimer!.cancel();
- }
- playerController.currentPosition = Duration(
- seconds: playerController
- .currentPosition.inSeconds -
- 10);
- playerController
- .seek(playerController.currentPosition);
- playerTimer = getPlayerTimer();
- } catch (e) {
- KazumiLogger()
- .log(Level.error, e.toString());
- }
- }
+ // 右方向键被按下
+ if (event.logicalKey ==
+ LogicalKeyboardKey.arrowRight) {
+ try {
+ if (playerTimer != null) {
+ playerTimer!.cancel();
}
- // Esc键被按下
- if (event.logicalKey ==
- LogicalKeyboardKey.escape) {
- if (videoPageController.androidFullscreen) {
- try {
- danmakuController.onClear();
- } catch (_) {}
- videoPageController.exitFullScreen();
- videoPageController.androidFullscreen =
- !videoPageController.androidFullscreen;
- } else {
- windowManager.hide();
+ playerController.currentPosition = Duration(
+ seconds: playerController
+ .currentPosition.inSeconds +
+ 10);
+ playerController
+ .seek(playerController.currentPosition);
+ playerTimer = getPlayerTimer();
+ } catch (e) {
+ KazumiLogger()
+ .log(Level.error, '播放器内部错误 ${e.toString()}');
+ }
+ }
+ // 左方向键被按下
+ if (event.logicalKey ==
+ LogicalKeyboardKey.arrowLeft) {
+ if (playerController.currentPosition.inSeconds >
+ 10) {
+ try {
+ if (playerTimer != null) {
+ playerTimer!.cancel();
}
+ playerController.currentPosition = Duration(
+ seconds: playerController
+ .currentPosition.inSeconds -
+ 10);
+ playerController
+ .seek(playerController.currentPosition);
+ playerTimer = getPlayerTimer();
+ } catch (e) {
+ KazumiLogger().log(Level.error, e.toString());
}
- // F键被按下
- if (event.logicalKey == LogicalKeyboardKey.keyF) {
- _handleFullscreen();
+ }
+ }
+ // Esc键被按下
+ if (event.logicalKey == LogicalKeyboardKey.escape) {
+ if (videoPageController.androidFullscreen) {
+ try {
+ danmakuController.onClear();
+ } catch (_) {}
+ videoPageController.exitFullScreen();
+ videoPageController.androidFullscreen =
+ !videoPageController.androidFullscreen;
+ } else {
+ windowManager.hide();
+ }
+ }
+ // F键被按下
+ if (event.logicalKey == LogicalKeyboardKey.keyF) {
+ _handleFullscreen();
+ }
+ // D键盘被按下
+ if (event.logicalKey == LogicalKeyboardKey.keyD) {
+ _handleDanmaku();
+ }
+ }
+ },
+ child: SizedBox(
+ height: videoPageController.androidFullscreen
+ ? (MediaQuery.of(context).size.height)
+ : (MediaQuery.of(context).size.width *
+ 9.0 /
+ (16.0)),
+ width: MediaQuery.of(context).size.width,
+ child: Stack(alignment: Alignment.center, children: [
+ Center(child: playerSurface),
+ (playerController.isBuffering ||
+ videoPageController.loading)
+ ? const Positioned.fill(
+ child: Center(
+ child: CircularProgressIndicator(),
+ ),
+ )
+ : Container(),
+ GestureDetector(
+ onTap: () {
+ _handleTap();
+ },
+ onDoubleTap: () {
+ if (!showPositioned) {
+ _handleTap();
}
- // D键盘被按下
- if (event.logicalKey == LogicalKeyboardKey.keyD) {
- _handleDanmaku();
+ if (playerController.playing) {
+ playerController.pause();
+ } else {
+ playerController.play();
}
- }
- },
- child: SizedBox(
- height: videoPageController.androidFullscreen
- ? (MediaQuery.of(context).size.height)
- : (MediaQuery.of(context).size.width *
- 9.0 /
- (16.0)),
- width: MediaQuery.of(context).size.width,
- child:
- Stack(alignment: Alignment.center, children: [
- Center(child: playerSurface),
- (playerController.isBuffering ||
- videoPageController.loading)
- ? const Positioned.fill(
- child: Center(
- child: CircularProgressIndicator(),
- ),
- )
- : Container(),
- GestureDetector(
- onTap: () {
- _handleTap();
- },
- onDoubleTap: () {
- if (!showPositioned) {
- _handleTap();
- }
- if (playerController.playing) {
- playerController.pause();
- } else {
- playerController.play();
- }
- },
- onLongPressStart: (_) {
- setState(() {
- showPlaySpeed = true;
- });
- playerController.setPlaybackSpeed(
- playerController.playerSpeed * 2.5);
- },
- onLongPressEnd: (_) {
- setState(() {
- showPlaySpeed = false;
- });
- playerController.setPlaybackSpeed(
- playerController.playerSpeed / 2.5);
- },
- child: Container(
- color: Colors.transparent,
- width: double.infinity,
- height: double.infinity,
- ),
- ),
+ },
+ onLongPressStart: (_) {
+ setState(() {
+ showPlaySpeed = true;
+ });
+ playerController.setPlaybackSpeed(
+ playerController.playerSpeed * 2.5);
+ },
+ onLongPressEnd: (_) {
+ setState(() {
+ showPlaySpeed = false;
+ });
+ playerController.setPlaybackSpeed(
+ playerController.playerSpeed / 2.5);
+ },
+ child: Container(
+ color: Colors.transparent,
+ width: double.infinity,
+ height: double.infinity,
+ ),
+ ),
- // 播放器手势控制
- Positioned.fill(
- left: 16,
- top: 25,
- right: 15,
- bottom: 15,
- child: Utils.isDesktop()
- ? Container()
- : GestureDetector(onHorizontalDragUpdate:
- (DragUpdateDetails details) {
- setState(() {
- showPosition = true;
- });
- if (playerTimer != null) {
- // debugPrint('检测到拖动, 定时器取消');
- playerTimer!.cancel();
- }
- playerController.pause();
- final double scale = 180000 /
- MediaQuery.sizeOf(context).width;
- playerController.currentPosition =
- Duration(
- milliseconds: playerController
- .currentPosition
- .inMilliseconds +
- (details.delta.dx * scale)
- .round());
- }, onHorizontalDragEnd:
- (DragEndDetails details) {
- playerController.play();
- playerController.seek(
- playerController.currentPosition);
- playerTimer = getPlayerTimer();
- setState(() {
- showPosition = false;
- });
- }, onVerticalDragUpdate:
- (DragUpdateDetails details) async {
- final double totalWidth =
- MediaQuery.sizeOf(context).width;
- final double totalHeight =
- MediaQuery.sizeOf(context).height;
- final double tapPosition =
- details.localPosition.dx;
- final double sectionWidth =
- totalWidth / 2;
- final double delta = details.delta.dy;
+ // 播放器手势控制
+ Positioned.fill(
+ left: 16,
+ top: 25,
+ right: 15,
+ bottom: 15,
+ child: Utils.isDesktop()
+ ? Container()
+ : GestureDetector(onHorizontalDragUpdate:
+ (DragUpdateDetails details) {
+ setState(() {
+ showPosition = true;
+ });
+ if (playerTimer != null) {
+ // debugPrint('检测到拖动, 定时器取消');
+ playerTimer!.cancel();
+ }
+ playerController.pause();
+ final double scale = 180000 /
+ MediaQuery.sizeOf(context).width;
+ playerController.currentPosition =
+ Duration(
+ milliseconds: playerController
+ .currentPosition
+ .inMilliseconds +
+ (details.delta.dx * scale)
+ .round());
+ }, onHorizontalDragEnd:
+ (DragEndDetails details) {
+ playerController.play();
+ playerController.seek(
+ playerController.currentPosition);
+ playerTimer = getPlayerTimer();
+ setState(() {
+ showPosition = false;
+ });
+ }, onVerticalDragUpdate:
+ (DragUpdateDetails details) async {
+ final double totalWidth =
+ MediaQuery.sizeOf(context).width;
+ final double totalHeight =
+ MediaQuery.sizeOf(context).height;
+ final double tapPosition =
+ details.localPosition.dx;
+ final double sectionWidth =
+ totalWidth / 2;
+ final double delta = details.delta.dy;
- /// 非全屏时禁用
- if (!videoPageController
- .androidFullscreen) {
- return;
- }
- if (tapPosition < sectionWidth) {
- // 左边区域
- setState(() {
- showBrightness = true;
- });
- try {
- playerController.brightness =
- await ScreenBrightness()
- .current;
- } catch (e) {
- KazumiLogger().log(
- Level.error, e.toString());
- }
- final double level =
- (totalHeight) * 3;
- final double brightness =
- playerController.brightness -
- delta / level;
- final double result =
- brightness.clamp(0.0, 1.0);
- setBrightness(result);
- } else {
- // 右边区域
- setState(() {
- showVolume = true;
- });
- final double level =
- (totalHeight) * 3;
- final double volume =
- playerController.volume -
- delta / level;
- final double result =
- volume.clamp(0.0, 1.0);
- setVolume(result);
- playerController.volume = result;
- }
- }, onVerticalDragEnd:
- (DragEndDetails details) {
- setState(() {
- showVolume = false;
- showBrightness = false;
- });
- })),
- // 顶部进度条
- Positioned(
- top: 25,
- width: 200,
- child: showPosition
- ? Wrap(
- alignment: WrapAlignment.center,
- children: <Widget>[
- Container(
- padding:
- const EdgeInsets.all(8.0),
- decoration: BoxDecoration(
- color: Colors.black
- .withOpacity(0.5),
- borderRadius:
- BorderRadius.circular(
- 8.0), // 圆角
- ),
- child: Text(
- playerController.currentPosition
- .compareTo(
- playerController
- .mediaPlayer
- .value
- .position) >
- 0
- ? '快进 ${playerController.currentPosition.inSeconds - playerController.mediaPlayer.value.position.inSeconds} 秒'
- : '快退 ${playerController.mediaPlayer.value.position.inSeconds - playerController.currentPosition.inSeconds} 秒',
- style: const TextStyle(
+ /// 非全屏时禁用
+ if (!videoPageController
+ .androidFullscreen) {
+ return;
+ }
+ if (tapPosition < sectionWidth) {
+ // 左边区域
+ setState(() {
+ showBrightness = true;
+ });
+ try {
+ playerController.brightness =
+ await ScreenBrightness().current;
+ } catch (e) {
+ KazumiLogger()
+ .log(Level.error, e.toString());
+ }
+ final double level = (totalHeight) * 3;
+ final double brightness =
+ playerController.brightness -
+ delta / level;
+ final double result =
+ brightness.clamp(0.0, 1.0);
+ setBrightness(result);
+ } else {
+ // 右边区域
+ setState(() {
+ showVolume = true;
+ });
+ final double level = (totalHeight) * 3;
+ final double volume =
+ playerController.volume -
+ delta / level;
+ final double result =
+ volume.clamp(0.0, 1.0);
+ setVolume(result);
+ playerController.volume = result;
+ }
+ }, onVerticalDragEnd:
+ (DragEndDetails details) {
+ setState(() {
+ showVolume = false;
+ showBrightness = false;
+ });
+ })),
+ // 顶部进度条
+ Positioned(
+ top: 25,
+ width: 200,
+ child: showPosition
+ ? Wrap(
+ alignment: WrapAlignment.center,
+ children: <Widget>[
+ Container(
+ padding: const EdgeInsets.all(8.0),
+ decoration: BoxDecoration(
+ color:
+ Colors.black.withOpacity(0.5),
+ borderRadius: BorderRadius.circular(
+ 8.0), // 圆角
+ ),
+ child: Text(
+ playerController.currentPosition
+ .compareTo(
+ playerController
+ .mediaPlayer
+ .value
+ .position) >
+ 0
+ ? '快进 ${playerController.currentPosition.inSeconds - playerController.mediaPlayer.value.position.inSeconds} 秒'
+ : '快退 ${playerController.mediaPlayer.value.position.inSeconds - playerController.currentPosition.inSeconds} 秒',
+ style: const TextStyle(
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ],
+ )
+ : Container()),
+ // 顶部播放速度条
+ Positioned(
+ top: 25,
+ child: showPlaySpeed
+ ? Wrap(
+ alignment: WrapAlignment.center,
+ children: <Widget>[
+ Container(
+ padding: const EdgeInsets.all(8.0),
+ decoration: BoxDecoration(
+ color:
+ Colors.black.withOpacity(0.5),
+ borderRadius: BorderRadius.circular(
+ 8.0), // 圆角
+ ),
+ child: const Row(
+ children: <Widget>[
+ Icon(Icons.fast_forward,
+ color: Colors.white),
+ Text(
+ ' 倍速播放',
+ style: TextStyle(
color: Colors.white,
),
),
+ ],
+ ),
+ ),
+ ],
+ )
+ : Container()),
+ // 亮度条
+ Positioned(
+ top: 25,
+ child: showBrightness
+ ? Wrap(
+ alignment: WrapAlignment.center,
+ children: <Widget>[
+ Container(
+ padding: const EdgeInsets.all(8.0),
+ decoration: BoxDecoration(
+ color:
+ Colors.black.withOpacity(0.5),
+ borderRadius:
+ BorderRadius.circular(
+ 8.0), // 圆角
),
- ],
- )
- : Container()),
- // 顶部播放速度条
- Positioned(
- top: 25,
- child: showPlaySpeed
- ? Wrap(
- alignment: WrapAlignment.center,
- children: <Widget>[
- Container(
- padding:
- const EdgeInsets.all(8.0),
- decoration: BoxDecoration(
- color: Colors.black
- .withOpacity(0.5),
- borderRadius:
- BorderRadius.circular(
- 8.0), // 圆角
- ),
- child: const Row(
- children: <Widget>[
- Icon(Icons.fast_forward,
- color: Colors.white),
- Text(
- ' 倍速播放',
- style: TextStyle(
- color: Colors.white,
- ),
+ child: Row(
+ children: <Widget>[
+ const Icon(Icons.brightness_7,
+ color: Colors.white),
+ Text(
+ ' ${(playerController.brightness * 100).toInt()} %',
+ style: const TextStyle(
+ color: Colors.white,
),
- ],
- ),
- ),
- ],
- )
- : Container()),
- // 亮度条
- Positioned(
- top: 25,
- child: showBrightness
- ? Wrap(
- alignment: WrapAlignment.center,
- children: <Widget>[
- Container(
- padding:
- const EdgeInsets.all(8.0),
- decoration: BoxDecoration(
- color: Colors.black
- .withOpacity(0.5),
- borderRadius:
- BorderRadius.circular(
- 8.0), // 圆角
),
- child: Row(
- children: <Widget>[
- const Icon(
- Icons.brightness_7,
- color: Colors.white),
- Text(
- ' ${(playerController.brightness * 100).toInt()} %',
- style: const TextStyle(
- color: Colors.white,
- ),
- ),
- ],
- )),
- ],
- )
- : Container()),
- // 音量条
- Positioned(
- top: 25,
- child: showVolume
- ? Wrap(
- alignment: WrapAlignment.center,
- children: <Widget>[
- Container(
- padding:
- const EdgeInsets.all(8.0),
- decoration: BoxDecoration(
- color: Colors.black
- .withOpacity(0.5),
- borderRadius:
- BorderRadius.circular(
- 8.0), // 圆角
+ ],
+ )),
+ ],
+ )
+ : Container()),
+ // 音量条
+ Positioned(
+ top: 25,
+ child: showVolume
+ ? Wrap(
+ alignment: WrapAlignment.center,
+ children: <Widget>[
+ Container(
+ padding: const EdgeInsets.all(8.0),
+ decoration: BoxDecoration(
+ color:
+ Colors.black.withOpacity(0.5),
+ borderRadius:
+ BorderRadius.circular(
+ 8.0), // 圆角
+ ),
+ child: Row(
+ children: <Widget>[
+ const Icon(Icons.volume_down,
+ color: Colors.white),
+ Text(
+ ' ${(playerController.volume * 100).toInt()}%',
+ style: const TextStyle(
+ color: Colors.white,
+ ),
),
- child: Row(
- children: <Widget>[
- const Icon(
- Icons.volume_down,
- color: Colors.white),
- Text(
- ' ${(playerController.volume * 100).toInt()}%',
- style: const TextStyle(
- color: Colors.white,
- ),
- ),
- ],
- )),
- ],
- )
- : Container()),
- // 弹幕面板
- Positioned(
- top: 0,
- left: 0,
- right: 0,
- height: videoPageController.androidFullscreen
- ? MediaQuery.sizeOf(context).height *
- danmakuArea
- : (MediaQuery.sizeOf(context).width *
- 9 /
- 16 *
- danmakuArea),
- child: DanmakuScreen(
- key: _danmuKey,
- createdController: (DanmakuController e) {
- danmakuController = e;
- playerController.danmakuController = e;
- // debugPrint('弹幕控制器创建成功');
- },
- option: DanmakuOption(
- hideTop: _hideTop,
- hideScroll: _hideScroll,
- hideBottom: _hideBottom,
- opacity: _opacity,
- fontSize: _fontSize,
- duration: _duration.toInt(),
- showStroke: _border,
- massiveMode: _massiveMode,
- ),
- ),
+ ],
+ )),
+ ],
+ )
+ : Container()),
+ // 弹幕面板
+ Positioned(
+ top: 0,
+ left: 0,
+ right: 0,
+ height: videoPageController.androidFullscreen
+ ? MediaQuery.sizeOf(context).height *
+ danmakuArea
+ : (MediaQuery.sizeOf(context).width *
+ 9 /
+ 16 *
+ danmakuArea),
+ child: DanmakuScreen(
+ key: _danmuKey,
+ createdController: (DanmakuController e) {
+ danmakuController = e;
+ playerController.danmakuController = e;
+ // debugPrint('弹幕控制器创建成功');
+ },
+ option: DanmakuOption(
+ hideTop: _hideTop,
+ hideScroll: _hideScroll,
+ hideBottom: _hideBottom,
+ opacity: _opacity,
+ fontSize: _fontSize,
+ duration: _duration.toInt(),
+ showStroke: _border,
+ massiveMode: _massiveMode,
),
+ ),
+ ),
- // 自定义顶部组件
- Positioned(
- top: 0,
- left: 0,
- right: 0,
- child: SlideTransition(
- position: _topOffsetAnimation,
- child: Row(
- children: [
- IconButton(
+ // 自定义顶部组件
+ Positioned(
+ top: 0,
+ left: 0,
+ right: 0,
+ child: SlideTransition(
+ position: _topOffsetAnimation,
+ child: Row(
+ children: [
+ IconButton(
+ color: Colors.white,
+ icon: const Icon(Icons.arrow_back),
+ onPressed: () {
+ onBackPressed(context);
+ },
+ ),
+ // 拖动条
+ const Expanded(
+ child: dtb.DragToMoveArea(
+ child: SizedBox(height: 40)),
+ ),
+ TextButton(
+ style: ButtonStyle(
+ padding: WidgetStateProperty.all(
+ EdgeInsets.zero),
+ ),
+ onPressed: () {
+ // 倍速播放
+ showSetSpeedSheet();
+ },
+ child: Text(
+ '${playerController.playerSpeed}X',
+ style: const TextStyle(
color: Colors.white,
- icon: const Icon(Icons.arrow_back),
- onPressed: () {
- onBackPressed(context);
- },
- ),
- // 拖动条
- const Expanded(
- child: dtb.DragToMoveArea(
- child: SizedBox(height: 40)),
+ fontSize: 12,
),
- TextButton(
- style: ButtonStyle(
- padding: WidgetStateProperty.all(
- EdgeInsets.zero),
- ),
- onPressed: () {
- // 倍速播放
- showSetSpeedSheet();
- },
- child: Text(
- '${playerController.playerSpeed}X',
- style: const TextStyle(
- color: Colors.white,
- fontSize: 12,
+ ),
+ ),
+ IconButton(
+ color: Colors.white,
+ icon: const Icon(Icons.cast),
+ onPressed: () {
+ RemotePlay().castVideo(context);
+ },
+ ),
+ // 追番
+ IconButton(
+ icon: Icon(
+ isFavorite
+ ? Icons.favorite
+ : Icons.favorite_outline,
+ color: Colors.white),
+ onPressed: () async {
+ if (isFavorite) {
+ favoriteController.deleteFavorite(
+ infoController.bangumiItem);
+ SmartDialog.showToast('取消追番成功');
+ } else {
+ favoriteController.addFavorite(
+ infoController.bangumiItem);
+ SmartDialog.showToast('自己追的番要好好看完哦');
+ }
+ setState(() {
+ isFavorite = !isFavorite;
+ });
+ },
+ ),
+ PopupMenuButton(
+ tooltip: '',
+ icon: const Icon(
+ Icons.more_vert,
+ color: Colors.white,
+ ),
+ itemBuilder: (context) {
+ return const [
+ PopupMenuItem(
+ value: 0,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [Text("弹幕设置")],
),
),
- ),
- IconButton(
- color: Colors.white,
- icon: const Icon(Icons.cast),
- onPressed: () {
- RemotePlay().castVideo(context);
- },
- ),
- // 追番
- IconButton(
- icon: Icon(
- isFavorite
- ? Icons.favorite
- : Icons.favorite_outline,
- color: Colors.white),
- onPressed: () async {
- if (isFavorite) {
- favoriteController.deleteFavorite(
- infoController.bangumiItem);
- SmartDialog.showToast('取消追番成功');
- } else {
- favoriteController.addFavorite(
- infoController.bangumiItem);
- SmartDialog.showToast(
- '自己追的番要好好看完哦');
- }
- setState(() {
- isFavorite = !isFavorite;
- });
- },
- ),
- PopupMenuButton(
- tooltip: '',
- icon: const Icon(
- Icons.more_vert,
- color: Colors.white,
+ PopupMenuItem(
+ value: 1,
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [Text("弹幕切换")],
+ ),
),
- itemBuilder: (context) {
- return const [
- PopupMenuItem(
- value: 0,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [Text("弹幕设置")],
- ),
- ),
- PopupMenuItem(
- value: 1,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [Text("弹幕切换")],
- ),
- ),
- ];
- },
- onSelected: (value) {
- if (value == 0) {
- SmartDialog.show(
- useAnimation: false,
- builder: (context) {
+ ];
+ },
+ onSelected: (value) {
+ if (value == 0) {
+ SmartDialog.show(
+ useAnimation: false,
+ builder: (context) {
return SizedBox(
- height: 440,
- child: DanmakuSettingsWindow(danmakuController: danmakuController));
+ height: 440,
+ child: DanmakuSettingsWindow(
+ danmakuController:
+ danmakuController));
});
- }
- if (value == 1) {
- showDanmakuSwitch(type: 'manual');
- }
- },
- )
- ],
- ),
- ),
+ }
+ if (value == 1) {
+ showDanmakuSwitch(type: 'manual');
+ }
+ },
+ )
+ ],
),
- // 自定义播放器底部组件
- Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: SlideTransition(
- position: _bottomOffsetAnimation,
- child: Row(
- children: [
- IconButton(
- color: Colors.white,
- icon: Icon(playerController.playing
- ? Icons.pause
- : Icons.play_arrow),
- onPressed: () {
- if (playerController.playing) {
- playerController.pause();
- } else {
- playerController.play();
- }
- },
- ),
- // 更换选集
- (videoPageController.androidFullscreen ==
- true)
- ? IconButton(
- color: Colors.white,
- icon: const Icon(Icons.skip_next),
- onPressed: () {
- if (videoPageController
- .currentEspisode ==
- videoPageController
- .roadList[
- videoPageController
- .currentRoad]
- .data
- .length) {
- SmartDialog.showToast(
- '已经是最新一集',
- displayType:
- SmartToastType.last);
- return;
- }
- SmartDialog.showToast(
- '正在加载第 ${videoPageController.currentEspisode + 1} 话');
- videoPageController.changeEpisode(
- videoPageController
- .currentEspisode +
- 1,
- currentRoad:
+ ),
+ ),
+ // 自定义播放器底部组件
+ Positioned(
+ bottom: 0,
+ left: 0,
+ right: 0,
+ child: SlideTransition(
+ position: _bottomOffsetAnimation,
+ child: Row(
+ children: [
+ IconButton(
+ color: Colors.white,
+ icon: Icon(playerController.playing
+ ? Icons.pause
+ : Icons.play_arrow),
+ onPressed: () {
+ if (playerController.playing) {
+ playerController.pause();
+ } else {
+ playerController.play();
+ }
+ },
+ ),
+ // 更换选集
+ (videoPageController.androidFullscreen ==
+ true)
+ ? IconButton(
+ color: Colors.white,
+ icon: const Icon(Icons.skip_next),
+ onPressed: () {
+ if (videoPageController
+ .currentEspisode ==
+ videoPageController
+ .roadList[
videoPageController
- .currentRoad);
- },
- )
- : Container(),
- Expanded(
- child: ProgressBar(
- timeLabelLocation:
- TimeLabelLocation.none,
- progress:
- playerController.currentPosition,
- buffered: playerController.buffer,
- total: playerController.duration,
- onSeek: (duration) {
- if (playerTimer != null) {
- playerTimer!.cancel();
+ .currentRoad]
+ .data
+ .length) {
+ SmartDialog.showToast('已经是最新一集',
+ displayType:
+ SmartToastType.last);
+ return;
}
- playerController.currentPosition =
- duration;
- playerController.seek(duration);
- playerTimer =
- getPlayerTimer(); //Bug_time
+ SmartDialog.showToast(
+ '正在加载第 ${videoPageController.currentEspisode + 1} 话');
+ videoPageController.changeEpisode(
+ videoPageController
+ .currentEspisode +
+ 1,
+ currentRoad: videoPageController
+ .currentRoad);
},
- ),
- ),
- ((Utils.isCompact()) &&
- !videoPageController
- .androidFullscreen)
- ? Container()
- : Container(
- padding: const EdgeInsets.only(
- left: 10.0),
- child: Text(
+ )
+ : Container(),
+ Expanded(
+ child: ProgressBar(
+ timeLabelLocation: TimeLabelLocation.none,
+ progress:
+ playerController.currentPosition,
+ buffered: playerController.buffer,
+ total: playerController.duration,
+ onSeek: (duration) {
+ if (playerTimer != null) {
+ playerTimer!.cancel();
+ }
+ playerController.currentPosition =
+ duration;
+ playerController.seek(duration);
+ playerTimer =
+ getPlayerTimer(); //Bug_time
+ },
+ ),
+ ),
+ ((Utils.isCompact()) &&
+ !videoPageController
+ .androidFullscreen)
+ ? Container()
+ : Container(
+ padding:
+ const EdgeInsets.only(left: 10.0),
+ child: Text(
+ Utils.durationToString(
+ playerController
+ .currentPosition) +
+ " / " +
Utils.durationToString(
- playerController
- .currentPosition) +
- " / " +
- Utils.durationToString(
- playerController
- .duration),
- style: TextStyle(
- color: Colors.white,
- fontSize: !Utils.isCompact()
- ? 16.0
- : 12.0,
- ),
- ),
+ playerController.duration),
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: !Utils.isCompact()
+ ? 16.0
+ : 12.0,
),
- // 弹幕相关
- // (playerController.androidFullscreen ==
- // true &&
- // playerController.danmakuOn ==
- // true)
- // ? IconButton(
- // color: Colors.white,
- // icon:
- // const Icon(Icons.notes),
- // onPressed: () {
- // if (playerController
- // .danDanmakus
- // .length ==
- // 0) {
- // SmartDialog.showToast(
- // '当前剧集不支持弹幕发送的说',
- // displayType:
- // SmartToastType
- // .last);
- // return;
- // }
- // showShootDanmakuSheet();
- // },
- // )
- // : Container(),
- IconButton(
- color: Colors.white,
- icon: Icon(playerController.danmakuOn
- ? Icons.comment
- : Icons.comments_disabled),
- onPressed: () {
- _handleDanmaku();
- },
- ),
- IconButton(
- color: Colors.white,
- icon: Icon(videoPageController
- .androidFullscreen
+ ),
+ ),
+ // 弹幕相关
+ // (playerController.androidFullscreen ==
+ // true &&
+ // playerController.danmakuOn ==
+ // true)
+ // ? IconButton(
+ // color: Colors.white,
+ // icon:
+ // const Icon(Icons.notes),
+ // onPressed: () {
+ // if (playerController
+ // .danDanmakus
+ // .length ==
+ // 0) {
+ // SmartDialog.showToast(
+ // '当前剧集不支持弹幕发送的说',
+ // displayType:
+ // SmartToastType
+ // .last);
+ // return;
+ // }
+ // showShootDanmakuSheet();
+ // },
+ // )
+ // : Container(),
+ IconButton(
+ color: Colors.white,
+ icon: Icon(playerController.danmakuOn
+ ? Icons.comment
+ : Icons.comments_disabled),
+ onPressed: () {
+ _handleDanmaku();
+ },
+ ),
+ IconButton(
+ color: Colors.white,
+ icon: Icon(
+ videoPageController.androidFullscreen
? Icons.fullscreen_exit
: Icons.fullscreen),
- onPressed: () {
- _handleFullscreen();
- },
- ),
- ],
+ onPressed: () {
+ _handleFullscreen();
+ },
),
- ),
+ ],
),
- ]),
+ ),
),
- ),
+ ]),
),
),
),
),
),
- )
- // SizedBox(child: Text("${videoController.androidFullscreen}")),
- ;
- }),
- ),
- ),
+ ),
+ ),
+ )
+ // SizedBox(child: Text("${videoController.androidFullscreen}")),
+ ;
+ }),
);
}