├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── doc └── media │ ├── improved_scrolling_example.gif │ └── logo.png ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ ├── example │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── flutter_improved_scrolling_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── main.dart │ └── scrollable_page.dart ├── pubspec.lock ├── pubspec.yaml └── web │ ├── favicon.png │ ├── icons │ ├── Icon-192.png │ └── Icon-512.png │ ├── index.html │ └── manifest.json ├── lib ├── flutter_improved_scrolling.dart └── src │ ├── config.dart │ ├── custom_scroll_cursor.dart │ ├── improved_scrolling_widget.dart │ └── throttler.dart ├── pubspec.lock └── pubspec.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/ephemeral 64 | **/ios/Flutter/app.flx 65 | **/ios/Flutter/app.zip 66 | **/ios/Flutter/flutter_assets/ 67 | **/ios/Flutter/flutter_export_environment.sh 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Exceptions to above rules. 72 | !**/ios/**/default.mode1v3 73 | !**/ios/**/default.mode2v3 74 | !**/ios/**/default.pbxuser 75 | !**/ios/**/default.perspectivev3 76 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.3 2 | 3 | - Added one throttler for each mouse wheel scrolling direction for being able to throttle independently 4 | 5 | ## 0.0.2 6 | 7 | - Added throttling for mouse wheel scroll events when using custom mouse wheel scrolling as an attempt to make the wheel scrolling smooth 8 | 9 | - Specify in the example app that it is also possible to use HOME and END keys for keyboard scrolling 10 | 11 | ## 0.0.1 12 | 13 | - Initial release. 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Adrian Flutur 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | improved_scrolling 3 |

