feat: 原网页查看专栏

This commit is contained in:
guozhigq
2024-10-03 16:30:47 +08:00
parent 09d8980001
commit 0654f601f4
6 changed files with 37 additions and 18 deletions

View File

@ -39,6 +39,7 @@ class OpusController extends GetxController {
'articleType': 'cv',
});
} else {
title.value = res['data'].detail!.basic!.title!;
opusData.value = res['data'];
}
}
@ -91,6 +92,15 @@ class OpusController extends GetxController {
);
}
// 跳转webview
void onJumpWebview() {
Get.toNamed('/webview', parameters: {
'url': url,
'type': 'webview',
'pageTitle': title.value,
});
}
@override
void onClose() {
scrollController.removeListener(_scrollListener);

View File

@ -60,9 +60,14 @@ class _OpusPageState extends State<OpusPage> {
},
),
actions: [
IconButton(
icon: const Icon(Icons.more_vert_rounded),
onPressed: () {},
PopupMenuButton(
icon: const Icon(Icons.more_vert_outlined),
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
onTap: controller.onJumpWebview,
child: const Text('查看原网页'),
)
],
),
const SizedBox(width: 16),
],

View File

@ -22,6 +22,7 @@ class ReadPageController extends GetxController {
title.value = Get.parameters['title'] ?? '';
id = Get.parameters['id']!;
articleType = Get.parameters['articleType']!;
url = 'https://www.bilibili.com/read/cv$id';
scrollController.addListener(_scrollListener);
fetchViewInfo();
}
@ -85,6 +86,15 @@ class ReadPageController extends GetxController {
ReadHttp.getViewInfo(id: id);
}
// 跳转webview
void onJumpWebview() {
Get.toNamed('/webview', parameters: {
'url': url,
'type': 'webview',
'pageTitle': title.value,
});
}
@override
void onClose() {
scrollController.removeListener(_scrollListener);

View File

@ -72,9 +72,14 @@ class _ReadPageState extends State<ReadPage> {
},
),
actions: [
IconButton(
icon: const Icon(Icons.more_vert_rounded),
onPressed: () {},
PopupMenuButton(
icon: const Icon(Icons.more_vert_outlined),
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
onTap: controller.onJumpWebview,
child: const Text('查看原网页'),
)
],
),
const SizedBox(width: 16),
],

View File

@ -1,19 +1,8 @@
// ignore_for_file: avoid_print
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/init.dart';
import 'package:pilipala/http/user.dart';
import 'package:pilipala/pages/home/index.dart';
import 'package:pilipala/pages/media/index.dart';
import 'package:pilipala/utils/cookie.dart';
import 'package:pilipala/utils/event_bus.dart';
import 'package:pilipala/utils/id_utils.dart';
import 'package:pilipala/utils/login.dart';
import 'package:pilipala/utils/storage.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebviewController extends GetxController {

View File

@ -82,7 +82,7 @@ class PiliSchame {
case 'opus':
if (path.startsWith('/detail')) {
var opusId = path.split('/').last;
Get.toNamed('/opus', arguments: {
Get.toNamed('/opus', parameters: {
'title': '',
'id': opusId,
'articleType': 'opus',