Compare commits

...

7 Commits

Author SHA1 Message Date
dom
0c308a7001 fix text selection patch
Signed-off-by: dom <githubaccount56556@proton.me>
2026-05-16 08:28:41 +08:00
dom
cd82668435 fix #2112
Signed-off-by: dom <githubaccount56556@proton.me>
2026-05-16 08:28:36 +08:00
dom
e142cb6800 add patch link
Signed-off-by: dom <githubaccount56556@proton.me>
2026-05-16 08:28:24 +08:00
dom
200329df4a remove image anim check
Signed-off-by: dom <githubaccount56556@proton.me>
2026-05-16 08:27:58 +08:00
dom
859f14423e image anim patch
Closes #2107

Signed-off-by: dom <githubaccount56556@proton.me>
2026-05-15 19:50:19 +08:00
dom
9d21be1048 improve text selection patch
Closes #2106

Signed-off-by: dom <githubaccount56556@proton.me>
2026-05-15 19:31:08 +08:00
My-Responsitories
d5293fbc72 feat: handle vote uri (#2105) 2026-05-15 18:42:38 +08:00
9 changed files with 152 additions and 31 deletions

View File

@@ -390,9 +390,7 @@ class _ImageState extends State<Image> with WidgetsBindingObserver {
void didChangeDependencies() {
_resolveImage();
_isPaused =
!TickerMode.valuesOf(context).enabled ||
(MediaQuery.maybeDisableAnimationsOf(context) ?? false);
_isPaused = !TickerMode.valuesOf(context).enabled;
if (_isPaused && _frameNumber != null) {
_stopListeningToStream(keepStreamAlive: true);

View File

@@ -375,7 +375,10 @@ abstract final class DynamicsHttp {
queryParameters: {'vote_id': voteId},
);
if (res.data['code'] == 0) {
return Success(VoteInfo.fromSeparatedJson(res.data['data']));
final voteInfo = VoteInfo.fromSeparatedJson(res.data['data']);
return voteInfo.voteId == null
? const Error('无效的投票id')
: Success(voteInfo);
} else {
return Error(res.data['message']);
}

View File

@@ -48,7 +48,7 @@ class _VotePanelState extends State<VotePanel> {
late bool _showPercentage = !_enabled;
late final _maxCnt = _voteInfo.choiceCnt ?? _voteInfo.options.length;
final isLogin = Accounts.main.isLogin;
late final Rxn<List<FolloweeVote>> followeeVote = Rxn<List<FolloweeVote>>();
late final followeeVote = Rxn<List<FolloweeVote>>();
@override
void initState() {
@@ -551,18 +551,15 @@ Future<void> showVoteDialog(
]) async {
final voteInfo = await DynamicsHttp.voteInfo(voteId);
if (context.mounted) {
if (voteInfo.isSuccess) {
if (voteInfo case Success(:final response)) {
showDialog(
context: context,
builder: (context) => Dialog(
constraints: const BoxConstraints(
minWidth: 280,
maxWidth: 625,
),
constraints: const BoxConstraints(minWidth: 280, maxWidth: 625),
child: Padding(
padding: const EdgeInsets.all(24),
padding: const .all(24),
child: VotePanel(
voteInfo: voteInfo.data,
voteInfo: response,
onVote: (votes, anonymous) => DynamicsHttp.doVote(
voteId: voteId,
votes: votes.toList(),

View File

@@ -6,6 +6,7 @@ import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/pair.dart';
import 'package:PiliPlus/common/widgets/sliver/sliver_pinned_header.dart';
import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/common/image_type.dart';
import 'package:PiliPlus/models_new/dynamic/dyn_topic_feed/item.dart';
@@ -315,7 +316,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
return;
}
PageUtils.inAppWebview(
'https://www.bilibili.com/h5/topic-active/topic-report?topic_id=${_controller.topicId}&topic_name=${_controller.topicName}&${ThemeUtils.themeUrl(colorScheme.isDark)}',
'${HttpString.baseUrl}/h5/topic-active/topic-report?topic_id=${_controller.topicId}&topic_name=${_controller.topicName}&${ThemeUtils.themeUrl(colorScheme.isDark)}',
);
},
),

View File

@@ -0,0 +1,13 @@
diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart
index 30429ea5e02..b58f4343440 100644
--- a/packages/flutter/lib/src/widgets/image.dart
+++ b/packages/flutter/lib/src/widgets/image.dart
@@ -1148,7 +1148,7 @@ class _ImageState extends State<Image> with WidgetsBindingObserver {
_updateInvertColors();
_resolveImage();
- _isPaused = !TickerMode.of(context) || (MediaQuery.maybeDisableAnimationsOf(context) ?? false);
+ _isPaused = !TickerMode.of(context);
if (_isPaused && _frameNumber != null) {
_stopListeningToStream(keepStreamAlive: true);

View File

@@ -16,12 +16,18 @@ $BottomSheetAndroidPatch = "lib/scripts/bottom_sheet_android.patch"
$BottomSheetIOSFlutterPatch = "lib/scripts/bottom_sheet_ios_flutter.patch"
$BottomSheetIOSPiliPlusPatch = "lib/scripts/bottom_sheet_ios_piliplus.patch"
# https://github.com/bggRGjQaUbCoE/PiliPlus/issues/1662
$ScrollViewPatch = "lib/scripts/scroll_view.patch"
# https://github.com/bggRGjQaUbCoE/PiliPlus/issues/2106
$TextSelectionPatch = "lib/scripts/text_selection.patch"
# https://github.com/bggRGjQaUbCoE/PiliPlus/issues/1947
$NavigatorPatch = "lib/scripts/navigator.patch"
# https://github.com/bggRGjQaUbCoE/PiliPlus/issues/2107
$ImageAnimPatch = "lib/scripts/image_anim.patch"
# TODO: remove
# https://github.com/flutter/flutter/issues/90223
$ModalBarrierPatch = "lib/scripts/modal_barrier.patch"
@@ -41,7 +47,8 @@ Set-Location $env:FLUTTER_ROOT
$picks = @()
$reverts = @()
$patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch)
$patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch,
$ImageAnimPatch)
switch ($platform.ToLower()) {
"android" {

View File

@@ -1,20 +1,111 @@
diff --git a/packages/flutter/lib/src/gestures/tap_and_drag.dart b/packages/flutter/lib/src/gestures/tap_and_drag.dart
index 2409d19eabd..9460b61c00a 100644
index 2409d19eabd..3d26609d1ce 100644
--- a/packages/flutter/lib/src/gestures/tap_and_drag.dart
+++ b/packages/flutter/lib/src/gestures/tap_and_drag.dart
@@ -1407,6 +1407,7 @@ class TapAndHorizontalDragGestureRecognizer extends BaseTapAndDragGestureRecogni
@@ -1407,6 +1407,9 @@ class TapAndHorizontalDragGestureRecognizer extends BaseTapAndDragGestureRecogni
@override
bool _hasSufficientGlobalDistanceToAccept(PointerDeviceKind pointerDeviceKind) {
+ return false;
+ if (pointerDeviceKind == PointerDeviceKind.touch) {
+ return false;
+ }
return _globalDistanceMoved.abs() > computeHitSlop(pointerDeviceKind, gestureSettings);
}
@@ -1442,6 +1443,7 @@ class TapAndPanGestureRecognizer extends BaseTapAndDragGestureRecognizer {
@override
bool _hasSufficientGlobalDistanceToAccept(PointerDeviceKind pointerDeviceKind) {
+ return true;
return _globalDistanceMoved.abs() > computePanSlop(pointerDeviceKind, gestureSettings);
}
diff --git a/packages/flutter/lib/src/widgets/selectable_region.dart b/packages/flutter/lib/src/widgets/selectable_region.dart
index 59de8bae20b..174a224913b 100644
--- a/packages/flutter/lib/src/widgets/selectable_region.dart
+++ b/packages/flutter/lib/src/widgets/selectable_region.dart
@@ -448,7 +448,7 @@ class SelectableRegionState extends State<SelectableRegion>
void initState() {
super.initState();
_focusNode.addListener(_handleFocusChanged);
- _initMouseGestureRecognizer();
+ // _initMouseGestureRecognizer();
_initTouchGestureRecognizer();
// Right clicks.
_gestureRecognizers[TapGestureRecognizer] =
@@ -682,12 +682,7 @@ class SelectableRegionState extends State<SelectableRegion>
// ancestor Scrollable gestures in common scenarios like a vertically scrolling list view.
_gestureRecognizers[TapAndHorizontalDragGestureRecognizer] =
GestureRecognizerFactoryWithHandlers<TapAndHorizontalDragGestureRecognizer>(
- () => TapAndHorizontalDragGestureRecognizer(
- debugOwner: this,
- supportedDevices: PointerDeviceKind.values.where((PointerDeviceKind device) {
- return device != PointerDeviceKind.mouse;
- }).toSet(),
- ),
+ () => TapAndHorizontalDragGestureRecognizer(debugOwner: this),
(TapAndHorizontalDragGestureRecognizer instance) {
instance
// iOS does not provide a device specific touch slop
diff --git a/packages/flutter/lib/src/widgets/text_selection.dart b/packages/flutter/lib/src/widgets/text_selection.dart
index 6da7274a82f..78dd5d0e7ec 100644
--- a/packages/flutter/lib/src/widgets/text_selection.dart
+++ b/packages/flutter/lib/src/widgets/text_selection.dart
@@ -3693,10 +3693,10 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
if (widget.onDragSelectionStart != null ||
widget.onDragSelectionUpdate != null ||
widget.onDragSelectionEnd != null) {
- switch (defaultTargetPlatform) {
- case TargetPlatform.android:
- case TargetPlatform.fuchsia:
- case TargetPlatform.iOS:
+ // switch (defaultTargetPlatform) {
+ // case TargetPlatform.android:
+ // case TargetPlatform.fuchsia:
+ // case TargetPlatform.iOS:
gestures[TapAndHorizontalDragGestureRecognizer] =
GestureRecognizerFactoryWithHandlers<TapAndHorizontalDragGestureRecognizer>(
() => TapAndHorizontalDragGestureRecognizer(debugOwner: this),
@@ -3716,28 +3716,28 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
..onCancel = _handleTapCancel;
},
);
- case TargetPlatform.linux:
- case TargetPlatform.macOS:
- case TargetPlatform.windows:
- gestures[TapAndPanGestureRecognizer] =
- GestureRecognizerFactoryWithHandlers<TapAndPanGestureRecognizer>(
- () => TapAndPanGestureRecognizer(debugOwner: this),
- (TapAndPanGestureRecognizer instance) {
- instance
- // Text selection should start from the position of the first pointer
- // down event.
- ..dragStartBehavior = DragStartBehavior.down
- ..onTapTrackStart = _handleTapTrackStart
- ..onTapTrackReset = _handleTapTrackReset
- ..onTapDown = _handleTapDown
- ..onDragStart = _handleDragStart
- ..onDragUpdate = _handleDragUpdate
- ..onDragEnd = _handleDragEnd
- ..onTapUp = _handleTapUp
- ..onCancel = _handleTapCancel;
- },
- );
- }
+ // case TargetPlatform.linux:
+ // case TargetPlatform.macOS:
+ // case TargetPlatform.windows:
+ // gestures[TapAndPanGestureRecognizer] =
+ // GestureRecognizerFactoryWithHandlers<TapAndPanGestureRecognizer>(
+ // () => TapAndPanGestureRecognizer(debugOwner: this),
+ // (TapAndPanGestureRecognizer instance) {
+ // instance
+ // // Text selection should start from the position of the first pointer
+ // // down event.
+ // ..dragStartBehavior = DragStartBehavior.down
+ // ..onTapTrackStart = _handleTapTrackStart
+ // ..onTapTrackReset = _handleTapTrackReset
+ // ..onTapDown = _handleTapDown
+ // ..onDragStart = _handleDragStart
+ // ..onDragUpdate = _handleDragUpdate
+ // ..onDragEnd = _handleDragEnd
+ // ..onTapUp = _handleTapUp
+ // ..onCancel = _handleTapCancel;
+ // },
+ // );
+ // }
}
if (widget.onForcePressStart != null || widget.onForcePressEnd != null) {

View File

@@ -7,6 +7,7 @@ import 'package:PiliPlus/http/search.dart';
import 'package:PiliPlus/models/common/fav_type.dart';
import 'package:PiliPlus/models/common/video/source_type.dart';
import 'package:PiliPlus/pages/audio/view.dart';
import 'package:PiliPlus/pages/dynamics/widgets/vote.dart';
import 'package:PiliPlus/pages/fan/view.dart';
import 'package:PiliPlus/pages/follow/view.dart';
import 'package:PiliPlus/pages/follow_type/followed/view.dart';
@@ -478,13 +479,25 @@ abstract final class PiliScheme {
}
final String path = uri.path;
late final queryParameters = uri.queryParameters;
if (host.contains('t.bilibili.com')) {
bool hasMatch = _onPushDynDetail(uri, off);
if (!hasMatch) {
launchURL();
if (_onPushDynDetail(uri, off)) {
return true;
} else if (path.startsWith('/vote')) {
// t.bilibili.com/vote/h5/index?vote_id={{vote_id}}#/result
if (queryParameters['vote_id'] case final voteIdStr?) {
final voteId = int.tryParse(voteIdStr);
if (voteId != null) {
if (Get.context != null) {
showVoteDialog(Get.context!, voteId);
}
return true;
}
}
}
return hasMatch;
launchURL();
return false;
} else if (host.contains('live.bilibili.com')) {
String? roomId = uriDigitRegExp.firstMatch(path)?.group(1);
if (roomId != null) {
@@ -513,8 +526,6 @@ abstract final class PiliScheme {
}
}
late final queryParameters = uri.queryParameters;
// space.bilibili.com/h5/follow?mid={{mid}}&type={{type}}
if (path.startsWith('/h5/follow')) {
final mid = queryParameters['mid'];

View File

@@ -61,7 +61,7 @@ abstract final class AssetUtils {
}
try {
final data = await rootBundle.load(file);
final data = await rootBundle.load('$src/$file');
await targetFile.writeAsBytes(data.buffer.asUint8List());
} catch (_) {}
}