From 32dbbd5e0e57b8ba85942116e77447bca67a8f9d Mon Sep 17 00:00:00 2001 From: kodjomoustapha <107993382+kodjodevf@users.noreply.github.com> Date: Sat, 24 Feb 2024 01:24:35 +0100 Subject: [PATCH] fix --- lib/modules/anime/anime_player_view.dart | 12 +- .../anime/providers/state_provider.dart | 2 +- lib/modules/anime/widgets/desktop.dart | 471 ++++++------ lib/modules/anime/widgets/mobile.dart | 705 +++++++++--------- .../widgets/subtitle_setting_widget.dart | 17 +- .../widgets/btn_chapter_list_dialog.dart | 10 +- .../appearance/appearance_screen.dart | 4 +- linux/flutter/generated_plugin_registrant.cc | 4 - linux/flutter/generated_plugins.cmake | 1 - 9 files changed, 623 insertions(+), 603 deletions(-) diff --git a/lib/modules/anime/anime_player_view.dart b/lib/modules/anime/anime_player_view.dart index a3aa636..d3ade9e 100644 --- a/lib/modules/anime/anime_player_view.dart +++ b/lib/modules/anime/anime_player_view.dart @@ -921,7 +921,17 @@ class _AnimeStreamPageState extends riv.ConsumerState ), Row(children: [ btnToShowChapterListDialog( - context, context.l10n.episodes, widget.episode), + context, + context.l10n.episodes, + widget.episode, + onChanged: (v) { + if (v) { + _player.play(); + } else { + _player.pause(); + } + }, + ), // IconButton( // onPressed: () { // showDialog( diff --git a/lib/modules/anime/providers/state_provider.dart b/lib/modules/anime/providers/state_provider.dart index 7506221..2972868 100644 --- a/lib/modules/anime/providers/state_provider.dart +++ b/lib/modules/anime/providers/state_provider.dart @@ -8,7 +8,7 @@ class SubtitleSettingsState extends _$SubtitleSettingsState { @override PlayerSubtitleSettings build() { final subSets = isar.settings.getSync(227)!.playerSubtitleSettings; - if (subSets == null) { + if (subSets == null || subSets.backgroundColorA == null) { set(PlayerSubtitleSettings(), true); return PlayerSubtitleSettings(); } diff --git a/lib/modules/anime/widgets/desktop.dart b/lib/modules/anime/widgets/desktop.dart index 2c98a25..ea70fad 100644 --- a/lib/modules/anime/widgets/desktop.dart +++ b/lib/modules/anime/widgets/desktop.dart @@ -189,249 +189,254 @@ class _DesktopControllerWidgetState extends State { const SingleActivator(LogicalKeyboardKey.escape): () => setFullScreen(value: false), }, - child: Focus( - autofocus: true, - child: Listener( - onPointerSignal: modifyVolumeOnScroll - ? (e) { - if (e is PointerScrollEvent) { - if (e.delta.dy > 0) { - final volume = - widget.videoController.player.state.volume - 5.0; - widget.videoController.player - .setVolume(volume.clamp(0.0, 100.0)); - } - if (e.delta.dy < 0) { - final volume = - widget.videoController.player.state.volume + 5.0; - widget.videoController.player - .setVolume(volume.clamp(0.0, 100.0)); - } - } - } - : null, - child: GestureDetector( - onTapUp: !toggleFullscreenOnDoublePress - ? null - : (e) { - final now = DateTime.now(); - final difference = now.difference(last); - last = now; - if (difference < const Duration(milliseconds: 400)) { - setFullScreen(); - } - }, - onPanUpdate: modifyVolumeOnScroll - ? (e) { - if (e.delta.dy > 0) { - final volume = - widget.videoController.player.state.volume - 5.0; - widget.videoController.player - .setVolume(volume.clamp(0.0, 100.0)); - } - if (e.delta.dy < 0) { - final volume = - widget.videoController.player.state.volume + 5.0; - widget.videoController.player - .setVolume(volume.clamp(0.0, 100.0)); - } - } - : null, - child: MouseRegion( - onHover: (_) => onHover(), - onEnter: (_) => onEnter(), - onExit: (_) => onExit(), - child: Stack( - children: [ - Consumer( - builder: (context, ref, _) => Positioned( - child: CustomSubtitleView( - controller: widget.videoController, - configuration: SubtitleViewConfiguration( - style: subtileTextStyle(ref)), - )), - ), - AnimatedOpacity( - curve: Curves.easeInOut, - opacity: visible ? 1.0 : 0.0, - duration: controlsTransitionDuration, - onEnd: () { - if (!visible) { - setState(() { - mount = false; - }); + child: Stack( + children: [ + Consumer( + builder: (context, ref, _) => Positioned( + child: CustomSubtitleView( + controller: widget.videoController, + configuration: + SubtitleViewConfiguration(style: subtileTextStyle(ref)), + )), + ), + Focus( + autofocus: true, + child: Listener( + onPointerSignal: modifyVolumeOnScroll + ? (e) { + if (e is PointerScrollEvent) { + if (e.delta.dy > 0) { + final volume = + widget.videoController.player.state.volume - 5.0; + widget.videoController.player + .setVolume(volume.clamp(0.0, 100.0)); + } + if (e.delta.dy < 0) { + final volume = + widget.videoController.player.state.volume + 5.0; + widget.videoController.player + .setVolume(volume.clamp(0.0, 100.0)); + } } - }, - child: Stack( - clipBehavior: Clip.none, - alignment: Alignment.bottomCenter, - children: [ - // Top gradient. + } + : null, + child: GestureDetector( + onTapUp: !toggleFullscreenOnDoublePress + ? null + : (e) { + final now = DateTime.now(); + final difference = now.difference(last); + last = now; + if (difference < const Duration(milliseconds: 400)) { + setFullScreen(); + } + }, + onPanUpdate: modifyVolumeOnScroll + ? (e) { + if (e.delta.dy > 0) { + final volume = + widget.videoController.player.state.volume - 5.0; + widget.videoController.player + .setVolume(volume.clamp(0.0, 100.0)); + } + if (e.delta.dy < 0) { + final volume = + widget.videoController.player.state.volume + 5.0; + widget.videoController.player + .setVolume(volume.clamp(0.0, 100.0)); + } + } + : null, + child: MouseRegion( + onHover: (_) => onHover(), + onEnter: (_) => onEnter(), + onExit: (_) => onExit(), + child: Stack( + children: [ + AnimatedOpacity( + curve: Curves.easeInOut, + opacity: visible ? 1.0 : 0.0, + duration: controlsTransitionDuration, + onEnd: () { + if (!visible) { + setState(() { + mount = false; + }); + } + }, + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.bottomCenter, + children: [ + // Top gradient. - Container( - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - stops: [ - 0.0, - 0.2, - ], - colors: [ - Color(0x61000000), - Color(0x00000000), - ], - ), - ), - ), - // Bottom gradient. - - Container( - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - stops: [ - 0.5, - 1.0, - ], - colors: [ - Color(0x00000000), - Color(0x61000000), - ], - ), - ), - ), - if (mount) - Padding( - padding: ( - // Add padding in fullscreen! - isFullscreen(context) - ? MediaQuery.of(context).padding - : EdgeInsets.zero), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - widget.topButtonBarWidget, - // Only display [primaryButtonBar] if [buffering] is false. - Expanded( - child: AnimatedOpacity( - curve: Curves.easeInOut, - opacity: buffering - ? 0.0 - : !showSwipeDuration - ? 0.0 - : 1.0, - duration: controlsTransitionDuration, - child: Center( - child: seekIndicatorTextWidget( - Duration(seconds: swipeDuration), - widget.videoController.player - .state.position))), - ), - widget.seekToWidget, - Transform.translate( - offset: Offset.zero, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 5), - child: CustomSeekBar( - onSeekStart: (value) { - setState(() { - swipeDuration = value.inSeconds; - showSwipeDuration = true; - widget.tempDuration(widget - .videoController - .player - .state - .position + - value); - }); - _timer?.cancel(); - }, - onSeekEnd: (value) { - _timer = Timer( - controlsHoverDuration, - () { - if (mounted) { - setState(() { - visible = false; - }); - } - }, - ); - setState(() { - showSwipeDuration = false; - }); - widget.tempDuration(null); - }, - player: widget.videoController.player, - ), - ), - ), - widget.bottomButtonBarWidget - ], - ), - ), - ], - ), - ), - // Buffering Indicator. - IgnorePointer( - child: Padding( - padding: ( - // Add padding in fullscreen! - isFullscreen(context) - ? MediaQuery.of(context).padding - : EdgeInsets.zero), - child: Column( - children: [ - Container( - height: buttonBarHeight, - margin: const EdgeInsets.all(0), - ), - Expanded( - child: Center( - child: Center( - child: TweenAnimationBuilder( - tween: Tween( - begin: 0.0, - end: buffering ? 1.0 : 0.0, - ), - duration: controlsTransitionDuration, - builder: (context, value, child) { - // Only mount the buffering indicator if the opacity is greater than 0.0. - // This has been done to prevent redundant resource usage in [CircularProgressIndicator]. - if (value > 0.0) { - return Opacity( - opacity: value, - child: child!, - ); - } - return const SizedBox.shrink(); - }, - child: const CircularProgressIndicator( - color: Color(0xFFFFFFFF), - ), + Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + stops: [ + 0.0, + 0.2, + ], + colors: [ + Color(0x61000000), + Color(0x00000000), + ], ), ), ), - ), - Container( - height: buttonBarHeight, - margin: bottomButtonBarMargin, - ), - ], + // Bottom gradient. + + Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + stops: [ + 0.5, + 1.0, + ], + colors: [ + Color(0x00000000), + Color(0x61000000), + ], + ), + ), + ), + if (mount) + Padding( + padding: ( + // Add padding in fullscreen! + isFullscreen(context) + ? MediaQuery.of(context).padding + : EdgeInsets.zero), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + widget.topButtonBarWidget, + // Only display [primaryButtonBar] if [buffering] is false. + Expanded( + child: AnimatedOpacity( + curve: Curves.easeInOut, + opacity: buffering + ? 0.0 + : !showSwipeDuration + ? 0.0 + : 1.0, + duration: controlsTransitionDuration, + child: Center( + child: seekIndicatorTextWidget( + Duration( + seconds: swipeDuration), + widget.videoController.player + .state.position))), + ), + widget.seekToWidget, + Transform.translate( + offset: Offset.zero, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 5), + child: CustomSeekBar( + onSeekStart: (value) { + setState(() { + swipeDuration = value.inSeconds; + showSwipeDuration = true; + widget.tempDuration(widget + .videoController + .player + .state + .position + + value); + }); + _timer?.cancel(); + }, + onSeekEnd: (value) { + _timer = Timer( + controlsHoverDuration, + () { + if (mounted) { + setState(() { + visible = false; + }); + } + }, + ); + setState(() { + showSwipeDuration = false; + }); + widget.tempDuration(null); + }, + player: widget.videoController.player, + ), + ), + ), + widget.bottomButtonBarWidget + ], + ), + ), + ], + ), ), - ), + // Buffering Indicator. + IgnorePointer( + child: Padding( + padding: ( + // Add padding in fullscreen! + isFullscreen(context) + ? MediaQuery.of(context).padding + : EdgeInsets.zero), + child: Column( + children: [ + Container( + height: buttonBarHeight, + margin: const EdgeInsets.all(0), + ), + Expanded( + child: Center( + child: Center( + child: TweenAnimationBuilder( + tween: Tween( + begin: 0.0, + end: buffering ? 1.0 : 0.0, + ), + duration: controlsTransitionDuration, + builder: (context, value, child) { + // Only mount the buffering indicator if the opacity is greater than 0.0. + // This has been done to prevent redundant resource usage in [CircularProgressIndicator]. + if (value > 0.0) { + return Opacity( + opacity: value, + child: child!, + ); + } + return const SizedBox.shrink(); + }, + child: const CircularProgressIndicator( + color: Color(0xFFFFFFFF), + ), + ), + ), + ), + ), + Container( + height: buttonBarHeight, + margin: bottomButtonBarMargin, + ), + ], + ), + ), + ), + ], ), - ], + ), ), ), ), - ), + ], ), ); } diff --git a/lib/modules/anime/widgets/mobile.dart b/lib/modules/anime/widgets/mobile.dart index 0292c82..55512c6 100644 --- a/lib/modules/anime/widgets/mobile.dart +++ b/lib/modules/anime/widgets/mobile.dart @@ -286,374 +286,381 @@ class _MobileControllerWidgetState @override Widget build(BuildContext context) { - return Focus( - autofocus: true, - child: Stack( - clipBehavior: Clip.none, - alignment: Alignment.center, - children: [ - // // Controls: - AnimatedOpacity( - curve: Curves.easeInOut, - opacity: visible ? 1.0 : 0.0, - duration: controlsTransitionDuration, - onEnd: () { - setState(() { - if (!visible) { - mount = false; - } - }); - }, - child: Stack( - clipBehavior: Clip.none, - alignment: Alignment.center, - children: [ - Consumer( - builder: (context, ref, _) => Positioned( - child: CustomSubtitleView( - controller: widget.videoController, - configuration: - SubtitleViewConfiguration(style: subtileTextStyle(ref)), - )), - ), - Positioned.fill( - child: Container( - color: backdropColor, - ), - ), - // We are adding 16.0 boundary around the actual controls (which contain the vertical drag gesture detectors). - // This will make the hit-test on edges (e.g. swiping to: show status-bar, show navigation-bar, go back in navigation) not activate the swipe gesture annoyingly. - Positioned.fill( - left: 16.0, - top: 16.0, - right: 16.0, - bottom: 16.0, - child: GestureDetector( - onTap: onTap, - onDoubleTapDown: _handleTapDown, - onDoubleTap: () { - if (_tapPosition != null && - _tapPosition!.dx > - MediaQuery.of(context).size.width / 2) { - onDoubleTapSeekForward(); - } else { - onDoubleTapSeekBackward(); - } - }, - onHorizontalDragUpdate: (details) { - onHorizontalDragUpdate(details); - }, - onHorizontalDragEnd: (details) { - onHorizontalDragEnd(); - }, - onVerticalDragUpdate: (e) async { - final delta = e.delta.dy; - final Offset position = e.localPosition; - - if (position.dx <= - MediaQuery.of(context).size.width / 2) { - // Left side of screen swiped - - final brightness = _brightnessValue.value - - delta / verticalGestureSensitivity; - final result = brightness.clamp(0.0, 1.0); - setBrightness(result); - } else { - // Right side of screen swiped - - final volume = _volumeValue.value - - delta / verticalGestureSensitivity; - final result = volume.clamp(0.0, 1.0); - setVolume(result); - } - }, - child: Container( - color: const Color(0x00000000), + return Stack( + children: [ + Consumer( + builder: (context, ref, _) => Positioned( + child: CustomSubtitleView( + controller: widget.videoController, + configuration: + SubtitleViewConfiguration(style: subtileTextStyle(ref)), + )), + ), + Focus( + autofocus: true, + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.center, + children: [ + // // Controls: + AnimatedOpacity( + curve: Curves.easeInOut, + opacity: visible ? 1.0 : 0.0, + duration: controlsTransitionDuration, + onEnd: () { + setState(() { + if (!visible) { + mount = false; + } + }); + }, + child: Stack( + clipBehavior: Clip.none, + alignment: Alignment.center, + children: [ + Positioned.fill( + child: Container( + color: backdropColor, + ), ), - ), - ), - if (mount) - Padding( - padding: ( - // Add padding in fullscreen! - isFullscreen(context) - ? MediaQuery.of(context).padding - : EdgeInsets.zero), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - widget.topButtonBarWidget, - // Only display [primaryButtonBar] if [buffering] is false. - Expanded( - child: AnimatedOpacity( - curve: Curves.easeInOut, - opacity: buffering - ? 0.0 - : showSwipeDuration - ? 0.0 - : 1.0, - duration: controlsTransitionDuration, - child: Center( - child: Row( - children: mobilePrimaryButtonBar( - context, - widget.videoStatekey, - widget.streamController, - widget.videoController)), - ), - ), + // We are adding 16.0 boundary around the actual controls (which contain the vertical drag gesture detectors). + // This will make the hit-test on edges (e.g. swiping to: show status-bar, show navigation-bar, go back in navigation) not activate the swipe gesture annoyingly. + Positioned.fill( + left: 16.0, + top: 16.0, + right: 16.0, + bottom: 16.0, + child: GestureDetector( + onTap: onTap, + onDoubleTapDown: _handleTapDown, + onDoubleTap: () { + if (_tapPosition != null && + _tapPosition!.dx > + MediaQuery.of(context).size.width / 2) { + onDoubleTapSeekForward(); + } else { + onDoubleTapSeekBackward(); + } + }, + onHorizontalDragUpdate: (details) { + onHorizontalDragUpdate(details); + }, + onHorizontalDragEnd: (details) { + onHorizontalDragEnd(); + }, + onVerticalDragUpdate: (e) async { + final delta = e.delta.dy; + final Offset position = e.localPosition; + + if (position.dx <= + MediaQuery.of(context).size.width / 2) { + // Left side of screen swiped + + final brightness = _brightnessValue.value - + delta / verticalGestureSensitivity; + final result = brightness.clamp(0.0, 1.0); + setBrightness(result); + } else { + // Right side of screen swiped + + final volume = _volumeValue.value - + delta / verticalGestureSensitivity; + final result = volume.clamp(0.0, 1.0); + setVolume(result); + } + }, + child: Container( + color: const Color(0x00000000), ), - Stack( - alignment: Alignment.bottomCenter, + ), + ), + if (mount) + Padding( + padding: ( + // Add padding in fullscreen! + isFullscreen(context) + ? MediaQuery.of(context).padding + : EdgeInsets.zero), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ - Padding( - padding: const EdgeInsets.only(bottom: 10), - child: CustomSeekBar( - onSeekStart: (value) { - setState(() { - swipeDuration = value.inSeconds; - showSwipeDuration = true; - }); - _timer?.cancel(); - }, - onSeekEnd: (value) { - _timer = Timer( - controlsHoverDuration, - () { - if (mounted) { - setState(() { - visible = false; - }); - } - }, - ); - setState(() { - showSwipeDuration = false; - }); - }, - player: widget.videoController.player, + widget.topButtonBarWidget, + // Only display [primaryButtonBar] if [buffering] is false. + Expanded( + child: AnimatedOpacity( + curve: Curves.easeInOut, + opacity: buffering + ? 0.0 + : showSwipeDuration + ? 0.0 + : 1.0, + duration: controlsTransitionDuration, + child: Center( + child: Row( + children: mobilePrimaryButtonBar( + context, + widget.videoStatekey, + widget.streamController, + widget.videoController)), + ), ), ), - widget.bottomButtonBarWidget + Stack( + alignment: Alignment.bottomCenter, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 10), + child: CustomSeekBar( + onSeekStart: (value) { + setState(() { + swipeDuration = value.inSeconds; + showSwipeDuration = true; + }); + _timer?.cancel(); + }, + onSeekEnd: (value) { + _timer = Timer( + controlsHoverDuration, + () { + if (mounted) { + setState(() { + visible = false; + }); + } + }, + ); + setState(() { + showSwipeDuration = false; + }); + }, + player: widget.videoController.player, + ), + ), + widget.bottomButtonBarWidget + ], + ), ], ), - ], - ), - ), - ], - ), - ), - // // Double-Tap Seek Seek-Bar: - if (!mount) - if (_mountSeekBackwardButton || - _mountSeekForwardButton || - showSwipeDuration) - Column( - children: [ - const Spacer(), - Stack( - alignment: Alignment.bottomCenter, + ), + ], + ), + ), + // // Double-Tap Seek Seek-Bar: + if (!mount) + if (_mountSeekBackwardButton || + _mountSeekForwardButton || + showSwipeDuration) + Column( children: [ - Padding( - padding: const EdgeInsets.only(bottom: 10), - child: CustomSeekBar( - delta: _seekBarDeltaValueNotifier, - player: widget.videoController.player), + const Spacer(), + Stack( + alignment: Alignment.bottomCenter, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 10), + child: CustomSeekBar( + delta: _seekBarDeltaValueNotifier, + player: widget.videoController.player), + ), + ], ), ], ), - ], - ), - // // Buffering Indicator. - IgnorePointer( - child: Padding( - padding: ( - // Add padding in fullscreen! - isFullscreen(context) - ? MediaQuery.of(context).padding - : EdgeInsets.zero), - child: Column( - children: [ - Container( - height: buttonBarHeight, - margin: const EdgeInsets.all(0), - ), - Expanded( - child: Center( - child: TweenAnimationBuilder( - tween: Tween( - begin: 0.0, - end: buffering ? 1.0 : 0.0, - ), - duration: controlsTransitionDuration, - builder: (context, value, child) { - // Only mount the buffering indicator if the opacity is greater than 0.0. - // This has been done to prevent redundant resource usage in [CircularProgressIndicator]. - if (value > 0.0) { - return Opacity( - opacity: value, - child: child!, - ); - } - return const SizedBox.shrink(); - }, - child: const CircularProgressIndicator( - color: Color(0xFFFFFFFF), + // // Buffering Indicator. + IgnorePointer( + child: Padding( + padding: ( + // Add padding in fullscreen! + isFullscreen(context) + ? MediaQuery.of(context).padding + : EdgeInsets.zero), + child: Column( + children: [ + Container( + height: buttonBarHeight, + margin: const EdgeInsets.all(0), + ), + Expanded( + child: Center( + child: TweenAnimationBuilder( + tween: Tween( + begin: 0.0, + end: buffering ? 1.0 : 0.0, + ), + duration: controlsTransitionDuration, + builder: (context, value, child) { + // Only mount the buffering indicator if the opacity is greater than 0.0. + // This has been done to prevent redundant resource usage in [CircularProgressIndicator]. + if (value > 0.0) { + return Opacity( + opacity: value, + child: child!, + ); + } + return const SizedBox.shrink(); + }, + child: const CircularProgressIndicator( + color: Color(0xFFFFFFFF), + ), + ), ), ), - ), + Container( + height: buttonBarHeight, + margin: bottomButtonBarMargin, + ), + ], ), - Container( - height: buttonBarHeight, - margin: bottomButtonBarMargin, - ), - ], + ), + ), + // // Volume Indicator. + IgnorePointer( + child: ValueListenableBuilder( + valueListenable: _volumeIndicator, + builder: (context, value, child) => AnimatedOpacity( + curve: Curves.easeInOut, + opacity: value ? 1.0 : 0.0, + duration: controlsTransitionDuration, + child: MediaIndicatorBuilder( + value: _volumeValue, isVolumeIndicator: true)), + ), + ), + // // Brightness Indicator. + IgnorePointer( + child: ValueListenableBuilder( + valueListenable: _brightnessIndicator, + builder: (context, value, child) => AnimatedOpacity( + curve: Curves.easeInOut, + opacity: value ? 1.0 : 0.0, + duration: controlsTransitionDuration, + child: MediaIndicatorBuilder( + value: _brightnessValue, isVolumeIndicator: false)), + ), + ), + // Seek Indicator. + IgnorePointer( + child: AnimatedOpacity( + duration: controlsTransitionDuration, + opacity: showSwipeDuration ? 1 : 0, + child: seekIndicatorTextWidget( + Duration(seconds: swipeDuration), + widget.videoController.player.state.position)), ), - ), - ), - // // Volume Indicator. - IgnorePointer( - child: ValueListenableBuilder( - valueListenable: _volumeIndicator, - builder: (context, value, child) => AnimatedOpacity( - curve: Curves.easeInOut, - opacity: value ? 1.0 : 0.0, - duration: controlsTransitionDuration, - child: MediaIndicatorBuilder( - value: _volumeValue, isVolumeIndicator: true)), - ), - ), - // // Brightness Indicator. - IgnorePointer( - child: ValueListenableBuilder( - valueListenable: _brightnessIndicator, - builder: (context, value, child) => AnimatedOpacity( - curve: Curves.easeInOut, - opacity: value ? 1.0 : 0.0, - duration: controlsTransitionDuration, - child: MediaIndicatorBuilder( - value: _brightnessValue, isVolumeIndicator: false)), - ), - ), - // Seek Indicator. - IgnorePointer( - child: AnimatedOpacity( - duration: controlsTransitionDuration, - opacity: showSwipeDuration ? 1 : 0, - child: seekIndicatorTextWidget(Duration(seconds: swipeDuration), - widget.videoController.player.state.position)), - ), - // Double-Tap Seek Button(s): - if (_mountSeekBackwardButton || _mountSeekForwardButton) - Positioned.fill( - child: Row( - children: [ - Expanded( - child: _mountSeekBackwardButton - ? TweenAnimationBuilder( - tween: Tween( - begin: 0.0, - end: _hideSeekBackwardButton ? 0.0 : 1.0, - ), - duration: const Duration(milliseconds: 200), - builder: (context, value, child) => Opacity( - opacity: value, - child: child, - ), - onEnd: () { - if (_hideSeekBackwardButton) { - setState(() { - _hideSeekBackwardButton = false; - _mountSeekBackwardButton = false; - }); - } - }, - child: _BackwardSeekIndicator( - onChanged: (value) { - setState(() { - _seekBarDeltaValueNotifier = widget - .videoController - .player - .state - .position - - value; - }); + // Double-Tap Seek Button(s): + if (_mountSeekBackwardButton || _mountSeekForwardButton) + Positioned.fill( + child: Row( + children: [ + Expanded( + child: _mountSeekBackwardButton + ? TweenAnimationBuilder( + tween: Tween( + begin: 0.0, + end: _hideSeekBackwardButton ? 0.0 : 1.0, + ), + duration: const Duration(milliseconds: 200), + builder: (context, value, child) => Opacity( + opacity: value, + child: child, + ), + onEnd: () { + if (_hideSeekBackwardButton) { + setState(() { + _hideSeekBackwardButton = false; + _mountSeekBackwardButton = false; + }); + } }, - onSubmitted: (value) { - setState(() { - _hideSeekBackwardButton = true; - }); - var result = widget.videoController.player - .state.position - - value; - result = result.clamp( - Duration.zero, - widget - .videoController.player.state.duration, - ); - widget.videoController.player.seek(result); + child: _BackwardSeekIndicator( + onChanged: (value) { + setState(() { + _seekBarDeltaValueNotifier = widget + .videoController + .player + .state + .position - + value; + }); + }, + onSubmitted: (value) { + setState(() { + _hideSeekBackwardButton = true; + }); + var result = widget.videoController.player + .state.position - + value; + result = result.clamp( + Duration.zero, + widget.videoController.player.state + .duration, + ); + widget.videoController.player + .seek(result); + }, + skipDuration: skipDuration), + ) + : const SizedBox(), + ), + Expanded( + child: _mountSeekForwardButton + ? TweenAnimationBuilder( + tween: Tween( + begin: 0.0, + end: _hideSeekForwardButton ? 0.0 : 1.0, + ), + duration: const Duration(milliseconds: 200), + builder: (context, value, child) => Opacity( + opacity: value, + child: child, + ), + onEnd: () { + if (_hideSeekForwardButton) { + setState(() { + _hideSeekForwardButton = false; + _mountSeekForwardButton = false; + }); + } }, - skipDuration: skipDuration), - ) - : const SizedBox(), + child: _ForwardSeekIndicator( + onChanged: (value) { + setState(() { + _seekBarDeltaValueNotifier = widget + .videoController + .player + .state + .position + + value; + }); + }, + onSubmitted: (value) { + setState(() { + _hideSeekForwardButton = true; + }); + var result = widget.videoController.player + .state.position + + value; + result = result.clamp( + Duration.zero, + widget.videoController.player.state + .duration, + ); + widget.videoController.player + .seek(result); + }, + skipDuration: skipDuration), + ) + : const SizedBox(), + ), + ], ), - Expanded( - child: _mountSeekForwardButton - ? TweenAnimationBuilder( - tween: Tween( - begin: 0.0, - end: _hideSeekForwardButton ? 0.0 : 1.0, - ), - duration: const Duration(milliseconds: 200), - builder: (context, value, child) => Opacity( - opacity: value, - child: child, - ), - onEnd: () { - if (_hideSeekForwardButton) { - setState(() { - _hideSeekForwardButton = false; - _mountSeekForwardButton = false; - }); - } - }, - child: _ForwardSeekIndicator( - onChanged: (value) { - setState(() { - _seekBarDeltaValueNotifier = widget - .videoController - .player - .state - .position + - value; - }); - }, - onSubmitted: (value) { - setState(() { - _hideSeekForwardButton = true; - }); - var result = widget.videoController.player - .state.position + - value; - result = result.clamp( - Duration.zero, - widget - .videoController.player.state.duration, - ); - widget.videoController.player.seek(result); - }, - skipDuration: skipDuration), - ) - : const SizedBox(), - ), - ], - ), - ), - ], - ), + ), + ], + ), + ), + ], ); } } diff --git a/lib/modules/anime/widgets/subtitle_setting_widget.dart b/lib/modules/anime/widgets/subtitle_setting_widget.dart index 0816209..971f0cb 100644 --- a/lib/modules/anime/widgets/subtitle_setting_widget.dart +++ b/lib/modules/anime/widgets/subtitle_setting_widget.dart @@ -144,7 +144,7 @@ class ColorSettingWidget extends ConsumerStatefulWidget { class _ColorSettingWidgetState extends ConsumerState { String selector = "text"; - Widget button(String text, Color color) { + Widget button(String text, String value, Color color) { return ElevatedButton( style: ElevatedButton.styleFrom( padding: const EdgeInsets.all(0), @@ -154,7 +154,7 @@ class _ColorSettingWidgetState extends ConsumerState { shadowColor: Colors.transparent), onPressed: () { setState(() { - selector = text.toLowerCase(); + selector = value; }); }, child: Column( @@ -175,9 +175,7 @@ class _ColorSettingWidgetState extends ConsumerState { Text("#${color.hexCode}", style: TextStyle(color: context.textColor)), Icon( Icons.arrow_drop_down, - color: selector != text.toLowerCase() - ? Colors.transparent - : context.textColor, + color: selector != value ? Colors.transparent : context.textColor, ) ], ), @@ -218,12 +216,15 @@ class _ColorSettingWidgetState extends ConsumerState { ), Row( children: [ - Expanded(flex: 3, child: button(context.l10n.text, textColor)), Expanded( - flex: 3, child: button(context.l10n.border, borderColor)), + flex: 3, child: button(context.l10n.text, "text", textColor)), Expanded( flex: 3, - child: button(context.l10n.background, backgroundColor)), + child: button(context.l10n.border, "border", borderColor)), + Expanded( + flex: 3, + child: button( + context.l10n.background, "backgroud", backgroundColor)), ], ), Padding( diff --git a/lib/modules/manga/reader/widgets/btn_chapter_list_dialog.dart b/lib/modules/manga/reader/widgets/btn_chapter_list_dialog.dart index e428616..4451c1f 100644 --- a/lib/modules/manga/reader/widgets/btn_chapter_list_dialog.dart +++ b/lib/modules/manga/reader/widgets/btn_chapter_list_dialog.dart @@ -9,10 +9,12 @@ import 'package:mangayomi/utils/date.dart'; import 'package:mangayomi/utils/extensions/build_context_extensions.dart'; Widget btnToShowChapterListDialog( - BuildContext context, String title, Chapter chapter) { + BuildContext context, String title, Chapter chapter, + {void Function(bool)? onChanged}) { return IconButton( - onPressed: () { - showDialog( + onPressed: () async { + onChanged?.call(false); + await showDialog( context: context, builder: (context) { return AlertDialog( @@ -22,6 +24,7 @@ Widget btnToShowChapterListDialog( child: ChapterListWidget(chapter: chapter)), ); }); + onChanged?.call(true); }, icon: const Icon(Icons.format_list_numbered_outlined)); } @@ -60,7 +63,6 @@ class _ChapterListWidgetState extends State { return DraggableScrollbarWidget( controller: controller, child: ListView.builder( - shrinkWrap: true, padding: const EdgeInsets.symmetric(vertical: 2), controller: controller, itemCount: chapterList.length, diff --git a/lib/modules/more/settings/appearance/appearance_screen.dart b/lib/modules/more/settings/appearance/appearance_screen.dart index 4506150..2b09b26 100644 --- a/lib/modules/more/settings/appearance/appearance_screen.dart +++ b/lib/modules/more/settings/appearance/appearance_screen.dart @@ -166,7 +166,8 @@ class AppearanceScreen extends ConsumerWidget { child: Column( children: [ Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.symmetric( + vertical: 12, horizontal: 8), child: TextField( onChanged: (v) { setState(() { @@ -209,7 +210,6 @@ class AppearanceScreen extends ConsumerWidget { controller: controller, child: ListView.builder( controller: controller, - shrinkWrap: true, itemCount: values.length, itemBuilder: (context, index) { final value = values[index]; diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index a905fd7..fbe6f0c 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,7 +6,6 @@ #include "generated_plugin_registrant.h" -#include #include #include #include @@ -16,9 +15,6 @@ #include void fl_register_plugins(FlPluginRegistry* registry) { - g_autoptr(FlPluginRegistrar) desktop_webview_window_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewWindowPlugin"); - desktop_webview_window_plugin_register_with_registrar(desktop_webview_window_registrar); g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin"); isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index c593ce3..a66b3d8 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - desktop_webview_window isar_flutter_libs media_kit_libs_linux media_kit_video