mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-05 09:37:52 +08:00
ios bottom sheet patch
related #1906 Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
87
lib/scripts/bottom_sheet_ios_flutter.patch
Normal file
87
lib/scripts/bottom_sheet_ios_flutter.patch
Normal file
@@ -0,0 +1,87 @@
|
||||
diff --git a/packages/flutter/lib/src/cupertino/route.dart b/packages/flutter/lib/src/cupertino/route.dart
|
||||
index 5ce4479480e..0e6387596c5 100644
|
||||
--- a/packages/flutter/lib/src/cupertino/route.dart
|
||||
+++ b/packages/flutter/lib/src/cupertino/route.dart
|
||||
@@ -883,7 +883,7 @@ class _CupertinoBackGestureController<T> {
|
||||
} else {
|
||||
if (isCurrent) {
|
||||
// This route is destined to pop at this point. Reuse navigator's pop.
|
||||
- navigator.pop();
|
||||
+ navigator.pop(gesturePop);
|
||||
}
|
||||
|
||||
// The popping may have finished inline if already at the target destination.
|
||||
diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart
|
||||
index d121d10f1d6..92fa155c168 100644
|
||||
--- a/packages/flutter/lib/src/material/scaffold.dart
|
||||
+++ b/packages/flutter/lib/src/material/scaffold.dart
|
||||
@@ -2521,6 +2521,7 @@ class ScaffoldState extends State<Scaffold>
|
||||
final LocalHistoryEntry? entry = isPersistent
|
||||
? null
|
||||
: LocalHistoryEntry(
|
||||
+ popGestureEnabled: true,
|
||||
onRemove: () {
|
||||
if (!removedEntry && _currentBottomSheet?._widget == bottomSheet && !doingDispose) {
|
||||
removeCurrentBottomSheet();
|
||||
diff --git a/packages/flutter/lib/src/widgets/routes.dart b/packages/flutter/lib/src/widgets/routes.dart
|
||||
index 5c4a8982617..d3fa530e250 100644
|
||||
--- a/packages/flutter/lib/src/widgets/routes.dart
|
||||
+++ b/packages/flutter/lib/src/widgets/routes.dart
|
||||
@@ -709,7 +709,11 @@ class LocalHistoryEntry {
|
||||
/// Creates an entry in the history of a [LocalHistoryRoute].
|
||||
///
|
||||
/// The [impliesAppBarDismissal] defaults to true if not provided.
|
||||
- LocalHistoryEntry({this.onRemove, this.impliesAppBarDismissal = true});
|
||||
+ LocalHistoryEntry({
|
||||
+ this.onRemove,
|
||||
+ this.impliesAppBarDismissal = true,
|
||||
+ this.popGestureEnabled = false,
|
||||
+ });
|
||||
|
||||
/// Called when this entry is removed from the history of its associated [LocalHistoryRoute].
|
||||
final VoidCallback? onRemove;
|
||||
@@ -722,6 +726,8 @@ class LocalHistoryEntry {
|
||||
/// Defaults to true.
|
||||
final bool impliesAppBarDismissal;
|
||||
|
||||
+ final bool popGestureEnabled;
|
||||
+
|
||||
/// Remove this entry from the history of its associated [LocalHistoryRoute].
|
||||
void remove() {
|
||||
_owner?.removeLocalHistoryEntry(this);
|
||||
@@ -949,6 +955,14 @@ mixin LocalHistoryRoute<T> on Route<T> {
|
||||
@override
|
||||
bool didPop(T? result) {
|
||||
if (_localHistory != null && _localHistory!.isNotEmpty) {
|
||||
+ if (result == gesturePop) {
|
||||
+ for (var e in _localHistory!) {
|
||||
+ e._owner = null;
|
||||
+ }
|
||||
+ _localHistory!.clear();
|
||||
+ _localHistory = null;
|
||||
+ return super.didPop(result);
|
||||
+ }
|
||||
final LocalHistoryEntry entry = _localHistory!.removeLast();
|
||||
assert(entry._owner == this);
|
||||
entry._owner = null;
|
||||
@@ -968,7 +982,9 @@ mixin LocalHistoryRoute<T> on Route<T> {
|
||||
|
||||
@override
|
||||
bool get willHandlePopInternally {
|
||||
- return _localHistory != null && _localHistory!.isNotEmpty;
|
||||
+ return _localHistory != null &&
|
||||
+ _localHistory!.isNotEmpty &&
|
||||
+ !_localHistory!.last.popGestureEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2839,3 +2855,9 @@ abstract class PopEntry<T> {
|
||||
return 'PopEntry canPop: ${canPopNotifier.value}, onPopInvoked: $onPopInvokedWithResult';
|
||||
}
|
||||
}
|
||||
+
|
||||
+class _GesturePop {
|
||||
+ const _GesturePop();
|
||||
+}
|
||||
+
|
||||
+const Object gesturePop = _GesturePop();
|
||||
17
lib/scripts/bottom_sheet_ios_piliplus.patch
Normal file
17
lib/scripts/bottom_sheet_ios_piliplus.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
diff --git a/lib/pages/common/slide/common_slide_page.dart b/lib/pages/common/slide/common_slide_page.dart
|
||||
index 58ba68b7c..e17449ee1 100644
|
||||
--- a/lib/pages/common/slide/common_slide_page.dart
|
||||
+++ b/lib/pages/common/slide/common_slide_page.dart
|
||||
@@ -142,6 +142,12 @@ class SlideDragGestureRecognizer extends HorizontalDragGestureRecognizer {
|
||||
bool isPointerAllowed(PointerEvent event) {
|
||||
return isDxAllowed(event.localPosition.dx) && super.isPointerAllowed(event);
|
||||
}
|
||||
+
|
||||
+ @override
|
||||
+ void addAllowedPointer(PointerDownEvent event) {
|
||||
+ super.addAllowedPointer(event);
|
||||
+ resolve(.accepted);
|
||||
+ }
|
||||
}
|
||||
|
||||
class TabBarDragGestureRecognizer
|
||||
@@ -10,7 +10,11 @@ $ToolTipFix = "56956c33ef102ac0b5fc46b62bd2dd9f50a86616";
|
||||
# https://github.com/flutter/flutter/issues/182281
|
||||
$NewOverScrollIndicator = "362b1de29974ffc1ed6faa826e1df870d7bec75f";
|
||||
|
||||
$BottomSheetPatch = "lib/scripts/bottom_sheet.patch"
|
||||
$BottomSheetAndroidPatch = "lib/scripts/bottom_sheet_android.patch"
|
||||
|
||||
# https://github.com/bggRGjQaUbCoE/PiliPlus/issues/1906
|
||||
$BottomSheetIOSFlutterPatch = "lib/scripts/bottom_sheet_ios_flutter.patch"
|
||||
$BottomSheetIOSPiliPlusPatch = "lib/scripts/bottom_sheet_ios_piliplus.patch"
|
||||
|
||||
$ScrollViewPatch = "lib/scripts/scroll_view.patch"
|
||||
|
||||
@@ -24,6 +28,13 @@ $ModalBarrierPatch = "lib/scripts/modal_barrier.patch"
|
||||
# https://github.com/flutter/flutter/issues/182466
|
||||
$MouseCursorPatch = "lib/scripts/mouse_cursor.patch"
|
||||
|
||||
if ($platform.ToLower() -eq "ios") {
|
||||
git apply $BottomSheetIOSPiliPlusPatch
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "$BottomSheetIOSPiliPlusPatch applied"
|
||||
}
|
||||
}
|
||||
|
||||
Set-Location $env:FLUTTER_ROOT
|
||||
|
||||
$picks = @()
|
||||
@@ -33,11 +44,12 @@ $patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch)
|
||||
switch ($platform.ToLower()) {
|
||||
"android" {
|
||||
$reverts += $NewOverScrollIndicator
|
||||
$patches += $BottomSheetPatch
|
||||
$patches += $BottomSheetAndroidPatch
|
||||
$patches += $ScrollViewPatch
|
||||
}
|
||||
"ios" {
|
||||
$patches += $ScrollViewPatch
|
||||
$patches += $BottomSheetIOSFlutterPatch
|
||||
}
|
||||
"linux" {
|
||||
$picks += $ToolTipFix
|
||||
|
||||
Reference in New Issue
Block a user