Skip to content

Commit

Permalink
Merge pull request #143 from miru-project/fix/comic-image-scaling
Browse files Browse the repository at this point in the history
fix: comic image scaling
  • Loading branch information
appdevelpo authored Dec 13, 2023
2 parents 107a073 + 8bb091d commit 798e8d1
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 383 deletions.
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

0 comments on commit 798e8d1

Please sign in to comment.