Skip to content

Commit

Permalink
Disable drawer swipe gesture on iOS
Browse files Browse the repository at this point in the history
Since iOS "bounces" when it gets to the end of a list, it felt very weird
  • Loading branch information
jmshrv committed Sep 17, 2024
1 parent 60e722f commit 7da719a
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 26 deletions.
20 changes: 19 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
PODS:
- app_set_id (1.2.0):
- Flutter
- audio_service (0.0.1):
- Flutter
- audio_session (0.0.1):
- Flutter
- background_downloader (0.0.1):
- Flutter
- battery_plus (1.0.0):
- Flutter
- CropViewController (2.6.1)
- device_info_plus (0.0.1):
- Flutter
Expand Down Expand Up @@ -91,11 +95,15 @@ PODS:
- SwiftyGif (5.4.4)
- url_launcher_ios (0.0.1):
- Flutter
- wakelock_plus (0.0.1):
- Flutter

DEPENDENCIES:
- app_set_id (from `.symlinks/plugins/app_set_id/ios`)
- audio_service (from `.symlinks/plugins/audio_service/ios`)
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- background_downloader (from `.symlinks/plugins/background_downloader/ios`)
- battery_plus (from `.symlinks/plugins/battery_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- DKImagePickerController (= 4.3.4)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
Expand All @@ -110,6 +118,7 @@ DEPENDENCIES:
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)

SPEC REPOS:
trunk:
Expand All @@ -123,12 +132,16 @@ SPEC REPOS:
- SwiftyGif

EXTERNAL SOURCES:
app_set_id:
:path: ".symlinks/plugins/app_set_id/ios"
audio_service:
:path: ".symlinks/plugins/audio_service/ios"
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
background_downloader:
:path: ".symlinks/plugins/background_downloader/ios"
battery_plus:
:path: ".symlinks/plugins/battery_plus/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
file_picker:
Expand All @@ -155,11 +168,15 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"

SPEC CHECKSUMS:
app_set_id: a4d12ebbc7915f987b4a04983b4c0104c64d5e02
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
background_downloader: 9f788ffc5de45acf87d6380e91ca0841066c18cf
battery_plus: 1ff2e16ba75af2a78387f65476057a390b47885e
CropViewController: 58fb440f30dac788b129d2a1f24cffdcb102669c
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
DKCamera: a902b66921fca14b7a75266feb8c7568aa7caa71
Expand All @@ -181,7 +198,8 @@ SPEC CHECKSUMS:
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1

PODFILE CHECKSUM: 047c0919aa274fcdf0ce568f883473a4587eda02

COCOAPODS: 1.13.0
COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit
import Flutter

@UIApplicationMain
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
Expand Down
50 changes: 28 additions & 22 deletions lib/screens/music_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -318,29 +318,35 @@ class _MusicScreenState extends ConsumerState<MusicScreen>
child: getFloatingActionButton(sortedTabs.toList()),
),
body: Builder(builder: (context) {
return TransparentRightSwipeDetector(
action: () {
if (_tabController?.index == 0 &&
!FinampSettingsHelper.finampSettings.disableGesture) {
Scaffold.of(context).openDrawer();
}
},
child: TabBarView(
controller: _tabController,
physics: FinampSettingsHelper.finampSettings.disableGesture
? const NeverScrollableScrollPhysics()
: const AlwaysScrollableScrollPhysics(),
dragStartBehavior: DragStartBehavior.down,
children: sortedTabs
.map((tabType) => MusicScreenTabView(
tabContentType: tabType,
searchTerm: searchQuery,
view: _finampUserHelper.currentUser?.currentView,
refresh: refreshMap[tabType],
))
.toList(),
),
final child = TabBarView(
controller: _tabController,
physics: FinampSettingsHelper.finampSettings.disableGesture
? const NeverScrollableScrollPhysics()
: const AlwaysScrollableScrollPhysics(),
dragStartBehavior: DragStartBehavior.down,
children: sortedTabs
.map((tabType) => MusicScreenTabView(
tabContentType: tabType,
searchTerm: searchQuery,
view: _finampUserHelper.currentUser?.currentView,
refresh: refreshMap[tabType],
))
.toList(),
);

if (Platform.isAndroid) {
return TransparentRightSwipeDetector(
action: () {
if (_tabController?.index == 0 &&
!FinampSettingsHelper.finampSettings.disableGesture) {
Scaffold.of(context).openDrawer();
}
},
child: child,
);
}

return child;
}),
),
);
Expand Down
26 changes: 25 additions & 1 deletion macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
PODS:
- app_set_id (1.2.0):
- FlutterMacOS
- audio_service (0.14.1):
- FlutterMacOS
- audio_session (0.0.1):
- FlutterMacOS
- battery_plus (0.0.1):
- FlutterMacOS
- device_info_plus (0.0.1):
- FlutterMacOS
- FlutterMacOS (1.0.0)
Expand All @@ -22,12 +26,18 @@ PODS:
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
- wakelock_plus (0.0.1):
- FlutterMacOS
- window_manager (0.2.0):
- FlutterMacOS

DEPENDENCIES:
- app_set_id (from `Flutter/ephemeral/.symlinks/plugins/app_set_id/macos`)
- audio_service (from `Flutter/ephemeral/.symlinks/plugins/audio_service/macos`)
- audio_session (from `Flutter/ephemeral/.symlinks/plugins/audio_session/macos`)
- battery_plus (from `Flutter/ephemeral/.symlinks/plugins/battery_plus/macos`)
- device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- isar_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/isar_flutter_libs/macos`)
Expand All @@ -37,13 +47,19 @@ DEPENDENCIES:
- screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`)
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)

EXTERNAL SOURCES:
app_set_id:
:path: Flutter/ephemeral/.symlinks/plugins/app_set_id/macos
audio_service:
:path: Flutter/ephemeral/.symlinks/plugins/audio_service/macos
audio_session:
:path: Flutter/ephemeral/.symlinks/plugins/audio_session/macos
battery_plus:
:path: Flutter/ephemeral/.symlinks/plugins/battery_plus/macos
device_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos
FlutterMacOS:
Expand All @@ -62,12 +78,18 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
wakelock_plus:
:path: Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos
window_manager:
:path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos

SPEC CHECKSUMS:
app_set_id: a356c3d63b33bb53ee5c22ca6508fed8bfbd682e
audio_service: b88ff778e0e3915efd4cd1a5ad6f0beef0c950a9
audio_session: dea1f41890dbf1718f04a56f1d6150fd50039b72
battery_plus: 922e3d9686072259c8fbce6c4238561f769990ae
device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
isar_flutter_libs: 43385c99864c168fadba7c9adeddc5d38838ca6a
Expand All @@ -77,8 +99,10 @@ SPEC CHECKSUMS:
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269
window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.13.0
COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Cocoa
import FlutterMacOS

@NSApplicationMain
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
Expand Down

0 comments on commit 7da719a

Please sign in to comment.