This commit is contained in:
kodjomoustapha 2024-02-24 01:24:35 +01:00
parent fe29eb6ecc
commit 32dbbd5e0e
9 changed files with 623 additions and 603 deletions

View file

@ -921,7 +921,17 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage>
),
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(

View file

@ -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();
}

View file

@ -189,7 +189,17 @@ class _DesktopControllerWidgetState extends State<DesktopControllerWidget> {
const SingleActivator(LogicalKeyboardKey.escape): () =>
setFullScreen(value: false),
},
child: Focus(
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
@ -243,14 +253,6 @@ class _DesktopControllerWidgetState extends State<DesktopControllerWidget> {
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,
@ -327,7 +329,8 @@ class _DesktopControllerWidgetState extends State<DesktopControllerWidget> {
duration: controlsTransitionDuration,
child: Center(
child: seekIndicatorTextWidget(
Duration(seconds: swipeDuration),
Duration(
seconds: swipeDuration),
widget.videoController.player
.state.position))),
),
@ -433,6 +436,8 @@ class _DesktopControllerWidgetState extends State<DesktopControllerWidget> {
),
),
),
],
),
);
}
}

View file

@ -286,7 +286,17 @@ class _MobileControllerWidgetState
@override
Widget build(BuildContext context) {
return Focus(
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,
@ -308,14 +318,6 @@ class _MobileControllerWidgetState
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,
@ -542,7 +544,8 @@ class _MobileControllerWidgetState
child: AnimatedOpacity(
duration: controlsTransitionDuration,
opacity: showSwipeDuration ? 1 : 0,
child: seekIndicatorTextWidget(Duration(seconds: swipeDuration),
child: seekIndicatorTextWidget(
Duration(seconds: swipeDuration),
widget.videoController.player.state.position)),
),
@ -591,10 +594,11 @@ class _MobileControllerWidgetState
value;
result = result.clamp(
Duration.zero,
widget
.videoController.player.state.duration,
widget.videoController.player.state
.duration,
);
widget.videoController.player.seek(result);
widget.videoController.player
.seek(result);
},
skipDuration: skipDuration),
)
@ -640,10 +644,11 @@ class _MobileControllerWidgetState
value;
result = result.clamp(
Duration.zero,
widget
.videoController.player.state.duration,
widget.videoController.player.state
.duration,
);
widget.videoController.player.seek(result);
widget.videoController.player
.seek(result);
},
skipDuration: skipDuration),
)
@ -654,6 +659,8 @@ class _MobileControllerWidgetState
),
],
),
),
],
);
}
}

View file

@ -144,7 +144,7 @@ class ColorSettingWidget extends ConsumerStatefulWidget {
class _ColorSettingWidgetState extends ConsumerState<ColorSettingWidget> {
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<ColorSettingWidget> {
shadowColor: Colors.transparent),
onPressed: () {
setState(() {
selector = text.toLowerCase();
selector = value;
});
},
child: Column(
@ -175,9 +175,7 @@ class _ColorSettingWidgetState extends ConsumerState<ColorSettingWidget> {
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<ColorSettingWidget> {
),
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(

View file

@ -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<ChapterListWidget> {
return DraggableScrollbarWidget(
controller: controller,
child: ListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(vertical: 2),
controller: controller,
itemCount: chapterList.length,

View file

@ -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];

View file

@ -6,7 +6,6 @@
#include "generated_plugin_registrant.h"
#include <desktop_webview_window/desktop_webview_window_plugin.h>
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
#include <media_kit_video/media_kit_video_plugin.h>
@ -16,9 +15,6 @@
#include <window_to_front/window_to_front_plugin.h>
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);

View file

@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
desktop_webview_window
isar_flutter_libs
media_kit_libs_linux
media_kit_video