4 | 5 | [![pub package](https://shields.io/pub/v/flutter_improved_scrolling.svg?style=flat-square&color=blue)](https://pub.dev/packages/flutter_improved_scrolling) 6 | 7 | ### An attempt to implement better scrolling for Flutter Web and Desktop. 8 | 9 | ### Includes keyboard, MButton and custom mouse wheel scrolling. 10 | 11 |
12 | 13 | ## _**Getting started**_ 14 | 15 | - [Example](#example) 16 | - [Usage and features](#usage-and-features) 17 | - [License](#license) 18 | 19 |
20 | 21 | ## _**Example**_ 22 | 23 |
24 | 25 | 26 | 27 |

28 | 29 | ## _**Usage and features**_ 30 | 31 | (from the [example app](https://github.com/adrianflutur/flutter_improved_scrolling/tree/main/example/lib/scrollable_page.dart)) 32 | 33 | ```dart 34 | final controller = ScrollController(); 35 | 36 | ... 37 | 38 | ImprovedScrolling( 39 | scrollController: controller, 40 | onScroll: (scrollOffset) => debugPrint( 41 | 'Scroll offset: $scrollOffset', 42 | ), 43 | onMMBScrollStateChanged: (scrolling) => debugPrint( 44 | 'Is scrolling: $scrolling', 45 | ), 46 | onMMBScrollCursorPositionUpdate: (localCursorOffset, scrollActivity) => debugPrint( 47 | 'Cursor position: $localCursorOffset\n' 48 | 'Scroll activity: $scrollActivity', 49 | ), 50 | enableMMBScrolling: true, 51 | enableKeyboardScrolling: true, 52 | enableCustomMouseWheelScrolling: true, 53 | mmbScrollConfig: MMBScrollConfig( 54 | customScrollCursor: useSystemCursor ? null : const DefaultCustomScrollCursor(), 55 | ), 56 | keyboardScrollConfig: KeyboardScrollConfig( 57 | arrowsScrollAmount: 250.0, 58 | homeScrollDurationBuilder: (currentScrollOffset, minScrollOffset) { 59 | return const Duration(milliseconds: 100); 60 | }, 61 | endScrollDurationBuilder: (currentScrollOffset, maxScrollOffset) { 62 | return const Duration(milliseconds: 2000); 63 | }, 64 | ), 65 | customMouseWheelScrollConfig: const CustomMouseWheelScrollConfig( 66 | scrollAmountMultiplier: 2.0, 67 | ), 68 | child: ScrollConfiguration( 69 | behavior: const CustomScrollBehaviour(), 70 | child: GridView( 71 | controller: controller, 72 | physics: const NeverScrollableScrollPhysics(), 73 | scrollDirection: axis, 74 | padding: const EdgeInsets.all(24.0), 75 | gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( 76 | maxCrossAxisExtent: 400.0, 77 | mainAxisExtent: 400.0, 78 | ), 79 | children: buildScrollableItemList(axis), 80 | ), 81 | ), 82 | ); 83 | ``` 84 | 85 |
86 | 87 | ### Requirements 88 | 89 | - The `ImprovedScrolling` Widget must be added as a parent of your scrollable Widget (`List/Grid/SingleChildScrollView/etc`). 90 | - You must create and provide the same scroll controller to both the `ImprovedScrolling` Widget and your scrollable Widget. 91 | 92 | * _Optional_: If you want to programatically scroll when rotating the mouse wheel and not let the framework manage the scrolling, you can set `physics: NeverScrollableScrollPhysics()` to your scrollable and then set `enableCustomMouseWheelScrolling: true` on `ImprovedScrolling` to enable this feature. 93 | 94 |
95 | 96 | ### Features: 97 | 98 | - #### Scrolling using the keyboard (Arrows, Page{Up, Down}, Spacebar, Home, End) 99 | 100 | > You need to set `enableKeyboardScrolling: true` and then you can configure the scrolling amount, duration and curve by using `keyboardScrollConfig: KeyboardScrollConfig(...)` 101 | 102 | - #### Scrolling using the middle mouse button ("auto-scrolling") 103 | 104 | > You need to set `enableMMBScrolling: true` and then you can configure the scrolling delay, velocity, acceleration and cursor appearance and size by using `mmbScrollConfig: MMBScrollConfig(...)` 105 | >
106 | > 107 | > There is also a `DefaultCustomScrollCursor` class which is a default custom cursor implementation 108 | 109 | - #### Programatically scroll using the mouse wheel 110 | 111 | > You need to set `enableCustomMouseWheelScrolling: true` and then you can configure the scrolling speed, duration, curve and throttling time by using `customMouseWheelScrollConfig: CustomMouseWheelScrollConfig(...)` 112 | 113 | - #### Horizontal scrolling using Left/Right arrows or Shift + mouse wheel 114 | 115 | > Requires `enableKeyboardScrolling: true` and `enableCustomMouseWheelScrolling: true` to be set. 116 | 117 |
118 | 119 | ### Callbacks: 120 | 121 | #### Other than the above features, there are also a few callbacks available on the `ImprovedScrolling` Widget: 122 | 123 |
124 | 125 | ```dart 126 | // Triggers whenever the ScrollController scrolls, no matter how or why 127 | onScroll: (double scrollOffset) => debugPrint( 128 | 'Scroll offset: $scrollOffset', 129 | ), 130 | 131 | // Triggers whenever the middle mouse button scrolling feature is activated or deactivated 132 | onMMBScrollStateChanged: (bool scrolling) => debugPrint( 133 | 'Is scrolling: $scrolling', 134 | ), 135 | 136 | // Triggers whenever the cursor is moved on the scrollable area, while the 137 | // middle mouse button feature is active and is scrolling 138 | // 139 | // We also get the current scroll activity (idle or moving up/down/left/right) 140 | // at the time the cursor moves 141 | onMMBScrollCursorPositionUpdate: ( 142 | Offset localCursorOffset, 143 | MMBScrollCursorActivity scrollActivity, 144 | ) => debugPrint( 145 | 'Cursor position: $localCursorOffset\n' 146 | 'Scroll activity: $scrollActivity', 147 | ), 148 | ``` 149 | 150 | ## _**License**_ 151 | 152 | [MIT](https://github.com/adrianflutur/flutter_improved_scrolling/blob/main/LICENSE) 153 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lint/analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | # ------ Disable individual rules ----- # 6 | # --- # 7 | # Turn off what you don't like. # 8 | # ------------------------------------- # 9 | 10 | # Use parameter order as in json response 11 | always_put_required_named_parameters_first: false 12 | 13 | # Util classes are awesome! 14 | avoid_classes_with_only_static_members: false 15 | 16 | avoid_positional_boolean_parameters: false 17 | 18 | use_setters_to_change_properties: false 19 | 20 | # ------ Enable individual rules ------ # 21 | # --- # 22 | # These rules here are good but too # 23 | # opinionated to enable them by default # 24 | # ------------------------------------- # 25 | 26 | # Make constructors the first thing in every class 27 | sort_constructors_first: true 28 | 29 | # The new tabs vs. spaces. Choose wisely 30 | prefer_single_quotes: true 31 | 32 | # Good packages document everything 33 | public_member_api_docs: true 34 | -------------------------------------------------------------------------------- /doc/media/improved_scrolling_example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/doc/media/improved_scrolling_example.gif -------------------------------------------------------------------------------- /doc/media/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/doc/media/logo.png -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_improved_scrolling_example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lint/analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | # ------ Disable individual rules ----- # 6 | # --- # 7 | # Turn off what you don't like. # 8 | # ------------------------------------- # 9 | 10 | # Use parameter order as in json response 11 | always_put_required_named_parameters_first: false 12 | 13 | # Util classes are awesome! 14 | avoid_classes_with_only_static_members: false 15 | 16 | # ------ Enable individual rules ------ # 17 | # --- # 18 | # These rules here are good but too # 19 | # opinionated to enable them by default # 20 | # ------------------------------------- # 21 | 22 | # Make constructors the first thing in every class 23 | sort_constructors_first: true 24 | 25 | # The new tabs vs. spaces. Choose wisely 26 | prefer_single_quotes: true 27 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 30 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | defaultConfig { 36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 37 | applicationId "com.example.flutter_improved_scrolling_example" 38 | minSdkVersion 16 39 | targetSdkVersion 30 40 | versionCode flutterVersionCode.toInteger() 41 | versionName flutterVersionName 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 59 | } 60 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/flutter_improved_scrolling_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_improved_scrolling_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/ephemeral/ 22 | Flutter/app.flx 23 | Flutter/app.zip 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1020; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterImprovedScrollingExample; 295 | PRODUCT_NAME = "$(TARGET_NAME)"; 296 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 297 | SWIFT_VERSION = 5.0; 298 | VERSIONING_SYSTEM = "apple-generic"; 299 | }; 300 | name = Profile; 301 | }; 302 | 97C147031CF9000F007C117D /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = dwarf; 333 | ENABLE_STRICT_OBJC_MSGSEND = YES; 334 | ENABLE_TESTABILITY = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_OPTIMIZATION_LEVEL = 0; 339 | GCC_PREPROCESSOR_DEFINITIONS = ( 340 | "DEBUG=1", 341 | "$(inherited)", 342 | ); 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | TARGETED_DEVICE_FAMILY = "1,2"; 354 | }; 355 | name = Debug; 356 | }; 357 | 97C147041CF9000F007C117D /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_ANALYZER_NONNULL = YES; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 367 | CLANG_WARN_BOOL_CONVERSION = YES; 368 | CLANG_WARN_COMMA = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 372 | CLANG_WARN_EMPTY_BODY = YES; 373 | CLANG_WARN_ENUM_CONVERSION = YES; 374 | CLANG_WARN_INFINITE_RECURSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 377 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 378 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 381 | CLANG_WARN_STRICT_PROTOTYPES = YES; 382 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | ENABLE_NS_ASSERTIONS = NO; 389 | ENABLE_STRICT_OBJC_MSGSEND = YES; 390 | GCC_C_LANGUAGE_STANDARD = gnu99; 391 | GCC_NO_COMMON_BLOCKS = YES; 392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 394 | GCC_WARN_UNDECLARED_SELECTOR = YES; 395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 396 | GCC_WARN_UNUSED_FUNCTION = YES; 397 | GCC_WARN_UNUSED_VARIABLE = YES; 398 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 399 | MTL_ENABLE_DEBUG_INFO = NO; 400 | SDKROOT = iphoneos; 401 | SUPPORTED_PLATFORMS = iphoneos; 402 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 403 | TARGETED_DEVICE_FAMILY = "1,2"; 404 | VALIDATE_PRODUCT = YES; 405 | }; 406 | name = Release; 407 | }; 408 | 97C147061CF9000F007C117D /* Debug */ = { 409 | isa = XCBuildConfiguration; 410 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | CLANG_ENABLE_MODULES = YES; 414 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 415 | ENABLE_BITCODE = NO; 416 | INFOPLIST_FILE = Runner/Info.plist; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterImprovedScrollingExample; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 421 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 422 | SWIFT_VERSION = 5.0; 423 | VERSIONING_SYSTEM = "apple-generic"; 424 | }; 425 | name = Debug; 426 | }; 427 | 97C147071CF9000F007C117D /* Release */ = { 428 | isa = XCBuildConfiguration; 429 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | CLANG_ENABLE_MODULES = YES; 433 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 434 | ENABLE_BITCODE = NO; 435 | INFOPLIST_FILE = Runner/Info.plist; 436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 437 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterImprovedScrollingExample; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 440 | SWIFT_VERSION = 5.0; 441 | VERSIONING_SYSTEM = "apple-generic"; 442 | }; 443 | name = Release; 444 | }; 445 | /* End XCBuildConfiguration section */ 446 | 447 | /* Begin XCConfigurationList section */ 448 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 449 | isa = XCConfigurationList; 450 | buildConfigurations = ( 451 | 97C147031CF9000F007C117D /* Debug */, 452 | 97C147041CF9000F007C117D /* Release */, 453 | 249021D3217E4FDB00AE95B9 /* Profile */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147061CF9000F007C117D /* Debug */, 462 | 97C147071CF9000F007C117D /* Release */, 463 | 249021D4217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | /* End XCConfigurationList section */ 469 | }; 470 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 471 | } 472 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_improved_scrolling_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'scrollable_page.dart'; 3 | 4 | void main() { 5 | runApp(const MyApp()); 6 | } 7 | 8 | class MyApp extends StatelessWidget { 9 | const MyApp({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | title: 'middle_click_scroll_example', 15 | theme: ThemeData( 16 | primarySwatch: Colors.blue, 17 | ), 18 | debugShowCheckedModeBanner: false, 19 | home: const ScrollablePage(), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /example/lib/scrollable_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_improved_scrolling/flutter_improved_scrolling.dart'; 4 | 5 | class CustomScrollBehaviour extends MaterialScrollBehavior { 6 | const CustomScrollBehaviour(); 7 | 8 | @override 9 | Widget buildScrollbar( 10 | BuildContext context, 11 | Widget child, 12 | ScrollableDetails details, 13 | ) { 14 | switch (getPlatform(context)) { 15 | case TargetPlatform.linux: 16 | case TargetPlatform.macOS: 17 | return Scrollbar( 18 | controller: details.controller, 19 | isAlwaysShown: true, 20 | child: child, 21 | ); 22 | case TargetPlatform.windows: 23 | return Scrollbar( 24 | controller: details.controller, 25 | isAlwaysShown: true, 26 | radius: Radius.zero, 27 | thickness: 16.0, 28 | hoverThickness: 16.0, 29 | showTrackOnHover: true, 30 | child: child, 31 | ); 32 | case TargetPlatform.android: 33 | case TargetPlatform.fuchsia: 34 | case TargetPlatform.iOS: 35 | return child; 36 | } 37 | } 38 | } 39 | 40 | class ScrollablePage extends StatefulWidget { 41 | const ScrollablePage({Key? key}) : super(key: key); 42 | 43 | @override 44 | _ScrollablePageState createState() => _ScrollablePageState(); 45 | } 46 | 47 | class _ScrollablePageState extends State { 48 | final scrollControllerVertical = ScrollController(); 49 | final scrollControllerVertical2 = ScrollController(); 50 | final scrollControllerHorizontal = ScrollController(); 51 | final scrollControllerHorizontal2 = ScrollController(); 52 | 53 | bool get isDesktop => 54 | Theme.of(context).platform == TargetPlatform.linux || 55 | Theme.of(context).platform == TargetPlatform.macOS || 56 | Theme.of(context).platform == TargetPlatform.windows; 57 | 58 | TextStyle? get textStyleBig => Theme.of(context).textTheme.headline5; 59 | TextStyle? get textStyleMedium => Theme.of(context).textTheme.headline6; 60 | TextStyle? get textStyleSmall => Theme.of(context).textTheme.bodyText2; 61 | 62 | Axis axis = Axis.vertical; 63 | bool useSystemCursor = false; 64 | 65 | void toggleAxis() { 66 | setState(() { 67 | if (axis == Axis.vertical) { 68 | axis = Axis.horizontal; 69 | } else { 70 | axis = Axis.vertical; 71 | } 72 | }); 73 | } 74 | 75 | void toggleCursor() { 76 | setState(() { 77 | useSystemCursor = !useSystemCursor; 78 | }); 79 | } 80 | 81 | @override 82 | void dispose() { 83 | scrollControllerVertical.dispose(); 84 | scrollControllerVertical2.dispose(); 85 | scrollControllerHorizontal.dispose(); 86 | scrollControllerHorizontal2.dispose(); 87 | super.dispose(); 88 | } 89 | 90 | @override 91 | Widget build(BuildContext context) { 92 | return Scaffold( 93 | body: Column( 94 | crossAxisAlignment: CrossAxisAlignment.stretch, 95 | children: [ 96 | buildHeader(), 97 | const Divider( 98 | thickness: 5.0, 99 | color: Colors.grey, 100 | ), 101 | if (axis == Axis.vertical) 102 | Expanded( 103 | child: Row( 104 | children: [ 105 | Expanded( 106 | child: buildScrollingView( 107 | Axis.vertical, 108 | scrollControllerVertical, 109 | ), 110 | ), 111 | const VerticalDivider(), 112 | Expanded( 113 | child: buildScrollingView( 114 | Axis.vertical, 115 | scrollControllerVertical2, 116 | ), 117 | ), 118 | ], 119 | ), 120 | ) 121 | else 122 | Expanded( 123 | child: Column( 124 | children: [ 125 | Expanded( 126 | child: buildScrollingView( 127 | Axis.horizontal, 128 | scrollControllerHorizontal, 129 | ), 130 | ), 131 | const Divider(), 132 | Expanded( 133 | child: buildScrollingView( 134 | Axis.horizontal, 135 | scrollControllerHorizontal2, 136 | ), 137 | ), 138 | ], 139 | ), 140 | ), 141 | ], 142 | ), 143 | floatingActionButton: Padding( 144 | padding: const EdgeInsets.all(10.0), 145 | child: Column( 146 | mainAxisAlignment: MainAxisAlignment.end, 147 | children: [ 148 | FloatingActionButton.extended( 149 | onPressed: toggleCursor, 150 | label: const Text('Toggle cursor'), 151 | backgroundColor: Colors.black, 152 | heroTag: 'FirstFAB', 153 | ), 154 | const SizedBox(height: 10.0), 155 | FloatingActionButton.extended( 156 | onPressed: toggleAxis, 157 | label: const Text('Toggle axis'), 158 | backgroundColor: Colors.black, 159 | heroTag: 'SecondFAB', 160 | ), 161 | ], 162 | ), 163 | ), 164 | ); 165 | } 166 | 167 | Widget buildHeader() { 168 | return Card( 169 | margin: const EdgeInsets.all(12.0), 170 | child: Padding( 171 | padding: const EdgeInsets.all(12.0), 172 | child: Row( 173 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 174 | children: [ 175 | Expanded( 176 | child: Column( 177 | crossAxisAlignment: CrossAxisAlignment.start, 178 | children: [ 179 | Text( 180 | 'Advanced scrolling for Flutter web and desktop', 181 | style: textStyleBig, 182 | ), 183 | Text( 184 | ' 1. Scroll using middle mouse button:', 185 | style: textStyleMedium, 186 | ), 187 | Text( 188 | ' - Tap MMB --> Drag --> Tap MMB, or', 189 | style: textStyleSmall, 190 | ), 191 | Text( 192 | ' - Press and hold MMB --> Drag --> Release MMB', 193 | style: textStyleSmall, 194 | ), 195 | Text( 196 | ' - Can use default system cursors,' 197 | ' or custom Widget cursor', 198 | style: textStyleSmall, 199 | ), 200 | Text( 201 | ' 2. Scroll using keyboard (the scrollable' 202 | ' widget must have focus):', 203 | style: textStyleMedium, 204 | ), 205 | Text( 206 | ' - Arrows (up, down, left, right)', 207 | style: textStyleSmall, 208 | ), 209 | Text( 210 | ' - Space, Shift + Space (reverse)', 211 | style: textStyleSmall, 212 | ), 213 | Text( 214 | ' - PageUp, PageDown, End, Home', 215 | style: textStyleSmall, 216 | ), 217 | ], 218 | ), 219 | ), 220 | Expanded( 221 | child: Column( 222 | crossAxisAlignment: CrossAxisAlignment.start, 223 | children: [ 224 | Text( 225 | '3. Can also programatically scroll using mouse wheel\n' 226 | '(when using NeverScrollableScrollPhysics)', 227 | style: textStyleMedium, 228 | ), 229 | Text( 230 | '4. Supports both vertical and horizontal scrolling,' 231 | ' but not at the same time', 232 | style: textStyleMedium, 233 | ), 234 | Text( 235 | '5. Check out the console for events log', 236 | style: textStyleMedium, 237 | ), 238 | const SizedBox(height: 20.0), 239 | Text( 240 | 'Current cursor type: ' 241 | '${useSystemCursor ? 'system' : 'custom'}', 242 | style: textStyleSmall, 243 | ), 244 | Text( 245 | 'Current scrollables orientation: ${describeEnum(axis)}', 246 | style: textStyleSmall, 247 | ), 248 | ], 249 | ), 250 | ), 251 | ], 252 | ), 253 | ), 254 | ); 255 | } 256 | 257 | Widget buildScrollingView(Axis axis, ScrollController controller) { 258 | return ImprovedScrolling( 259 | scrollController: controller, 260 | onScroll: (scrollOffset) => debugPrint( 261 | 'Scroll offset: $scrollOffset', 262 | ), 263 | onMMBScrollStateChanged: (scrolling) => debugPrint( 264 | 'Is scrolling: $scrolling', 265 | ), 266 | onMMBScrollCursorPositionUpdate: (localCursorOffset, scrollActivity) => 267 | debugPrint( 268 | 'Cursor position: $localCursorOffset\n' 269 | 'Scroll activity: $scrollActivity', 270 | ), 271 | enableMMBScrolling: true, 272 | enableKeyboardScrolling: true, 273 | enableCustomMouseWheelScrolling: true, 274 | mmbScrollConfig: MMBScrollConfig( 275 | customScrollCursor: 276 | useSystemCursor ? null : const DefaultCustomScrollCursor(), 277 | ), 278 | keyboardScrollConfig: KeyboardScrollConfig( 279 | homeScrollDurationBuilder: (currentScrollOffset, minScrollOffset) { 280 | return const Duration(milliseconds: 100); 281 | }, 282 | endScrollDurationBuilder: (currentScrollOffset, maxScrollOffset) { 283 | return const Duration(milliseconds: 2000); 284 | }, 285 | ), 286 | customMouseWheelScrollConfig: const CustomMouseWheelScrollConfig( 287 | scrollAmountMultiplier: 4.0, 288 | scrollDuration: Duration(milliseconds: 350), 289 | ), 290 | child: ScrollConfiguration( 291 | behavior: const CustomScrollBehaviour(), 292 | child: GridView( 293 | controller: controller, 294 | physics: const NeverScrollableScrollPhysics(), 295 | scrollDirection: axis, 296 | padding: const EdgeInsets.all(24.0), 297 | gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( 298 | maxCrossAxisExtent: 400.0, 299 | mainAxisExtent: 400.0, 300 | ), 301 | children: buildScrollableItemList(axis), 302 | ), 303 | ), 304 | ); 305 | } 306 | 307 | List buildScrollableItemList(Axis axis) { 308 | final isVertical = axis == Axis.vertical; 309 | final Size itemsSize; 310 | if (isVertical) { 311 | itemsSize = const Size(700.0, 300.0); 312 | } else { 313 | itemsSize = const Size(300.0, 500.0); 314 | } 315 | 316 | return [ 317 | for (var i = 1; i <= 100; i++) 318 | buildScrollableItem( 319 | size: itemsSize, 320 | child: Center( 321 | child: Text( 322 | '$i', 323 | style: textStyleMedium, 324 | ), 325 | ), 326 | ), 327 | ]; 328 | } 329 | 330 | Widget buildScrollableItem({ 331 | required Size size, 332 | required Widget child, 333 | }) { 334 | return GridTile( 335 | child: Container( 336 | margin: const EdgeInsets.only( 337 | top: 24.0, 338 | left: 24.0, 339 | right: 24.0, 340 | ), 341 | padding: const EdgeInsets.all(12.0), 342 | decoration: BoxDecoration( 343 | borderRadius: BorderRadius.circular(10.0), 344 | border: Border.all(color: Colors.black.withAlpha(10), width: 2.0), 345 | color: Colors.white, 346 | ), 347 | width: size.width, 348 | height: size.height, 349 | child: child, 350 | ), 351 | ); 352 | } 353 | } 354 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.6.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.0.3" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "1.2.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_improved_scrolling: 66 | dependency: "direct main" 67 | description: 68 | path: ".." 69 | relative: true 70 | source: path 71 | version: "0.0.3" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | lint: 78 | dependency: "direct dev" 79 | description: 80 | name: lint 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.6.0" 84 | matcher: 85 | dependency: transitive 86 | description: 87 | name: matcher 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "0.12.10" 91 | meta: 92 | dependency: transitive 93 | description: 94 | name: meta 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.3.0" 98 | path: 99 | dependency: transitive 100 | description: 101 | name: path 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.8.0" 105 | sky_engine: 106 | dependency: transitive 107 | description: flutter 108 | source: sdk 109 | version: "0.0.99" 110 | source_span: 111 | dependency: transitive 112 | description: 113 | name: source_span 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.8.1" 117 | stack_trace: 118 | dependency: transitive 119 | description: 120 | name: stack_trace 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.10.0" 124 | stream_channel: 125 | dependency: transitive 126 | description: 127 | name: stream_channel 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "2.1.0" 131 | string_scanner: 132 | dependency: transitive 133 | description: 134 | name: string_scanner 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.1.0" 138 | term_glyph: 139 | dependency: transitive 140 | description: 141 | name: term_glyph 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.2.0" 145 | test_api: 146 | dependency: transitive 147 | description: 148 | name: test_api 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "0.3.0" 152 | typed_data: 153 | dependency: transitive 154 | description: 155 | name: typed_data 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.3.0" 159 | vector_math: 160 | dependency: transitive 161 | description: 162 | name: vector_math 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "2.1.0" 166 | sdks: 167 | dart: ">=2.13.0 <3.0.0" 168 | flutter: ">=1.17.0" 169 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_improved_scrolling_example 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | dependencies: 24 | cupertino_icons: ^1.0.2 25 | flutter: 26 | sdk: flutter 27 | 28 | flutter_improved_scrolling: 29 | path: ../ 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | lint: ^1.6.0 35 | 36 | # For information on the generic Dart part of this file, see the 37 | # following page: https://dart.dev/tools/pub/pubspec 38 | # The following section is specific to Flutter. 39 | flutter: 40 | # The following line ensures that the Material Icons font is 41 | # included with your application, so that you can use the icons in 42 | # the material Icons class. 43 | uses-material-design: true 44 | # To add assets to your application, add an assets section, like this: 45 | # assets: 46 | # - images/a_dot_burr.jpeg 47 | # - images/a_dot_ham.jpeg 48 | # An image asset can refer to one or more resolution-specific "variants", see 49 | # https://flutter.dev/assets-and-images/#resolution-aware. 50 | # For details regarding adding assets from package dependencies, see 51 | # https://flutter.dev/assets-and-images/#from-packages 52 | # To add custom fonts to your application, add a fonts section here, 53 | # in this "flutter" section. Each entry in this list should have a 54 | # "family" key with the font family name, and a "fonts" key with a 55 | # list giving the asset and other descriptors for the font. For 56 | # example: 57 | # fonts: 58 | # - family: Schyler 59 | # fonts: 60 | # - asset: fonts/Schyler-Regular.ttf 61 | # - asset: fonts/Schyler-Italic.ttf 62 | # style: italic 63 | # - family: Trajan Pro 64 | # fonts: 65 | # - asset: fonts/TrajanPro.ttf 66 | # - asset: fonts/TrajanPro_Bold.ttf 67 | # weight: 700 68 | # 69 | # For details regarding fonts from package dependencies, 70 | # see https://flutter.dev/custom-fonts/#from-packages 71 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianflutur/flutter_improved_scrolling/3df506921f930779c08374853af13e8080465041/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | flutter_improved_scrolling_example 27 | 28 | 29 | 30 | 33 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_improved_scrolling_example", 3 | "short_name": "flutter_improved_scrolling_example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /lib/flutter_improved_scrolling.dart: -------------------------------------------------------------------------------- 1 | library flutter_improved_scrolling; 2 | 3 | export 'src/config.dart'; 4 | export 'src/custom_scroll_cursor.dart'; 5 | export 'src/improved_scrolling_widget.dart'; 6 | -------------------------------------------------------------------------------- /lib/src/config.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/animation.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'custom_scroll_cursor.dart'; 5 | 6 | /// Middle mouse button scrolling configuration 7 | class MMBScrollConfig { 8 | /// Default values 9 | const MMBScrollConfig({ 10 | this.customScrollCursor, 11 | this.idleCursorAreaSize = 30.0, 12 | this.autoScrollDelay = Duration.zero, 13 | this.velocityBackpropagationPercent = 30.0 / 100.0, 14 | this.decelerationForce = 500.0, 15 | }); 16 | 17 | /// Custom cursor specified by the user 18 | /// 19 | /// If null, default system cursors will be used instead 20 | final CustomScrollCursor? customScrollCursor; 21 | 22 | /// Size of the area where the cursor changes to idle 23 | /// This gets split in half (one half up, one half down) 24 | final double idleCursorAreaSize; 25 | 26 | /// The delay between sequential auto scrolls. 27 | /// 28 | /// Affects scrolling framerate (higher delay = more staggered/laggy scrolling) 29 | final Duration autoScrollDelay; 30 | 31 | /// Percent of how much speed to extract from the 32 | /// last scrolling's velocity and add to the next velocity 33 | /// 34 | /// Affects speed 35 | final double velocityBackpropagationPercent; 36 | 37 | /// Amount of friction 38 | /// 39 | /// Affects how smooth to initiate the scrolling when getting out 40 | /// of the idle zone, but will also affect overall speed 41 | /// 42 | /// A lower value will make the scrolling start abruptly, 43 | /// while a higher value will make it smooth 44 | final double decelerationForce; 45 | } 46 | 47 | /// Keyboard scrolling configuration 48 | class KeyboardScrollConfig { 49 | /// Default values 50 | const KeyboardScrollConfig({ 51 | this.arrowsScrollAmount = 200.0, 52 | this.arrowsScrollDuration = const Duration(milliseconds: 200), 53 | this.pageUpDownScrollAmount = 500.0, 54 | this.pageUpDownScrollDuration = const Duration(milliseconds: 200), 55 | this.spaceScrollAmount = 600.0, 56 | this.spaceScrollDuration = const Duration(milliseconds: 200), 57 | this.defaultHomeEndScrollDuration = const Duration(milliseconds: 500), 58 | this.homeScrollDurationBuilder, 59 | this.endScrollDurationBuilder, 60 | this.scrollCurve = Curves.easeOutCubic, 61 | }); 62 | 63 | /// Amount to scroll when pressing arrow keys 64 | final double arrowsScrollAmount; 65 | 66 | /// Duration to reach the new scroll position when using arrow keys 67 | final Duration arrowsScrollDuration; 68 | 69 | /// Amount to scroll when pressing page up/down 70 | final double pageUpDownScrollAmount; 71 | 72 | /// Duration to reach the new scroll position when using page up/down 73 | final Duration pageUpDownScrollDuration; 74 | 75 | /// Amount to scroll when pressing space 76 | final double spaceScrollAmount; 77 | 78 | /// Duration to reach the new scroll position when using space 79 | final Duration spaceScrollDuration; 80 | 81 | /// Compute duration to reach the start of the scroll view 82 | /// based on where the scroll offset is right now 83 | final Duration Function( 84 | double currentScrollOffset, 85 | double minScrollOffset, 86 | )? homeScrollDurationBuilder; 87 | 88 | /// Compute duration to reach the end of the scroll view 89 | /// based on where the scroll offset is right now 90 | final Duration Function( 91 | double currentScrollOffset, 92 | double maxScrollOffset, 93 | )? endScrollDurationBuilder; 94 | 95 | /// Default duration for home and end scrolling 96 | final Duration defaultHomeEndScrollDuration; 97 | 98 | /// Scroll curve 99 | final Curve scrollCurve; 100 | } 101 | 102 | /// Custom mouse wheel scrolling configuration 103 | class CustomMouseWheelScrollConfig { 104 | /// Default values 105 | const CustomMouseWheelScrollConfig({ 106 | this.scrollAmountMultiplier = 3.0, 107 | this.scrollDuration = const Duration(milliseconds: 400), 108 | this.scrollCurve = Curves.linearToEaseOut, 109 | this.mouseWheelTurnsThrottleTimeMs = 80, 110 | }); 111 | 112 | /// Extra amount to scroll when scrolling using mouse wheel 113 | /// 114 | /// Can be negative 115 | final double scrollAmountMultiplier; 116 | 117 | /// Scroll duration 118 | final Duration scrollDuration; 119 | 120 | /// Scroll curve 121 | final Curve scrollCurve; 122 | 123 | /// Scrolling throttle duration 124 | final int mouseWheelTurnsThrottleTimeMs; 125 | } 126 | -------------------------------------------------------------------------------- /lib/src/custom_scroll_cursor.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | /// Custom cursor widget interface 6 | abstract class CustomScrollCursor { 7 | /// Size 8 | double get size; 9 | 10 | /// The widget to show when in `CursorScrollActivity.idle` state 11 | Widget get idle; 12 | 13 | /// The widget to show when in `CursorScrollActivity.scrollingUp` state 14 | Widget get scrollingUp; 15 | 16 | /// The widget to show when in `CursorScrollActivity.scrollingDown` state 17 | Widget get scrollingDown; 18 | 19 | /// The widget to show when in `CursorScrollActivity.scrollingLeft` state 20 | Widget get scrollingLeft; 21 | 22 | /// The widget to show when in `CursorScrollActivity.scrollingRight` state 23 | Widget get scrollingRight; 24 | } 25 | 26 | /// Default custom cursor widget implementation 27 | class DefaultCustomScrollCursor implements CustomScrollCursor { 28 | /// Constructor 29 | const DefaultCustomScrollCursor({ 30 | Color cursorColor = Colors.black, 31 | Color borderColor = Colors.black, 32 | Color backgroundColor = Colors.white, 33 | }) : _cursorColor = cursorColor, 34 | _borderColor = borderColor, 35 | _backgroundColor = backgroundColor; 36 | 37 | final Color _cursorColor; 38 | final Color _borderColor; 39 | final Color _backgroundColor; 40 | 41 | Widget _buildCursor({ 42 | bool idle = false, 43 | required Widget icon, 44 | }) { 45 | return Container( 46 | decoration: idle 47 | ? BoxDecoration( 48 | color: _backgroundColor, 49 | shape: BoxShape.circle, 50 | border: Border.all( 51 | color: _borderColor, 52 | ), 53 | ) 54 | : null, 55 | child: icon, 56 | ); 57 | } 58 | 59 | /// Size 60 | @override 61 | double get size => 28.0; 62 | 63 | /// The widget to show when in `CursorScrollActivity.idle` state 64 | @override 65 | Widget get idle => Transform.rotate( 66 | angle: 3 * pi / 4, 67 | child: _buildCursor( 68 | idle: true, 69 | icon: Icon( 70 | Icons.zoom_out_map, 71 | color: _cursorColor, 72 | size: size - 6.0, 73 | ), 74 | ), 75 | ); 76 | 77 | /// The widget to show when in `CursorScrollActivity.scrollingUp` state 78 | @override 79 | Widget get scrollingUp => _buildCursor( 80 | icon: Icon( 81 | Icons.arrow_drop_up, 82 | color: _cursorColor, 83 | size: size, 84 | ), 85 | ); 86 | 87 | /// The widget to show when in `CursorScrollActivity.scrollingDown` state 88 | @override 89 | Widget get scrollingDown => Transform.rotate( 90 | angle: pi, 91 | child: scrollingUp, 92 | ); 93 | 94 | /// The widget to show when in `CursorScrollActivity.scrollingLeft` state 95 | @override 96 | Widget get scrollingLeft => Transform.rotate( 97 | angle: -pi / 2, 98 | child: scrollingUp, 99 | ); 100 | 101 | /// The widget to show when in `CursorScrollActivity.scrollingRight` state 102 | @override 103 | Widget get scrollingRight => Transform.rotate( 104 | angle: pi / 2, 105 | child: scrollingUp, 106 | ); 107 | } 108 | -------------------------------------------------------------------------------- /lib/src/improved_scrolling_widget.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:math' as math; 3 | 4 | import 'package:flutter/gestures.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/rendering.dart'; 7 | import 'package:flutter/services.dart'; 8 | import 'package:flutter_improved_scrolling/src/throttler.dart'; 9 | import 'config.dart'; 10 | import 'custom_scroll_cursor.dart'; 11 | 12 | /// Current cursor scroll activity 13 | enum MMBScrollCursorActivity { 14 | /// Middle button pressed, but the cursor is not moving 15 | idle, 16 | 17 | /// Middle button pressed and the cursor is moving up 18 | scrollingUp, 19 | 20 | /// Middle button pressed and the cursor is moving down 21 | scrollingDown, 22 | 23 | /// Middle button pressed and the cursor is moving left 24 | scrollingLeft, 25 | 26 | /// Middle button pressed and the cursor is moving right 27 | scrollingRight, 28 | } 29 | 30 | /// Improved scrolling for Flutter Web and Desktop 31 | /// 32 | /// Must wrap scrollables such as [SingleChildScrollView] or [ListView] 33 | /// in order to provide scrolling features that a normal user 34 | /// would expect from a website or a desktop app 35 | class ImprovedScrolling extends StatefulWidget { 36 | /// Constructor 37 | const ImprovedScrolling({ 38 | Key? key, 39 | required this.scrollController, 40 | this.enableMMBScrolling = false, 41 | this.enableKeyboardScrolling = false, 42 | this.enableCustomMouseWheelScrolling = false, 43 | this.mmbScrollConfig = const MMBScrollConfig(), 44 | this.keyboardScrollConfig = const KeyboardScrollConfig(), 45 | this.customMouseWheelScrollConfig = const CustomMouseWheelScrollConfig(), 46 | this.onScroll, 47 | this.onMMBScrollStateChanged, 48 | this.onMMBScrollCursorPositionUpdate, 49 | required this.child, 50 | }) : super(key: key); 51 | 52 | /// Scrollable child widget 53 | final Widget child; 54 | 55 | /// The scroll controller must also be supplied 56 | /// to the wrapped scrollable widget. 57 | /// 58 | /// They must use the same controller 59 | final ScrollController scrollController; 60 | 61 | /// Enables scrolling using the middle mouse button (MMB), in two ways: 62 | /// 1. Tap MMB --> Drag MMB --> Tap MMB 63 | /// or 64 | /// 2. Tap and hold MMB --> Drag MMB --> Release MMB 65 | final bool enableMMBScrolling; 66 | 67 | /// Configuration for middle mouse button scrolling 68 | final MMBScrollConfig mmbScrollConfig; 69 | 70 | /// Enables scrolling using theese keys: 71 | /// ``` 72 | /// Arrows (up, down, left, right) 73 | /// Space (+ Shift) 74 | /// PageUp, PageDown 75 | /// ``` 76 | final bool enableKeyboardScrolling; 77 | 78 | /// Configuration for keyboard scrolling 79 | final KeyboardScrollConfig keyboardScrollConfig; 80 | 81 | /// Enables scrolling the view programatically when using mouse wheel 82 | /// This is done using a scroll listener 83 | /// 84 | /// Useful in cases when using NeverScrollableScrollPhysics 85 | /// on the wrapped scrollable widget 86 | final bool enableCustomMouseWheelScrolling; 87 | 88 | /// Configuration for programatically scrolling using mouse wheel 89 | final CustomMouseWheelScrollConfig customMouseWheelScrollConfig; 90 | 91 | /// Callback which fires when the wrapped scrollable's scroll offset changes 92 | final void Function(double offset)? onScroll; 93 | 94 | /// Callback which fires when the MMB scrolling state is changed 95 | final void Function(bool scrollingActive)? onMMBScrollStateChanged; 96 | 97 | /// Callback which fires when the MMB scrolling 98 | /// cursor's local position changes 99 | final void Function( 100 | Offset localCursorOffset, 101 | MMBScrollCursorActivity cursorScrollActivity, 102 | )? onMMBScrollCursorPositionUpdate; 103 | 104 | @override 105 | _ImprovedScrollingState createState() => _ImprovedScrollingState(); 106 | } 107 | 108 | class _ImprovedScrollingState extends State { 109 | ScrollController get scrollController => widget.scrollController; 110 | bool get isVerticalAxis => scrollController.position.axis == Axis.vertical; 111 | 112 | final _middleMouseButtonId = 4; 113 | var _mmbScrollCursorActivity = MMBScrollCursorActivity.idle; 114 | var _mmbScrollActive = false; 115 | var _mmbScrollCurrentCursorPosition = Offset.zero; 116 | var _mmbScrollLastCursorStartPosition = Offset.zero; 117 | var _mmbScrollLastVelocity = Offset.zero; 118 | Timer? _mmbScrollingTimer; 119 | 120 | final _keyboardScrollFocusNode = FocusNode(); 121 | var _isShiftPressedDown = false; 122 | 123 | late final Throttler mouseWheelForwardThrottler; 124 | late final Throttler mouseWheelBackwardThrottler; 125 | 126 | bool get isMMBScrollTimerActive => 127 | _mmbScrollingTimer != null && _mmbScrollingTimer!.isActive; 128 | 129 | double get mmbScrollNextAutoScrollAcceleration { 130 | final lastVelocityByAxis = 131 | isVerticalAxis ? _mmbScrollLastVelocity.dy : _mmbScrollLastVelocity.dx; 132 | return lastVelocityByAxis.abs() / widget.mmbScrollConfig.decelerationForce; 133 | } 134 | 135 | MouseCursor get mmbScrollMouseCursor { 136 | if (widget.enableMMBScrolling && _mmbScrollActive) { 137 | if (widget.mmbScrollConfig.customScrollCursor != null) { 138 | return SystemMouseCursors.none; 139 | } 140 | 141 | switch (_mmbScrollCursorActivity) { 142 | case MMBScrollCursorActivity.idle: 143 | return SystemMouseCursors.move; 144 | case MMBScrollCursorActivity.scrollingUp: 145 | return SystemMouseCursors.resizeUp; 146 | case MMBScrollCursorActivity.scrollingDown: 147 | return SystemMouseCursors.resizeDown; 148 | case MMBScrollCursorActivity.scrollingLeft: 149 | return SystemMouseCursors.resizeLeft; 150 | case MMBScrollCursorActivity.scrollingRight: 151 | return SystemMouseCursors.resizeRight; 152 | } 153 | } 154 | return MouseCursor.defer; 155 | } 156 | 157 | @override 158 | void initState() { 159 | super.initState(); 160 | mouseWheelForwardThrottler = Throttler( 161 | widget.customMouseWheelScrollConfig.mouseWheelTurnsThrottleTimeMs, 162 | ); 163 | mouseWheelBackwardThrottler = Throttler( 164 | widget.customMouseWheelScrollConfig.mouseWheelTurnsThrottleTimeMs, 165 | ); 166 | scrollController.addListener(scrollControllerListener); 167 | } 168 | 169 | void scrollControllerListener() { 170 | widget.onScroll?.call(scrollController.offset); 171 | } 172 | 173 | void setMMBScrollActive(bool value) { 174 | if (_mmbScrollActive == value) { 175 | return; 176 | } 177 | 178 | setState(() { 179 | _mmbScrollActive = value; 180 | }); 181 | } 182 | 183 | void setMMBScrollCursorStartScrollPosition(Offset position) { 184 | setState(() { 185 | _mmbScrollLastCursorStartPosition = position; 186 | }); 187 | } 188 | 189 | void setMMBScrollCursorPosition(Offset position) { 190 | setState(() { 191 | _mmbScrollCurrentCursorPosition = position; 192 | }); 193 | } 194 | 195 | void setMMBScrollCursorActivity(MMBScrollCursorActivity mmbCursorActivity) { 196 | if (_mmbScrollCursorActivity == mmbCursorActivity) { 197 | return; 198 | } 199 | 200 | setState(() { 201 | _mmbScrollCursorActivity = mmbCursorActivity; 202 | }); 203 | } 204 | 205 | void setMMBScrollVelocity(Offset offset) { 206 | // setState() is not necessary here because 207 | // this is not used inside the build() method 208 | _mmbScrollLastVelocity = offset; 209 | } 210 | 211 | void updateMMBScrollVelocity(Offset offset) { 212 | // setState() is not necessary here because 213 | // this is not used inside the build() method 214 | _mmbScrollLastVelocity += offset; 215 | } 216 | 217 | void setShiftPressedDown(bool value) { 218 | // setState() is not necessary here because 219 | // this is not used inside the build() method 220 | _isShiftPressedDown = value; 221 | } 222 | 223 | void mmbScrollBy(Offset delta) { 224 | if (!_mmbScrollActive) { 225 | return; 226 | } 227 | final currentOffset = scrollController.offset; 228 | 229 | final scrollDeltaByAxis = isVerticalAxis ? delta.dy : delta.dx; 230 | final newScrollOffset = 231 | currentOffset + scrollDeltaByAxis * mmbScrollNextAutoScrollAcceleration; 232 | 233 | final minScrollExtent = scrollController.position.minScrollExtent; 234 | final maxScrollExtent = scrollController.position.maxScrollExtent; 235 | 236 | // Only allow scrolling within the scrollable boundaries 237 | if (newScrollOffset <= minScrollExtent) { 238 | scrollController.jumpTo(minScrollExtent); 239 | } else if (newScrollOffset >= maxScrollExtent) { 240 | scrollController.jumpTo(maxScrollExtent); 241 | } else { 242 | scrollController.jumpTo(newScrollOffset); 243 | } 244 | } 245 | 246 | void performMMBAutoScrolling(PointerEvent event) { 247 | // Theese will always happen in order to 248 | // update the current cursor and velocity 249 | setMMBScrollCursorPosition(event.localPosition); 250 | updateMMBScrollVelocity(event.delta); 251 | 252 | widget.onMMBScrollCursorPositionUpdate?.call( 253 | _mmbScrollCurrentCursorPosition, 254 | _mmbScrollCursorActivity, 255 | ); 256 | 257 | // If the timer is already running for 258 | // either `onPointerMove` or `onPointerHover` then return 259 | if (isMMBScrollTimerActive) { 260 | return; 261 | } 262 | 263 | _mmbScrollingTimer = 264 | Timer.periodic(widget.mmbScrollConfig.autoScrollDelay, (timer) { 265 | // Everything here is computed after this 266 | // callback is scheduled (in the future) 267 | 268 | // First check if the cursor is idle (is inside the start area) 269 | final lastStartCursorPosByAxis = isVerticalAxis 270 | ? _mmbScrollLastCursorStartPosition.dy 271 | : _mmbScrollLastCursorStartPosition.dx; 272 | 273 | final currentCursorPosByAxis = isVerticalAxis 274 | ? _mmbScrollCurrentCursorPosition.dy 275 | : _mmbScrollCurrentCursorPosition.dx; 276 | 277 | final cursorIsWhereTheScrollStartedArea = currentCursorPosByAxis > 278 | lastStartCursorPosByAxis - 279 | widget.mmbScrollConfig.idleCursorAreaSize / 2 && 280 | currentCursorPosByAxis < 281 | lastStartCursorPosByAxis + 282 | widget.mmbScrollConfig.idleCursorAreaSize / 2; 283 | 284 | if (cursorIsWhereTheScrollStartedArea) { 285 | // 286 | // If the cursor is idle, change it's type to idle 287 | setMMBScrollCursorActivity(MMBScrollCursorActivity.idle); 288 | } else { 289 | // 290 | // Else compute the next auto scrolling velocity using a percent of 291 | // the last velocity for an incremental scrolling effect. 292 | final scrollingVelocity = event.delta + 293 | _mmbScrollLastVelocity * 294 | widget.mmbScrollConfig.velocityBackpropagationPercent; 295 | 296 | if (isVerticalAxis) { 297 | if (scrollingVelocity.dy > _mmbScrollLastVelocity.dy) { 298 | setMMBScrollCursorActivity(MMBScrollCursorActivity.scrollingUp); 299 | } else { 300 | setMMBScrollCursorActivity(MMBScrollCursorActivity.scrollingDown); 301 | } 302 | } else { 303 | if (scrollingVelocity.dx > _mmbScrollLastVelocity.dx) { 304 | setMMBScrollCursorActivity(MMBScrollCursorActivity.scrollingLeft); 305 | } else { 306 | setMMBScrollCursorActivity(MMBScrollCursorActivity.scrollingRight); 307 | } 308 | } 309 | 310 | mmbScrollBy(scrollingVelocity); 311 | } 312 | 313 | // The timer will stop when MMB scrolling is active and 314 | // one of `onPointerDown` or `onPointerUp` events gets triggered 315 | if (!_mmbScrollActive) { 316 | timer.cancel(); 317 | } 318 | }); 319 | } 320 | 321 | @override 322 | void dispose() { 323 | if (isMMBScrollTimerActive) { 324 | _mmbScrollingTimer!.cancel(); 325 | } 326 | scrollController.removeListener(scrollControllerListener); 327 | _keyboardScrollFocusNode.dispose(); 328 | super.dispose(); 329 | } 330 | 331 | @override 332 | Widget build(BuildContext context) { 333 | var child = widget.child; 334 | 335 | child = Listener( 336 | onPointerDown: (event) { 337 | // Set the initial local position, cursor type and velocity 338 | // Triggers only when the input type is mouse and the button is MMB 339 | if (widget.enableMMBScrolling && 340 | event.kind == PointerDeviceKind.mouse && 341 | event.buttons == _middleMouseButtonId) { 342 | setMMBScrollActive(!_mmbScrollActive); 343 | setMMBScrollCursorStartScrollPosition(event.localPosition); 344 | setMMBScrollCursorPosition(event.localPosition); 345 | setMMBScrollVelocity(event.localDelta); 346 | setMMBScrollCursorActivity(MMBScrollCursorActivity.idle); 347 | 348 | widget.onMMBScrollStateChanged?.call(_mmbScrollActive); 349 | widget.onMMBScrollCursorPositionUpdate?.call( 350 | _mmbScrollCurrentCursorPosition, 351 | _mmbScrollCursorActivity, 352 | ); 353 | } 354 | }, 355 | onPointerMove: (event) { 356 | if (widget.enableMMBScrolling && _mmbScrollActive) { 357 | performMMBAutoScrolling(event); 358 | } 359 | }, 360 | onPointerHover: (event) { 361 | if (widget.enableMMBScrolling && _mmbScrollActive) { 362 | performMMBAutoScrolling(event); 363 | } 364 | 365 | if (widget.enableKeyboardScrolling && 366 | !_keyboardScrollFocusNode.hasFocus && 367 | event.kind == PointerDeviceKind.mouse) { 368 | // Request focus in order to be able to use keyboard keys 369 | FocusScope.of(context).requestFocus(_keyboardScrollFocusNode); 370 | } 371 | }, 372 | onPointerUp: (event) { 373 | // When releasing the button, if the timer is still 374 | // running then cancel timer and stop the MMB scrolling 375 | if (isMMBScrollTimerActive) { 376 | setMMBScrollActive(false); 377 | _mmbScrollingTimer!.cancel(); 378 | 379 | widget.onMMBScrollStateChanged?.call(false); 380 | widget.onMMBScrollCursorPositionUpdate?.call( 381 | _mmbScrollCurrentCursorPosition, 382 | _mmbScrollCursorActivity, 383 | ); 384 | } 385 | }, 386 | onPointerSignal: (event) { 387 | if (widget.enableCustomMouseWheelScrolling && 388 | event is PointerScrollEvent && 389 | event.kind == PointerDeviceKind.mouse) { 390 | if (!isVerticalAxis && !_isShiftPressedDown) { 391 | return; 392 | } 393 | 394 | // Work-around for a Flutter issue regarding horizontal scrolling 395 | // 396 | // Basically `event.scrollDelta.dx` should return +-33.3333 397 | // (the default scroll amount) but it returns 0.0, so we must 398 | // use `event.scrollDelta.dy` instead (which should actually 399 | // return 0.0 now, but it actually returns +-33.3333, 400 | // which means they are somehow inverted) 401 | final scrollDelta = event.scrollDelta.dy; 402 | 403 | final newOffset = scrollController.offset + 404 | scrollDelta * 405 | widget.customMouseWheelScrollConfig.scrollAmountMultiplier; 406 | 407 | final duration = widget.customMouseWheelScrollConfig.scrollDuration; 408 | final curve = widget.customMouseWheelScrollConfig.scrollCurve; 409 | 410 | if (scrollDelta.isNegative) { 411 | mouseWheelForwardThrottler.run(() { 412 | scrollController.animateTo( 413 | math.max(0.0, newOffset), 414 | duration: duration, 415 | curve: curve, 416 | ); 417 | }); 418 | } else { 419 | mouseWheelBackwardThrottler.run(() { 420 | scrollController.animateTo( 421 | math.min(scrollController.position.maxScrollExtent, newOffset), 422 | duration: duration, 423 | curve: curve, 424 | ); 425 | }); 426 | } 427 | } 428 | }, 429 | child: Stack( 430 | children: [ 431 | Positioned.fill( 432 | child: child, 433 | ), 434 | if (widget.enableMMBScrolling && 435 | widget.mmbScrollConfig.customScrollCursor != null && 436 | _mmbScrollActive) 437 | Positioned( 438 | top: _mmbScrollCurrentCursorPosition.dy - 439 | widget.mmbScrollConfig.customScrollCursor!.size / 2, 440 | left: _mmbScrollCurrentCursorPosition.dx - 441 | widget.mmbScrollConfig.customScrollCursor!.size / 2, 442 | child: SizedBox( 443 | height: widget.mmbScrollConfig.customScrollCursor!.size, 444 | width: widget.mmbScrollConfig.customScrollCursor!.size, 445 | child: buildMMBScrollingCustomCursor( 446 | widget.mmbScrollConfig.customScrollCursor!, 447 | ), 448 | ), 449 | ), 450 | ], 451 | ), 452 | ); 453 | 454 | if (widget.enableMMBScrolling) { 455 | child = MouseRegion( 456 | cursor: mmbScrollMouseCursor, 457 | child: child, 458 | ); 459 | } 460 | 461 | if (widget.enableKeyboardScrolling) { 462 | final arrowsScrollAmount = widget.keyboardScrollConfig.arrowsScrollAmount; 463 | final arrowsScrollDuration = 464 | widget.keyboardScrollConfig.arrowsScrollDuration; 465 | final pageUpDownScrollAmount = 466 | widget.keyboardScrollConfig.pageUpDownScrollAmount; 467 | final pageUpDownScrollDuration = 468 | widget.keyboardScrollConfig.pageUpDownScrollDuration; 469 | final spaceScrollAmount = widget.keyboardScrollConfig.spaceScrollAmount; 470 | final spaceScrollDuration = 471 | widget.keyboardScrollConfig.spaceScrollDuration; 472 | final homeScrollDurationBuilder = 473 | widget.keyboardScrollConfig.homeScrollDurationBuilder; 474 | final endScrollDurationBuilder = 475 | widget.keyboardScrollConfig.endScrollDurationBuilder; 476 | final defaultHomeEndScrollDuration = 477 | widget.keyboardScrollConfig.defaultHomeEndScrollDuration; 478 | final curve = widget.keyboardScrollConfig.scrollCurve; 479 | 480 | child = RawKeyboardListener( 481 | focusNode: _keyboardScrollFocusNode, 482 | onKey: (event) { 483 | if (isVerticalAxis) { 484 | if (event.isKeyPressed(LogicalKeyboardKey.arrowDown)) { 485 | scrollController.animateTo( 486 | scrollController.offset + arrowsScrollAmount, 487 | duration: arrowsScrollDuration, 488 | curve: curve, 489 | ); 490 | } else if (event.isKeyPressed(LogicalKeyboardKey.arrowUp)) { 491 | scrollController.animateTo( 492 | scrollController.offset - arrowsScrollAmount, 493 | duration: arrowsScrollDuration, 494 | curve: curve, 495 | ); 496 | } else if (event.isKeyPressed(LogicalKeyboardKey.pageUp)) { 497 | scrollController.animateTo( 498 | scrollController.offset - pageUpDownScrollAmount, 499 | duration: pageUpDownScrollDuration, 500 | curve: curve, 501 | ); 502 | } else if (event.isKeyPressed(LogicalKeyboardKey.pageDown)) { 503 | scrollController.animateTo( 504 | scrollController.offset + pageUpDownScrollAmount, 505 | duration: pageUpDownScrollDuration, 506 | curve: curve, 507 | ); 508 | } else if (event.isShiftPressed && 509 | event.isKeyPressed(LogicalKeyboardKey.space)) { 510 | scrollController.animateTo( 511 | scrollController.offset - spaceScrollAmount, 512 | duration: spaceScrollDuration, 513 | curve: curve, 514 | ); 515 | } else if (event.isKeyPressed(LogicalKeyboardKey.space)) { 516 | scrollController.animateTo( 517 | scrollController.offset + spaceScrollAmount, 518 | duration: spaceScrollDuration, 519 | curve: curve, 520 | ); 521 | } else if (event.isKeyPressed(LogicalKeyboardKey.home)) { 522 | scrollController.animateTo( 523 | scrollController.position.minScrollExtent, 524 | duration: homeScrollDurationBuilder?.call( 525 | scrollController.offset, 526 | scrollController.position.minScrollExtent, 527 | ) ?? 528 | defaultHomeEndScrollDuration, 529 | curve: curve, 530 | ); 531 | } else if (event.isKeyPressed(LogicalKeyboardKey.end)) { 532 | scrollController.animateTo( 533 | scrollController.position.maxScrollExtent, 534 | duration: endScrollDurationBuilder?.call( 535 | scrollController.offset, 536 | scrollController.position.maxScrollExtent, 537 | ) ?? 538 | defaultHomeEndScrollDuration, 539 | curve: curve, 540 | ); 541 | } 542 | } else { 543 | // 544 | // When direction is horizontal, only allow 545 | // left and right arrow keys and shift-scrolling 546 | if (event.isShiftPressed != _isShiftPressedDown) { 547 | setShiftPressedDown(event.isShiftPressed); 548 | } 549 | 550 | if (event.isKeyPressed(LogicalKeyboardKey.arrowLeft)) { 551 | scrollController.animateTo( 552 | scrollController.offset - arrowsScrollAmount, 553 | duration: arrowsScrollDuration, 554 | curve: curve, 555 | ); 556 | } else if (event.isKeyPressed(LogicalKeyboardKey.arrowRight)) { 557 | scrollController.animateTo( 558 | scrollController.offset + arrowsScrollAmount, 559 | duration: arrowsScrollDuration, 560 | curve: curve, 561 | ); 562 | } 563 | } 564 | }, 565 | child: child, 566 | ); 567 | } 568 | return child; 569 | } 570 | 571 | Widget buildMMBScrollingCustomCursor(CustomScrollCursor cursor) { 572 | switch (_mmbScrollCursorActivity) { 573 | case MMBScrollCursorActivity.idle: 574 | return cursor.idle; 575 | case MMBScrollCursorActivity.scrollingUp: 576 | return cursor.scrollingUp; 577 | case MMBScrollCursorActivity.scrollingDown: 578 | return cursor.scrollingDown; 579 | case MMBScrollCursorActivity.scrollingLeft: 580 | return cursor.scrollingLeft; 581 | case MMBScrollCursorActivity.scrollingRight: 582 | return cursor.scrollingRight; 583 | } 584 | } 585 | } 586 | -------------------------------------------------------------------------------- /lib/src/throttler.dart: -------------------------------------------------------------------------------- 1 | /// Throttle some action by a specified amount of milliseconds 2 | class Throttler { 3 | /// Throttle value 4 | Throttler(this._throttleTimeMs); 5 | 6 | final int _throttleTimeMs; 7 | int? _lastRunTimeMs; 8 | 9 | /// Run the function which needs to be throttled 10 | void run(void Function() action) { 11 | if (_lastRunTimeMs == null) { 12 | action(); 13 | _lastRunTimeMs = DateTime.now().millisecondsSinceEpoch; 14 | } else { 15 | if (DateTime.now().millisecondsSinceEpoch - _lastRunTimeMs! > 16 | _throttleTimeMs) { 17 | action(); 18 | _lastRunTimeMs = DateTime.now().millisecondsSinceEpoch; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.6.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.0" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | lint: 64 | dependency: "direct dev" 65 | description: 66 | name: lint 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "1.6.0" 70 | matcher: 71 | dependency: transitive 72 | description: 73 | name: matcher 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "0.12.10" 77 | meta: 78 | dependency: transitive 79 | description: 80 | name: meta 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.3.0" 84 | path: 85 | dependency: transitive 86 | description: 87 | name: path 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.8.0" 91 | sky_engine: 92 | dependency: transitive 93 | description: flutter 94 | source: sdk 95 | version: "0.0.99" 96 | source_span: 97 | dependency: transitive 98 | description: 99 | name: source_span 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "1.8.1" 103 | stack_trace: 104 | dependency: transitive 105 | description: 106 | name: stack_trace 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.10.0" 110 | stream_channel: 111 | dependency: transitive 112 | description: 113 | name: stream_channel 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "2.1.0" 117 | string_scanner: 118 | dependency: transitive 119 | description: 120 | name: string_scanner 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.1.0" 124 | term_glyph: 125 | dependency: transitive 126 | description: 127 | name: term_glyph 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.2.0" 131 | test_api: 132 | dependency: transitive 133 | description: 134 | name: test_api 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "0.3.0" 138 | typed_data: 139 | dependency: transitive 140 | description: 141 | name: typed_data 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.3.0" 145 | vector_math: 146 | dependency: transitive 147 | description: 148 | name: vector_math 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "2.1.0" 152 | sdks: 153 | dart: ">=2.13.0 <3.0.0" 154 | flutter: ">=1.17.0" 155 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_improved_scrolling 2 | description: Attempt to implement better scrolling for Flutter Web and Desktop. Includes keyboard, MButton and custom mouse wheel scrolling. 3 | version: 0.0.3 4 | homepage: https://github.com/adrianflutur/flutter_improved_scrolling 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | flutter: ">=1.17.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | lint: ^1.6.0 18 | 19 | # For information on the generic Dart part of this file, see the 20 | # following page: https://dart.dev/tools/pub/pubspec 21 | # The following section is specific to Flutter. 22 | flutter: null 23 | # To add assets to your package, add an assets section, like this: 24 | # assets: 25 | # - images/a_dot_burr.jpeg 26 | # - images/a_dot_ham.jpeg 27 | # 28 | # For details regarding assets in packages, see 29 | # https://flutter.dev/assets-and-images/#from-packages 30 | # 31 | # An image asset can refer to one or more resolution-specific "variants", see 32 | # https://flutter.dev/assets-and-images/#resolution-aware. 33 | # To add custom fonts to your package, add a fonts section here, 34 | # in this "flutter" section. Each entry in this list should have a 35 | # "family" key with the font family name, and a "fonts" key with a 36 | # list giving the asset and other descriptors for the font. For 37 | # example: 38 | # fonts: 39 | # - family: Schyler 40 | # fonts: 41 | # - asset: fonts/Schyler-Regular.ttf 42 | # - asset: fonts/Schyler-Italic.ttf 43 | # style: italic 44 | # - family: Trajan Pro 45 | # fonts: 46 | # - asset: fonts/TrajanPro.ttf 47 | # - asset: fonts/TrajanPro_Bold.ttf 48 | # weight: 700 49 | # 50 | # For details regarding fonts in packages, see 51 | # https://flutter.dev/custom-fonts/#from-packages 52 | --------------------------------------------------------------------------------