Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: comic image scaling #143

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/controllers/watch/comic_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class ComicController extends ReaderController<ExtensionMangaWatch> {
}

// 下一页
@override
void nextPage() {
if (readType.value != MangaReadMode.webTonn) {
pageController.value.nextPage(
Expand All @@ -124,6 +125,7 @@ class ComicController extends ReaderController<ExtensionMangaWatch> {
}

// 上一页
@override
void previousPage() {
if (readType.value != MangaReadMode.webTonn) {
pageController.value.previousPage(
Expand Down
8 changes: 5 additions & 3 deletions lib/controllers/watch/reader_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ class ReaderController<T> extends GetxController {
try {
error.value = '';
watchData.value = null;
watchData.value = await runtime.watch(
cuurentPlayUrl,
) as T;
watchData.value = await runtime.watch(cuurentPlayUrl) as T;
} catch (e) {
error.value = e.toString();
}
}

void previousPage() {}

void nextPage() {}

showControlPanel() {
isShowControlPanel.value = true;
_timer?.cancel();
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ class LayoutUtils {
static bool? _isTablet;

// 获取当前宽度
static double get getWidth {
static double get width {
return MediaQuery.of(currentContext).size.width;
}

// 获取当前高度
static double get getHeight {
static double get height {
return MediaQuery.of(currentContext).size.height;
}

// 是否是平板
static bool get isTablet {
return _isTablet ??= getWidth > 800;
return _isTablet ??= width > 800;
}
}
22 changes: 7 additions & 15 deletions lib/views/pages/watch/reader/comic/comic_reader.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import 'dart:io';

import 'package:fluent_ui/fluent_ui.dart';
import 'package:get/get.dart';
import 'package:miru_app/models/extension.dart';
import 'package:miru_app/views/pages/watch/reader/comic/comic_reader_content.dart';
import 'package:miru_app/views/pages/watch/reader/comic/comic_reader_settings.dart';
import 'package:miru_app/controllers/watch/comic_controller.dart';
import 'package:miru_app/views/widgets/platform_widget.dart';
// import 'package:miru_app/views/pages/watch/reader/comic/comic_zoom.dart';
import 'package:miru_app/views/widgets/watch/comic_view.dart';
import 'package:miru_app/data/services/extension_service.dart';
import 'package:miru_app/views/widgets/watch/reader_view.dart';
import 'package:window_manager/window_manager.dart';

class ComicReader extends StatefulWidget {
Expand Down Expand Up @@ -61,20 +60,13 @@ class _ComicReaderState extends State<ComicReader> {

@override
Widget build(BuildContext context) {
if (Platform.isAndroid) {
return ReaderView<ComicController>(
widget.title,
content: Center(
child: ComicReaderContent(widget.title),
),
buildSettings: (context) => ComicReaderSettings(widget.title),
);
}
return ReaderView<ComicController>(
widget.title,
content: DragToMoveArea(
child: ComicReaderContent(widget.title),
),
content: PlatformWidget(
androidWidget: ComicReaderContent(widget.title),
desktopWidget: DragToMoveArea(
child: ComicReaderContent(widget.title),
)),
buildSettings: (context) => ComicReaderSettings(widget.title),
);
}
Expand Down
Loading