├── .github └── workflows │ └── test.yml ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── 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 │ │ │ └── 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 ├── assets │ ├── ice_cream_indicator │ │ ├── cup.png │ │ ├── cup2.png │ │ ├── ice1.png │ │ ├── ice2.png │ │ ├── ice3.png │ │ ├── mint.png │ │ └── spoon.png │ └── plane_indicator │ │ ├── cloud1.png │ │ ├── cloud2.png │ │ ├── cloud3.png │ │ ├── cloud4.png │ │ └── plane.png ├── 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 │ └── RunnerTests │ │ └── RunnerTests.swift ├── lib │ ├── indicators │ │ ├── ball_indicator.dart │ │ ├── check_mark_indicator.dart │ │ ├── envelope_indicator.dart │ │ ├── fetch_more_indicator.dart │ │ ├── ice_cream_indicator.dart │ │ ├── plane_indicator.dart │ │ └── warp_indicator.dart │ ├── main.dart │ ├── screens │ │ ├── ball_indicator_screen.dart │ │ ├── check_mark_indicator_screen.dart │ │ ├── custom_material_indicator_screen.dart │ │ ├── envelope_indicator_screen.dart │ │ ├── fetch_more_screen.dart │ │ ├── horizontal_screen.dart │ │ ├── ice_cream_indicator_screen.dart │ │ ├── plane_indicator_screen.dart │ │ ├── presentation_screen.dart │ │ ├── programmatically_controlled_indicator_screen.dart │ │ └── warp_indicator_screen.dart │ ├── utils │ │ ├── mobile_like_scroll_behavior.dart │ │ └── positioned_indicator_container.dart │ └── widgets │ │ ├── example_app_bar.dart │ │ ├── example_list.dart │ │ ├── infinite_rotation.dart │ │ └── web_frame.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── app_icon_1024.png │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ │ └── MainMenu.xib │ │ ├── Configs │ │ │ ├── AppInfo.xcconfig │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements │ └── RunnerTests │ │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── custom_refresh_indicator.dart └── src │ ├── custom_refresh_indicator.dart │ ├── data │ ├── data.dart │ ├── indicator_edge.dart │ ├── indicator_side.dart │ ├── indicator_state.dart │ ├── indicator_state_change.dart │ ├── indicator_trigger_edge.dart │ ├── indicator_trigger_mode.dart │ └── refresh_indicator_durations.dart │ ├── indicator_controller.dart │ ├── physics │ ├── clamping_with_overscroll_physics.dart │ └── physics.dart │ ├── utils │ ├── clamped_animation.dart │ ├── transformed_animation.dart │ └── utils.dart │ └── widgets │ ├── custom_material_indicator.dart │ ├── positioned_indicator_container.dart │ └── widgets.dart ├── pubspec.yaml ├── readme ├── complete_state.gif ├── controller_data.gif ├── cover.png ├── drag_details.gif ├── envelope_indicator.gif ├── fetch_more.gif ├── ice_cream_indicator.gif ├── plane_indicator.gif ├── programmatically_controlled.gif ├── simple_indicator.gif ├── simple_with_opacity.gif └── warp_indicator.gif ├── screenshots └── thumbnail.png └── test └── src ├── controller_test.dart ├── custom_refresh_indicator_test.dart └── data ├── data_test.dart ├── indicator_edge_test.dart └── indicator_side_test.dart /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: pull_request 3 | 4 | jobs: 5 | checks: 6 | name: Analyzer and unit tests 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: subosito/flutter-action@v2.3.0 11 | with: 12 | channel: 'stable' 13 | - name: Getting packages 14 | run: flutter pub get 15 | - name: analyzis 16 | run: flutter analyze . 17 | - name: tests 18 | run: flutter test -------------------------------------------------------------------------------- /.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 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | build/ 31 | /pubspec.lock 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/Generated.xcconfig 62 | **/ios/Flutter/app.flx 63 | **/ios/Flutter/app.zip 64 | **/ios/Flutter/flutter_assets/ 65 | **/ios/Flutter/flutter_export_environment.sh 66 | **/ios/ServiceDefinitions.json 67 | **/ios/Runner/GeneratedPluginRegistrant.* 68 | 69 | # Exceptions to above rules. 70 | !**/ios/**/default.mode1v3 71 | !**/ios/**/default.mode2v3 72 | !**/ios/**/default.pbxuser 73 | !**/ios/**/default.perspectivev3 74 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 75 | 76 | # Flutter version manager 77 | 78 | # FVM Version Cache 79 | .fvm/ -------------------------------------------------------------------------------- /.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: 68587a0916366e9512a78df22c44163d041dd5f3 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Kamil Klyta 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. -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | -------------------------------------------------------------------------------- /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 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Android Studio will place build artifacts here 43 | /android/app/debug 44 | /android/app/profile 45 | /android/app/release 46 | -------------------------------------------------------------------------------- /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: 097d3313d8e2c7f901932d63e537c1acefb87800 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Flutter custom refresh indicator example app 2 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /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 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.example.example" 27 | compileSdkVersion flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.example" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /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/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /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 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | plugins { 14 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 15 | } 16 | } 17 | 18 | include ":app" 19 | 20 | apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" 21 | -------------------------------------------------------------------------------- /example/assets/ice_cream_indicator/cup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/ice_cream_indicator/cup.png -------------------------------------------------------------------------------- /example/assets/ice_cream_indicator/cup2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/ice_cream_indicator/cup2.png -------------------------------------------------------------------------------- /example/assets/ice_cream_indicator/ice1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/ice_cream_indicator/ice1.png -------------------------------------------------------------------------------- /example/assets/ice_cream_indicator/ice2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/ice_cream_indicator/ice2.png -------------------------------------------------------------------------------- /example/assets/ice_cream_indicator/ice3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/ice_cream_indicator/ice3.png -------------------------------------------------------------------------------- /example/assets/ice_cream_indicator/mint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/ice_cream_indicator/mint.png -------------------------------------------------------------------------------- /example/assets/ice_cream_indicator/spoon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/ice_cream_indicator/spoon.png -------------------------------------------------------------------------------- /example/assets/plane_indicator/cloud1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/plane_indicator/cloud1.png -------------------------------------------------------------------------------- /example/assets/plane_indicator/cloud2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/plane_indicator/cloud2.png -------------------------------------------------------------------------------- /example/assets/plane_indicator/cloud3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/plane_indicator/cloud3.png -------------------------------------------------------------------------------- /example/assets/plane_indicator/cloud4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/plane_indicator/cloud4.png -------------------------------------------------------------------------------- /example/assets/plane_indicator/plane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/assets/plane_indicator/plane.png -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /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 | 12.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.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 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/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 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example/lib/indicators/check_mark_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/rendering.dart'; 5 | 6 | class CheckMarkColors { 7 | final Color content; 8 | final Color background; 9 | 10 | const CheckMarkColors({ 11 | required this.content, 12 | required this.background, 13 | }); 14 | } 15 | 16 | class CheckMarkStyle { 17 | final CheckMarkColors loading; 18 | final CheckMarkColors success; 19 | final CheckMarkColors error; 20 | 21 | const CheckMarkStyle({ 22 | required this.loading, 23 | required this.success, 24 | required this.error, 25 | }); 26 | 27 | static const defaultStyle = CheckMarkStyle( 28 | loading: CheckMarkColors( 29 | content: Colors.white, 30 | background: Colors.blueAccent, 31 | ), 32 | success: CheckMarkColors( 33 | content: Colors.black, 34 | background: Colors.greenAccent, 35 | ), 36 | error: CheckMarkColors( 37 | content: Colors.black, 38 | background: Colors.redAccent, 39 | ), 40 | ); 41 | } 42 | 43 | class CheckMarkIndicator extends StatefulWidget { 44 | final Widget child; 45 | final CheckMarkStyle style; 46 | final AsyncCallback onRefresh; 47 | final IndicatorController? controller; 48 | 49 | const CheckMarkIndicator({ 50 | super.key, 51 | required this.child, 52 | this.controller, 53 | this.style = CheckMarkStyle.defaultStyle, 54 | required this.onRefresh, 55 | }); 56 | 57 | @override 58 | State createState() => _CheckMarkIndicatorState(); 59 | } 60 | 61 | class _CheckMarkIndicatorState extends State 62 | with SingleTickerProviderStateMixin { 63 | /// Whether to render check mark instead of spinner 64 | bool _renderCompleteState = false; 65 | 66 | ScrollDirection prevScrollDirection = ScrollDirection.idle; 67 | 68 | bool _hasError = false; 69 | 70 | Future _handleRefresh() async { 71 | try { 72 | setState(() { 73 | _hasError = false; 74 | }); 75 | await widget.onRefresh(); 76 | } catch (_) { 77 | setState(() { 78 | _hasError = true; 79 | }); 80 | rethrow; 81 | } 82 | } 83 | 84 | @override 85 | Widget build(BuildContext context) { 86 | return CustomMaterialIndicator( 87 | controller: widget.controller, 88 | onRefresh: _handleRefresh, 89 | durations: const RefreshIndicatorDurations( 90 | completeDuration: Duration(seconds: 2), 91 | ), 92 | onStateChanged: (change) { 93 | /// set [_renderCompleteState] to true when controller.state become completed 94 | if (change.didChange(to: IndicatorState.complete)) { 95 | _renderCompleteState = true; 96 | 97 | /// set [_renderCompleteState] to false when controller.state become idle 98 | } else if (change.didChange(to: IndicatorState.idle)) { 99 | _renderCompleteState = false; 100 | } 101 | }, 102 | indicatorBuilder: ( 103 | BuildContext context, 104 | IndicatorController controller, 105 | ) { 106 | final CheckMarkColors style; 107 | if (_renderCompleteState) { 108 | if (_hasError) { 109 | style = widget.style.error; 110 | } else { 111 | style = widget.style.success; 112 | } 113 | } else { 114 | style = widget.style.loading; 115 | } 116 | 117 | return AnimatedContainer( 118 | duration: const Duration(milliseconds: 150), 119 | alignment: Alignment.center, 120 | decoration: BoxDecoration( 121 | color: style.background, 122 | shape: BoxShape.circle, 123 | ), 124 | child: _renderCompleteState 125 | ? Icon( 126 | _hasError ? Icons.close : Icons.check, 127 | color: style.content, 128 | ) 129 | : SizedBox( 130 | height: 24, 131 | width: 24, 132 | child: CircularProgressIndicator( 133 | strokeWidth: 2, 134 | color: style.content, 135 | value: controller.isDragging || controller.isArmed 136 | ? controller.value.clamp(0.0, 1.0) 137 | : null, 138 | ), 139 | ), 140 | ); 141 | }, 142 | child: widget.child, 143 | ); 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /example/lib/indicators/envelope_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class EnvelopRefreshIndicator extends StatelessWidget { 5 | final Widget child; 6 | final bool leadingScrollIndicatorVisible; 7 | final bool trailingScrollIndicatorVisible; 8 | final RefreshCallback onRefresh; 9 | final Color? accent; 10 | final IndicatorController? controller; 11 | 12 | static const _circleSize = 70.0; 13 | 14 | static const _blurRadius = 10.0; 15 | static const _defaultShadow = [ 16 | BoxShadow(blurRadius: _blurRadius, color: Colors.black26) 17 | ]; 18 | 19 | const EnvelopRefreshIndicator({ 20 | super.key, 21 | required this.child, 22 | required this.onRefresh, 23 | this.leadingScrollIndicatorVisible = false, 24 | this.trailingScrollIndicatorVisible = false, 25 | this.accent, 26 | this.controller, 27 | }); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | final theme = Theme.of(context); 32 | return CustomRefreshIndicator( 33 | controller: controller, 34 | leadingScrollIndicatorVisible: leadingScrollIndicatorVisible, 35 | trailingScrollIndicatorVisible: trailingScrollIndicatorVisible, 36 | builder: (context, child, controller) => 37 | LayoutBuilder(builder: (context, constraints) { 38 | final widgetWidth = constraints.maxWidth; 39 | final widgetHeight = constraints.maxHeight; 40 | final letterTopWidth = (widgetWidth / 2) + 50; 41 | 42 | final leftValue = (widgetWidth + 43 | _blurRadius - 44 | ((letterTopWidth + _blurRadius) * controller.value / 1)) 45 | .clamp(letterTopWidth - 100, double.infinity); 46 | 47 | final rightShift = widgetWidth + _blurRadius; 48 | final rightValue = (rightShift - (rightShift * controller.value / 1)) 49 | .clamp(0.0, double.infinity); 50 | 51 | final opacity = (controller.value - 1).clamp(0, 0.5) / 0.5; 52 | 53 | final isNotIdle = !controller.isIdle; 54 | return Stack( 55 | children: [ 56 | Transform.scale( 57 | scale: 1 - 0.1 * controller.value.clamp(0.0, 1.0), 58 | child: Container( 59 | foregroundDecoration: BoxDecoration( 60 | border: Border.all( 61 | width: 1, 62 | strokeAlign: BorderSide.strokeAlignOutside, 63 | color: theme.dividerColor, 64 | ), 65 | ), 66 | child: child, 67 | ), 68 | ), 69 | if (isNotIdle) 70 | Positioned( 71 | right: rightValue, 72 | child: Container( 73 | height: widgetHeight, 74 | width: widgetWidth, 75 | decoration: BoxDecoration( 76 | color: theme.colorScheme.surfaceContainer, 77 | boxShadow: _defaultShadow, 78 | border: Border.all( 79 | color: theme.dividerColor, 80 | width: 2, 81 | ), 82 | ), 83 | ), 84 | ), 85 | if (isNotIdle) 86 | Positioned( 87 | left: leftValue, 88 | child: CustomPaint( 89 | size: Size( 90 | letterTopWidth, 91 | widgetHeight, 92 | ), 93 | painter: TrianglePainter( 94 | strokeColor: theme.dividerColor, 95 | color: theme.colorScheme.surfaceContainer, 96 | strokeWidth: 2, 97 | ), 98 | ), 99 | ), 100 | if (controller.value >= 1) 101 | Container( 102 | padding: const EdgeInsets.only(right: 100), 103 | child: Transform.scale( 104 | scale: controller.value, 105 | child: Opacity( 106 | opacity: controller.isLoading || controller.state.isSettling 107 | ? 1 108 | : opacity, 109 | child: Align( 110 | alignment: Alignment.center, 111 | child: Container( 112 | width: _circleSize, 113 | height: _circleSize, 114 | decoration: BoxDecoration( 115 | boxShadow: _defaultShadow, 116 | color: 117 | accent ?? Theme.of(context).colorScheme.primary, 118 | shape: BoxShape.circle, 119 | ), 120 | child: Stack( 121 | fit: StackFit.expand, 122 | alignment: Alignment.center, 123 | children: [ 124 | Padding( 125 | padding: const EdgeInsets.all(4.0), 126 | child: CircularProgressIndicator( 127 | strokeWidth: 2, 128 | valueColor: AlwaysStoppedAnimation( 129 | Theme.of(context).colorScheme.onPrimary, 130 | ), 131 | value: controller.isLoading ? null : 0, 132 | ), 133 | ), 134 | Icon( 135 | Icons.mail_outline, 136 | color: Theme.of(context).colorScheme.onPrimary, 137 | size: 35, 138 | ), 139 | ], 140 | ), 141 | ), 142 | ), 143 | ), 144 | ), 145 | ) 146 | ], 147 | ); 148 | }), 149 | child: child, 150 | onRefresh: () => Future.delayed(const Duration(seconds: 2)), 151 | ); 152 | } 153 | } 154 | 155 | class TrianglePainter extends CustomPainter { 156 | final Color? strokeColor; 157 | final Color color; 158 | final double strokeWidth; 159 | 160 | static double convertRadiusToSigma(double radius) { 161 | return radius * 0.57735 + 0.5; 162 | } 163 | 164 | TrianglePainter({ 165 | this.strokeColor = Colors.black, 166 | this.color = Colors.white, 167 | this.strokeWidth = 2, 168 | }); 169 | 170 | @override 171 | void paint(Canvas canvas, Size size) { 172 | final path = getTrianglePath(size.width, size.height); 173 | 174 | Paint backgroundPaint = Paint() 175 | ..color = color 176 | ..strokeWidth = strokeWidth 177 | ..style = PaintingStyle.fill; 178 | final shadowPaint = Paint() 179 | ..color = Colors.black.withAlpha(50) 180 | ..maskFilter = 181 | MaskFilter.blur(BlurStyle.normal, convertRadiusToSigma(10)); 182 | canvas 183 | ..drawPath(path, shadowPaint) 184 | ..drawPath(path, backgroundPaint); 185 | 186 | final strokeColor = this.strokeColor; 187 | if (strokeColor != null) { 188 | Paint strokePaint = Paint() 189 | ..color = strokeColor 190 | ..strokeWidth = strokeWidth 191 | ..style = PaintingStyle.stroke; 192 | canvas.drawPath(path, strokePaint); 193 | } 194 | } 195 | 196 | Path getTrianglePath(double x, double y) { 197 | return Path() 198 | ..moveTo(0, y / 2) 199 | ..lineTo(x, 0) 200 | ..lineTo(x, y) 201 | ..lineTo(0, y / 2); 202 | } 203 | 204 | @override 205 | bool shouldRepaint(TrianglePainter oldDelegate) { 206 | return oldDelegate.strokeColor != strokeColor || 207 | oldDelegate.color != color || 208 | oldDelegate.strokeWidth != strokeWidth; 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /example/lib/indicators/fetch_more_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class FetchMoreIndicator extends StatelessWidget { 5 | final Widget child; 6 | final VoidCallback onAction; 7 | 8 | const FetchMoreIndicator({ 9 | super.key, 10 | required this.child, 11 | required this.onAction, 12 | }); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | const height = 150.0; 17 | return CustomRefreshIndicator( 18 | onRefresh: () async => onAction(), 19 | trigger: IndicatorTrigger.trailingEdge, 20 | trailingScrollIndicatorVisible: false, 21 | leadingScrollIndicatorVisible: true, 22 | durations: const RefreshIndicatorDurations( 23 | completeDuration: Duration(seconds: 1), 24 | ), 25 | child: child, 26 | builder: ( 27 | BuildContext context, 28 | Widget child, 29 | IndicatorController controller, 30 | ) { 31 | return AnimatedBuilder( 32 | animation: controller, 33 | builder: (context, _) { 34 | final dy = controller.value.clamp(0.0, 1.25) * 35 | -(height - (height * 0.25)); 36 | return Stack( 37 | children: [ 38 | child, 39 | PositionedIndicatorContainer( 40 | controller: controller, 41 | displacement: 0, 42 | child: Container( 43 | padding: const EdgeInsets.all(8.0), 44 | transform: Matrix4.translationValues(0.0, dy, 0.0), 45 | child: switch (controller.state) { 46 | IndicatorState.idle => null, 47 | IndicatorState.dragging || 48 | IndicatorState.canceling || 49 | IndicatorState.armed || 50 | IndicatorState.settling => 51 | const Column( 52 | children: [ 53 | Icon(Icons.keyboard_arrow_up), 54 | Text("Pull to fetch more"), 55 | ], 56 | ), 57 | IndicatorState.loading => Column( 58 | children: [ 59 | Container( 60 | margin: const EdgeInsets.only(bottom: 8.0), 61 | width: 16, 62 | height: 16, 63 | child: const CircularProgressIndicator( 64 | strokeWidth: 2, 65 | ), 66 | ), 67 | const Text("Fetching..."), 68 | ], 69 | ), 70 | IndicatorState.complete || 71 | IndicatorState.finalizing => 72 | const Text("Fetched 🚀"), 73 | }), 74 | ), 75 | ], 76 | ); 77 | }); 78 | }, 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /example/lib/indicators/ice_cream_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class ParallaxConfig { 7 | final int level; 8 | final AssetImage image; 9 | 10 | const ParallaxConfig({ 11 | required this.level, 12 | required this.image, 13 | }); 14 | } 15 | 16 | class IceCreamIndicator extends StatefulWidget { 17 | final Widget child; 18 | final IndicatorController? controller; 19 | 20 | const IceCreamIndicator({ 21 | super.key, 22 | required this.child, 23 | this.controller, 24 | }); 25 | 26 | @override 27 | State createState() => _IceCreamIndicatorState(); 28 | } 29 | 30 | class _IceCreamIndicatorState extends State 31 | with SingleTickerProviderStateMixin { 32 | static const _assets = [ 33 | ParallaxConfig( 34 | image: AssetImage("assets/ice_cream_indicator/cup2.png"), 35 | level: 0, 36 | ), 37 | ParallaxConfig( 38 | image: AssetImage("assets/ice_cream_indicator/spoon.png"), 39 | level: 1, 40 | ), 41 | ParallaxConfig( 42 | image: AssetImage("assets/ice_cream_indicator/ice1.png"), 43 | level: 3, 44 | ), 45 | ParallaxConfig( 46 | image: AssetImage("assets/ice_cream_indicator/ice3.png"), 47 | level: 4, 48 | ), 49 | ParallaxConfig( 50 | image: AssetImage("assets/ice_cream_indicator/ice2.png"), 51 | level: 2, 52 | ), 53 | ParallaxConfig( 54 | image: AssetImage("assets/ice_cream_indicator/cup.png"), 55 | level: 0, 56 | ), 57 | ParallaxConfig( 58 | image: AssetImage("assets/ice_cream_indicator/mint.png"), 59 | level: 5, 60 | ), 61 | ]; 62 | 63 | static const _indicatorSize = 150.0; 64 | static const _imageSize = 140.0; 65 | 66 | late AnimationController _spoonController; 67 | static final _spoonTween = CurveTween(curve: Curves.easeInOut); 68 | 69 | @override 70 | void initState() { 71 | _spoonController = 72 | AnimationController(vsync: this, duration: const Duration(seconds: 1)); 73 | WidgetsBinding.instance.addPostFrameCallback((_) => _precacheImages()); 74 | super.initState(); 75 | } 76 | 77 | void _precacheImages() { 78 | for (final config in _assets) { 79 | unawaited(precacheImage(config.image, context)); 80 | } 81 | } 82 | 83 | Widget _buildImage(IndicatorController controller, ParallaxConfig asset) { 84 | return Transform.translate( 85 | offset: Offset( 86 | 0, 87 | -(asset.level * (controller.value.clamp(1.0, 1.5) - 1.0) * 20) + 10, 88 | ), 89 | child: OverflowBox( 90 | maxHeight: _imageSize, 91 | minHeight: _imageSize, 92 | child: Image( 93 | image: asset.image, 94 | fit: BoxFit.contain, 95 | height: _imageSize, 96 | ), 97 | ), 98 | ); 99 | } 100 | 101 | @override 102 | Widget build(BuildContext context) { 103 | return CustomRefreshIndicator( 104 | controller: widget.controller, 105 | offsetToArmed: _indicatorSize, 106 | onRefresh: () => Future.delayed(const Duration(seconds: 4)), 107 | autoRebuild: false, 108 | child: widget.child, 109 | onStateChanged: (change) { 110 | if (change.didChange(to: IndicatorState.loading)) { 111 | _spoonController.repeat(reverse: true); 112 | } else if (change.didChange(from: IndicatorState.loading)) { 113 | _spoonController.stop(); 114 | } else if (change.didChange(to: IndicatorState.idle)) { 115 | _spoonController.value = 0.0; 116 | } 117 | }, 118 | builder: ( 119 | BuildContext context, 120 | Widget child, 121 | IndicatorController controller, 122 | ) { 123 | return Stack( 124 | children: [ 125 | AnimatedBuilder( 126 | animation: controller, 127 | builder: (BuildContext context, Widget? _) { 128 | return SizedBox( 129 | height: controller.value * _indicatorSize, 130 | child: Stack( 131 | children: [ 132 | for (int i = 0; i < _assets.length; i++) 133 | 134 | /// checking for spoon build animation and attaching the spoon controller 135 | if (i == 1) 136 | AnimatedBuilder( 137 | animation: _spoonController, 138 | child: _buildImage(controller, _assets[i]), 139 | builder: (context, child) { 140 | return Transform.rotate( 141 | angle: (-_spoonTween 142 | .transform(_spoonController.value)) * 143 | 1.25, 144 | child: child, 145 | ); 146 | }, 147 | ) 148 | else 149 | _buildImage(controller, _assets[i]) 150 | ], 151 | ), 152 | ); 153 | }, 154 | ), 155 | AnimatedBuilder( 156 | builder: (context, _) { 157 | return Transform.translate( 158 | offset: Offset(0.0, controller.value * _indicatorSize), 159 | child: child, 160 | ); 161 | }, 162 | animation: controller, 163 | ), 164 | ], 165 | ); 166 | }, 167 | ); 168 | } 169 | 170 | @override 171 | void dispose() { 172 | _spoonController.dispose(); 173 | super.dispose(); 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/screens/ball_indicator_screen.dart'; 2 | import 'package:example/screens/envelope_indicator_screen.dart'; 3 | import 'package:example/screens/horizontal_screen.dart'; 4 | import 'package:example/screens/presentation_screen.dart'; 5 | import 'package:example/screens/programmatically_controlled_indicator_screen.dart'; 6 | import 'package:example/widgets/web_frame.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter/services.dart'; 9 | 10 | import 'screens/custom_material_indicator_screen.dart'; 11 | import 'screens/fetch_more_screen.dart'; 12 | import 'screens/ice_cream_indicator_screen.dart'; 13 | import 'screens/plane_indicator_screen.dart'; 14 | import 'screens/check_mark_indicator_screen.dart'; 15 | import 'screens/warp_indicator_screen.dart'; 16 | import 'utils/mobile_like_scroll_behavior.dart'; 17 | import 'widgets/example_list.dart'; 18 | 19 | void main() async { 20 | WidgetsFlutterBinding.ensureInitialized(); 21 | await SystemChrome.setPreferredOrientations([ 22 | DeviceOrientation.portraitUp, 23 | ]); 24 | runApp(const MyApp()); 25 | } 26 | 27 | class MyApp extends StatelessWidget { 28 | const MyApp({super.key}); 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return MaterialApp( 33 | scrollBehavior: const MobileLikeScrollBehavior(), 34 | title: 'CustomRefreshIndicator Demo', 35 | theme: ThemeData.dark(), 36 | home: const MainScreen(), 37 | builder: (context, child) => WebFrame(child: child), 38 | routes: { 39 | '/presentation': (context) => const PresentationScreen(), 40 | '/example': (context) => const CustomMaterialIndicatorScreen(), 41 | '/plane': (context) => const PlaneIndicatorScreen(), 42 | '/ice-cream': (context) => const IceCreamIndicatorScreen(), 43 | '/drag-details': (context) => const BallIndicatorScreen(), 44 | '/check-mark': (context) => const CheckMarkIndicatorScreen(), 45 | '/warp': (context) => const WarpIndicatorScreen(), 46 | '/envelope': (context) => const EnvelopIndicatorScreen(), 47 | '/fetch-more': (context) => const FetchMoreScreen(), 48 | '/horizontal': (context) => const HorizontalScreen(), 49 | '/programmatically-controlled': (context) => 50 | const ProgrammaticallyControlled(), 51 | }, 52 | ); 53 | } 54 | } 55 | 56 | class MainScreen extends StatelessWidget { 57 | const MainScreen({super.key}); 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return Scaffold( 62 | appBar: AppBar( 63 | title: const Text("Examples"), 64 | ), 65 | body: SafeArea( 66 | child: ListView( 67 | padding: const EdgeInsets.all(16), 68 | children: [ 69 | ElevatedButton( 70 | child: Container( 71 | height: 50, 72 | alignment: Alignment.center, 73 | child: const Text("Overview"), 74 | ), 75 | onPressed: () => Navigator.pushNamed( 76 | context, 77 | '/presentation', 78 | ), 79 | ), 80 | const SizedBox(height: 16), 81 | ElevatedButton( 82 | child: Container( 83 | height: 50, 84 | alignment: Alignment.center, 85 | child: const Text("Custom Material Indicator"), 86 | ), 87 | onPressed: () => Navigator.pushNamed( 88 | context, 89 | '/example', 90 | ), 91 | ), 92 | const ListSection(label: "Use cases"), 93 | const SizedBox(height: 16), 94 | ElevatedButton( 95 | child: Container( 96 | height: 50, 97 | alignment: Alignment.center, 98 | child: const Text("Multidirectional"), 99 | ), 100 | onPressed: () => Navigator.pushNamed( 101 | context, 102 | '/horizontal', 103 | ), 104 | ), 105 | const SizedBox(height: 16), 106 | ElevatedButton( 107 | child: Container( 108 | height: 50, 109 | alignment: Alignment.center, 110 | child: const Text("Complete state"), 111 | ), 112 | onPressed: () => Navigator.pushNamed( 113 | context, 114 | '/check-mark', 115 | ), 116 | ), 117 | const SizedBox(height: 16), 118 | ElevatedButton( 119 | child: Container( 120 | height: 50, 121 | alignment: Alignment.center, 122 | child: const Text("Drag details (Ball)"), 123 | ), 124 | onPressed: () => Navigator.pushNamed( 125 | context, 126 | '/drag-details', 127 | ), 128 | ), 129 | const SizedBox(height: 16), 130 | ElevatedButton( 131 | child: Container( 132 | height: 50, 133 | alignment: Alignment.center, 134 | child: const Text("Programmatically-controlled (Warp)"), 135 | ), 136 | onPressed: () => Navigator.pushNamed( 137 | context, 138 | '/programmatically-controlled', 139 | ), 140 | ), 141 | const ListSection(label: "Indicator examples"), 142 | ElevatedButton( 143 | child: Container( 144 | height: 50, 145 | alignment: Alignment.center, 146 | child: const Text("Pull up to fetch more"), 147 | ), 148 | onPressed: () => Navigator.pushNamed( 149 | context, 150 | '/fetch-more', 151 | ), 152 | ), 153 | const SizedBox(height: 16), 154 | ElevatedButton( 155 | child: Container( 156 | height: 50, 157 | alignment: Alignment.center, 158 | child: const Text("Plane"), 159 | ), 160 | onPressed: () => Navigator.pushNamed( 161 | context, 162 | '/plane', 163 | ), 164 | ), 165 | const SizedBox(height: 16), 166 | ElevatedButton( 167 | child: Container( 168 | height: 50, 169 | alignment: Alignment.center, 170 | child: const Text("Ice cream"), 171 | ), 172 | onPressed: () => Navigator.pushNamed( 173 | context, 174 | '/ice-cream', 175 | ), 176 | ), 177 | const SizedBox(height: 16), 178 | ElevatedButton( 179 | child: Container( 180 | height: 50, 181 | alignment: Alignment.center, 182 | child: const Text("Warp indicator"), 183 | ), 184 | onPressed: () => Navigator.pushNamed( 185 | context, 186 | '/warp', 187 | ), 188 | ), 189 | const SizedBox(height: 16), 190 | ElevatedButton( 191 | child: Container( 192 | height: 50, 193 | alignment: Alignment.center, 194 | child: const Text("Envelope indicator"), 195 | ), 196 | onPressed: () => Navigator.pushNamed( 197 | context, 198 | '/envelope', 199 | ), 200 | ), 201 | ], 202 | ), 203 | ), 204 | ); 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /example/lib/screens/ball_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/indicators/ball_indicator.dart'; 3 | import 'package:example/widgets/example_app_bar.dart'; 4 | import 'package:example/widgets/example_list.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class BallIndicatorScreen extends StatefulWidget { 8 | const BallIndicatorScreen({super.key}); 9 | 10 | @override 11 | State createState() => _BallIndicatorScreenState(); 12 | } 13 | 14 | class _BallIndicatorScreenState extends State { 15 | final _controller = IndicatorController(); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: const ExampleAppBar( 21 | title: "Drag details", 22 | ), 23 | body: SafeArea( 24 | child: BallIndicator( 25 | controller: _controller, 26 | ballColors: const [ 27 | Colors.blue, 28 | Colors.red, 29 | Colors.green, 30 | Colors.amber, 31 | Colors.pink, 32 | Colors.purple, 33 | Colors.cyan, 34 | Colors.orange, 35 | Colors.yellow, 36 | ], 37 | onRefresh: () async { 38 | await Future.delayed(const Duration(seconds: 5)); 39 | }, 40 | child: ExampleList( 41 | physics: AlwaysScrollableScrollPhysics( 42 | parent: ClampingWithOverscrollPhysics(state: _controller), 43 | ), 44 | leading: Column( 45 | children: [ 46 | const ListHelpBox( 47 | child: Text( 48 | r"You can create indicators based on user drag details.", 49 | ), 50 | ), 51 | ListHelpBox( 52 | margin: const EdgeInsets.fromLTRB(16, 0, 16, 16), 53 | child: ListenableBuilder( 54 | listenable: _controller, 55 | builder: (_, __) => Column( 56 | children: [ 57 | const Expanded( 58 | child: Text( 59 | "This indicator is based on the local position of the drag details, " 60 | "which is currently: ", 61 | ), 62 | ), 63 | const SizedBox(height: 8), 64 | ListHelpBox( 65 | icon: Icons.data_object_sharp, 66 | child: Text( 67 | "${_controller.dragDetails?.localPosition}", 68 | ), 69 | ) 70 | ], 71 | ), 72 | ), 73 | ), 74 | ], 75 | ), 76 | ), 77 | ), 78 | ), 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /example/lib/screens/check_mark_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/indicators/check_mark_indicator.dart'; 3 | import 'package:example/widgets/example_app_bar.dart'; 4 | import 'package:example/widgets/example_list.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class CheckMarkIndicatorScreen extends StatefulWidget { 8 | const CheckMarkIndicatorScreen({super.key}); 9 | 10 | @override 11 | State createState() => 12 | _CheckMarkIndicatorScreenState(); 13 | } 14 | 15 | class _CheckMarkIndicatorScreenState extends State { 16 | final _controller = IndicatorController(); 17 | bool _useError = false; 18 | @override 19 | Widget build(BuildContext context) { 20 | return Scaffold( 21 | appBar: const ExampleAppBar( 22 | title: "Complete state", 23 | ), 24 | body: SafeArea( 25 | child: CheckMarkIndicator( 26 | controller: _controller, 27 | onRefresh: () async { 28 | await Future.delayed(const Duration(seconds: 2)); 29 | if (_useError) { 30 | throw Exception("Fake exception"); 31 | } 32 | }, 33 | child: ExampleList( 34 | physics: AlwaysScrollableScrollPhysics( 35 | parent: ClampingWithOverscrollPhysics(state: _controller), 36 | ), 37 | leading: Column( 38 | children: [ 39 | const ListHelpBox( 40 | child: Text( 41 | 'You can specify the "complete state" duration to enable the additional state of the indicator widget.', 42 | ), 43 | ), 44 | const ListHelpBox( 45 | margin: EdgeInsets.fromLTRB(16, 0, 16, 16), 46 | child: Text( 47 | 'To configure it, please check the durations parameter of the CustomRefreshIndicator widget.', 48 | ), 49 | ), 50 | ListHelpBox( 51 | margin: const EdgeInsets.fromLTRB(16, 0, 16, 16), 52 | child: SwitchListTile( 53 | contentPadding: EdgeInsets.zero, 54 | title: Text( 55 | "Simulate unsuccessful fetches", 56 | style: Theme.of(context).textTheme.bodyMedium, 57 | ), 58 | value: _useError, 59 | onChanged: (useError) { 60 | setState(() { 61 | _useError = useError; 62 | }); 63 | }, 64 | ), 65 | ), 66 | ], 67 | ), 68 | ), 69 | ), 70 | ), 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /example/lib/screens/custom_material_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/widgets/example_app_bar.dart'; 3 | import 'package:example/widgets/example_list.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class CustomMaterialIndicatorScreen extends StatefulWidget { 7 | const CustomMaterialIndicatorScreen({super.key}); 8 | 9 | @override 10 | State createState() => 11 | _CustomMaterialIndicatorScreenState(); 12 | } 13 | 14 | class _CustomMaterialIndicatorScreenState 15 | extends State { 16 | final _controller = IndicatorController(); 17 | 18 | bool _useCustom = true; 19 | 20 | void _toggleCustom(bool useCustom) { 21 | // if no change exit 22 | if (_useCustom == useCustom) return; 23 | 24 | setState(() { 25 | _useCustom = useCustom; 26 | }); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | final child = ExampleList( 32 | leading: const Column( 33 | children: [ 34 | ListHelpBox( 35 | child: Text( 36 | "Use the toggle on the app bar to change between CustomMaterialIndicator " 37 | "and the built-in RefreshIndicator widget.", 38 | ), 39 | ), 40 | ListHelpBox( 41 | margin: EdgeInsets.fromLTRB(16, 0, 16, 16), 42 | child: Text( 43 | "Can you spot the difference? 😉", 44 | ), 45 | ), 46 | ], 47 | ), 48 | itemCount: 12, 49 | physics: AlwaysScrollableScrollPhysics( 50 | parent: _useCustom 51 | ? ClampingWithOverscrollPhysics(state: _controller) 52 | : const ClampingScrollPhysics(), 53 | ), 54 | ); 55 | return Scaffold( 56 | appBar: ExampleAppBar( 57 | elevation: 0, 58 | title: _useCustom ? "CustomMaterialIndicator" : "RefreshIndicator", 59 | actions: [ 60 | Switch( 61 | value: _useCustom, 62 | onChanged: _toggleCustom, 63 | ), 64 | ], 65 | ), 66 | body: SafeArea( 67 | child: Container( 68 | child: _useCustom 69 | ? CustomMaterialIndicator( 70 | clipBehavior: Clip.antiAlias, 71 | trigger: IndicatorTrigger.bothEdges, 72 | triggerMode: IndicatorTriggerMode.anywhere, 73 | onRefresh: () => Future.delayed(const Duration(seconds: 2)), 74 | child: child, 75 | ) 76 | : RefreshIndicator( 77 | onRefresh: () => Future.delayed(const Duration(seconds: 2)), 78 | triggerMode: RefreshIndicatorTriggerMode.anywhere, 79 | child: child, 80 | ), 81 | ), 82 | ), 83 | ); 84 | } 85 | 86 | @override 87 | void dispose() { 88 | _controller.dispose(); 89 | super.dispose(); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /example/lib/screens/envelope_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/indicators/envelope_indicator.dart'; 3 | import 'package:example/widgets/example_app_bar.dart'; 4 | import 'package:example/widgets/example_list.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class EnvelopIndicatorScreen extends StatefulWidget { 8 | const EnvelopIndicatorScreen({super.key}); 9 | 10 | @override 11 | State createState() => _EnvelopIndicatorScreenState(); 12 | } 13 | 14 | class _EnvelopIndicatorScreenState extends State { 15 | final _controller = IndicatorController(); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: const ExampleAppBar( 21 | title: "Envelope indicator", 22 | ), 23 | body: EnvelopRefreshIndicator( 24 | controller: _controller, 25 | onRefresh: () => Future.delayed(const Duration(seconds: 2)), 26 | child: ExampleList( 27 | physics: AlwaysScrollableScrollPhysics( 28 | parent: ClampingWithOverscrollPhysics(state: _controller), 29 | ), 30 | ), 31 | ), 32 | ); 33 | } 34 | 35 | @override 36 | void dispose() { 37 | _controller.dispose(); 38 | super.dispose(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /example/lib/screens/fetch_more_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/indicators/fetch_more_indicator.dart'; 2 | import 'package:example/widgets/example_app_bar.dart'; 3 | import 'package:example/widgets/example_list.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class FetchMoreScreen extends StatefulWidget { 7 | const FetchMoreScreen({super.key}); 8 | 9 | @override 10 | State createState() => _FetchMoreScreenState(); 11 | } 12 | 13 | class _FetchMoreScreenState extends State { 14 | int _itemsCount = 10; 15 | 16 | Future _fetchMore() async { 17 | // Simulate fetch time 18 | await Future.delayed(const Duration(seconds: 2)); 19 | // make sure that the widget is still mounted. 20 | if (!mounted) return; 21 | // Add more fake elements 22 | setState(() { 23 | _itemsCount += 10; 24 | }); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return Scaffold( 30 | appBar: const ExampleAppBar(title: "Pull to fetch more"), 31 | body: FetchMoreIndicator( 32 | onAction: _fetchMore, 33 | child: ExampleList( 34 | leading: const ListHelpBox( 35 | child: Text( 36 | "Scroll to the end of the list " 37 | "and pull up to retrieve more rows.", 38 | ), 39 | ), 40 | itemCount: _itemsCount, 41 | countElements: true, 42 | ), 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /example/lib/screens/horizontal_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/widgets/example_app_bar.dart'; 3 | import 'package:example/widgets/example_list.dart'; 4 | import 'package:example/widgets/infinite_rotation.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class HorizontalScreen extends StatefulWidget { 8 | const HorizontalScreen({super.key}); 9 | 10 | @override 11 | State createState() => _HorizontalScreenState(); 12 | } 13 | 14 | class _HorizontalScreenState extends State { 15 | bool _isHorizontal = true; 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: ExampleAppBar( 20 | title: "Multidirectional indicator", 21 | actions: [ 22 | IconButton( 23 | tooltip: "Change axis", 24 | onPressed: () { 25 | setState(() { 26 | _isHorizontal = !_isHorizontal; 27 | }); 28 | }, 29 | icon: _isHorizontal 30 | ? const Icon(Icons.swap_horizontal_circle) 31 | : const Icon(Icons.swap_vert_circle), 32 | ) 33 | ], 34 | ), 35 | body: SafeArea( 36 | child: CustomMaterialIndicator( 37 | leadingScrollIndicatorVisible: false, 38 | trailingScrollIndicatorVisible: false, 39 | triggerMode: IndicatorTriggerMode.anywhere, 40 | trigger: IndicatorTrigger.bothEdges, 41 | indicatorBuilder: (context, controller) { 42 | return InfiniteRotation( 43 | running: controller.state.isLoading, 44 | child: const Icon( 45 | Icons.accessibility, 46 | size: 30, 47 | ), 48 | ); 49 | }, 50 | onRefresh: () => Future.delayed(const Duration(seconds: 2)), 51 | child: ExampleHorizontalList( 52 | leading: const ListHelpBox( 53 | child: Text( 54 | 'The indicator can be triggered from both sides. ' 55 | 'A button located on the app bar can be used to change the axis.', 56 | ), 57 | ), 58 | itemCount: 4, 59 | isHorizontal: _isHorizontal, 60 | ), 61 | ), 62 | ), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /example/lib/screens/ice_cream_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/indicators/ice_cream_indicator.dart'; 3 | import 'package:example/widgets/example_app_bar.dart'; 4 | import 'package:example/widgets/example_list.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class IceCreamIndicatorScreen extends StatefulWidget { 8 | const IceCreamIndicatorScreen({super.key}); 9 | 10 | @override 11 | State createState() => 12 | _IceCreamIndicatorScreenState(); 13 | } 14 | 15 | class _IceCreamIndicatorScreenState extends State { 16 | final _controller = IndicatorController(); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Scaffold( 21 | appBar: const ExampleAppBar(), 22 | body: SafeArea( 23 | child: IceCreamIndicator( 24 | controller: _controller, 25 | child: ExampleList( 26 | physics: AlwaysScrollableScrollPhysics( 27 | parent: ClampingWithOverscrollPhysics(state: _controller), 28 | ), 29 | ), 30 | ), 31 | ), 32 | ); 33 | } 34 | 35 | @override 36 | void dispose() { 37 | _controller.dispose(); 38 | super.dispose(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /example/lib/screens/plane_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/indicators/plane_indicator.dart'; 3 | import 'package:example/widgets/example_app_bar.dart'; 4 | import 'package:example/widgets/example_list.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class PlaneIndicatorScreen extends StatefulWidget { 8 | const PlaneIndicatorScreen({super.key}); 9 | 10 | @override 11 | State createState() => _PlaneIndicatorScreenState(); 12 | } 13 | 14 | class _PlaneIndicatorScreenState extends State { 15 | final _controller = IndicatorController(); 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: const ExampleAppBar(), 20 | body: PlaneIndicator( 21 | controller: _controller, 22 | child: ExampleList( 23 | physics: AlwaysScrollableScrollPhysics( 24 | parent: ClampingWithOverscrollPhysics(state: _controller), 25 | ), 26 | ), 27 | ), 28 | ); 29 | } 30 | 31 | @override 32 | void dispose() { 33 | _controller.dispose(); 34 | super.dispose(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /example/lib/screens/programmatically_controlled_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 4 | import 'package:example/indicators/warp_indicator.dart'; 5 | import 'package:example/widgets/example_app_bar.dart'; 6 | import 'package:example/widgets/example_list.dart'; 7 | import 'package:flutter/material.dart'; 8 | 9 | class ProgrammaticallyControlled extends StatefulWidget { 10 | const ProgrammaticallyControlled({super.key}); 11 | 12 | @override 13 | State createState() => 14 | _ProgrammaticallyControlledState(); 15 | } 16 | 17 | class _ProgrammaticallyControlledState 18 | extends State { 19 | final key = GlobalKey(); 20 | 21 | final controller = IndicatorController(refreshEnabled: false); 22 | 23 | bool _startedManually = false; 24 | 25 | int _itemsCount = 4; 26 | Future onRefresh() async { 27 | await Future.delayed(const Duration(seconds: 2)); 28 | if (!mounted) return; 29 | setState(() { 30 | _itemsCount = Random().nextInt(4) + 1; 31 | }); 32 | } 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | return Scaffold( 37 | appBar: ExampleAppBar( 38 | title: "Programmatically-controlled", 39 | actions: [ 40 | AnimatedBuilder( 41 | animation: controller, 42 | builder: (context, _) { 43 | return Row( 44 | children: [ 45 | IconButton( 46 | onPressed: controller.isIdle 47 | ? () { 48 | key.currentState!.show( 49 | draggingCurve: Curves.easeOutBack, 50 | ); 51 | _startedManually = true; 52 | } 53 | : null, 54 | icon: const Icon(Icons.play_arrow), 55 | ), 56 | IconButton( 57 | onPressed: controller.isIdle 58 | ? () => key.currentState!.refresh( 59 | draggingCurve: Curves.easeOutBack, 60 | ) 61 | : null, 62 | icon: const Icon(Icons.refresh), 63 | ), 64 | IconButton( 65 | onPressed: controller.isLoading && _startedManually 66 | ? () { 67 | key.currentState!.hide(); 68 | _startedManually = false; 69 | } 70 | : null, 71 | icon: const Icon(Icons.stop), 72 | ), 73 | ], 74 | ); 75 | }, 76 | ), 77 | ], 78 | ), 79 | body: WarpIndicator( 80 | controller: controller, 81 | indicatorKey: key, 82 | onRefresh: onRefresh, 83 | child: ExampleList( 84 | leading: const ListHelpBox( 85 | child: Text( 86 | 'You can use the buttons located in the app bar to control the state of the indicator.', 87 | ), 88 | ), 89 | itemCount: _itemsCount, 90 | ), 91 | ), 92 | ); 93 | } 94 | 95 | @override 96 | void dispose() { 97 | controller.dispose(); 98 | super.dispose(); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /example/lib/screens/warp_indicator_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:example/widgets/example_app_bar.dart'; 3 | import 'package:example/widgets/example_list.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | import '../indicators/warp_indicator.dart'; 7 | 8 | class WarpIndicatorScreen extends StatefulWidget { 9 | const WarpIndicatorScreen({super.key}); 10 | 11 | @override 12 | State createState() => _WarpIndicatorScreenState(); 13 | } 14 | 15 | class _WarpIndicatorScreenState extends State { 16 | final _controller = IndicatorController(); 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: const ExampleAppBar(), 21 | body: SafeArea( 22 | child: WarpIndicator( 23 | controller: _controller, 24 | onRefresh: () => Future.delayed(const Duration(seconds: 2)), 25 | child: ExampleList( 26 | physics: AlwaysScrollableScrollPhysics( 27 | parent: ClampingWithOverscrollPhysics(state: _controller), 28 | ), 29 | ), 30 | ), 31 | ), 32 | ); 33 | } 34 | 35 | @override 36 | void dispose() { 37 | _controller.dispose(); 38 | super.dispose(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /example/lib/utils/mobile_like_scroll_behavior.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | class MobileLikeScrollBehavior extends MaterialScrollBehavior { 6 | const MobileLikeScrollBehavior(); 7 | 8 | @override 9 | Set get dragDevices => { 10 | PointerDeviceKind.touch, 11 | PointerDeviceKind.mouse, 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /example/lib/utils/positioned_indicator_container.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class PositionedIndicatorContainer extends StatelessWidget { 5 | final IndicatorController controller; 6 | final Widget child; 7 | 8 | /// Position child widget in a similar way 9 | /// to the built-in [RefreshIndicator] widget. 10 | const PositionedIndicatorContainer({ 11 | super.key, 12 | required this.controller, 13 | required this.child, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | if (controller.side.isNone) return const SizedBox(); 19 | 20 | final double positionFromSide = -50 + (controller.value * 110); 21 | 22 | final verticalSide = controller.side.isTop || controller.side.isBottom; 23 | final horizontalSide = controller.side.isLeft || controller.side.isRight; 24 | 25 | return Positioned( 26 | top: horizontalSide 27 | ? 0 28 | : controller.side.isTop 29 | ? positionFromSide 30 | : null, 31 | bottom: horizontalSide 32 | ? 0 33 | : controller.side.isBottom 34 | ? positionFromSide 35 | : null, 36 | left: verticalSide 37 | ? 0 38 | : controller.side.isLeft 39 | ? positionFromSide 40 | : null, 41 | right: verticalSide 42 | ? 0 43 | : controller.side.isRight 44 | ? positionFromSide 45 | : null, 46 | child: child, 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /example/lib/widgets/example_app_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ExampleAppBar extends StatelessWidget implements PreferredSizeWidget { 4 | final String? title; 5 | final List? actions; 6 | final double elevation; 7 | 8 | const ExampleAppBar({ 9 | super.key, 10 | this.title, 11 | this.actions, 12 | this.elevation = 1.0, 13 | }); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return AppBar( 18 | title: Text( 19 | title ?? "custom_refresh_indicator", 20 | ), 21 | actions: actions, 22 | elevation: elevation, 23 | ); 24 | } 25 | 26 | @override 27 | Size get preferredSize => const Size.fromHeight(kToolbarHeight); 28 | } 29 | -------------------------------------------------------------------------------- /example/lib/widgets/infinite_rotation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class InfiniteRotation extends StatefulWidget { 4 | final Widget? child; 5 | final bool running; 6 | 7 | const InfiniteRotation({ 8 | super.key, 9 | required this.child, 10 | required this.running, 11 | }); 12 | 13 | @override 14 | State createState() => _InfiniteRotationState(); 15 | } 16 | 17 | class _InfiniteRotationState extends State 18 | with SingleTickerProviderStateMixin { 19 | late AnimationController _rotationController; 20 | 21 | @override 22 | void didUpdateWidget(InfiniteRotation oldWidget) { 23 | if (oldWidget.running != widget.running) { 24 | if (widget.running) { 25 | _startAnimation(); 26 | } else { 27 | _rotationController.animateTo(0.0, 28 | duration: const Duration(milliseconds: 50)); 29 | } 30 | } 31 | super.didUpdateWidget(oldWidget); 32 | } 33 | 34 | @override 35 | void initState() { 36 | _rotationController = AnimationController( 37 | duration: const Duration(milliseconds: 750), 38 | vsync: this, 39 | ); 40 | 41 | if (widget.running) { 42 | _startAnimation(); 43 | } 44 | 45 | super.initState(); 46 | } 47 | 48 | @override 49 | void dispose() { 50 | _rotationController.dispose(); 51 | super.dispose(); 52 | } 53 | 54 | void _startAnimation() { 55 | _rotationController.repeat(); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) => 60 | RotationTransition(turns: _rotationController, child: widget.child); 61 | } 62 | -------------------------------------------------------------------------------- /example/lib/widgets/web_frame.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class WebFrame extends StatelessWidget { 5 | final Widget? child; 6 | 7 | const WebFrame({ 8 | super.key, 9 | required this.child, 10 | }); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | final theme = Theme.of(context); 15 | final platform = theme.platform; 16 | final isWebNotMobile = kIsWeb || 17 | platform == TargetPlatform.macOS || 18 | platform == TargetPlatform.linux || 19 | platform == TargetPlatform.windows && 20 | (platform != TargetPlatform.iOS && 21 | platform != TargetPlatform.android); 22 | 23 | final Size(width: width, height: height) = MediaQuery.of(context).size; 24 | final aspectRatio = width / height; 25 | 26 | if (isWebNotMobile && aspectRatio > 0.6) { 27 | final safeAreaWidth = width.clamp(300.0, 500.0); 28 | final safeAreaHeight = height - 48; 29 | return ScrollConfiguration( 30 | behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), 31 | child: Material( 32 | color: theme.colorScheme.surfaceContainerHighest, 33 | child: SafeArea( 34 | child: Center( 35 | child: SizedBox( 36 | width: safeAreaWidth, 37 | height: safeAreaHeight, 38 | child: Center( 39 | child: AspectRatio( 40 | aspectRatio: 3 / 6, 41 | child: Container( 42 | decoration: const BoxDecoration( 43 | boxShadow: [ 44 | BoxShadow( 45 | spreadRadius: 10, 46 | blurRadius: 10, 47 | color: Colors.black12, 48 | ) 49 | ], 50 | borderRadius: BorderRadius.all(Radius.circular(8)), 51 | ), 52 | clipBehavior: Clip.hardEdge, 53 | child: child, 54 | ), 55 | ), 56 | ), 57 | ), 58 | ), 59 | ), 60 | ), 61 | ); 62 | } else { 63 | return child ?? const SizedBox(); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.example") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Fully re-copy the assets directory on each build to avoid having stale files 127 | # from a previous install. 128 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 129 | install(CODE " 130 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 131 | " COMPONENT Runtime) 132 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 133 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 134 | 135 | # Install the AOT library on non-Debug builds only. 136 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 137 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 138 | COMPONENT Runtime) 139 | endif() 140 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /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 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.11.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.1" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.3.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.1" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.18.0" 44 | custom_refresh_indicator: 45 | dependency: "direct main" 46 | description: 47 | path: ".." 48 | relative: true 49 | source: path 50 | version: "4.0.1" 51 | fake_async: 52 | dependency: transitive 53 | description: 54 | name: fake_async 55 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 56 | url: "https://pub.dev" 57 | source: hosted 58 | version: "1.3.1" 59 | flutter: 60 | dependency: "direct main" 61 | description: flutter 62 | source: sdk 63 | version: "0.0.0" 64 | flutter_lints: 65 | dependency: "direct dev" 66 | description: 67 | name: flutter_lints 68 | sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 69 | url: "https://pub.dev" 70 | source: hosted 71 | version: "3.0.1" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | leak_tracker: 78 | dependency: transitive 79 | description: 80 | name: leak_tracker 81 | sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" 82 | url: "https://pub.dev" 83 | source: hosted 84 | version: "10.0.4" 85 | leak_tracker_flutter_testing: 86 | dependency: transitive 87 | description: 88 | name: leak_tracker_flutter_testing 89 | sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" 90 | url: "https://pub.dev" 91 | source: hosted 92 | version: "3.0.3" 93 | leak_tracker_testing: 94 | dependency: transitive 95 | description: 96 | name: leak_tracker_testing 97 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 98 | url: "https://pub.dev" 99 | source: hosted 100 | version: "3.0.1" 101 | lints: 102 | dependency: transitive 103 | description: 104 | name: lints 105 | sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 106 | url: "https://pub.dev" 107 | source: hosted 108 | version: "3.0.0" 109 | matcher: 110 | dependency: transitive 111 | description: 112 | name: matcher 113 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 114 | url: "https://pub.dev" 115 | source: hosted 116 | version: "0.12.16+1" 117 | material_color_utilities: 118 | dependency: transitive 119 | description: 120 | name: material_color_utilities 121 | sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" 122 | url: "https://pub.dev" 123 | source: hosted 124 | version: "0.8.0" 125 | meta: 126 | dependency: transitive 127 | description: 128 | name: meta 129 | sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" 130 | url: "https://pub.dev" 131 | source: hosted 132 | version: "1.12.0" 133 | path: 134 | dependency: transitive 135 | description: 136 | name: path 137 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 138 | url: "https://pub.dev" 139 | source: hosted 140 | version: "1.9.0" 141 | sky_engine: 142 | dependency: transitive 143 | description: flutter 144 | source: sdk 145 | version: "0.0.99" 146 | source_span: 147 | dependency: transitive 148 | description: 149 | name: source_span 150 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 151 | url: "https://pub.dev" 152 | source: hosted 153 | version: "1.10.0" 154 | stack_trace: 155 | dependency: transitive 156 | description: 157 | name: stack_trace 158 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 159 | url: "https://pub.dev" 160 | source: hosted 161 | version: "1.11.1" 162 | stream_channel: 163 | dependency: transitive 164 | description: 165 | name: stream_channel 166 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 167 | url: "https://pub.dev" 168 | source: hosted 169 | version: "2.1.2" 170 | string_scanner: 171 | dependency: transitive 172 | description: 173 | name: string_scanner 174 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "1.2.0" 178 | term_glyph: 179 | dependency: transitive 180 | description: 181 | name: term_glyph 182 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "1.2.1" 186 | test_api: 187 | dependency: transitive 188 | description: 189 | name: test_api 190 | sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" 191 | url: "https://pub.dev" 192 | source: hosted 193 | version: "0.7.0" 194 | vector_math: 195 | dependency: transitive 196 | description: 197 | name: vector_math 198 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 199 | url: "https://pub.dev" 200 | source: hosted 201 | version: "2.1.4" 202 | vm_service: 203 | dependency: transitive 204 | description: 205 | name: vm_service 206 | sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" 207 | url: "https://pub.dev" 208 | source: hosted 209 | version: "14.2.1" 210 | sdks: 211 | dart: ">=3.3.0 <4.0.0" 212 | flutter: ">=3.18.0-18.0.pre.54" 213 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: Custom refresh indicator example. 3 | publish_to: none 4 | 5 | version: 1.0.0 6 | 7 | environment: 8 | sdk: ">=3.0.0 <4.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | custom_refresh_indicator: 14 | path: ../ 15 | 16 | dev_dependencies: 17 | flutter_lints: ^3.0.1 18 | flutter_test: 19 | sdk: flutter 20 | 21 | flutter: 22 | uses-material-design: true 23 | assets: 24 | - assets/plane_indicator/ 25 | - assets/ice_cream_indicator/ 26 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "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 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(example LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Fully re-copy the assets directory on each build to avoid having stale files 91 | # from a previous install. 92 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 93 | install(CODE " 94 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 95 | " COMPONENT Runtime) 96 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 97 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 98 | 99 | # Install the AOT library on non-Debug builds only. 100 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 101 | CONFIGURATIONS Profile;Release 102 | COMPONENT Runtime) 103 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /lib/custom_refresh_indicator.dart: -------------------------------------------------------------------------------- 1 | export 'src/data/data.dart'; 2 | export 'src/custom_refresh_indicator.dart'; 3 | export 'src/widgets/widgets.dart'; 4 | export 'src/physics/physics.dart'; 5 | export 'src/utils/utils.dart'; 6 | -------------------------------------------------------------------------------- /lib/src/data/data.dart: -------------------------------------------------------------------------------- 1 | export 'indicator_edge.dart'; 2 | export 'indicator_side.dart'; 3 | export 'indicator_state.dart'; 4 | export 'indicator_state_change.dart'; 5 | export 'indicator_trigger_edge.dart'; 6 | export 'indicator_trigger_mode.dart'; 7 | export 'refresh_indicator_durations.dart'; 8 | -------------------------------------------------------------------------------- /lib/src/data/indicator_edge.dart: -------------------------------------------------------------------------------- 1 | enum IndicatorEdge { 2 | leading, 3 | trailing, 4 | } 5 | 6 | extension IndicatorEdgeGetters on IndicatorEdge { 7 | bool get isTrailing => this == IndicatorEdge.trailing; 8 | bool get isLeading => this == IndicatorEdge.leading; 9 | } 10 | -------------------------------------------------------------------------------- /lib/src/data/indicator_side.dart: -------------------------------------------------------------------------------- 1 | enum IndicatorSide { 2 | left, 3 | top, 4 | right, 5 | bottom, 6 | 7 | none, 8 | } 9 | 10 | extension IndicatorSideGetters on IndicatorSide { 11 | bool get isLeft => this == IndicatorSide.left; 12 | bool get isTop => this == IndicatorSide.top; 13 | bool get isRight => this == IndicatorSide.right; 14 | bool get isBottom => this == IndicatorSide.bottom; 15 | 16 | bool get isNone => this == IndicatorSide.none; 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/data/indicator_state.dart: -------------------------------------------------------------------------------- 1 | /// Describes state of CustomRefreshIndicator widget. 2 | enum IndicatorState { 3 | /// {@template custom_refresh_indicator.indicator_state.idle} 4 | /// In this state, the indicator is not visible. 5 | /// No user action is performed. Value remains at *0.0*. 6 | /// {@endtemplate} 7 | idle, 8 | 9 | /// {@template custom_refresh_indicator.indicator_state.dragging} 10 | /// The user starts scrolling/dragging the pointer to refresh. 11 | /// Releasing the pointer in this state will not trigger 12 | /// the *onRefresh* function. The controller value changes 13 | /// from *0.0* to *1.0*. 14 | /// {@endtemplate} 15 | dragging, 16 | 17 | /// {@template custom_refresh_indicator.indicator_state.canceling} 18 | /// The function *onRefresh* **has not been executed**, 19 | /// and the indicator is hidding from its current value 20 | /// that is lower than *1.0* to *0.0*. 21 | /// {@endtemplate} 22 | canceling, 23 | 24 | /// {@template custom_refresh_indicator.indicator_state.armed} 25 | /// The user has dragged the pointer further than the distance 26 | /// declared by *containerExtentPercentageToArmed* or *offsetToArmed* 27 | /// (over the value of *1.0*). Releasing the pointer in this state will 28 | /// trigger the *onRefresh* function. 29 | /// {@endtemplate} 30 | armed, 31 | 32 | /// {@template custom_refresh_indicator.indicator_state.settling} 33 | /// The user has released the indicator in the armed state. 34 | /// The indicator settles on its target value *1.0*. 35 | /// {@endtemplate} 36 | settling, 37 | 38 | /// {@template custom_refresh_indicator.indicator_state.loading} 39 | /// The indicator is in its target value *1.0*. 40 | /// The *onRefresh* function is triggered. 41 | /// {@endtemplate} 42 | loading, 43 | 44 | /// {@template custom_refresh_indicator.indicator_state.complete} 45 | /// **OPTIONAL** - Provide `completeStateDuration` argument to enable it. 46 | /// The *onRefresh* callback has completed and the pointer remains 47 | /// at value *1.0* for the specified duration. 48 | /// {@endtemplate} 49 | complete, 50 | 51 | /// {@template custom_refresh_indicator.indicator_state.finalizing} 52 | /// The *onRefresh* function **has been executed**, and the indicator 53 | /// hides from the value *1.0* to *0.0*. 54 | /// {@endtemplate} 55 | finalizing, 56 | } 57 | 58 | extension IndicatorStateGetters on IndicatorState { 59 | /// {@macro custom_refresh_indicator.indicator_state.idle} 60 | bool get isIdle => this == IndicatorState.idle; 61 | 62 | /// {@macro custom_refresh_indicator.indicator_state.dragging} 63 | bool get isDragging => this == IndicatorState.dragging; 64 | 65 | /// {@macro custom_refresh_indicator.indicator_state.canceling} 66 | bool get isCanceling => this == IndicatorState.canceling; 67 | 68 | /// {@macro custom_refresh_indicator.indicator_state.armed} 69 | bool get isArmed => this == IndicatorState.armed; 70 | 71 | /// {@macro custom_refresh_indicator.indicator_state.settling} 72 | bool get isSettling => this == IndicatorState.settling; 73 | 74 | /// {@macro custom_refresh_indicator.indicator_state.loading} 75 | bool get isLoading => this == IndicatorState.loading; 76 | 77 | /// {@macro custom_refresh_indicator.indicator_state.complete} 78 | bool get isComplete => this == IndicatorState.complete; 79 | 80 | /// {@macro custom_refresh_indicator.indicator_state.finalizing} 81 | bool get isFinalizing => this == IndicatorState.finalizing; 82 | } 83 | -------------------------------------------------------------------------------- /lib/src/data/indicator_state_change.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | 4 | /// Describes [IndicatorState] change. 5 | @immutable 6 | class IndicatorStateChange { 7 | final IndicatorState currentState; 8 | final IndicatorState newState; 9 | 10 | const IndicatorStateChange(this.currentState, this.newState); 11 | 12 | /// - When [from] and [to] are provided - returns `true` when state did change [from] to [to]. 13 | /// - When only [from] is provided - returns `true` when state did change from [from]. 14 | /// - When only [to] is provided - returns `true` when state did change to [to]. 15 | /// - When [from] and [to] equals `null` - returns `true` for any state change. 16 | bool didChange({IndicatorState? from, IndicatorState? to}) { 17 | final stateChanged = currentState != newState; 18 | if (to == null && from != null) return currentState == from && stateChanged; 19 | if (to != null && from == null) return newState == to && stateChanged; 20 | if (to == null && from == null) return stateChanged; 21 | return currentState == from && newState == to; 22 | } 23 | 24 | @override 25 | bool operator ==(Object other) => 26 | other.runtimeType == runtimeType && 27 | other is IndicatorStateChange && 28 | other.currentState == currentState && 29 | other.newState == newState; 30 | 31 | @override 32 | int get hashCode => Object.hash(currentState, newState); 33 | 34 | @override 35 | String toString() => "$runtimeType(${currentState.name} → ${newState.name})"; 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/data/indicator_trigger_edge.dart: -------------------------------------------------------------------------------- 1 | /// {@template custom_refresh_indicator.indicator_trigger} 2 | /// Defines the trigger for the pull to refresh gesture. 3 | /// {@endtemplate} 4 | /// 5 | /// **startEdge**: 6 | /// {@macro custom_refresh_indicator.indicator_trigger.leading} 7 | /// 8 | /// **endEdge**: 9 | /// {@macro custom_refresh_indicator.indicator_trigger.trailing} 10 | /// 11 | /// **bothEdges**: 12 | /// {@macro custom_refresh_indicator.indicator_trigger.both} 13 | enum IndicatorTrigger { 14 | /// {@template custom_refresh_indicator.indicator_trigger.leading} 15 | /// Pull to refresh can be triggered only from the **leading** edge of the list. 16 | /// Mostly top side, but can be bottom for reversed ListView 17 | /// (with *reverse* argument set to true). 18 | /// {@endtemplate} 19 | leadingEdge, 20 | 21 | /// {@template custom_refresh_indicator.indicator_trigger.trailing} 22 | /// Pull to refresh can be triggered only from the **trailing** edge of the list. 23 | /// Mostly bottom, but can be top for reversed ListView 24 | /// (with *reverse* argument set to true). 25 | /// {@endtemplate} 26 | trailingEdge, 27 | 28 | /// {@template custom_refresh_indicator.indicator_trigger.both} 29 | /// Pull to refresh can be triggered from **both edges** of the list. 30 | /// {@endtemplate} 31 | bothEdges, 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/data/indicator_trigger_mode.dart: -------------------------------------------------------------------------------- 1 | /// Used to configure how [CustomRefreshIndicator] can be triggered. 2 | enum IndicatorTriggerMode { 3 | /// The indicator can be triggered regardless of the scroll position 4 | /// of the [Scrollable] when the drag starts. 5 | anywhere, 6 | 7 | /// The indicator can only be triggered if the [Scrollable] is at the edge 8 | /// when the drag starts. 9 | onEdge, 10 | } 11 | -------------------------------------------------------------------------------- /lib/src/data/refresh_indicator_durations.dart: -------------------------------------------------------------------------------- 1 | /// Encapsulates the duration of various phases of the refresh indicator's animation. 2 | /// 3 | /// The durations defined within are used to control how long each respective 4 | /// phase lasts, allowing for customization of the refresh indicator's behavior. 5 | class RefreshIndicatorDurations { 6 | /// Duration of hiding the indicator when dragging was stopped before 7 | /// the indicator was armed (the *onRefresh* callback was not called). 8 | /// 9 | /// The default is 300 milliseconds. 10 | final Duration cancelDuration; 11 | 12 | /// The time of settling the pointer on the target location after releasing 13 | /// the pointer in the armed state. 14 | /// 15 | /// During this process, the value of the indicator decreases from its current value, 16 | /// which can be greater than or equal to 1.0 but less or equal to 1.5, 17 | /// to a target value of `1.0`. 18 | /// During this process, the state is set to [IndicatorState.loading]. 19 | /// 20 | /// The default is 150 milliseconds. 21 | final Duration settleDuration; 22 | 23 | /// Duration of hiding the pointer after the [onRefresh] function completes. 24 | /// 25 | /// During this time, the value of the controller decreases from `1.0` to `0.0` 26 | /// with a state set to [IndicatorState.finalizing]. 27 | /// 28 | /// The default is 100 milliseconds. 29 | final Duration finalizeDuration; 30 | 31 | /// Duration for which the indicator remains at value of *1.0* and 32 | /// [IndicatorState.complete] state after the [onRefresh] function completes. 33 | final Duration? completeDuration; 34 | 35 | /// Constructs a `RefreshIndicatorDurations` with the specified durations. 36 | /// 37 | /// If a duration is not specified, it falls back to a default value: 38 | /// - `cancelDuration`: 300 milliseconds 39 | /// - `settleDuration`: 150 milliseconds 40 | /// - `finalizeDuration`: 100 milliseconds 41 | const RefreshIndicatorDurations({ 42 | this.cancelDuration = const Duration(milliseconds: 300), 43 | this.settleDuration = const Duration(milliseconds: 150), 44 | this.finalizeDuration = const Duration(milliseconds: 100), 45 | this.completeDuration, 46 | }); 47 | } 48 | -------------------------------------------------------------------------------- /lib/src/physics/clamping_with_overscroll_physics.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:meta/meta.dart'; 4 | 5 | /// Keeps overscroll data for the [ClampingWithOverscrollPhysics] scroll 6 | /// physics. 7 | /// 8 | /// Implemented by the [IndicatorController] class. 9 | @experimental 10 | mixin ClampingWithOverscrollPhysicsState { 11 | double _overscroll = 0; 12 | 13 | /// Returns true when overscroll is available. 14 | bool get _hasOverscroll => _overscroll > 0; 15 | 16 | void _addOverscroll(double delta) { 17 | _overscroll += delta; 18 | if (_overscroll < 0) { 19 | _overscroll = 0; 20 | } 21 | } 22 | 23 | void _removeOverscroll(double delta) { 24 | _overscroll -= delta; 25 | if (_overscroll < 0) { 26 | _overscroll = 0; 27 | } 28 | } 29 | 30 | @internal 31 | void clearPhysicsState() { 32 | _overscroll = 0; 33 | } 34 | } 35 | 36 | /// Creates scroll physics that prevent the scroll offset from exceeding the 37 | /// bounds of the content while handling the overscroll. 38 | class ClampingWithOverscrollPhysics extends ClampingScrollPhysics { 39 | final ClampingWithOverscrollPhysicsState _state; 40 | 41 | /// Creates scroll physics that prevent the scroll offset from exceeding the 42 | /// bounds of the content while handling the overscroll. 43 | const ClampingWithOverscrollPhysics({ 44 | super.parent, 45 | required ClampingWithOverscrollPhysicsState state, 46 | }) : _state = state; 47 | 48 | @override 49 | ClampingWithOverscrollPhysics applyTo(ScrollPhysics? ancestor) { 50 | return ClampingWithOverscrollPhysics( 51 | parent: buildParent(ancestor), 52 | state: _state, 53 | ); 54 | } 55 | 56 | @override 57 | double applyBoundaryConditions(ScrollMetrics position, double value) { 58 | assert(() { 59 | if (value == position.pixels) { 60 | throw FlutterError.fromParts([ 61 | ErrorSummary( 62 | '$runtimeType.applyBoundaryConditions() was called redundantly.'), 63 | ErrorDescription( 64 | 'The proposed new position, $value, is exactly equal to the current position of the ' 65 | 'given ${position.runtimeType}, ${position.pixels}.\n' 66 | 'The applyBoundaryConditions method should only be called when the value is ' 67 | 'going to actually change the pixels, otherwise it is redundant.', 68 | ), 69 | DiagnosticsProperty( 70 | 'The physics object in question was', this, 71 | style: DiagnosticsTreeStyle.errorProperty), 72 | DiagnosticsProperty( 73 | 'The position object in question was', position, 74 | style: DiagnosticsTreeStyle.errorProperty), 75 | ]); 76 | } 77 | return true; 78 | }()); 79 | 80 | if (value < position.pixels && 81 | position.pixels <= position.minScrollExtent) { 82 | // Underscroll. 83 | 84 | final delta = value - position.pixels; 85 | _state._addOverscroll(delta.abs()); 86 | return delta; 87 | } 88 | if (position.maxScrollExtent <= position.pixels && 89 | position.pixels < value) { 90 | // Overscroll. 91 | final delta = value - position.pixels; 92 | _state._addOverscroll(delta); 93 | return delta; 94 | } 95 | if (value < position.minScrollExtent && 96 | position.minScrollExtent < position.pixels) { 97 | // Hit top edge. 98 | final delta = value - position.minScrollExtent; 99 | _state._addOverscroll(delta); 100 | return delta; 101 | } 102 | if (position.pixels < position.maxScrollExtent && 103 | position.maxScrollExtent < value) { 104 | // Hit bottom edge. 105 | final delta = value - position.maxScrollExtent; 106 | _state._addOverscroll(delta); 107 | return delta; 108 | } 109 | if (_state._hasOverscroll) { 110 | final delta = value - position.pixels; 111 | _state._removeOverscroll(delta.abs()); 112 | 113 | return delta; 114 | } else { 115 | return 0; 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /lib/src/physics/physics.dart: -------------------------------------------------------------------------------- 1 | export 'clamping_with_overscroll_physics.dart'; 2 | -------------------------------------------------------------------------------- /lib/src/utils/clamped_animation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/animation.dart'; 2 | 3 | /// An animation that clamps the value of another animation within a specified range. 4 | /// 5 | /// This animation proxies the parent animation but enforces a minimum and a maximum 6 | /// limit on its value. If the parent animation produces a value outside of this 7 | /// range, it is clamped to the nearest boundary defined by [min] and [max]. 8 | /// 9 | /// The [min] value should be less than the [max] value. 10 | /// 11 | /// Example usage: 12 | /// ```dart 13 | /// final ClampedAnimation clampedAnimation = ClampedAnimation( 14 | /// parent: parent, 15 | /// min: 0.0, 16 | /// max: 1.0, 17 | /// ); 18 | /// ``` 19 | /// Here `clampedAnimation.value` will always be between 0.0 and 1.0, inclusive. 20 | class ClampedAnimation extends Animation 21 | with AnimationWithParentMixin { 22 | /// Creates a clamped animation with an invariant range. 23 | /// 24 | /// The [parent] animation is the source of values for this animation. 25 | /// The [min] and [max] parameters specify the range within which the 26 | /// values of the parent animation should be clamped. 27 | /// The constructor asserts that [min] is less than [max]. 28 | const ClampedAnimation({ 29 | required this.parent, 30 | required this.min, 31 | required this.max, 32 | }) : assert(min < max, 'The min value must be less than the max value.'); 33 | 34 | /// The animation that this clamped animation is based on. 35 | @override 36 | final Animation parent; 37 | 38 | /// The minimum value of the clamped range. 39 | final double min; 40 | 41 | /// The maximum value of the clamped range. 42 | final double max; 43 | 44 | /// Gets the current value of the parent animation clamped to the range [min] to [max]. 45 | /// 46 | /// This method overrides the getter for `value` from the parent class and applies 47 | /// the clamping logic to the current value of the [parent] animation. 48 | @override 49 | double get value => parent.value.clamp(min, max); 50 | 51 | @override 52 | String toString() => '$parent(min: $min, max: $max)'; 53 | } 54 | -------------------------------------------------------------------------------- /lib/src/utils/transformed_animation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/animation.dart'; 2 | 3 | /// An animation that transforms the value of another animation from a certain range to another. 4 | /// 5 | /// This animation proxies the parent animation, but enforces the minimum and maximum values 6 | /// in the [toMin] and [toMax] range. 7 | /// 8 | /// *From* values should be less than *max* values. 9 | /// 10 | /// Example usage: 11 | /// ```dart 12 | /// final TransformedAnimation animation = TransformedAnimation( 13 | /// parent: parent, 14 | /// fromMin: 0.0, 15 | /// fromMax: 1.0, 16 | /// toMin: 0.0, 17 | /// toMax: 10.0, 18 | /// ); 19 | /// ``` 20 | /// Here `animation.value` will always be between 0.0 and 10.0, inclusive. 21 | class TransformedAnimation extends Animation 22 | with AnimationWithParentMixin { 23 | /// Creates a transformed animation with an invariant range. 24 | /// 25 | /// The [parent] animation is the source of values for this animation. 26 | /// The [fromMin] and [fromMax] parameters specify the range of the parent animation value that should be transformed. 27 | /// The [toMin] and [toMax] parameters specify the range to which the animation value should be transformed. 28 | /// 29 | /// The constructor asserts that [fromMin] is less than [fromMax] and [toMin] is less than [toMax]. 30 | const TransformedAnimation({ 31 | required this.parent, 32 | required this.fromMin, 33 | required this.fromMax, 34 | required this.toMin, 35 | required this.toMax, 36 | }) : assert(fromMin < fromMax, 37 | 'The fromMin value must be less than the fromMax value.'), 38 | assert(toMin < toMax, 39 | 'The toMin value must be less than the toMax value.'); 40 | 41 | /// The animation that this clamped animation is based on. 42 | @override 43 | final Animation parent; 44 | 45 | /// The minimum value of the current range. 46 | final double fromMin; 47 | 48 | /// The maximum value of the current range. 49 | final double fromMax; 50 | 51 | /// The minimum value of the transformed range. 52 | final double toMin; 53 | 54 | /// The maximum value of the transformed range. 55 | final double toMax; 56 | 57 | /// Gets the current value of the parent animation transformed from the range [fromMin] -> [toMax] to [toMin] -> [toMax]. 58 | @override 59 | double get value { 60 | return (parent.value - fromMin) / (fromMax - fromMin) * (toMax - toMin) + 61 | toMin; 62 | } 63 | 64 | @override 65 | String toString() => 'TransformedAnimation(min: $toMin, max: $toMax)'; 66 | } 67 | -------------------------------------------------------------------------------- /lib/src/utils/utils.dart: -------------------------------------------------------------------------------- 1 | export 'clamped_animation.dart'; 2 | export 'transformed_animation.dart'; 3 | -------------------------------------------------------------------------------- /lib/src/widgets/positioned_indicator_container.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | /// Position child widget in a similar way 5 | /// to the built-in [RefreshIndicator] widget. 6 | class PositionedIndicatorContainer extends StatelessWidget { 7 | final IndicatorController controller; 8 | final double displacement; 9 | final Widget child; 10 | final double edgeOffset; 11 | 12 | /// Position child widget in a similar way 13 | /// to the built-in [RefreshIndicator] widget. 14 | const PositionedIndicatorContainer({ 15 | super.key, 16 | required this.child, 17 | required this.controller, 18 | this.displacement = 40.0, 19 | this.edgeOffset = 0.0, 20 | }); 21 | 22 | Alignment _getAlignment(IndicatorSide side) { 23 | switch (side) { 24 | case IndicatorSide.left: 25 | return Alignment.centerLeft; 26 | case IndicatorSide.top: 27 | return Alignment.topCenter; 28 | case IndicatorSide.right: 29 | return Alignment.centerRight; 30 | case IndicatorSide.bottom: 31 | return Alignment.bottomCenter; 32 | case IndicatorSide.none: 33 | throw UnsupportedError('Cannot get alignment for "none" side.'); 34 | } 35 | } 36 | 37 | EdgeInsets _getEdgeInsets(IndicatorSide side) { 38 | switch (side) { 39 | case IndicatorSide.left: 40 | return EdgeInsets.only(left: displacement); 41 | case IndicatorSide.top: 42 | return EdgeInsets.only(top: displacement); 43 | case IndicatorSide.right: 44 | return EdgeInsets.only(right: displacement); 45 | case IndicatorSide.bottom: 46 | return EdgeInsets.only(bottom: displacement); 47 | case IndicatorSide.none: 48 | throw UnsupportedError('Cannot get edge insets for "none" side.'); 49 | } 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | final side = controller.side; 55 | if (side.isNone) return const SizedBox.shrink(); 56 | 57 | final isVerticalAxis = side.isTop || side.isBottom; 58 | final isHorizontalAxis = side.isLeft || side.isRight; 59 | 60 | final AlignmentDirectional alignment = isVerticalAxis 61 | ? AlignmentDirectional(-1.0, side.isTop ? 1.0 : -1.0) 62 | : AlignmentDirectional(side.isLeft ? 1.0 : -1.0, -1.0); 63 | 64 | final endOffset = isVerticalAxis 65 | ? Offset(0.0, side.isTop ? 1.0 : -1.0) 66 | : Offset(side.isLeft ? 1.0 : -1.0, 0.0); 67 | 68 | final animation = controller.isFinalizing 69 | ? AlwaysStoppedAnimation(endOffset) 70 | : Tween(begin: const Offset(0.0, 0.0), end: endOffset) 71 | .animate(controller); 72 | 73 | return Positioned( 74 | top: isHorizontalAxis 75 | ? 0 76 | : side.isTop 77 | ? edgeOffset 78 | : null, 79 | bottom: isHorizontalAxis 80 | ? 0 81 | : side.isBottom 82 | ? edgeOffset 83 | : null, 84 | left: isVerticalAxis 85 | ? 0 86 | : side.isLeft 87 | ? edgeOffset 88 | : null, 89 | right: isVerticalAxis 90 | ? 0 91 | : side.isRight 92 | ? edgeOffset 93 | : null, 94 | child: Align( 95 | alignment: alignment, 96 | heightFactor: isVerticalAxis ? 0.0 : null, 97 | widthFactor: isHorizontalAxis ? 0.0 : null, 98 | child: SlideTransition( 99 | position: animation, 100 | child: Padding( 101 | padding: _getEdgeInsets(side), 102 | child: Align( 103 | alignment: _getAlignment(side), 104 | child: child, 105 | ), 106 | ), 107 | ), 108 | ), 109 | ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /lib/src/widgets/widgets.dart: -------------------------------------------------------------------------------- 1 | export 'custom_material_indicator.dart'; 2 | export 'positioned_indicator_container.dart'; 3 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: custom_refresh_indicator 2 | description: Widget that makes it easy to implement a custom pull to refresh gesture. 3 | version: 4.0.1 4 | repository: https://github.com/gonuit/flutter-custom-refresh-indicator 5 | issue_tracker: https://github.com/gonuit/flutter-custom-refresh-indicator/issues 6 | homepage: https://github.com/gonuit/flutter-custom-refresh-indicator 7 | 8 | scripts: 9 | format: dart format . --line-length=120 10 | 11 | environment: 12 | sdk: ">=2.17.0 <4.0.0" 13 | flutter: ">=1.16.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | meta: ^1.3.0 19 | 20 | dev_dependencies: 21 | flutter_lints: ^3.0.1 22 | flutter_test: 23 | sdk: flutter 24 | rps: ^0.7.0 25 | 26 | flutter: 27 | 28 | funding: 29 | - https://www.paypal.com/donate/?hosted_button_id=Z82R98MAR4URE 30 | - https://www.buymeacoffee.com/kamilklyta 31 | 32 | topics: 33 | - widgets 34 | - animation 35 | - pull-to-refresh 36 | - refresh-indicator 37 | - p2r 38 | 39 | screenshots: 40 | - description: The custom refresh indicator package thumbnail. 41 | path: screenshots/thumbnail.png 42 | -------------------------------------------------------------------------------- /readme/complete_state.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/complete_state.gif -------------------------------------------------------------------------------- /readme/controller_data.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/controller_data.gif -------------------------------------------------------------------------------- /readme/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/cover.png -------------------------------------------------------------------------------- /readme/drag_details.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/drag_details.gif -------------------------------------------------------------------------------- /readme/envelope_indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/envelope_indicator.gif -------------------------------------------------------------------------------- /readme/fetch_more.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/fetch_more.gif -------------------------------------------------------------------------------- /readme/ice_cream_indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/ice_cream_indicator.gif -------------------------------------------------------------------------------- /readme/plane_indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/plane_indicator.gif -------------------------------------------------------------------------------- /readme/programmatically_controlled.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/programmatically_controlled.gif -------------------------------------------------------------------------------- /readme/simple_indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/simple_indicator.gif -------------------------------------------------------------------------------- /readme/simple_with_opacity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/simple_with_opacity.gif -------------------------------------------------------------------------------- /readme/warp_indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/readme/warp_indicator.gif -------------------------------------------------------------------------------- /screenshots/thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gonuit/flutter-custom-refresh-indicator/7a99379d21e3d11f949bcb63af9ab07309560c3c/screenshots/thumbnail.png -------------------------------------------------------------------------------- /test/src/data/data_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | test("State getters works correctly", () { 6 | const change = IndicatorStateChange( 7 | IndicatorState.dragging, 8 | IndicatorState.armed, 9 | ); 10 | expect(change.currentState, equals(IndicatorState.dragging)); 11 | expect(change.newState, equals(IndicatorState.armed)); 12 | }); 13 | 14 | test('didChange method works correctly.', () { 15 | var change = const IndicatorStateChange( 16 | IndicatorState.idle, 17 | IndicatorState.idle, 18 | ); 19 | expect(change.didChange(), isFalse); 20 | change = const IndicatorStateChange( 21 | IndicatorState.idle, 22 | IndicatorState.dragging, 23 | ); 24 | expect( 25 | change.didChange(), 26 | isTrue, 27 | ); 28 | expect( 29 | change.didChange( 30 | from: IndicatorState.idle, 31 | to: IndicatorState.dragging, 32 | ), 33 | isTrue, 34 | ); 35 | expect( 36 | change.didChange( 37 | to: IndicatorState.dragging, 38 | ), 39 | isTrue, 40 | ); 41 | expect( 42 | change.didChange( 43 | from: IndicatorState.idle, 44 | ), 45 | isTrue, 46 | ); 47 | expect( 48 | change.didChange( 49 | from: IndicatorState.dragging, 50 | ), 51 | isFalse, 52 | ); 53 | expect( 54 | change.didChange( 55 | to: IndicatorState.idle, 56 | ), 57 | isFalse, 58 | ); 59 | }); 60 | 61 | test('Equality operator works correctly', () async { 62 | // ignore: prefer_const_constructors 63 | final a = IndicatorStateChange( 64 | IndicatorState.idle, 65 | IndicatorState.dragging, 66 | ); 67 | // ignore: prefer_const_constructors 68 | final b = IndicatorStateChange( 69 | IndicatorState.idle, 70 | IndicatorState.dragging, 71 | ); 72 | 73 | expect(a, equals(b)); 74 | expect(a.hashCode, equals(b.hashCode)); 75 | }); 76 | 77 | test("toString method works correctly", () { 78 | var change = const IndicatorStateChange( 79 | IndicatorState.dragging, 80 | IndicatorState.armed, 81 | ); 82 | expect( 83 | change.toString(), 84 | 'IndicatorStateChange(dragging → armed)', 85 | ); 86 | change = const IndicatorStateChange( 87 | IndicatorState.loading, 88 | IndicatorState.complete, 89 | ); 90 | expect( 91 | change.toString(), 92 | 'IndicatorStateChange(loading → complete)', 93 | ); 94 | }); 95 | } 96 | -------------------------------------------------------------------------------- /test/src/data/indicator_edge_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/src/data/indicator_edge.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | test('IndicatorEdgeGetters - trailing', () async { 6 | const end = IndicatorEdge.trailing; 7 | expect(end.isLeading, isFalse); 8 | expect(end.isTrailing, isTrue); 9 | }); 10 | 11 | test('IndicatorEdgeGetters - leading', () async { 12 | const start = IndicatorEdge.leading; 13 | expect(start.isLeading, isTrue); 14 | expect(start.isTrailing, isFalse); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /test/src/data/indicator_side_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:custom_refresh_indicator/custom_refresh_indicator.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | test('IndicatorSideGetters - left', () async { 6 | const left = IndicatorSide.left; 7 | expect(left.isLeft, isTrue); 8 | expect(left.isTop, isFalse); 9 | expect(left.isRight, isFalse); 10 | expect(left.isBottom, isFalse); 11 | expect(left.isNone, isFalse); 12 | }); 13 | 14 | test('IndicatorSideGetters - right', () async { 15 | const right = IndicatorSide.right; 16 | expect(right.isLeft, isFalse); 17 | expect(right.isTop, isFalse); 18 | expect(right.isRight, isTrue); 19 | expect(right.isBottom, isFalse); 20 | expect(right.isNone, isFalse); 21 | }); 22 | 23 | test('IndicatorSideGetters - top', () async { 24 | const right = IndicatorSide.top; 25 | expect(right.isLeft, isFalse); 26 | expect(right.isTop, isTrue); 27 | expect(right.isRight, isFalse); 28 | expect(right.isBottom, isFalse); 29 | expect(right.isNone, isFalse); 30 | }); 31 | 32 | test('IndicatorSideGetters - bottom', () async { 33 | const right = IndicatorSide.bottom; 34 | expect(right.isLeft, isFalse); 35 | expect(right.isTop, isFalse); 36 | expect(right.isRight, isFalse); 37 | expect(right.isBottom, isTrue); 38 | expect(right.isNone, isFalse); 39 | }); 40 | 41 | test('IndicatorSideGetters - none', () async { 42 | const none = IndicatorSide.none; 43 | expect(none.isLeft, isFalse); 44 | expect(none.isTop, isFalse); 45 | expect(none.isRight, isFalse); 46 | expect(none.isBottom, isFalse); 47 | expect(none.isNone, isTrue); 48 | }); 49 | } 50 | --------------------------------------------------------------------------------