mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: 消息中心新增浏览器打开,浏览器缩放手势支持
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
@@ -43,7 +45,7 @@ class _WebviewPageState extends State<WebviewPage> {
|
|||||||
icon: Icon(Icons.open_in_browser_outlined,
|
icon: Icon(Icons.open_in_browser_outlined,
|
||||||
color: Theme.of(context).colorScheme.primary),
|
color: Theme.of(context).colorScheme.primary),
|
||||||
),
|
),
|
||||||
if (_webviewController.type.value == 'login')...<Widget>[
|
if (_webviewController.type.value == 'login') ...<Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => _webviewController.confirmLogin(null),
|
onPressed: () => _webviewController.confirmLogin(null),
|
||||||
child: const Text('刷新登录态'),
|
child: const Text('刷新登录态'),
|
||||||
@@ -83,11 +85,30 @@ class _WebviewPageState extends State<WebviewPage> {
|
|||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 12, right: 12, top: 6, bottom: 6),
|
left: 12, right: 12, top: 6, bottom: 6),
|
||||||
child: const Text('如需二维码登录,请点击「电脑版」,放大左侧二维码,截图后官方app或另一设备扫码,授权后点击「刷新登录态」'),
|
child: const Text(
|
||||||
|
'如需二维码登录,请点击「电脑版」,放大左侧二维码,截图后官方app或另一设备扫码,授权后点击「刷新登录态」'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
child: WebViewWidget(controller: _webviewController.controller),
|
child: WebViewWidget(
|
||||||
|
controller: _webviewController.controller,
|
||||||
|
gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{
|
||||||
|
Factory<VerticalDragGestureRecognizer>(
|
||||||
|
() => VerticalDragGestureRecognizer(),
|
||||||
|
),
|
||||||
|
Factory<PanGestureRecognizer>(
|
||||||
|
() => PanGestureRecognizer(),
|
||||||
|
),
|
||||||
|
Factory<ForcePressGestureRecognizer>(
|
||||||
|
() => ForcePressGestureRecognizer(),
|
||||||
|
),
|
||||||
|
Factory<EagerGestureRecognizer>(
|
||||||
|
() => EagerGestureRecognizer(),
|
||||||
|
),
|
||||||
|
Factory<HorizontalDragGestureRecognizer>(
|
||||||
|
() => HorizontalDragGestureRecognizer(),
|
||||||
|
),
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -44,6 +44,21 @@ class _WhisperPageState extends State<WhisperPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('消息'),
|
title: const Text('消息'),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.open_in_browser_outlined,
|
||||||
|
color: Theme.of(context).colorScheme.primary),
|
||||||
|
tooltip: '用浏览器打开',
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed('/webview', parameters: {
|
||||||
|
'url': 'https://message.bilibili.com',
|
||||||
|
'type': 'whisper',
|
||||||
|
'pageTitle': '消息中心',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: RefreshIndicator(
|
body: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
@@ -104,7 +119,8 @@ class _WhisperPageState extends State<WhisperPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (!_whisperController.msgFeedTop[idx]['enabled']) {
|
if (!_whisperController.msgFeedTop[idx]
|
||||||
|
['enabled']) {
|
||||||
SmartDialog.showToast('已禁用');
|
SmartDialog.showToast('已禁用');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user