├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── android
└── app
│ └── src
│ └── main
│ └── java
│ └── io
│ └── flutter
│ └── plugins
│ └── GeneratedPluginRegistrant.java
├── example
├── .gitignore
├── .idea
│ ├── codeStyles
│ │ └── Project.xml
│ ├── libraries
│ │ ├── Dart_Packages.xml
│ │ ├── Dart_SDK.xml
│ │ ├── Flutter_Plugins.xml
│ │ └── Flutter_for_Android.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations
│ │ └── main_dart.xml
│ └── workspace.xml
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── tengio
│ │ │ │ └── slidecontainerexample
│ │ │ │ └── MainActivity.java
│ │ │ └── res
│ │ │ ├── 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
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── Runner
│ │ ├── AppDelegate.h
│ │ ├── AppDelegate.m
│ │ ├── 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
│ │ └── main.m
├── lib
│ ├── help_page.dart
│ ├── main.dart
│ ├── page1.dart
│ ├── page2.dart
│ └── page3.dart
├── pubspec.lock
├── pubspec.yaml
├── slide_container_example.iml
└── slide_container_example_android.iml
├── lib
├── extended_drag_gesture_recognizer.dart
├── slide_container.dart
└── slide_container_controller.dart
├── pubspec.lock
├── pubspec.yaml
└── slide_container.iml
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | **/.DS_Store
3 | .idea/
4 | .vscode/
5 | **/.idea/
6 | .metadata
7 | .packages
8 | .flutter-plugins
9 | build/
10 |
11 | #android related
12 | **/android/local.properties
13 | **/android/**/GeneratedPluginRegistrant.java
14 |
15 | # iOS/XCode related
16 | **/ios/**/*.mode1v3
17 | **/ios/**/*.mode2v3
18 | **/ios/**/*.moved-aside
19 | **/ios/**/*.pbxuser
20 | **/ios/**/*.perspectivev3
21 | **/ios/**/*sync/
22 | **/ios/**/.sconsign.dblite
23 | **/ios/**/.tags*
24 | **/ios/**/.vagrant/
25 | **/ios/**/DerivedData/
26 | **/ios/**/Icon?
27 | **/ios/**/Pods/
28 | **/ios/**/profile
29 | **/ios/**/xcuserdata
30 | **/ios/.generated/
31 | **/ios/Flutter/App.framework
32 | **/ios/Flutter/Flutter.framework
33 | **/ios/Flutter/Generated.xcconfig
34 | **/ios/Flutter/app.flx
35 | **/ios/Flutter/app.zip
36 | **/ios/Flutter/flutter_assets/
37 | **/ios/ServiceDefinitions.json
38 | **/ios/Runner/GeneratedPluginRegistrant.*
39 | **/ios/Podfile.lock
40 |
41 | **/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/
42 |
43 | android/Gemfile
44 | ios/Gemfile
45 | ios/Runner.app.dSYM.zip
46 | ios/Runner.ipa
47 |
48 | # Flutter auto generated:
49 | example/ios/Flutter/flutter_export_environment.sh
50 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.1.2 - 2019-10-09
2 |
3 | * Fixed container hit detection area not moving with content.
4 | * Updated example to demo the issue above and show a work around.
5 | * Updated example to add a few more use cases.
6 |
7 | ## 1.1.1 - 2019-10-09
8 |
9 | * Added option to disable auto-slide, allowing the container to stay where it as been dragged when the gesture end, instead of snapping to the start position or to the full extent.
10 |
11 | ## 1.1.0 - 2019-09-18
12 |
13 | * **Breaking change** Fixed naming issue with new Flutter version (1.9.0 and above). Use this version of the plugin when you upgrade Flutter.
14 |
15 | ## 1.0.7 - 2018-11-29
16 |
17 | * Added the SlideContainerController to allow a manual force slide in a given direction.
18 | * Updated example app to showcase the new SlideContainerController.
19 |
20 | ## 1.0.6 - 2018-10-25
21 |
22 | * Fixed Flutter analysis warnings.
23 |
24 | ## 1.0.5 - 2018-10-25
25 |
26 | * Fixed Flutter analysis warnings.
27 |
28 | ## 1.0.4 - 2018-10-25
29 |
30 | * Added onSlideValidated and onSlideUnvalidated callbacks.
31 |
32 | ## 1.0.3 - 2018-10-10
33 |
34 | * Improved logic to reduce nested GestureDetector conflicts. Now if the container as been slid to
35 | its max extent in one direction, trying to slid it more in this direction will not count as a gesture,
36 | thus allowing other GestureDetectors to get and handle the event.
37 |
38 | ## 1.0.2 - 2018-10-09
39 |
40 | * Updated README.
41 |
42 | ## 1.0.1 - 2018-10-06
43 |
44 | * Added support for horizontal sliding.
45 | * **Breaking change**
46 | * Renamed class `VerticalSlideContainer` to `SlideContainer`
47 | * Renamed enum `VerticalSlideContainerDirection` to `SlideContainerDirection` and changed its values.
48 |
49 | ## 1.0.0 - 2018-10-05
50 |
51 | * Initial release.
52 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Created by Quentin Le Guennec and Tengio Ltd
2 | https://tengio.com/
3 |
4 | Copyright 2018 Tengio Ltd
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions are met:
9 |
10 | * Redistributions of source code must retain the above copyright notice, this
11 | list of conditions and the following disclaimer.
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 | * Neither the name of Tengio Ltd nor the names of its contributors may
16 | be used to endorse or promote products derived from this software
17 | without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL TENGIO LTD OR THE CONTRIBUTORS BE LIABLE FOR ANY
23 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | # Slide Container
10 |
11 | A container that can be slid vertically and horizontally with a smooth dampened motion.
12 |
13 | Offers a handful of callbacks for customization and handles both drag distance and velocity to validate swipe gestures.
14 |
15 | Features a customized GestureDetector to reduce nested GestureDetector conflicts.
16 |
17 | Build the `example` folder with `flutter run` for a demo, or check the video in this blog post:
18 |
19 | https://tengio.com/blog/flutter-slide-container/
20 |
21 | Install instructions and doc are available here:
22 |
23 | https://pub.dartlang.org/packages/slide_container
24 |
--------------------------------------------------------------------------------
/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java:
--------------------------------------------------------------------------------
1 | package io.flutter.plugins;
2 |
3 | import io.flutter.plugin.common.PluginRegistry;
4 |
5 | /**
6 | * Generated file. Do not edit.
7 | */
8 | public final class GeneratedPluginRegistrant {
9 | public static void registerWith(PluginRegistry registry) {
10 | if (alreadyRegisteredWith(registry)) {
11 | return;
12 | }
13 | }
14 |
15 | private static boolean alreadyRegisteredWith(PluginRegistry registry) {
16 | final String key = GeneratedPluginRegistrant.class.getCanonicalName();
17 | if (registry.hasPlugin(key)) {
18 | return true;
19 | }
20 | registry.registrarFor(key);
21 | return false;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
9 | .flutter-plugins
10 |
--------------------------------------------------------------------------------
/example/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/example/.idea/libraries/Dart_Packages.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/example/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/example/.idea/libraries/Flutter_for_Android.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/.idea/misc.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/example/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/.idea/runConfigurations/main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/example/.idea/workspace.xml:
--------------------------------------------------------------------------------
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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 | 1538784141918
172 |
173 |
174 | 1538784141918
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
--------------------------------------------------------------------------------
/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: 5ab9e70727d858def3a586db7fb98ee580352957
8 | channel: beta
9 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # Slide Container Example
2 |
3 | Demo of the Slide Container.
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | *.class
3 | .gradle
4 | /local.properties
5 | /.idea/workspace.xml
6 | /.idea/libraries
7 | .DS_Store
8 | /build
9 | /captures
10 | GeneratedPluginRegistrant.java
11 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 |
27 | android {
28 | compileSdkVersion 27
29 |
30 | lintOptions {
31 | disable 'InvalidPackage'
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.tengio.slidecontainerexample"
37 | minSdkVersion 16
38 | targetSdkVersion 27
39 | versionCode flutterVersionCode.toInteger()
40 | versionName flutterVersionName
41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
42 | }
43 |
44 | buildTypes {
45 | release {
46 | // TODO: Add your own signing config for the release build.
47 | // Signing with the debug keys for now, so `flutter run --release` works.
48 | signingConfig signingConfigs.debug
49 | }
50 | }
51 | }
52 |
53 | flutter {
54 | source '../..'
55 | }
56 |
57 | dependencies {
58 | testImplementation 'junit:junit:4.12'
59 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
61 | }
62 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
15 |
19 |
26 |
30 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/tengio/slidecontainerexample/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.tengio.slidecontainerexample;
2 |
3 | import android.os.Bundle;
4 | import io.flutter.app.FlutterActivity;
5 | import io.flutter.plugins.GeneratedPluginRegistrant;
6 |
7 | public class MainActivity extends FlutterActivity {
8 | @Override
9 | protected void onCreate(Bundle savedInstanceState) {
10 | super.onCreate(savedInstanceState);
11 | GeneratedPluginRegistrant.registerWith(this);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.1.2'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | task clean(type: Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/app.flx
37 | /Flutter/app.zip
38 | /Flutter/flutter_assets/
39 | /Flutter/App.framework
40 | /Flutter/Flutter.framework
41 | /Flutter/Generated.xcconfig
42 | /ServiceDefinitions.json
43 |
44 | Pods/
45 | .symlinks/
46 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXCopyFilesBuildPhase section */
25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
26 | isa = PBXCopyFilesBuildPhase;
27 | buildActionMask = 2147483647;
28 | dstPath = "";
29 | dstSubfolderSpec = 10;
30 | files = (
31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
33 | );
34 | name = "Embed Frameworks";
35 | runOnlyForDeploymentPostprocessing = 0;
36 | };
37 | /* End PBXCopyFilesBuildPhase section */
38 |
39 | /* Begin PBXFileReference section */
40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
56 | /* End PBXFileReference section */
57 |
58 | /* Begin PBXFrameworksBuildPhase section */
59 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
60 | isa = PBXFrameworksBuildPhase;
61 | buildActionMask = 2147483647;
62 | files = (
63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
65 | );
66 | runOnlyForDeploymentPostprocessing = 0;
67 | };
68 | /* End PBXFrameworksBuildPhase section */
69 |
70 | /* Begin PBXGroup section */
71 | 9740EEB11CF90186004384FC /* Flutter */ = {
72 | isa = PBXGroup;
73 | children = (
74 | 3B80C3931E831B6300D905FE /* App.framework */,
75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
80 | );
81 | name = Flutter;
82 | sourceTree = "";
83 | };
84 | 97C146E51CF9000F007C117D = {
85 | isa = PBXGroup;
86 | children = (
87 | 9740EEB11CF90186004384FC /* Flutter */,
88 | 97C146F01CF9000F007C117D /* Runner */,
89 | 97C146EF1CF9000F007C117D /* Products */,
90 | );
91 | sourceTree = "";
92 | };
93 | 97C146EF1CF9000F007C117D /* Products */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 97C146EE1CF9000F007C117D /* Runner.app */,
97 | );
98 | name = Products;
99 | sourceTree = "";
100 | };
101 | 97C146F01CF9000F007C117D /* Runner */ = {
102 | isa = PBXGroup;
103 | children = (
104 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
105 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
106 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
107 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
108 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
109 | 97C147021CF9000F007C117D /* Info.plist */,
110 | 97C146F11CF9000F007C117D /* Supporting Files */,
111 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
112 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
113 | );
114 | path = Runner;
115 | sourceTree = "";
116 | };
117 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
118 | isa = PBXGroup;
119 | children = (
120 | 97C146F21CF9000F007C117D /* main.m */,
121 | );
122 | name = "Supporting Files";
123 | sourceTree = "";
124 | };
125 | /* End PBXGroup section */
126 |
127 | /* Begin PBXNativeTarget section */
128 | 97C146ED1CF9000F007C117D /* Runner */ = {
129 | isa = PBXNativeTarget;
130 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
131 | buildPhases = (
132 | 9740EEB61CF901F6004384FC /* Run Script */,
133 | 97C146EA1CF9000F007C117D /* Sources */,
134 | 97C146EB1CF9000F007C117D /* Frameworks */,
135 | 97C146EC1CF9000F007C117D /* Resources */,
136 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
137 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
138 | );
139 | buildRules = (
140 | );
141 | dependencies = (
142 | );
143 | name = Runner;
144 | productName = Runner;
145 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
146 | productType = "com.apple.product-type.application";
147 | };
148 | /* End PBXNativeTarget section */
149 |
150 | /* Begin PBXProject section */
151 | 97C146E61CF9000F007C117D /* Project object */ = {
152 | isa = PBXProject;
153 | attributes = {
154 | LastUpgradeCheck = 0910;
155 | ORGANIZATIONNAME = "The Chromium Authors";
156 | TargetAttributes = {
157 | 97C146ED1CF9000F007C117D = {
158 | CreatedOnToolsVersion = 7.3.1;
159 | DevelopmentTeam = C6PQJBBUJD;
160 | };
161 | };
162 | };
163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
164 | compatibilityVersion = "Xcode 3.2";
165 | developmentRegion = English;
166 | hasScannedForEncodings = 0;
167 | knownRegions = (
168 | English,
169 | en,
170 | Base,
171 | );
172 | mainGroup = 97C146E51CF9000F007C117D;
173 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
174 | projectDirPath = "";
175 | projectRoot = "";
176 | targets = (
177 | 97C146ED1CF9000F007C117D /* Runner */,
178 | );
179 | };
180 | /* End PBXProject section */
181 |
182 | /* Begin PBXResourcesBuildPhase section */
183 | 97C146EC1CF9000F007C117D /* Resources */ = {
184 | isa = PBXResourcesBuildPhase;
185 | buildActionMask = 2147483647;
186 | files = (
187 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
188 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
189 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
190 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
191 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
192 | );
193 | runOnlyForDeploymentPostprocessing = 0;
194 | };
195 | /* End PBXResourcesBuildPhase section */
196 |
197 | /* Begin PBXShellScriptBuildPhase section */
198 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
199 | isa = PBXShellScriptBuildPhase;
200 | buildActionMask = 2147483647;
201 | files = (
202 | );
203 | inputPaths = (
204 | );
205 | name = "Thin Binary";
206 | outputPaths = (
207 | );
208 | runOnlyForDeploymentPostprocessing = 0;
209 | shellPath = /bin/sh;
210 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
211 | };
212 | 9740EEB61CF901F6004384FC /* Run Script */ = {
213 | isa = PBXShellScriptBuildPhase;
214 | buildActionMask = 2147483647;
215 | files = (
216 | );
217 | inputPaths = (
218 | );
219 | name = "Run Script";
220 | outputPaths = (
221 | );
222 | runOnlyForDeploymentPostprocessing = 0;
223 | shellPath = /bin/sh;
224 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
225 | };
226 | /* End PBXShellScriptBuildPhase section */
227 |
228 | /* Begin PBXSourcesBuildPhase section */
229 | 97C146EA1CF9000F007C117D /* Sources */ = {
230 | isa = PBXSourcesBuildPhase;
231 | buildActionMask = 2147483647;
232 | files = (
233 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
234 | 97C146F31CF9000F007C117D /* main.m in Sources */,
235 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
236 | );
237 | runOnlyForDeploymentPostprocessing = 0;
238 | };
239 | /* End PBXSourcesBuildPhase section */
240 |
241 | /* Begin PBXVariantGroup section */
242 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
243 | isa = PBXVariantGroup;
244 | children = (
245 | 97C146FB1CF9000F007C117D /* Base */,
246 | );
247 | name = Main.storyboard;
248 | sourceTree = "";
249 | };
250 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
251 | isa = PBXVariantGroup;
252 | children = (
253 | 97C147001CF9000F007C117D /* Base */,
254 | );
255 | name = LaunchScreen.storyboard;
256 | sourceTree = "";
257 | };
258 | /* End PBXVariantGroup section */
259 |
260 | /* Begin XCBuildConfiguration section */
261 | 97C147031CF9000F007C117D /* Debug */ = {
262 | isa = XCBuildConfiguration;
263 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
264 | buildSettings = {
265 | ALWAYS_SEARCH_USER_PATHS = NO;
266 | CLANG_ANALYZER_NONNULL = YES;
267 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
268 | CLANG_CXX_LIBRARY = "libc++";
269 | CLANG_ENABLE_MODULES = YES;
270 | CLANG_ENABLE_OBJC_ARC = YES;
271 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
272 | CLANG_WARN_BOOL_CONVERSION = YES;
273 | CLANG_WARN_COMMA = YES;
274 | CLANG_WARN_CONSTANT_CONVERSION = YES;
275 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
276 | CLANG_WARN_EMPTY_BODY = YES;
277 | CLANG_WARN_ENUM_CONVERSION = YES;
278 | CLANG_WARN_INFINITE_RECURSION = YES;
279 | CLANG_WARN_INT_CONVERSION = YES;
280 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
281 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
282 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
283 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
284 | CLANG_WARN_STRICT_PROTOTYPES = YES;
285 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
286 | CLANG_WARN_UNREACHABLE_CODE = YES;
287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
288 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
289 | COPY_PHASE_STRIP = NO;
290 | DEBUG_INFORMATION_FORMAT = dwarf;
291 | ENABLE_STRICT_OBJC_MSGSEND = YES;
292 | ENABLE_TESTABILITY = YES;
293 | GCC_C_LANGUAGE_STANDARD = gnu99;
294 | GCC_DYNAMIC_NO_PIC = NO;
295 | GCC_NO_COMMON_BLOCKS = YES;
296 | GCC_OPTIMIZATION_LEVEL = 0;
297 | GCC_PREPROCESSOR_DEFINITIONS = (
298 | "DEBUG=1",
299 | "$(inherited)",
300 | );
301 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
302 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
303 | GCC_WARN_UNDECLARED_SELECTOR = YES;
304 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
305 | GCC_WARN_UNUSED_FUNCTION = YES;
306 | GCC_WARN_UNUSED_VARIABLE = YES;
307 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
308 | MTL_ENABLE_DEBUG_INFO = YES;
309 | ONLY_ACTIVE_ARCH = YES;
310 | SDKROOT = iphoneos;
311 | TARGETED_DEVICE_FAMILY = "1,2";
312 | };
313 | name = Debug;
314 | };
315 | 97C147041CF9000F007C117D /* Release */ = {
316 | isa = XCBuildConfiguration;
317 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
318 | buildSettings = {
319 | ALWAYS_SEARCH_USER_PATHS = NO;
320 | CLANG_ANALYZER_NONNULL = YES;
321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
322 | CLANG_CXX_LIBRARY = "libc++";
323 | CLANG_ENABLE_MODULES = YES;
324 | CLANG_ENABLE_OBJC_ARC = YES;
325 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
326 | CLANG_WARN_BOOL_CONVERSION = YES;
327 | CLANG_WARN_COMMA = YES;
328 | CLANG_WARN_CONSTANT_CONVERSION = YES;
329 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
330 | CLANG_WARN_EMPTY_BODY = YES;
331 | CLANG_WARN_ENUM_CONVERSION = YES;
332 | CLANG_WARN_INFINITE_RECURSION = YES;
333 | CLANG_WARN_INT_CONVERSION = YES;
334 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
335 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
337 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
338 | CLANG_WARN_STRICT_PROTOTYPES = YES;
339 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
340 | CLANG_WARN_UNREACHABLE_CODE = YES;
341 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
342 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
343 | COPY_PHASE_STRIP = NO;
344 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
345 | ENABLE_NS_ASSERTIONS = NO;
346 | ENABLE_STRICT_OBJC_MSGSEND = YES;
347 | GCC_C_LANGUAGE_STANDARD = gnu99;
348 | GCC_NO_COMMON_BLOCKS = YES;
349 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
350 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
351 | GCC_WARN_UNDECLARED_SELECTOR = YES;
352 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
353 | GCC_WARN_UNUSED_FUNCTION = YES;
354 | GCC_WARN_UNUSED_VARIABLE = YES;
355 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
356 | MTL_ENABLE_DEBUG_INFO = NO;
357 | SDKROOT = iphoneos;
358 | TARGETED_DEVICE_FAMILY = "1,2";
359 | VALIDATE_PRODUCT = YES;
360 | };
361 | name = Release;
362 | };
363 | 97C147061CF9000F007C117D /* Debug */ = {
364 | isa = XCBuildConfiguration;
365 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
366 | buildSettings = {
367 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
368 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
369 | DEVELOPMENT_TEAM = C6PQJBBUJD;
370 | ENABLE_BITCODE = NO;
371 | FRAMEWORK_SEARCH_PATHS = (
372 | "$(inherited)",
373 | "$(PROJECT_DIR)/Flutter",
374 | );
375 | INFOPLIST_FILE = Runner/Info.plist;
376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
377 | LIBRARY_SEARCH_PATHS = (
378 | "$(inherited)",
379 | "$(PROJECT_DIR)/Flutter",
380 | );
381 | PRODUCT_BUNDLE_IDENTIFIER = com.tengio.slideContainerExample;
382 | PRODUCT_NAME = "$(TARGET_NAME)";
383 | VERSIONING_SYSTEM = "apple-generic";
384 | };
385 | name = Debug;
386 | };
387 | 97C147071CF9000F007C117D /* Release */ = {
388 | isa = XCBuildConfiguration;
389 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
390 | buildSettings = {
391 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
392 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
393 | DEVELOPMENT_TEAM = C6PQJBBUJD;
394 | ENABLE_BITCODE = NO;
395 | FRAMEWORK_SEARCH_PATHS = (
396 | "$(inherited)",
397 | "$(PROJECT_DIR)/Flutter",
398 | );
399 | INFOPLIST_FILE = Runner/Info.plist;
400 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
401 | LIBRARY_SEARCH_PATHS = (
402 | "$(inherited)",
403 | "$(PROJECT_DIR)/Flutter",
404 | );
405 | PRODUCT_BUNDLE_IDENTIFIER = com.tengio.slideContainerExample;
406 | PRODUCT_NAME = "$(TARGET_NAME)";
407 | VERSIONING_SYSTEM = "apple-generic";
408 | };
409 | name = Release;
410 | };
411 | /* End XCBuildConfiguration section */
412 |
413 | /* Begin XCConfigurationList section */
414 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
415 | isa = XCConfigurationList;
416 | buildConfigurations = (
417 | 97C147031CF9000F007C117D /* Debug */,
418 | 97C147041CF9000F007C117D /* Release */,
419 | );
420 | defaultConfigurationIsVisible = 0;
421 | defaultConfigurationName = Release;
422 | };
423 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
424 | isa = XCConfigurationList;
425 | buildConfigurations = (
426 | 97C147061CF9000F007C117D /* Debug */,
427 | 97C147071CF9000F007C117D /* Release */,
428 | );
429 | defaultConfigurationIsVisible = 0;
430 | defaultConfigurationName = Release;
431 | };
432 | /* End XCConfigurationList section */
433 | };
434 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
435 | }
436 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/quentinleguennec/flutter-slide-container/8548aec6ca34cfae15a6ae38dc0babbb40d88065/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 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | slide_container_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/help_page.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter/services.dart';
5 | import 'package:slide_container/slide_container.dart';
6 | import 'package:slide_container/slide_container_controller.dart';
7 |
8 | class HelpPage extends PopupRoute {
9 | @override
10 | Color get barrierColor => null;
11 |
12 | @override
13 | bool get barrierDismissible => false;
14 |
15 | /// If this is true the page bellow will not be visible when sliding.
16 | @override
17 | bool get opaque => false;
18 |
19 | @override
20 | String get barrierLabel => "Close";
21 |
22 | @override
23 | Duration get transitionDuration => const Duration(microseconds: 1);
24 |
25 | @override
26 | Widget buildPage(_, __, ___) => _PageLayout();
27 | }
28 |
29 | class _PageLayout extends StatefulWidget {
30 | _PageLayout();
31 |
32 | @override
33 | _PageLayoutState createState() => _PageLayoutState();
34 | }
35 |
36 | class _PageLayoutState extends State<_PageLayout> {
37 | final SlideContainerController slideContainerController =
38 | SlideContainerController();
39 |
40 | Widget get lineSeparator => Container(
41 | margin: const EdgeInsets.only(top: 10, bottom: 10),
42 | width: 47.0,
43 | height: 0.5,
44 | color: Colors.black,
45 | );
46 |
47 | @override
48 | Widget build(BuildContext context) => WillPopScope(
49 | onWillPop: () async {
50 | slideContainerController
51 | .forceSlide(SlideContainerDirection.topToBottom);
52 | return false;
53 | },
54 | child: Scaffold(
55 | backgroundColor: Colors.transparent,
56 | body: _ClosePageSlideContainer(
57 | controller: slideContainerController,
58 | child: Container(
59 | constraints: BoxConstraints.tight(MediaQuery.of(context).size),
60 | padding: MediaQuery.of(context).padding +
61 | EdgeInsets.only(top: 20, left: 20, right: 20),
62 | color: Colors.white,
63 | child: Column(
64 | crossAxisAlignment: CrossAxisAlignment.center,
65 | children: [
66 | const Text(
67 | "Welcome to SlideContainer!",
68 | style: TextStyle(fontSize: 20),
69 | textAlign: TextAlign.center,
70 | ),
71 | lineSeparator,
72 | const Text(
73 | "This example app covers several aspects of the SlideContainer.",
74 | style: TextStyle(fontSize: 16),
75 | textAlign: TextAlign.center,
76 | ),
77 | lineSeparator,
78 | const Text(
79 | "On the main page the bottom nav bar as several options, check the source code for more info:" +
80 | "\n\t- 1: Simple example where both SlideContainers can be manually slid and the bottom one also slide by itself using a SlideContainerController." +
81 | "\n\t- 2: Example showing a limitation in Flutter affecting Gesture hit test detection and how to work around it." +
82 | "\n\t- 3: Example of use of SlideContainers as side menus.",
83 | style: TextStyle(fontSize: 16),
84 | textAlign: TextAlign.start,
85 | ),
86 | lineSeparator,
87 | const Text(
88 | "The page you are currently looking at is in a SlideContainer, you can slide it from top to bottom to pop it and reveal the underlying page.",
89 | style: TextStyle(fontSize: 16),
90 | textAlign: TextAlign.center,
91 | ),
92 | ],
93 | ),
94 | ),
95 | ),
96 | ),
97 | );
98 | }
99 |
100 | /// Handy version of the [SlideContainer] to pop pages with a slide.
101 | class _ClosePageSlideContainer extends StatefulWidget {
102 | final Widget child;
103 | final VoidCallback onSlideStarted;
104 | final VoidCallback onSlideCompleted;
105 | final VoidCallback onSlideCanceled;
106 | final ValueChanged onSlide;
107 | final SlideContainerController controller;
108 |
109 | _ClosePageSlideContainer({
110 | @required this.child,
111 | this.onSlideStarted,
112 | this.onSlideCompleted,
113 | this.onSlideCanceled,
114 | this.onSlide,
115 | this.controller,
116 | });
117 |
118 | @override
119 | _ClosePageSlideContainerState createState() =>
120 | _ClosePageSlideContainerState();
121 | }
122 |
123 | class _ClosePageSlideContainerState extends State<_ClosePageSlideContainer> {
124 | double overlayOpacity = 1.0;
125 |
126 | double get maxSlideDistance => MediaQuery.of(context).size.height;
127 |
128 | double get minSlideDistanceToValidate => maxSlideDistance * 0.5;
129 |
130 | void onSlide(double verticalPosition) {
131 | if (mounted) {
132 | setState(() => overlayOpacity = (1.000912 -
133 | 0.1701771 * verticalPosition +
134 | 1.676138 * pow(verticalPosition, 2) -
135 | 3.784127 * pow(verticalPosition, 3))
136 | .clamp(0.0, 1.0));
137 | }
138 | if (widget.onSlide != null) widget.onSlide(verticalPosition);
139 | }
140 |
141 | void onSlideCompleted() {
142 | if (widget.onSlideCompleted != null) widget.onSlideCompleted();
143 | Navigator.of(context).pop();
144 | }
145 |
146 | @override
147 | Widget build(BuildContext context) => SlideContainer(
148 | controller: widget.controller,
149 | slideDirection: SlideContainerDirection.topToBottom,
150 | onSlide: onSlide,
151 | onSlideCompleted: onSlideCompleted,
152 | minDragVelocityForAutoSlide: 600.0,
153 | minSlideDistanceToValidate: minSlideDistanceToValidate,
154 | maxSlideDistance: maxSlideDistance,
155 | autoSlideDuration: const Duration(milliseconds: 300),
156 | onSlideStarted: widget.onSlideStarted,
157 | onSlideCanceled: widget.onSlideCanceled,
158 | onSlideValidated: () => HapticFeedback.mediumImpact(),
159 | child: Opacity(
160 | opacity: overlayOpacity,
161 | child: widget.child,
162 | ),
163 | );
164 | }
165 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/scheduler.dart';
3 | import 'package:slide_container_example/help_page.dart';
4 | import 'package:slide_container_example/page1.dart';
5 | import 'package:slide_container_example/page2.dart';
6 | import 'package:slide_container_example/page3.dart';
7 |
8 | void main() => runApp(App());
9 |
10 | class App extends StatelessWidget {
11 | static const double bottomNavigationBarHeight = 48;
12 |
13 | @override
14 | Widget build(BuildContext context) => MaterialApp(
15 | theme: ThemeData(splashColor: Colors.transparent),
16 | home: Scaffold(
17 | body: _Body(),
18 | ),
19 | );
20 | }
21 |
22 | class _Body extends StatefulWidget {
23 | @override
24 | _State createState() => _State();
25 | }
26 |
27 | class _State extends State<_Body> {
28 | int selectedPageIndex = 0;
29 |
30 | @override
31 | void initState() {
32 | super.initState();
33 | SchedulerBinding.instance
34 | .addPostFrameCallback((_) => Navigator.of(context).push(HelpPage()));
35 | }
36 |
37 | void onPageSelected(int index) {
38 | if (mounted) setState(() => selectedPageIndex = index);
39 | }
40 |
41 | @override
42 | Widget build(BuildContext context) => Scaffold(
43 | body: selectedPageIndex == 0
44 | ? Page1()
45 | : selectedPageIndex == 1 ? Page2() : Page3(),
46 | bottomNavigationBar: SizedBox(
47 | height: App.bottomNavigationBarHeight,
48 | child: BottomNavigationBar(
49 | items: [
50 | BottomNavigationBarItem(
51 | icon: Container(),
52 | title: Text('1'),
53 | ),
54 | BottomNavigationBarItem(
55 | icon: Container(),
56 | title: Text('2'),
57 | ),
58 | BottomNavigationBarItem(
59 | icon: Container(),
60 | title: Text('3'),
61 | ),
62 | ],
63 | currentIndex: selectedPageIndex,
64 | selectedItemColor: Colors.amber[800],
65 | onTap: onPageSelected,
66 | ),
67 | ),
68 | );
69 | }
70 |
--------------------------------------------------------------------------------
/example/lib/page1.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter/services.dart';
5 | import 'package:slide_container/slide_container.dart';
6 | import 'package:slide_container/slide_container_controller.dart';
7 | import 'package:slide_container_example/main.dart';
8 |
9 | class Page1 extends StatefulWidget {
10 | @override
11 | _State createState() => _State();
12 | }
13 |
14 | class _State extends State {
15 | final SlideContainerController controller = SlideContainerController();
16 |
17 | double position = 0.0;
18 |
19 | double get maxSlideDistance => MediaQuery.of(context).size.height * 0.2;
20 |
21 | @override
22 | void initState() {
23 | /// This will not do anything because [build()] as not been called yet and thus the controller is not attached to any [SlideContainer]
24 | controller.forceSlide(SlideContainerDirection.rightToLeft);
25 |
26 | playForceSlideLoop();
27 | super.initState();
28 | }
29 |
30 | void playForceSlideLoop() {
31 | Future.delayed(Duration(seconds: 3), () {
32 | controller.forceSlide(SlideContainerDirection.leftToRight);
33 | Future.delayed(Duration(seconds: 3), () {
34 | controller.forceSlide(SlideContainerDirection.leftToRight);
35 | Future.delayed(Duration(seconds: 3), () {
36 | controller.forceSlide(SlideContainerDirection.rightToLeft);
37 | Future.delayed(Duration(seconds: 3), () {
38 | controller.forceSlide(SlideContainerDirection.rightToLeft);
39 | playForceSlideLoop();
40 | });
41 | });
42 | });
43 | });
44 | }
45 |
46 | void onSlide(double position) {
47 | setState(() => this.position = position);
48 | }
49 |
50 | @override
51 | Widget build(BuildContext context) => Container(
52 | constraints: BoxConstraints.expand(),
53 | child: Stack(
54 | children: [
55 | Positioned(
56 | top: MediaQuery.of(context).size.height * 0.07,
57 | width: MediaQuery.of(context).size.width,
58 | child: Text(
59 | "❤️",
60 | style: TextStyle(fontSize: 46.0),
61 | textAlign: TextAlign.center,
62 | ),
63 | ),
64 | Positioned(
65 | top: MediaQuery.of(context).size.height * 0.36,
66 | width: MediaQuery.of(context).size.width,
67 | child: Text(
68 | "✌️",
69 | style: TextStyle(fontSize: 46.0),
70 | textAlign: TextAlign.center,
71 | ),
72 | ),
73 |
74 | /// This GestureDetector is here to demonstrate how the gesture event only propagate to the parent when the
75 | /// SlideContainer can not slide more in the direction of the drag.
76 | GestureDetector(
77 | onVerticalDragStart: (_) => print(
78 | "Container cannot be slid further in that direction, this GestureDetector can take control and handle the gesture."),
79 | child: SlideContainer(
80 | slideDirection: SlideContainerDirection.vertical,
81 | autoSlideDuration: Duration(milliseconds: 300),
82 | onSlide: onSlide,
83 | maxSlideDistance: maxSlideDistance,
84 | onSlideValidated: () => HapticFeedback.mediumImpact(),
85 | onSlideUnvalidated: () => HapticFeedback.mediumImpact(),
86 | child: Container(
87 | width: MediaQuery.of(context).size.width,
88 | height: MediaQuery.of(context).size.height * 0.5,
89 | alignment: Alignment.center,
90 | decoration: BoxDecoration(
91 | gradient: LinearGradient(
92 | begin: Alignment.topLeft,
93 | end: Alignment.bottomRight,
94 | colors: [
95 | Color.lerp(
96 | Color(0xfffddb92), Color(0xfffed6e3), position),
97 | Color.lerp(
98 | Color(0xffd1fdff), Color(0xff9a9ce2), position),
99 | ],
100 | ),
101 | boxShadow: [
102 | const BoxShadow(
103 | color: Color(0x90000000),
104 | blurRadius: 10.0,
105 | spreadRadius: 5.0,
106 | ),
107 | ],
108 | ),
109 | child: Center(
110 | child: Text(
111 | "Slide me!",
112 | style: TextStyle(fontSize: 26.0),
113 | ),
114 | ),
115 | ),
116 | ),
117 | ),
118 | Positioned(
119 | bottom: 0.0,
120 | child: SlideContainer(
121 | controller: controller,
122 | slideDirection: SlideContainerDirection.horizontal,
123 | autoSlideDuration: Duration(milliseconds: 600),
124 | maxSlideDistance: maxSlideDistance,
125 | child: Container(
126 | width: MediaQuery.of(context).size.width,
127 | height: MediaQuery.of(context).size.height * 0.5 -
128 | App.bottomNavigationBarHeight,
129 | alignment: Alignment.center,
130 | decoration: BoxDecoration(
131 | gradient: LinearGradient(
132 | begin: Alignment.centerLeft,
133 | end: Alignment.centerRight,
134 | colors: [
135 | const Color(0xfffddb92),
136 | const Color(0xffd1fdff),
137 | ],
138 | ),
139 | boxShadow: [
140 | const BoxShadow(
141 | color: Color(0x90000000),
142 | blurRadius: 15.0,
143 | spreadRadius: 10.0,
144 | ),
145 | ],
146 | ),
147 | child: Center(
148 | child: Text(
149 | "Auto Slide",
150 | style: TextStyle(fontSize: 26.0),
151 | ),
152 | ),
153 | ),
154 | ),
155 | ),
156 | ],
157 | ),
158 | );
159 | }
160 |
--------------------------------------------------------------------------------
/example/lib/page2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:slide_container/slide_container.dart';
3 | import 'package:slide_container/slide_container_controller.dart';
4 |
5 | /// This example shows a limitation in Flutter preventing hit test detection if the child gesture detector is out
6 | /// of it's parent bounds as described here: https://github.com/flutter/flutter/issues/27587
7 | ///
8 | /// The current solution is to make sure the [SlideContainer] always stays in its parent bounds, even when translated
9 | /// to it's [SlideContainer.maxSlideDistance].
10 | /// Of course, if the [SlideContainer] is translated off screen or under something that completely cover it this issue
11 | /// will not be noticeable, and the size of the parent doesn't matter (like in [Page1]).
12 | ///
13 | /// The green area is the parent bounds. On the bottom [SlideContainer] you can see that it will not respond if you
14 | /// slide it up and then try to slide it down by dragging on the top part of the [SlideContainer] (the part that is out
15 | /// of the parent bounds).
16 | class Page2 extends StatefulWidget {
17 | @override
18 | _State createState() => _State();
19 | }
20 |
21 | class _State extends State {
22 | final SlideContainerController controller = SlideContainerController();
23 |
24 | double get maxSlideDistance => MediaQuery.of(context).size.height * 0.1;
25 |
26 | @override
27 | Widget build(BuildContext context) => Container(
28 | constraints: BoxConstraints.expand(),
29 | child: Stack(
30 | children: [
31 | Container(
32 | alignment: Alignment.center,
33 | height: MediaQuery.of(context).size.height * 0.25 +
34 | maxSlideDistance * 2,
35 | color: Colors.green.withOpacity(0.3),
36 | child: SlideContainer(
37 | slideDirection: SlideContainerDirection.vertical,
38 | maxSlideDistance: maxSlideDistance,
39 | child: Container(
40 | alignment: Alignment.center,
41 | width: MediaQuery.of(context).size.width,
42 | height: MediaQuery.of(context).size.height * 0.25,
43 | decoration: BoxDecoration(
44 | gradient: LinearGradient(
45 | begin: Alignment.topLeft,
46 | end: Alignment.bottomRight,
47 | colors: [
48 | const Color(0xfffddb92),
49 | const Color(0xffd1fdff),
50 | ],
51 | ),
52 | boxShadow: [
53 | const BoxShadow(
54 | color: Color(0x90000000),
55 | blurRadius: 10.0,
56 | spreadRadius: 5.0,
57 | ),
58 | ],
59 | ),
60 | child: Text(
61 | "Parent big enough",
62 | style: TextStyle(fontSize: 26.0),
63 | ),
64 | ),
65 | ),
66 | ),
67 | Positioned(
68 | bottom: MediaQuery.of(context).size.height * 0.1,
69 | child: Container(
70 | alignment: Alignment.center,
71 | height: MediaQuery.of(context).size.height * 0.25,
72 | color: Colors.green.withOpacity(0.3),
73 | child: SlideContainer(
74 | slideDirection: SlideContainerDirection.vertical,
75 | maxSlideDistance: maxSlideDistance,
76 | child: Container(
77 | alignment: Alignment.center,
78 | width: MediaQuery.of(context).size.width,
79 | height: MediaQuery.of(context).size.height * 0.25,
80 | decoration: BoxDecoration(
81 | gradient: LinearGradient(
82 | begin: Alignment.topLeft,
83 | end: Alignment.bottomRight,
84 | colors: [
85 | const Color(0xfffddb92),
86 | const Color(0xffd1fdff),
87 | ],
88 | ),
89 | boxShadow: [
90 | const BoxShadow(
91 | color: Color(0x90000000),
92 | blurRadius: 10.0,
93 | spreadRadius: 5.0,
94 | ),
95 | ],
96 | ),
97 | child: Text(
98 | "Parent NOT big enough",
99 | style: TextStyle(fontSize: 26.0),
100 | ),
101 | ),
102 | ),
103 | ),
104 | ),
105 | ],
106 | ),
107 | );
108 | }
109 |
--------------------------------------------------------------------------------
/example/lib/page3.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:slide_container/slide_container.dart';
3 | import 'package:slide_container/slide_container_controller.dart';
4 |
5 | /// This example shows of the [SlideContainer] can be used as a side menu. And demonstrate how to
6 | /// disable the auto-slide.
7 | class Page3 extends StatefulWidget {
8 | @override
9 | _State createState() => _State();
10 | }
11 |
12 | class _State extends State {
13 | static const double menuBarHeight = 64;
14 | final SlideContainerController controller = SlideContainerController();
15 |
16 | bool isMenuExtended = false;
17 |
18 | double get maxSlideDistance =>
19 | MediaQuery.of(context).size.width - menuBarHeight;
20 |
21 | BoxDecoration get containerDecoration => BoxDecoration(
22 | gradient: LinearGradient(
23 | begin: Alignment.topLeft,
24 | end: Alignment.bottomRight,
25 | colors: [
26 | const Color(0xfffddb92),
27 | const Color(0xffd1fdff),
28 | ],
29 | ),
30 | boxShadow: [
31 | const BoxShadow(
32 | color: Color(0x90000000),
33 | blurRadius: 10.0,
34 | spreadRadius: 5.0,
35 | ),
36 | ],
37 | );
38 |
39 | Widget get menuWithoutAutoSlide => Positioned(
40 | top: MediaQuery.of(context).size.height * 0.6,
41 | width: MediaQuery.of(context).size.width,
42 | height: menuBarHeight,
43 | child: Transform.translate(
44 | offset: Offset(-maxSlideDistance, 0),
45 | child: SlideContainer(
46 | slideDirection: SlideContainerDirection.leftToRight,
47 |
48 | /// Setting the following two to double.infinity will fully disable the auto-slide
49 | /// (they can also be disabled separately).
50 | minSlideDistanceToValidate: double.infinity,
51 | minDragVelocityForAutoSlide: double.infinity,
52 | maxSlideDistance: maxSlideDistance,
53 | child: Container(
54 | alignment: Alignment.center,
55 | decoration: containerDecoration,
56 | child: Row(
57 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
58 | children: [
59 | const Padding(
60 | padding: const EdgeInsets.only(left: 20),
61 | child: Text(
62 | "Without auto-slide",
63 | style: TextStyle(fontSize: 26.0),
64 | ),
65 | ),
66 | Container(
67 | width: menuBarHeight,
68 | height: menuBarHeight,
69 | child: Icon(
70 | Icons.arrow_forward_ios,
71 | size: 24.0,
72 | ),
73 | ),
74 | ],
75 | ),
76 | ),
77 | ),
78 | ),
79 | );
80 |
81 | Widget get menuWithAutoSlide => Positioned(
82 | top: MediaQuery.of(context).size.height * 0.4,
83 | width: MediaQuery.of(context).size.width,
84 | height: menuBarHeight,
85 | child: Transform.translate(
86 | offset: Offset(maxSlideDistance, 0),
87 | child: SlideContainer(
88 | slideDirection: SlideContainerDirection.rightToLeft,
89 | maxSlideDistance: maxSlideDistance,
90 | child: Container(
91 | alignment: Alignment.center,
92 | decoration: containerDecoration,
93 | child: Row(
94 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
95 | children: [
96 | Container(
97 | width: menuBarHeight,
98 | height: menuBarHeight,
99 | child: Icon(
100 | Icons.arrow_back_ios,
101 | size: 24.0,
102 | ),
103 | ),
104 | const Padding(
105 | padding: const EdgeInsets.only(right: 20),
106 | child: Text(
107 | "With auto-slide",
108 | style: TextStyle(fontSize: 26.0),
109 | ),
110 | ),
111 | ],
112 | ),
113 | ),
114 | ),
115 | ),
116 | );
117 |
118 | Widget get menuWithTapGesture => Positioned(
119 | top: MediaQuery.of(context).size.height * 0.2,
120 | width: MediaQuery.of(context).size.width,
121 | height: menuBarHeight,
122 | child: Transform.translate(
123 | offset: Offset(-maxSlideDistance, 0),
124 | child: SlideContainer(
125 | slideDirection: SlideContainerDirection.leftToRight,
126 | maxSlideDistance: maxSlideDistance,
127 | controller: controller,
128 | onSlideCompleted: () => isMenuExtended = true,
129 | onSlideCanceled: () => isMenuExtended = false,
130 | child: Container(
131 | alignment: Alignment.center,
132 | decoration: containerDecoration,
133 | child: Row(
134 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
135 | children: [
136 | GestureDetector(
137 | onTap: () => print("onTap"),
138 | child: const Padding(
139 | padding: const EdgeInsets.only(left: 20),
140 | child: Text(
141 | "With tap to slide",
142 | style: TextStyle(fontSize: 26.0),
143 | ),
144 | ),
145 | ),
146 | GestureDetector(
147 | onTap: () {
148 | isMenuExtended
149 | ? controller
150 | .forceSlide(SlideContainerDirection.rightToLeft)
151 | : controller
152 | .forceSlide(SlideContainerDirection.leftToRight);
153 | },
154 | child: Container(
155 | width: menuBarHeight,
156 | height: menuBarHeight,
157 | color: Colors.transparent,
158 | child: Icon(
159 | Icons.arrow_forward_ios,
160 | size: 24.0,
161 | ),
162 | ),
163 | ),
164 | ],
165 | ),
166 | ),
167 | ),
168 | ),
169 | );
170 |
171 | @override
172 | Widget build(BuildContext context) => Container(
173 | constraints: BoxConstraints.expand(),
174 | child: Stack(
175 | children: [
176 | menuWithoutAutoSlide,
177 | menuWithAutoSlide,
178 | menuWithTapGesture,
179 | ],
180 | ),
181 | );
182 | }
183 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | collection:
5 | dependency: transitive
6 | description:
7 | name: collection
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "1.14.11"
11 | flutter:
12 | dependency: "direct main"
13 | description: flutter
14 | source: sdk
15 | version: "0.0.0"
16 | meta:
17 | dependency: transitive
18 | description:
19 | name: meta
20 | url: "https://pub.dartlang.org"
21 | source: hosted
22 | version: "1.1.7"
23 | sky_engine:
24 | dependency: transitive
25 | description: flutter
26 | source: sdk
27 | version: "0.0.99"
28 | slide_container:
29 | dependency: "direct main"
30 | description:
31 | path: ".."
32 | relative: true
33 | source: path
34 | version: "1.1.2"
35 | typed_data:
36 | dependency: transitive
37 | description:
38 | name: typed_data
39 | url: "https://pub.dartlang.org"
40 | source: hosted
41 | version: "1.1.6"
42 | vector_math:
43 | dependency: transitive
44 | description:
45 | name: vector_math
46 | url: "https://pub.dartlang.org"
47 | source: hosted
48 | version: "2.0.8"
49 | sdks:
50 | dart: ">=2.2.2 <3.0.0"
51 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: slide_container_example
2 | description: Demo of the Slide Container.
3 | version: 1.0.5
4 | author: Quentin Le Guennec
5 |
6 | environment:
7 | sdk: ">=2.0.0-dev.68.0 <3.0.0"
8 |
9 | dependencies:
10 | flutter:
11 | sdk: flutter
12 | slide_container:
13 | path: ../
14 |
15 |
16 | flutter:
17 | uses-material-design: true
--------------------------------------------------------------------------------
/example/slide_container_example.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/example/slide_container_example_android.iml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/lib/extended_drag_gesture_recognizer.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/gestures.dart';
2 | import 'package:flutter/widgets.dart';
3 | import 'package:slide_container/slide_container.dart';
4 |
5 | /// Recognizes movement in the vertical direction.
6 | ///
7 | /// Modified version of the [VerticalDragGestureRecognizer] that can be locked to prevent up or down movement.
8 | /// Movements in the locked direction will not trigger a gesture and thus not block other gesture detectors.
9 | class LockableVerticalDragGestureRecognizer
10 | extends ExtendedDragGestureRecognizer {
11 | /// Getter to know if the movement should be blocked in one direction.
12 | final ValueGetter lockGetter;
13 |
14 | LockableVerticalDragGestureRecognizer({
15 | @required this.lockGetter,
16 | Object debugOwner,
17 | }) : assert(lockGetter != null),
18 | super(debugOwner: debugOwner);
19 |
20 | SlideContainerLock get lock => lockGetter();
21 |
22 | @override
23 | bool isFlingGesture(VelocityEstimate estimate) {
24 | final double minVelocity = minFlingVelocity ?? kMinFlingVelocity;
25 | final double minDistance = minFlingDistance ?? kTouchSlop;
26 | if ((lock == SlideContainerLock.top && estimate.pixelsPerSecond.dy < 0.0) ||
27 | (lock == SlideContainerLock.bottom &&
28 | estimate.pixelsPerSecond.dy > 0.0)) {
29 | return false;
30 | }
31 | return estimate.pixelsPerSecond.dy.abs() > minVelocity &&
32 | estimate.offset.dy.abs() > minDistance;
33 | }
34 |
35 | @override
36 | bool get _hasSufficientPendingDragDeltaToAccept {
37 | if ((lock == SlideContainerLock.top && _pendingDragOffset.dy < 0.0) ||
38 | (lock == SlideContainerLock.bottom && _pendingDragOffset.dy > 0.0)) {
39 | return false;
40 | }
41 | return _pendingDragOffset.dy.abs() > kTouchSlop;
42 | }
43 |
44 | @override
45 | Offset _getDeltaForDetails(Offset delta) => Offset(0.0, delta.dy);
46 |
47 | @override
48 | double _getPrimaryValueFromOffset(Offset value) => value.dy;
49 |
50 | @override
51 | String get debugDescription => 'lockable vertical drag';
52 | }
53 |
54 | /// Recognizes movement in the horizontal direction.
55 | ///
56 | /// Modified version of the [HorizontalDragGestureRecognizer] that can be locked to prevent left or right movement.
57 | /// Movements in the locked direction will not trigger a gesture and thus not block other gesture detectors.
58 | class LockableHorizontalDragGestureRecognizer
59 | extends ExtendedDragGestureRecognizer {
60 | /// Getter to know if the movement should be blocked in one direction.
61 | final ValueGetter lockGetter;
62 |
63 | LockableHorizontalDragGestureRecognizer({
64 | @required this.lockGetter,
65 | Object debugOwner,
66 | }) : assert(lockGetter != null),
67 | super(debugOwner: debugOwner);
68 |
69 | SlideContainerLock get lock => lockGetter();
70 |
71 | @override
72 | bool isFlingGesture(VelocityEstimate estimate) {
73 | final double minVelocity = minFlingVelocity ?? kMinFlingVelocity;
74 | final double minDistance = minFlingDistance ?? kTouchSlop;
75 | if ((lock == SlideContainerLock.left &&
76 | estimate.pixelsPerSecond.dx < 0.0) ||
77 | (lock == SlideContainerLock.right &&
78 | estimate.pixelsPerSecond.dx > 0.0)) {
79 | return false;
80 | }
81 | return estimate.pixelsPerSecond.dx.abs() > minVelocity &&
82 | estimate.offset.dx.abs() > minDistance;
83 | }
84 |
85 | @override
86 | bool get _hasSufficientPendingDragDeltaToAccept {
87 | if ((lock == SlideContainerLock.left && _pendingDragOffset.dx < 0.0) ||
88 | (lock == SlideContainerLock.right && _pendingDragOffset.dx > 0.0)) {
89 | return false;
90 | }
91 | return _pendingDragOffset.dx.abs() > kTouchSlop;
92 | }
93 |
94 | @override
95 | Offset _getDeltaForDetails(Offset delta) => Offset(delta.dx, 0.0);
96 |
97 | @override
98 | double _getPrimaryValueFromOffset(Offset value) => value.dx;
99 |
100 | @override
101 | String get debugDescription => 'lockable horizontal drag';
102 | }
103 |
104 | enum _DragState {
105 | ready,
106 | possible,
107 | accepted,
108 | }
109 |
110 | /// Copy-paste of Flutter's [DragGestureRecognizer] to get access to the private elements.
111 | abstract class ExtendedDragGestureRecognizer extends DragGestureRecognizer {
112 | ExtendedDragGestureRecognizer({Object debugOwner})
113 | : super(debugOwner: debugOwner);
114 | GestureDragDownCallback onDown;
115 | GestureDragStartCallback onStart;
116 | GestureDragUpdateCallback onUpdate;
117 | GestureDragEndCallback onEnd;
118 | GestureDragCancelCallback onCancel;
119 | double minFlingDistance;
120 | double minFlingVelocity;
121 | double maxFlingVelocity;
122 |
123 | _DragState _state = _DragState.ready;
124 | Offset _initialPosition;
125 | Offset _pendingDragOffset;
126 | Duration _lastPendingEventTimestamp;
127 |
128 | bool isFlingGesture(VelocityEstimate estimate);
129 |
130 | Offset _getDeltaForDetails(Offset delta);
131 |
132 | double _getPrimaryValueFromOffset(Offset value);
133 |
134 | bool get _hasSufficientPendingDragDeltaToAccept;
135 |
136 | final Map _velocityTrackers = {};
137 |
138 | @override
139 | void addPointer(PointerEvent event) {
140 | startTrackingPointer(event.pointer);
141 | _velocityTrackers[event.pointer] = VelocityTracker();
142 | if (_state == _DragState.ready) {
143 | _state = _DragState.possible;
144 | _initialPosition = event.position;
145 | _pendingDragOffset = Offset.zero;
146 | _lastPendingEventTimestamp = event.timeStamp;
147 | if (onDown != null)
148 | invokeCallback('onDown',
149 | () => onDown(DragDownDetails(globalPosition: _initialPosition)));
150 | } else if (_state == _DragState.accepted) {
151 | resolve(GestureDisposition.accepted);
152 | }
153 | }
154 |
155 | @override
156 | void handleEvent(PointerEvent event) {
157 | assert(_state != _DragState.ready);
158 | if (!event.synthesized &&
159 | (event is PointerDownEvent || event is PointerMoveEvent)) {
160 | final VelocityTracker tracker = _velocityTrackers[event.pointer];
161 | assert(tracker != null);
162 | tracker.addPosition(event.timeStamp, event.position);
163 | }
164 |
165 | if (event is PointerMoveEvent) {
166 | final Offset delta = event.delta;
167 | if (_state == _DragState.accepted) {
168 | if (onUpdate != null) {
169 | invokeCallback(
170 | 'onUpdate',
171 | () => onUpdate(DragUpdateDetails(
172 | sourceTimeStamp: event.timeStamp,
173 | delta: _getDeltaForDetails(delta),
174 | primaryDelta: _getPrimaryValueFromOffset(delta),
175 | globalPosition: event.position,
176 | )));
177 | }
178 | } else {
179 | _pendingDragOffset += delta;
180 | _lastPendingEventTimestamp = event.timeStamp;
181 | if (_hasSufficientPendingDragDeltaToAccept)
182 | resolve(GestureDisposition.accepted);
183 | }
184 | }
185 | stopTrackingIfPointerNoLongerDown(event);
186 | }
187 |
188 | @override
189 | void acceptGesture(int pointer) {
190 | if (_state != _DragState.accepted) {
191 | _state = _DragState.accepted;
192 | final Offset delta = _pendingDragOffset;
193 | final Duration timestamp = _lastPendingEventTimestamp;
194 | _pendingDragOffset = Offset.zero;
195 | _lastPendingEventTimestamp = null;
196 | if (onStart != null) {
197 | invokeCallback(
198 | 'onStart',
199 | () => onStart(DragStartDetails(
200 | sourceTimeStamp: timestamp,
201 | globalPosition: _initialPosition,
202 | )));
203 | }
204 | if (delta != Offset.zero && onUpdate != null) {
205 | final Offset deltaForDetails = _getDeltaForDetails(delta);
206 | invokeCallback(
207 | 'onUpdate',
208 | () => onUpdate(DragUpdateDetails(
209 | sourceTimeStamp: timestamp,
210 | delta: deltaForDetails,
211 | primaryDelta: _getPrimaryValueFromOffset(delta),
212 | globalPosition: _initialPosition + deltaForDetails,
213 | )));
214 | }
215 | }
216 | }
217 |
218 | @override
219 | void rejectGesture(int pointer) {
220 | stopTrackingPointer(pointer);
221 | }
222 |
223 | @override
224 | void didStopTrackingLastPointer(int pointer) {
225 | if (_state == _DragState.possible) {
226 | resolve(GestureDisposition.rejected);
227 | _state = _DragState.ready;
228 | if (onCancel != null) invokeCallback('onCancel', onCancel);
229 | return;
230 | }
231 | final bool wasAccepted = _state == _DragState.accepted;
232 | _state = _DragState.ready;
233 | if (wasAccepted && onEnd != null) {
234 | final VelocityTracker tracker = _velocityTrackers[pointer];
235 | assert(tracker != null);
236 |
237 | final VelocityEstimate estimate = tracker.getVelocityEstimate();
238 | if (estimate != null && isFlingGesture(estimate)) {
239 | final Velocity velocity =
240 | Velocity(pixelsPerSecond: estimate.pixelsPerSecond).clampMagnitude(
241 | minFlingVelocity ?? kMinFlingVelocity,
242 | maxFlingVelocity ?? kMaxFlingVelocity);
243 | invokeCallback(
244 | 'onEnd',
245 | () => onEnd(DragEndDetails(
246 | velocity: velocity,
247 | primaryVelocity:
248 | _getPrimaryValueFromOffset(velocity.pixelsPerSecond),
249 | )), debugReport: () {
250 | return '$estimate; fling at $velocity.';
251 | });
252 | } else {
253 | invokeCallback(
254 | 'onEnd',
255 | () => onEnd(DragEndDetails(
256 | velocity: Velocity.zero,
257 | primaryVelocity: 0.0,
258 | )), debugReport: () {
259 | if (estimate == null) return 'Could not estimate velocity.';
260 | return '$estimate; judged to not be a fling.';
261 | });
262 | }
263 | }
264 | _velocityTrackers.clear();
265 | }
266 |
267 | @override
268 | void dispose() {
269 | _velocityTrackers.clear();
270 | super.dispose();
271 | }
272 | }
273 |
--------------------------------------------------------------------------------
/lib/slide_container.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/gestures.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter/scheduler.dart';
4 | import 'package:flutter/widgets.dart';
5 | import 'package:slide_container/extended_drag_gesture_recognizer.dart';
6 | import 'package:slide_container/slide_container_controller.dart';
7 |
8 | /// Direction the container can be slid from its initial position.
9 | enum SlideContainerDirection {
10 | topToBottom,
11 | bottomToTop,
12 | vertical,
13 | leftToRight,
14 | rightToLeft,
15 | horizontal,
16 | }
17 |
18 | // Used by the Gesture Recognizers to know when the container can not be slid in this direction.
19 | // This prevents the Gesture Detector to intercept and consume gesture events even when the container can not slide in the drag direction.
20 | // This way, other gesture detectors can be used in conjunction with the SlideContainer.
21 | enum SlideContainerLock {
22 | top,
23 | bottom,
24 | left,
25 | right,
26 | none,
27 | }
28 |
29 | /// Container that can be slid vertically or horizontally.
30 | ///
31 | /// Applies a dampening effect to the movement for a smoother gesture.
32 | /// Can validate slide with either drag gesture velocity or distance.
33 | /// Will automatically finish the slide animation when the drag gesture ends.
34 | class SlideContainer extends StatefulWidget {
35 | final Widget child;
36 |
37 | /// Constrain the direction the container can be slid.
38 | final SlideContainerDirection slideDirection;
39 |
40 | /// When the gesture ends the animation play at this speed to move back to the start position or to [maxSlideDistance] (see [minSlideDistanceToValidate]).
41 | /// This takes into account the position of the container just before the gesture ends.
42 | final Duration autoSlideDuration;
43 |
44 | /// The container will not slide beyond this value.
45 | ///
46 | /// Default to [MediaQueryData.size].height if the [slideDirection] is vertical and [MediaQueryData.size].width if the [slideDirection] is horizontal.
47 | ///
48 | /// In px.
49 | final double maxSlideDistance;
50 |
51 | /// If the drag gesture is faster than this it will complete the slide
52 | ///
53 | /// If set to [double.infinity] the container will not auto-slide.
54 | ///
55 | /// In px/s.
56 | final double minDragVelocityForAutoSlide;
57 |
58 | /// If the drag gesture is slower than [minDragVelocityForAutoSlide] and the slide distance is less than this value then the drag is not validated and the container go back to the starting position.
59 | /// Else the drag is validated and the container moves to [maxSlideDistance].
60 | ///
61 | /// If set to [double.infinity] the container will not auto-slide.
62 | /// Default to half of [maxSlideDistance].
63 | ///
64 | /// In px.
65 | final double minSlideDistanceToValidate;
66 |
67 | /// The strength of the dampening effect when the container is moved.
68 | ///
69 | /// The bigger this value the slower the container will move toward the finger position.
70 | /// A Value of 1.0 means no damping is added.
71 | ///
72 | /// Needs to be superior or equal to 1.0.
73 | final double dampeningStrength;
74 |
75 | /// Called when the slide gesture starts.
76 | final VoidCallback onSlideStarted;
77 |
78 | /// Called once when the drag distance becomes superior to [minSlideDistanceToValidate] (ending the gesture here would complete the slide).
79 | ///
80 | /// Only triggers if [minSlideDistanceToValidate] is not equal to [double.infinity] and if the slide has not yet completed.
81 | /// If a slide is completed because of a fast drag, the auto-slide animation will not trigger this callback.
82 | ///
83 | /// Useful to give users feedback (like haptics).
84 | final VoidCallback onSlideValidated;
85 |
86 | /// Called once after [onSlideValidated] if the drag distance becomes inferior to [minSlideDistanceToValidate] (ending the gesture here would cancel the slide).
87 | ///
88 | /// Only triggers if [minSlideDistanceToValidate] is not equal to [double.infinity] and if the slide has not yet been cancelled.
89 | /// If a slide is cancelled because of a fast drag, the auto-slide animation will not trigger this callback.
90 | ///
91 | /// Useful to give users feedback (like haptics).
92 | final VoidCallback onSlideUnvalidated;
93 |
94 | /// Called when:
95 | /// - The slide gesture ends with a distance superior to [minSlideDistanceToValidate].
96 | /// - The slide gesture ends with a velocity superior to [minDragVelocityForAutoSlide].
97 | /// - A slide is forced from the [controller] (effectively triggering an auto-slide to [maxSlideDistance]).
98 | final VoidCallback onSlideCompleted;
99 |
100 | /// Called when:
101 | /// - The slide gesture ends with a value inferior or equal to [minSlideDistanceToValidate] and [minSlideDistanceToValidate] is not equal to [double.infinity].
102 | /// - The slide gesture ends with a velocity inferior or equal to [minDragVelocityForAutoSlide] and [minDragVelocityForAutoSlide] is not equal to [double.infinity].
103 | /// - A slide is forced from the [controller] (effectively triggering an auto-slide to the starting position).
104 | final VoidCallback onSlideCanceled;
105 |
106 | /// Called each frame when the slide gesture is active (i.e. after [onSlideStarted] and before [onSlideCompleted] or [onSlideCanceled]) and during the auto-slide.
107 | ///
108 | /// returns the normalized position of the slide container as a value between 0.0 and 1.0 where 0.0 means the container is at the starting position and 1.0 means the container is at [maxSlideDistance].
109 | final ValueChanged onSlide;
110 |
111 | /// Register this controller to be able to manually force a slide in a given direction.
112 | final SlideContainerController controller;
113 |
114 | SlideContainer({
115 | @required this.child,
116 | this.slideDirection = SlideContainerDirection.vertical,
117 | this.minDragVelocityForAutoSlide = 600.0,
118 | this.autoSlideDuration = const Duration(milliseconds: 300),
119 | this.dampeningStrength = 8.0,
120 | this.minSlideDistanceToValidate,
121 | this.maxSlideDistance,
122 | this.onSlideStarted,
123 | this.onSlideValidated,
124 | this.onSlideUnvalidated,
125 | this.onSlideCompleted,
126 | this.onSlideCanceled,
127 | this.onSlide,
128 | this.controller,
129 | }) : assert(child != null),
130 | assert(autoSlideDuration != null),
131 | assert(dampeningStrength != null && dampeningStrength >= 1.0),
132 | assert(slideDirection != null);
133 |
134 | @override
135 | _State createState() => _State();
136 | }
137 |
138 | class _State extends State with TickerProviderStateMixin {
139 | final Map gestures =
140 | {};
141 |
142 | double dragValue = 0.0;
143 | double dragTarget = 0.0;
144 | bool isFirstDragFrame = true;
145 | bool didValidate = false;
146 | bool didForceSlide = false;
147 | AnimationController animationController;
148 | Ticker followFingerTicker;
149 |
150 | SlideContainerController get controller => widget.controller;
151 |
152 | SlideContainerDirection get slideDirection => widget.slideDirection;
153 |
154 | bool get isVerticalSlide =>
155 | slideDirection == SlideContainerDirection.topToBottom ||
156 | slideDirection == SlideContainerDirection.bottomToTop ||
157 | slideDirection == SlideContainerDirection.vertical;
158 |
159 | double get maxDragDistance =>
160 | widget.maxSlideDistance ??
161 | (isVerticalSlide
162 | ? MediaQuery.of(context).size.height
163 | : MediaQuery.of(context).size.width);
164 |
165 | double get minDragDistanceToValidate =>
166 | widget.minSlideDistanceToValidate ?? maxDragDistance * 0.5;
167 |
168 | double get containerOffset =>
169 | animationController.value * maxDragDistance * dragTarget.sign;
170 |
171 | SlideContainerLock get lock {
172 | switch (slideDirection) {
173 | case SlideContainerDirection.topToBottom:
174 | if (containerOffset == maxDragDistance) {
175 | return SlideContainerLock.bottom;
176 | } else if (containerOffset == 0.0) {
177 | return SlideContainerLock.top;
178 | } else {
179 | return SlideContainerLock.none;
180 | }
181 | break;
182 | case SlideContainerDirection.bottomToTop:
183 | if (containerOffset == -maxDragDistance) {
184 | return SlideContainerLock.top;
185 | } else if (containerOffset == 0.0) {
186 | return SlideContainerLock.bottom;
187 | } else {
188 | return SlideContainerLock.none;
189 | }
190 | break;
191 | case SlideContainerDirection.vertical:
192 | if (containerOffset == -maxDragDistance) {
193 | return SlideContainerLock.top;
194 | } else if (containerOffset == maxDragDistance) {
195 | return SlideContainerLock.bottom;
196 | } else {
197 | return SlideContainerLock.none;
198 | }
199 | break;
200 | case SlideContainerDirection.leftToRight:
201 | if (containerOffset == maxDragDistance) {
202 | return SlideContainerLock.right;
203 | } else if (containerOffset == 0.0) {
204 | return SlideContainerLock.left;
205 | } else {
206 | return SlideContainerLock.none;
207 | }
208 | break;
209 | case SlideContainerDirection.rightToLeft:
210 | if (containerOffset == -maxDragDistance) {
211 | return SlideContainerLock.left;
212 | } else if (containerOffset == 0.0) {
213 | return SlideContainerLock.right;
214 | } else {
215 | return SlideContainerLock.none;
216 | }
217 | break;
218 | case SlideContainerDirection.horizontal:
219 | if (containerOffset == -maxDragDistance) {
220 | return SlideContainerLock.left;
221 | } else if (containerOffset == maxDragDistance) {
222 | return SlideContainerLock.right;
223 | } else {
224 | return SlideContainerLock.none;
225 | }
226 | break;
227 | default:
228 | return SlideContainerLock.none;
229 | }
230 | }
231 |
232 | @override
233 | void initState() {
234 | controller?.addListener(onControllerUpdated);
235 |
236 | animationController =
237 | AnimationController(vsync: this, duration: widget.autoSlideDuration)
238 | ..addListener(() {
239 | if (widget.onSlide != null)
240 | widget.onSlide(animationController.value);
241 | if (mounted) setState(() {});
242 | });
243 |
244 | followFingerTicker = createTicker((_) {
245 | if ((dragValue - dragTarget).abs() <= 1.0) {
246 | dragTarget = dragValue;
247 | } else {
248 | // This dampen the drag movement (acts like a spring, the farther from the finger position the faster it moves toward it).
249 | dragTarget += (dragValue - dragTarget) / widget.dampeningStrength;
250 | }
251 |
252 | if (minDragDistanceToValidate != double.infinity) {
253 | if (dragTarget.abs() > minDragDistanceToValidate) {
254 | if (!didValidate) {
255 | didValidate = true;
256 | if (widget.onSlideValidated != null) widget.onSlideValidated();
257 | }
258 | } else {
259 | if (didValidate) {
260 | didValidate = false;
261 | if (widget.onSlideUnvalidated != null) widget.onSlideUnvalidated();
262 | }
263 | }
264 | }
265 |
266 | animationController.value = dragTarget.abs() / maxDragDistance;
267 | });
268 |
269 | registerGestureRecognizer();
270 |
271 | super.initState();
272 | }
273 |
274 | @override
275 | void dispose() {
276 | animationController?.dispose();
277 | followFingerTicker?.dispose();
278 | controller?.removeListener(onControllerUpdated);
279 | super.dispose();
280 | }
281 |
282 | @override
283 | void didUpdateWidget(oldWidget) {
284 | super.didUpdateWidget(oldWidget);
285 | oldWidget.controller?.removeListener(onControllerUpdated);
286 | widget.controller?.addListener(onControllerUpdated);
287 | }
288 |
289 | void onControllerUpdated() {
290 | final SlideContainerDirection forcedSlideDirection =
291 | controller.forcedSlideDirection;
292 |
293 | assert(
294 | ((forcedSlideDirection == SlideContainerDirection.topToBottom ||
295 | forcedSlideDirection ==
296 | SlideContainerDirection.bottomToTop) &&
297 | (slideDirection == SlideContainerDirection.topToBottom ||
298 | slideDirection ==
299 | SlideContainerDirection.bottomToTop) ||
300 | slideDirection == SlideContainerDirection.vertical) ||
301 | ((forcedSlideDirection == SlideContainerDirection.leftToRight ||
302 | forcedSlideDirection ==
303 | SlideContainerDirection.rightToLeft) &&
304 | (slideDirection == SlideContainerDirection.leftToRight ||
305 | slideDirection == SlideContainerDirection.rightToLeft ||
306 | slideDirection == SlideContainerDirection.horizontal)),
307 | "Invalid force slide direction = $forcedSlideDirection for container of directionality = $slideDirection.");
308 |
309 | didForceSlide = true;
310 | if (followFingerTicker.isActive) {
311 | followFingerTicker.stop();
312 | }
313 |
314 | if (containerOffset == 0.0) {
315 | if (forcedSlideDirection == SlideContainerDirection.topToBottom ||
316 | forcedSlideDirection == SlideContainerDirection.leftToRight) {
317 | dragTarget = 0.001;
318 | } else {
319 | dragTarget = -0.001;
320 | }
321 | }
322 |
323 | switch (slideDirection) {
324 | case SlideContainerDirection.topToBottom:
325 | case SlideContainerDirection.leftToRight:
326 | case SlideContainerDirection.bottomToTop:
327 | case SlideContainerDirection.rightToLeft:
328 | forcedSlideDirection == slideDirection
329 | ? completeSlide()
330 | : cancelSlide();
331 | break;
332 | case SlideContainerDirection.horizontal:
333 | case SlideContainerDirection.vertical:
334 | if (forcedSlideDirection == SlideContainerDirection.topToBottom ||
335 | forcedSlideDirection == SlideContainerDirection.leftToRight) {
336 | containerOffset >= 0 ? completeSlide() : cancelSlide();
337 | } else {
338 | containerOffset <= 0 ? completeSlide() : cancelSlide();
339 | }
340 | }
341 | }
342 |
343 | GestureRecognizerFactoryWithHandlers
344 | createGestureRecognizer(
345 | GestureRecognizerFactoryConstructor constructor) =>
346 | GestureRecognizerFactoryWithHandlers(
347 | constructor,
348 | (T instance) {
349 | instance
350 | ..onStart = handlePanStart
351 | ..onUpdate = handlePanUpdate
352 | ..onEnd = handlePanEnd;
353 | },
354 | );
355 |
356 | void registerGestureRecognizer() {
357 | if (isVerticalSlide) {
358 | gestures[LockableVerticalDragGestureRecognizer] =
359 | createGestureRecognizer(() =>
360 | LockableVerticalDragGestureRecognizer(lockGetter: () => lock));
361 | } else {
362 | gestures[LockableHorizontalDragGestureRecognizer] =
363 | createGestureRecognizer(() =>
364 | LockableHorizontalDragGestureRecognizer(lockGetter: () => lock));
365 | }
366 | }
367 |
368 | double getVelocity(DragEndDetails details) => isVerticalSlide
369 | ? details.velocity.pixelsPerSecond.dy
370 | : details.velocity.pixelsPerSecond.dx;
371 |
372 | double getDelta(DragUpdateDetails details) =>
373 | isVerticalSlide ? details.delta.dy : details.delta.dx;
374 |
375 | void completeSlide() => animationController.forward().then((_) {
376 | if (widget.onSlideCompleted != null) widget.onSlideCompleted();
377 | });
378 |
379 | void cancelSlide() => animationController.reverse().then((_) {
380 | if (widget.onSlideCanceled != null) widget.onSlideCanceled();
381 | });
382 |
383 | void handlePanStart(DragStartDetails details) {
384 | didForceSlide = false;
385 | animationController.stop();
386 | isFirstDragFrame = true;
387 | dragValue = animationController.value * maxDragDistance * dragTarget.sign;
388 | dragTarget = dragValue;
389 | didValidate = dragTarget != 0;
390 | followFingerTicker.start();
391 | if (widget.onSlideStarted != null) widget.onSlideStarted();
392 | }
393 |
394 | void handlePanUpdate(DragUpdateDetails details) {
395 | if (didForceSlide) {
396 | return;
397 | }
398 | if (isFirstDragFrame) {
399 | isFirstDragFrame = false;
400 | return;
401 | }
402 |
403 | dragValue = (dragValue + getDelta(details))
404 | .clamp(-maxDragDistance, maxDragDistance);
405 | if (slideDirection == SlideContainerDirection.topToBottom ||
406 | slideDirection == SlideContainerDirection.leftToRight) {
407 | dragValue = dragValue.clamp(0.0, maxDragDistance);
408 | } else if (slideDirection == SlideContainerDirection.bottomToTop ||
409 | slideDirection == SlideContainerDirection.rightToLeft) {
410 | dragValue = dragValue.clamp(-maxDragDistance, 0.0);
411 | }
412 | }
413 |
414 | void handlePanEnd(DragEndDetails details) {
415 | if (didForceSlide) {
416 | return;
417 | }
418 |
419 | if (getVelocity(details) * dragTarget.sign >
420 | widget.minDragVelocityForAutoSlide) {
421 | completeSlide();
422 | } else if (getVelocity(details) * dragTarget.sign <
423 | -widget.minDragVelocityForAutoSlide) {
424 | cancelSlide();
425 | } else if (minDragDistanceToValidate != double.infinity) {
426 | dragTarget.abs() > minDragDistanceToValidate
427 | ? completeSlide()
428 | : cancelSlide();
429 | }
430 | followFingerTicker.stop();
431 | }
432 |
433 | @override
434 | Widget build(BuildContext context) => Transform.translate(
435 | offset: isVerticalSlide
436 | ? Offset(0.0, containerOffset)
437 | : Offset(containerOffset, 0.0),
438 | child: RawGestureDetector(
439 | gestures: gestures,
440 | child: widget.child,
441 | ),
442 | );
443 | }
444 |
--------------------------------------------------------------------------------
/lib/slide_container_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/widgets.dart';
2 | import 'package:slide_container/slide_container.dart';
3 |
4 | /// A controller for the [SlideContainer].
5 | ///
6 | /// Allows you to force a slide in a given direction.
7 | ///
8 | /// Will only work after the controller has been attached to a SlideController from a build function.
9 | class SlideContainerController extends ChangeNotifier {
10 | SlideContainerDirection _forcedSlideDirection;
11 |
12 | SlideContainerDirection get forcedSlideDirection => _forcedSlideDirection;
13 |
14 | void forceSlide(SlideContainerDirection slideDirection) {
15 | _forcedSlideDirection = slideDirection;
16 | notifyListeners();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | collection:
5 | dependency: transitive
6 | description:
7 | name: collection
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "1.14.11"
11 | flutter:
12 | dependency: "direct main"
13 | description: flutter
14 | source: sdk
15 | version: "0.0.0"
16 | meta:
17 | dependency: transitive
18 | description:
19 | name: meta
20 | url: "https://pub.dartlang.org"
21 | source: hosted
22 | version: "1.1.7"
23 | sky_engine:
24 | dependency: transitive
25 | description: flutter
26 | source: sdk
27 | version: "0.0.99"
28 | typed_data:
29 | dependency: transitive
30 | description:
31 | name: typed_data
32 | url: "https://pub.dartlang.org"
33 | source: hosted
34 | version: "1.1.6"
35 | vector_math:
36 | dependency: transitive
37 | description:
38 | name: vector_math
39 | url: "https://pub.dartlang.org"
40 | source: hosted
41 | version: "2.0.8"
42 | sdks:
43 | dart: ">=2.2.2 <3.0.0"
44 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: slide_container
2 | description: A container that can be slid vertically and horizontally with a smooth dampened motion. Offers a handful of callbacks for customization.
3 | version: 1.1.2
4 | author: Quentin Le Guennec
5 | homepage: https://github.com/quentinleguennec/flutter-slide-container
6 |
7 | environment:
8 | sdk: ">=2.0.0-dev.68.0 <3.0.0"
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 |
--------------------------------------------------------------------------------
/slide_container.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------