├── .github
└── FUNDING.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── doc
└── images
│ └── parallax.gif
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── letsar
│ │ │ │ └── example
│ │ │ │ └── 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
│ └── main.dart
└── pubspec.yaml
├── lib
├── flutter_parallax.dart
└── src
│ ├── rendering
│ └── parallax.dart
│ └── widgets
│ └── parallax.dart
├── pubspec.yaml
└── test
└── flutter_parallax_test.dart
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: letsar
2 | patreon: romainrastel
3 | open_collective: # Replace with a single Open Collective username
4 | ko_fi: # Replace with a single Ko-fi username
5 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
6 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
7 | liberapay: # Replace with a single Liberapay username
8 | issuehunt: # Replace with a single IssueHunt username
9 | otechie: # Replace with a single Otechie username
10 | custom: ['https://www.buymeacoffee.com/romainrastel', 'paypal.me/RomainRastel']
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://www.dartlang.org/tools/private-files.html
2 |
3 | # Files and directories created by pub
4 | .dart_tool/
5 | .packages
6 | .pub/
7 | build/
8 | # If you're building an application, you may want to check-in your pubspec.lock
9 | pubspec.lock
10 |
11 | # Directory created by dartdoc
12 | # If you don't generate documentation locally you can remove this line.
13 | doc/api/
14 |
15 | *.iml
16 | *.ipr
17 | *.iws
18 | .idea/
19 | .DS_Store
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.1.2
2 | * Add Dart 2 support.
3 |
4 | ## 0.1.1
5 | * Remove Flutter SDK constraint
6 |
7 | ## 0.1.0
8 | * Initial Open Source release
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Romain Rastel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_parallax
2 |
3 | A Flutter widget that moves according to a scroll controller.
4 |
5 | [](https://pub.dartlang.org/packages/flutter_parallax)
6 |
7 | ## Features
8 |
9 | * Can contain **any** widget.
10 | * Configurable parallax scroll direction.
11 | * Customizable parallax delegate.
12 | * For widgets inside **and** outside a scroll view (list items and list backgrounds for example).
13 |
14 | 
15 |
16 | ## Getting started
17 |
18 | In the `pubspec.yaml` of your flutter project, add the following dependency:
19 |
20 | ```yaml
21 | dependencies:
22 | ...
23 | flutter_parallax: "^0.1.2"
24 | ```
25 |
26 | In your library add the following import:
27 |
28 | ```dart
29 | import 'package:flutter_parallax/flutter_parallax.dart';
30 | ```
31 |
32 | For help getting started with Flutter, view the online [documentation](https://flutter.io/).
33 |
34 | ## Example
35 |
36 | ```dart
37 | new Parallax.inside(
38 | child: new Image.network('https://flutter.io/images/homepage/header-illustration.png'),
39 | mainAxisExtent: 150.0,
40 | );
41 | ```
42 |
43 | You can find more examples in the [Example](https://github.com/letsar/flutter_parallax/tree/master/example) project.
44 |
45 | ## Constructors
46 |
47 | * The `Parallax.inside`, that computes the parallax offset from its position in its first `Scrollable` parent.
48 | Useful for list or grid items.
49 | * The `Parallax.outside`, that computes the parallax offset from the percentage of the scrollable's container extent.
50 | Useful for a list or grid background.
51 | * The `Parallax.custom` takes a `ParallaxDelegate`, which provides the ability to customize additional aspects of the child model. For example, a `ParallaxDelegate`
52 | can control the algorithm used to computes the parallax offset of the child within its parent.
53 |
54 | ## Changelog
55 |
56 | Please see the [Changelog](https://github.com/letsar/flutter_parallax/blob/master/CHANGELOG.md) page to know what's recently changed.
57 |
58 | ## Contributions
59 |
60 | Feel free to contribute to this project.
61 |
62 | If you find a bug or want a feature, but don't know how to fix/implement it, please fill an [issue](https://github.com/letsar/flutter_parallax/issues).
63 | If you fixed a bug or implemented a new feature, please send a [pull request](https://github.com/letsar/flutter_parallax/pulls).
--------------------------------------------------------------------------------
/doc/images/parallax.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/doc/images/parallax.gif
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .atom/
3 | .idea
4 | .vscode/
5 | .packages
6 | .pub/
7 | build/
8 | ios/.generated/
9 | packages
10 | .flutter-plugins
11 |
--------------------------------------------------------------------------------
/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: 3ea4d06340a97a1e9d7cae97567c64e0569dcaa2
8 | channel: beta
9 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | For help getting started with Flutter, view our online
8 | [documentation](https://flutter.io/).
9 |
--------------------------------------------------------------------------------
/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 | apply plugin: 'com.android.application'
15 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
16 |
17 | android {
18 | compileSdkVersion 27
19 |
20 | lintOptions {
21 | disable 'InvalidPackage'
22 | }
23 |
24 | defaultConfig {
25 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
26 | applicationId "com.letsar.example"
27 | minSdkVersion 16
28 | targetSdkVersion 27
29 | versionCode 1
30 | versionName "1.0"
31 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
32 | }
33 |
34 | buildTypes {
35 | release {
36 | // TODO: Add your own signing config for the release build.
37 | // Signing with the debug keys for now, so `flutter run --release` works.
38 | signingConfig signingConfigs.debug
39 | }
40 | }
41 | }
42 |
43 | flutter {
44 | source '../..'
45 | }
46 |
47 | dependencies {
48 | testImplementation 'junit:junit:4.12'
49 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
50 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
51 | }
52 |
--------------------------------------------------------------------------------
/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/letsar/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.letsar.example;
2 |
3 | import android.os.Bundle;
4 |
5 | import io.flutter.app.FlutterActivity;
6 | import io.flutter.plugins.GeneratedPluginRegistrant;
7 |
8 | public class MainActivity extends FlutterActivity {
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | GeneratedPluginRegistrant.registerWith(this);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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.0.1'
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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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.1-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 | *.pbxuser
16 | *.mode1v3
17 | *.mode2v3
18 | *.perspectivev3
19 |
20 | !default.pbxuser
21 | !default.mode1v3
22 | !default.mode2v3
23 | !default.perspectivev3
24 |
25 | xcuserdata
26 |
27 | *.moved-aside
28 |
29 | *.pyc
30 | *sync/
31 | Icon?
32 | .tags*
33 |
34 | /Flutter/app.flx
35 | /Flutter/app.zip
36 | /Flutter/flutter_assets/
37 | /Flutter/App.framework
38 | /Flutter/Flutter.framework
39 | /Flutter/Generated.xcconfig
40 | /ServiceDefinitions.json
41 |
42 | Pods/
43 |
--------------------------------------------------------------------------------
/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 | UIRequiredDeviceCapabilities
24 |
25 | arm64
26 |
27 | MinimumOSVersion
28 | 8.0
29 |
30 |
31 |
--------------------------------------------------------------------------------
/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 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
18 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
19 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
20 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
21 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
22 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
23 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXCopyFilesBuildPhase section */
27 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
28 | isa = PBXCopyFilesBuildPhase;
29 | buildActionMask = 2147483647;
30 | dstPath = "";
31 | dstSubfolderSpec = 10;
32 | files = (
33 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
34 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
35 | );
36 | name = "Embed Frameworks";
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXCopyFilesBuildPhase section */
40 |
41 | /* Begin PBXFileReference section */
42 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
43 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
44 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
45 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
46 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
48 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
49 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
50 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
51 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
52 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
53 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
54 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
55 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
56 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
57 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
58 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
67 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | /* End PBXFrameworksBuildPhase section */
72 |
73 | /* Begin PBXGroup section */
74 | 9740EEB11CF90186004384FC /* Flutter */ = {
75 | isa = PBXGroup;
76 | children = (
77 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
78 | 3B80C3931E831B6300D905FE /* App.framework */,
79 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
80 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
81 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
82 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
83 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
84 | );
85 | name = Flutter;
86 | sourceTree = "";
87 | };
88 | 97C146E51CF9000F007C117D = {
89 | isa = PBXGroup;
90 | children = (
91 | 9740EEB11CF90186004384FC /* Flutter */,
92 | 97C146F01CF9000F007C117D /* Runner */,
93 | 97C146EF1CF9000F007C117D /* Products */,
94 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
95 | );
96 | sourceTree = "";
97 | };
98 | 97C146EF1CF9000F007C117D /* Products */ = {
99 | isa = PBXGroup;
100 | children = (
101 | 97C146EE1CF9000F007C117D /* Runner.app */,
102 | );
103 | name = Products;
104 | sourceTree = "";
105 | };
106 | 97C146F01CF9000F007C117D /* Runner */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
110 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
111 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
112 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
113 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
114 | 97C147021CF9000F007C117D /* Info.plist */,
115 | 97C146F11CF9000F007C117D /* Supporting Files */,
116 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
117 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
118 | );
119 | path = Runner;
120 | sourceTree = "";
121 | };
122 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
123 | isa = PBXGroup;
124 | children = (
125 | 97C146F21CF9000F007C117D /* main.m */,
126 | );
127 | name = "Supporting Files";
128 | sourceTree = "";
129 | };
130 | /* End PBXGroup section */
131 |
132 | /* Begin PBXNativeTarget section */
133 | 97C146ED1CF9000F007C117D /* Runner */ = {
134 | isa = PBXNativeTarget;
135 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
136 | buildPhases = (
137 | 9740EEB61CF901F6004384FC /* Run Script */,
138 | 97C146EA1CF9000F007C117D /* Sources */,
139 | 97C146EB1CF9000F007C117D /* Frameworks */,
140 | 97C146EC1CF9000F007C117D /* Resources */,
141 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
142 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
143 | );
144 | buildRules = (
145 | );
146 | dependencies = (
147 | );
148 | name = Runner;
149 | productName = Runner;
150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
151 | productType = "com.apple.product-type.application";
152 | };
153 | /* End PBXNativeTarget section */
154 |
155 | /* Begin PBXProject section */
156 | 97C146E61CF9000F007C117D /* Project object */ = {
157 | isa = PBXProject;
158 | attributes = {
159 | LastUpgradeCheck = 0910;
160 | ORGANIZATIONNAME = "The Chromium Authors";
161 | TargetAttributes = {
162 | 97C146ED1CF9000F007C117D = {
163 | CreatedOnToolsVersion = 7.3.1;
164 | };
165 | };
166 | };
167 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
168 | compatibilityVersion = "Xcode 3.2";
169 | developmentRegion = English;
170 | hasScannedForEncodings = 0;
171 | knownRegions = (
172 | en,
173 | Base,
174 | );
175 | mainGroup = 97C146E51CF9000F007C117D;
176 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
177 | projectDirPath = "";
178 | projectRoot = "";
179 | targets = (
180 | 97C146ED1CF9000F007C117D /* Runner */,
181 | );
182 | };
183 | /* End PBXProject section */
184 |
185 | /* Begin PBXResourcesBuildPhase section */
186 | 97C146EC1CF9000F007C117D /* Resources */ = {
187 | isa = PBXResourcesBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
191 | 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
193 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
194 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
195 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
196 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
197 | );
198 | runOnlyForDeploymentPostprocessing = 0;
199 | };
200 | /* End PBXResourcesBuildPhase section */
201 |
202 | /* Begin PBXShellScriptBuildPhase section */
203 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
204 | isa = PBXShellScriptBuildPhase;
205 | buildActionMask = 2147483647;
206 | files = (
207 | );
208 | inputPaths = (
209 | );
210 | name = "Thin Binary";
211 | outputPaths = (
212 | );
213 | runOnlyForDeploymentPostprocessing = 0;
214 | shellPath = /bin/sh;
215 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
216 | };
217 | 9740EEB61CF901F6004384FC /* Run Script */ = {
218 | isa = PBXShellScriptBuildPhase;
219 | buildActionMask = 2147483647;
220 | files = (
221 | );
222 | inputPaths = (
223 | );
224 | name = "Run Script";
225 | outputPaths = (
226 | );
227 | runOnlyForDeploymentPostprocessing = 0;
228 | shellPath = /bin/sh;
229 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
230 | };
231 | /* End PBXShellScriptBuildPhase section */
232 |
233 | /* Begin PBXSourcesBuildPhase section */
234 | 97C146EA1CF9000F007C117D /* Sources */ = {
235 | isa = PBXSourcesBuildPhase;
236 | buildActionMask = 2147483647;
237 | files = (
238 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
239 | 97C146F31CF9000F007C117D /* main.m in Sources */,
240 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
241 | );
242 | runOnlyForDeploymentPostprocessing = 0;
243 | };
244 | /* End PBXSourcesBuildPhase section */
245 |
246 | /* Begin PBXVariantGroup section */
247 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
248 | isa = PBXVariantGroup;
249 | children = (
250 | 97C146FB1CF9000F007C117D /* Base */,
251 | );
252 | name = Main.storyboard;
253 | sourceTree = "";
254 | };
255 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
256 | isa = PBXVariantGroup;
257 | children = (
258 | 97C147001CF9000F007C117D /* Base */,
259 | );
260 | name = LaunchScreen.storyboard;
261 | sourceTree = "";
262 | };
263 | /* End PBXVariantGroup section */
264 |
265 | /* Begin XCBuildConfiguration section */
266 | 97C147031CF9000F007C117D /* Debug */ = {
267 | isa = XCBuildConfiguration;
268 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
269 | buildSettings = {
270 | ALWAYS_SEARCH_USER_PATHS = NO;
271 | CLANG_ANALYZER_NONNULL = YES;
272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
273 | CLANG_CXX_LIBRARY = "libc++";
274 | CLANG_ENABLE_MODULES = YES;
275 | CLANG_ENABLE_OBJC_ARC = YES;
276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
277 | CLANG_WARN_BOOL_CONVERSION = YES;
278 | CLANG_WARN_COMMA = YES;
279 | CLANG_WARN_CONSTANT_CONVERSION = YES;
280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
281 | CLANG_WARN_EMPTY_BODY = YES;
282 | CLANG_WARN_ENUM_CONVERSION = YES;
283 | CLANG_WARN_INFINITE_RECURSION = YES;
284 | CLANG_WARN_INT_CONVERSION = YES;
285 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
286 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
288 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
289 | CLANG_WARN_STRICT_PROTOTYPES = YES;
290 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
291 | CLANG_WARN_UNREACHABLE_CODE = YES;
292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
293 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
294 | COPY_PHASE_STRIP = NO;
295 | DEBUG_INFORMATION_FORMAT = dwarf;
296 | ENABLE_STRICT_OBJC_MSGSEND = YES;
297 | ENABLE_TESTABILITY = YES;
298 | GCC_C_LANGUAGE_STANDARD = gnu99;
299 | GCC_DYNAMIC_NO_PIC = NO;
300 | GCC_NO_COMMON_BLOCKS = YES;
301 | GCC_OPTIMIZATION_LEVEL = 0;
302 | GCC_PREPROCESSOR_DEFINITIONS = (
303 | "DEBUG=1",
304 | "$(inherited)",
305 | );
306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
308 | GCC_WARN_UNDECLARED_SELECTOR = YES;
309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
310 | GCC_WARN_UNUSED_FUNCTION = YES;
311 | GCC_WARN_UNUSED_VARIABLE = YES;
312 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
313 | MTL_ENABLE_DEBUG_INFO = YES;
314 | ONLY_ACTIVE_ARCH = YES;
315 | SDKROOT = iphoneos;
316 | TARGETED_DEVICE_FAMILY = "1,2";
317 | };
318 | name = Debug;
319 | };
320 | 97C147041CF9000F007C117D /* Release */ = {
321 | isa = XCBuildConfiguration;
322 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
323 | buildSettings = {
324 | ALWAYS_SEARCH_USER_PATHS = NO;
325 | CLANG_ANALYZER_NONNULL = YES;
326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
327 | CLANG_CXX_LIBRARY = "libc++";
328 | CLANG_ENABLE_MODULES = YES;
329 | CLANG_ENABLE_OBJC_ARC = YES;
330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
331 | CLANG_WARN_BOOL_CONVERSION = YES;
332 | CLANG_WARN_COMMA = YES;
333 | CLANG_WARN_CONSTANT_CONVERSION = YES;
334 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
335 | CLANG_WARN_EMPTY_BODY = YES;
336 | CLANG_WARN_ENUM_CONVERSION = YES;
337 | CLANG_WARN_INFINITE_RECURSION = YES;
338 | CLANG_WARN_INT_CONVERSION = YES;
339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
340 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
342 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
343 | CLANG_WARN_STRICT_PROTOTYPES = YES;
344 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
345 | CLANG_WARN_UNREACHABLE_CODE = YES;
346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
348 | COPY_PHASE_STRIP = NO;
349 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
350 | ENABLE_NS_ASSERTIONS = NO;
351 | ENABLE_STRICT_OBJC_MSGSEND = YES;
352 | GCC_C_LANGUAGE_STANDARD = gnu99;
353 | GCC_NO_COMMON_BLOCKS = YES;
354 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
355 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
356 | GCC_WARN_UNDECLARED_SELECTOR = YES;
357 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
358 | GCC_WARN_UNUSED_FUNCTION = YES;
359 | GCC_WARN_UNUSED_VARIABLE = YES;
360 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
361 | MTL_ENABLE_DEBUG_INFO = NO;
362 | SDKROOT = iphoneos;
363 | TARGETED_DEVICE_FAMILY = "1,2";
364 | VALIDATE_PRODUCT = YES;
365 | };
366 | name = Release;
367 | };
368 | 97C147061CF9000F007C117D /* Debug */ = {
369 | isa = XCBuildConfiguration;
370 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
371 | buildSettings = {
372 | ARCHS = arm64;
373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
374 | ENABLE_BITCODE = NO;
375 | FRAMEWORK_SEARCH_PATHS = (
376 | "$(inherited)",
377 | "$(PROJECT_DIR)/Flutter",
378 | );
379 | INFOPLIST_FILE = Runner/Info.plist;
380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
381 | LIBRARY_SEARCH_PATHS = (
382 | "$(inherited)",
383 | "$(PROJECT_DIR)/Flutter",
384 | );
385 | PRODUCT_BUNDLE_IDENTIFIER = com.letsar.example;
386 | PRODUCT_NAME = "$(TARGET_NAME)";
387 | };
388 | name = Debug;
389 | };
390 | 97C147071CF9000F007C117D /* Release */ = {
391 | isa = XCBuildConfiguration;
392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
393 | buildSettings = {
394 | ARCHS = arm64;
395 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
396 | ENABLE_BITCODE = NO;
397 | FRAMEWORK_SEARCH_PATHS = (
398 | "$(inherited)",
399 | "$(PROJECT_DIR)/Flutter",
400 | );
401 | INFOPLIST_FILE = Runner/Info.plist;
402 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
403 | LIBRARY_SEARCH_PATHS = (
404 | "$(inherited)",
405 | "$(PROJECT_DIR)/Flutter",
406 | );
407 | PRODUCT_BUNDLE_IDENTIFIER = com.letsar.example;
408 | PRODUCT_NAME = "$(TARGET_NAME)";
409 | };
410 | name = Release;
411 | };
412 | /* End XCBuildConfiguration section */
413 |
414 | /* Begin XCConfigurationList section */
415 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
416 | isa = XCConfigurationList;
417 | buildConfigurations = (
418 | 97C147031CF9000F007C117D /* Debug */,
419 | 97C147041CF9000F007C117D /* Release */,
420 | );
421 | defaultConfigurationIsVisible = 0;
422 | defaultConfigurationName = Release;
423 | };
424 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
425 | isa = XCConfigurationList;
426 | buildConfigurations = (
427 | 97C147061CF9000F007C117D /* Debug */,
428 | 97C147071CF9000F007C117D /* Release */,
429 | );
430 | defaultConfigurationIsVisible = 0;
431 | defaultConfigurationName = Release;
432 | };
433 | /* End XCConfigurationList section */
434 | };
435 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
436 | }
437 |
--------------------------------------------------------------------------------
/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 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
7 | [GeneratedPluginRegistrant registerWithRegistry:self];
8 | // Override point for customization after application launch.
9 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
10 | }
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/letsar/flutter_parallax/d700eb3db1f165c14f4b7f3b8b06fbce25c0f923/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 | example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | arm64
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIViewControllerBasedStatusBarAppearance
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/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/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_parallax/flutter_parallax.dart';
3 |
4 | void main() => runApp(new MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | @override
8 | Widget build(BuildContext context) {
9 | return new MaterialApp(
10 | title: 'Flutter Demo',
11 | theme: new ThemeData(
12 | primarySwatch: Colors.blue,
13 | ),
14 | home: new MyHomePage(title: 'Parallax demo'),
15 | );
16 | }
17 | }
18 |
19 | class MyHomePage extends StatefulWidget {
20 | MyHomePage({Key key, this.title}) : super(key: key);
21 |
22 | final String title;
23 |
24 | @override
25 | _MyHomePageState createState() => new _MyHomePageState();
26 | }
27 |
28 | class _MyHomePageState extends State {
29 | ScrollController _scrollController;
30 |
31 | @override
32 | void initState() {
33 | super.initState();
34 | _scrollController = new ScrollController();
35 | }
36 |
37 | @override
38 | Widget build(BuildContext context) {
39 | return new Scaffold(
40 | appBar: new AppBar(title: new Text(widget.title)),
41 | body: new Stack(
42 | children: [
43 | new Parallax.outside(
44 | controller: _scrollController,
45 | child: new Column(
46 | children: [
47 | new Container(
48 | color: Colors.red,
49 | height: 200.0,
50 | ),
51 | new Container(
52 | color: Colors.pink,
53 | height: 200.0,
54 | ),
55 | new Container(
56 | color: Colors.lightGreen,
57 | height: 200.0,
58 | ),
59 | new Container(
60 | color: Colors.orange,
61 | height: 200.0,
62 | ),
63 | new Container(
64 | color: Colors.teal,
65 | height: 200.0,
66 | ),
67 | new Container(
68 | color: Colors.purple,
69 | height: 200.0,
70 | ),
71 | new Container(
72 | color: Colors.grey,
73 | height: 200.0,
74 | ),
75 | new Container(
76 | color: Colors.lime,
77 | height: 200.0,
78 | ),
79 | new Container(
80 | color: Colors.indigo,
81 | height: 200.0,
82 | ),
83 | new Container(
84 | color: Colors.yellow,
85 | height: 200.0,
86 | ),
87 | new Container(
88 | color: Colors.green,
89 | height: 200.0,
90 | ),
91 | new Container(
92 | color: Colors.blue,
93 | height: 200.0,
94 | ),
95 | ],
96 | ),
97 | ),
98 | new ListView.builder(
99 | controller: _scrollController,
100 | itemBuilder: buildItem,
101 | itemCount: 20,
102 | ),
103 | ],
104 | ),
105 | );
106 | }
107 |
108 | Widget buildItem(BuildContext context, int index) {
109 | var mode = index % 4;
110 | switch (mode) {
111 | case 0:
112 | return new Parallax.inside(
113 | child: new Image.network(
114 | 'https://flutter.io/images/homepage/header-illustration.png'),
115 | mainAxisExtent: 150.0,
116 | );
117 | case 1:
118 | return new Parallax.inside(
119 | child: new Image.network(
120 | 'http://t.wallpaperweb.org/wallpaper/nature/3840x1024/9XMedia1280TripleHorizontalMountainsclouds.jpg'),
121 | mainAxisExtent: 150.0,
122 | direction: AxisDirection.right,
123 | );
124 | case 2:
125 | return new Parallax.inside(
126 | child: new Image.network(
127 | 'https://flutter.io/images/homepage/header-illustration.png'),
128 | mainAxisExtent: 150.0,
129 | flipDirection: true,
130 | );
131 | default:
132 | return new Parallax.inside(
133 | child: new Image.network(
134 | 'http://t.wallpaperweb.org/wallpaper/nature/3840x1024/9XMedia1280TripleHorizontalMountainsclouds.jpg'),
135 | mainAxisExtent: 150.0,
136 | direction: AxisDirection.left,
137 | );
138 | }
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter project.
3 |
4 | dependencies:
5 | flutter:
6 | sdk: flutter
7 |
8 | # The following adds the Cupertino Icons font to your application.
9 | # Use with the CupertinoIcons class for iOS style icons.
10 | cupertino_icons: ^0.1.0
11 |
12 | flutter_parallax:
13 | path: ../
14 |
15 | dev_dependencies:
16 | flutter_test:
17 | sdk: flutter
18 |
19 | # For information on the generic Dart part of this file, see the
20 | # following page: https://www.dartlang.org/tools/pub/pubspec
21 |
22 | # The following section is specific to Flutter.
23 | flutter:
24 |
25 | # The following line ensures that the Material Icons font is
26 | # included with your application, so that you can use the icons in
27 | # the material Icons class.
28 | uses-material-design: true
29 |
--------------------------------------------------------------------------------
/lib/flutter_parallax.dart:
--------------------------------------------------------------------------------
1 | library flutter_parallax;
2 |
3 | export 'src/rendering/parallax.dart';
4 | export 'src/widgets/parallax.dart';
5 |
--------------------------------------------------------------------------------
/lib/src/rendering/parallax.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math' as math;
2 | import 'dart:ui' show lerpDouble;
3 |
4 | import 'package:flutter/foundation.dart';
5 | import 'package:flutter/widgets.dart';
6 | import 'package:flutter/rendering.dart';
7 |
8 | /// A delegate that controls the parallax effect of a [Parallax] widget.
9 | ///
10 | /// Used by [ParallaxSingleChildLayout] (in the widgets folder) and
11 | /// [RenderParallaxSingleChildLayoutBox] (in this file).
12 | ///
13 | /// When asked to layout, [RenderParallaxSingleChildLayoutBox] first calls [getSize] with
14 | /// its incoming constraints to determine its size. It then calls
15 | /// [getConstraintsForChild] to determine the constraints to apply to the child.
16 | /// After the child completes its layout, [RenderParallaxSingleChildLayoutBox]
17 | /// calls [getPositionForChild] to determine the child's position.
18 | ///
19 | /// The [shouldRelayout] method is called when a new instance of the class
20 | /// is provided, to check if the new instance actually represents different
21 | /// information.
22 | ///
23 | /// See also:
24 | ///
25 | /// * [ParallaxSingleChildLayout], the widget that uses this delegate.
26 | /// * [RenderParallaxSingleChildLayoutBox], render object that uses this
27 | /// delegate.
28 | abstract class ParallaxDelegate {
29 | /// Creates a parallax layout delegate.
30 | ///
31 | /// The layout will update whenever [controller] notifies its listeners.
32 | const ParallaxDelegate({
33 | @required this.controller,
34 | }) : assert(controller != null);
35 |
36 | /// The controller used to update the parallax offset.
37 | final ScrollController controller;
38 |
39 | /// The size of this object given the incoming constraints.
40 | ///
41 | /// Defaults to the biggest size that satisfies the given constraints.
42 | Size getSize(BoxConstraints constraints) => constraints.biggest;
43 |
44 | /// The constraints for the child given the incoming constraints.
45 | ///
46 | /// During layout, the child is given the layout constraints returned by this
47 | /// function. The child is required to pick a size for itself that satisfies
48 | /// these constraints.
49 | ///
50 | /// Defaults to the given constraints.
51 | BoxConstraints getConstraintsForChild(BoxConstraints constraints) =>
52 | constraints;
53 |
54 | /// The position where the child should be placed.
55 | ///
56 | /// The `size` argument is the size of the parent, which might be different
57 | /// from the value returned by [getSize] if that size doesn't satisfy the
58 | /// constraints passed to [getSize]. The `childSize` argument is the size of
59 | /// the child, which will satisfy the constraints returned by
60 | /// [getConstraintsForChild].
61 | ///
62 | /// Defaults to positioning the child in the upper left corner of the parent.
63 | Offset getPositionForChild(Size size, Size childSize, RenderBox renderBox) =>
64 | Offset.zero;
65 |
66 | /// Called whenever a new instance of the custom layout delegate class is
67 | /// provided to the [RenderParallaxSingleChildLayoutBox] object, or any time
68 | /// that a new [ParallaxSingleChildLayout] object is created with a new instance
69 | /// of the custom layout delegate class (which amounts to the same thing,
70 | /// because the latter is implemented in terms of the former).
71 | ///
72 | /// If the new instance represents different information than the old
73 | /// instance, then the method should return true, otherwise it should return
74 | /// false.
75 | ///
76 | /// If the method returns false, then the [getSize],
77 | /// [getConstraintsForChild], and [getPositionForChild] calls might be
78 | /// optimized away.
79 | ///
80 | /// It's possible that the layout methods will get called even if
81 | /// [shouldRelayout] returns false (e.g. if an ancestor changed its layout).
82 | /// It's also possible that the layout method will get called
83 | /// without [shouldRelayout] being called at all (e.g. if the parent changes
84 | /// size).
85 | bool shouldRelayout(covariant ParallaxDelegate oldDelegate) {
86 | return controller != oldDelegate.controller;
87 | }
88 | }
89 |
90 | /// A parallax layout delegate that follows a given direction when scrolled.
91 | ///
92 | /// See also:
93 | ///
94 | /// * [ParallaxInsideDelegate], which is a delegate for widgets inside a scroll view.
95 | /// * [ParallaxOutsideDelegate], which is a delegate for widgets outside a scroll view.
96 | abstract class ParallaxWithAxisDirectionDelegate extends ParallaxDelegate {
97 | /// Creates a parallax layout delegate that indicates its own scroll direction
98 | /// independently of the [controller.position] one.
99 | ///
100 | /// The [controller] and [flipDirection] arguments must not be null.
101 | const ParallaxWithAxisDirectionDelegate({
102 | @required ScrollController controller,
103 | this.direction,
104 | this.flipDirection = false,
105 | }) : assert(controller != null),
106 | assert(flipDirection != null),
107 | super(controller: controller);
108 |
109 | /// The direction of the parallax effect when scroll offset increases.
110 | ///
111 | /// When null, the direction is the same as the [controller].
112 | final AxisDirection direction;
113 |
114 | /// Whether to flip the given [direction].
115 | ///
116 | /// Defaults to false.
117 | final bool flipDirection;
118 |
119 | static Offset _getOffsetUnit(AxisDirection direction) {
120 | switch (direction) {
121 | case AxisDirection.up:
122 | case AxisDirection.down:
123 | return const Offset(0.0, 1.0);
124 | case AxisDirection.left:
125 | case AxisDirection.right:
126 | return const Offset(1.0, 0.0);
127 | }
128 | return null;
129 | }
130 |
131 | @override
132 | bool shouldRelayout(ParallaxWithAxisDirectionDelegate oldDelegate) {
133 | return super.shouldRelayout(oldDelegate) ||
134 | direction != oldDelegate.direction;
135 | }
136 |
137 | @override
138 | Offset getPositionForChild(Size size, Size childSize, RenderBox renderBox) {
139 | final ScrollPosition position = controller.position;
140 | assert(position != null);
141 |
142 | final AxisDirection parallaxDirection = _getParallaxDirection();
143 | final Axis parallaxAxis = axisDirectionToAxis(parallaxDirection);
144 |
145 | final Offset offsetUnit = _getOffsetUnit(parallaxDirection);
146 |
147 | final double childExtent =
148 | (parallaxAxis == Axis.horizontal) ? childSize.width : childSize.height;
149 | final double mainAxisExtent =
150 | (parallaxAxis == Axis.horizontal) ? size.width : size.height;
151 |
152 | if (mainAxisExtent < childExtent) {
153 | double scrollRatio =
154 | getChildScrollRatio(offsetUnit, childExtent, renderBox);
155 | if (parallaxDirection == AxisDirection.down ||
156 | parallaxDirection == AxisDirection.right) {
157 | scrollRatio = 1.0 - scrollRatio;
158 | }
159 |
160 | final offset =
161 | childExtent - lerpDouble(mainAxisExtent, childExtent, scrollRatio);
162 |
163 | return -(offsetUnit * offset);
164 | } else {
165 | return Offset.zero;
166 | }
167 | }
168 |
169 | double getChildScrollRatio(
170 | Offset offsetUnit, double childExtent, RenderBox renderBox);
171 |
172 | AxisDirection _getParallaxDirection() {
173 | AxisDirection parallaxDirection =
174 | direction ?? controller?.position?.axisDirection;
175 | if (flipDirection) {
176 | parallaxDirection = flipAxisDirection(parallaxDirection);
177 | }
178 | assert(parallaxDirection != null);
179 | return parallaxDirection;
180 | }
181 | }
182 |
183 | /// A parallax delegate for a widget inside a scroll view.
184 | ///
185 | /// The parallax offset is determined by the position of the widget within its first [Scrollable]
186 | /// parent.
187 | class ParallaxInsideDelegate extends ParallaxWithAxisDirectionDelegate {
188 | /// Creates a parallax layout delegate for widgets inside a scroll view.
189 | ///
190 | /// The [controller], [mainAxisExtent] and [flipDirection] arguments must not be null.
191 | /// The [mainAxisExtent] argument must be positive.
192 | const ParallaxInsideDelegate({
193 | @required ScrollController controller,
194 | @required this.mainAxisExtent,
195 | AxisDirection direction,
196 | bool flipDirection = false,
197 | }) : assert(mainAxisExtent != null && mainAxisExtent >= 0.0),
198 | super(
199 | controller: controller,
200 | direction: direction,
201 | flipDirection: flipDirection,
202 | );
203 |
204 | /// The extent of the layout in the same axis as the scrolling.
205 | final double mainAxisExtent;
206 |
207 | @override
208 | BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
209 | final AxisDirection parallaxDirection = _getParallaxDirection();
210 | final Axis parallaxAxis = axisDirectionToAxis(parallaxDirection);
211 | final Axis scrollAxis = controller?.position?.axis;
212 |
213 | if (scrollAxis == parallaxAxis) {
214 | return scrollAxis == Axis.horizontal
215 | ? constraints.heightConstraints()
216 | : constraints.widthConstraints();
217 | } else {
218 | return scrollAxis == Axis.horizontal
219 | ? constraints.widthConstraints().tighten(width: mainAxisExtent)
220 | : constraints.heightConstraints().tighten(height: mainAxisExtent);
221 | }
222 | }
223 |
224 | @override
225 | Size getSize(BoxConstraints constraints) {
226 | final ScrollPosition position = controller.position;
227 | assert(position != null);
228 | final bool isHorizontalAxis = (position.axis == Axis.horizontal);
229 |
230 | return constraints.constrain(new Size(
231 | isHorizontalAxis ? mainAxisExtent : constraints.maxWidth,
232 | isHorizontalAxis ? constraints.maxHeight : mainAxisExtent));
233 | }
234 |
235 | @override
236 | double getChildScrollRatio(
237 | Offset offsetUnit, double childExtent, RenderBox renderBox) {
238 | final RenderAbstractViewport viewport =
239 | RenderAbstractViewport.of(renderBox);
240 | assert(viewport != null);
241 |
242 | final ScrollPosition position = controller.position;
243 | assert(position != null);
244 | final bool isHorizontalAxis = (position.axis == Axis.horizontal);
245 |
246 | final Offset localPositionOffset = isHorizontalAxis
247 | ? new Offset(mainAxisExtent, 0.0)
248 | : new Offset(0.0, mainAxisExtent); //offsetUnit * mainAxisExtent;
249 | final Offset positionInViewport =
250 | renderBox.localToGlobal(localPositionOffset, ancestor: viewport);
251 |
252 | // One dimension should be 0.0, so this should be ok.
253 | final double distanceFromLeading =
254 | math.max(positionInViewport.dx, positionInViewport.dy);
255 |
256 | double scrollRatio = distanceFromLeading /
257 | (controller.position.viewportDimension + mainAxisExtent);
258 | return scrollRatio;
259 | }
260 | }
261 |
262 | /// A parallax delegate for a widget outside a scroll view, or for a widget where the parallax offset does
263 | /// not depend on its position within its first [Scrollable] parent.
264 | class ParallaxOutsideDelegate extends ParallaxWithAxisDirectionDelegate {
265 | /// Creates a delegate for a widget outside a scroll view.
266 | ///
267 | /// The [controller] and [flipDirection] arguments must not be null.
268 | const ParallaxOutsideDelegate({
269 | @required ScrollController controller,
270 | AxisDirection direction,
271 | bool flipDirection = false,
272 | }) : super(
273 | controller: controller,
274 | direction: direction,
275 | flipDirection: flipDirection,
276 | );
277 |
278 | @override
279 | BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
280 | final AxisDirection parallaxDirection = _getParallaxDirection();
281 | final Axis parallaxAxis = axisDirectionToAxis(parallaxDirection);
282 |
283 | return parallaxAxis == Axis.horizontal
284 | ? constraints.heightConstraints()
285 | : constraints.widthConstraints();
286 | }
287 |
288 | @override
289 | double getChildScrollRatio(
290 | Offset offsetUnit, double childExtent, RenderBox renderBox) {
291 | double scrollRatio = 0.0;
292 | final ScrollPosition position = controller.position;
293 | final double offset = controller.offset;
294 | final double minScrollExtent =
295 | position?.minScrollExtent ?? double.negativeInfinity;
296 | final double maxScrollExtent = position?.maxScrollExtent ?? double.infinity;
297 |
298 | if (minScrollExtent.isFinite && maxScrollExtent.isFinite) {
299 | scrollRatio =
300 | (offset - minScrollExtent) / (maxScrollExtent - minScrollExtent);
301 | }
302 | return scrollRatio;
303 | }
304 | }
305 |
306 | /// Defers the parallax layout of its single child to a delegate.
307 | ///
308 | /// The delegate can determine the layout constraints for the child and can
309 | /// decide where to position the child. The delegate can also determine the size
310 | /// of the parent, but the size of the parent cannot depend on the size of the
311 | /// child.
312 | class RenderParallaxSingleChildLayoutBox extends RenderShiftedBox {
313 | /// Creates a render box that defers its parallax layout to a delegate.
314 | ///
315 | /// The [delegate] argument must not be null.
316 | RenderParallaxSingleChildLayoutBox({
317 | RenderBox child,
318 | @required ParallaxDelegate delegate,
319 | }) : assert(delegate != null),
320 | _delegate = delegate,
321 | super(child);
322 |
323 | /// A delegate that controls this object's layout.
324 | ParallaxDelegate get delegate => _delegate;
325 | ParallaxDelegate _delegate;
326 | set delegate(ParallaxDelegate newDelegate) {
327 | assert(newDelegate != null);
328 | if (_delegate == newDelegate) {
329 | return;
330 | }
331 | final ParallaxDelegate oldDelegate = _delegate;
332 | if (newDelegate.runtimeType != oldDelegate.runtimeType ||
333 | newDelegate.shouldRelayout(oldDelegate)) {
334 | markNeedsLayout();
335 | }
336 | _delegate = newDelegate;
337 | if (attached) {
338 | oldDelegate?.controller?.removeListener(markNeedsLayout);
339 | newDelegate?.controller?.addListener(markNeedsLayout);
340 | }
341 | }
342 |
343 | @override
344 | void attach(PipelineOwner owner) {
345 | super.attach(owner);
346 | _delegate?.controller?.addListener(markNeedsLayout);
347 | }
348 |
349 | @override
350 | void detach() {
351 | _delegate?.controller?.removeListener(markNeedsLayout);
352 | super.detach();
353 | }
354 |
355 | Size _getSize(BoxConstraints constraints) {
356 | return constraints.constrain(_delegate.getSize(constraints));
357 | }
358 |
359 | @override
360 | void performLayout() {
361 | size = _getSize(constraints);
362 | if (child != null) {
363 | final BoxConstraints childConstraints =
364 | delegate.getConstraintsForChild(constraints);
365 | assert(childConstraints.debugAssertIsValid(isAppliedConstraint: true));
366 | child.layout(childConstraints, parentUsesSize: !childConstraints.isTight);
367 | final BoxParentData childParentData = child.parentData;
368 | childParentData.offset = delegate.getPositionForChild(
369 | size,
370 | childConstraints.isTight ? childConstraints.smallest : child.size,
371 | this);
372 | }
373 | }
374 | }
375 |
--------------------------------------------------------------------------------
/lib/src/widgets/parallax.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/widgets.dart';
3 | import 'package:flutter/rendering.dart';
4 |
5 | import '../rendering/parallax.dart';
6 |
7 | /// A widget that applies a parallax effect on its child.
8 | ///
9 | /// There are three options for constructing a [Parallax]:
10 | ///
11 | /// 1. The [Parallax.inside], that computes the parallax offset from its position
12 | /// in its first [Scrollable] parent.
13 | /// Useful for list or grid items.
14 | ///
15 | /// 2. The [Parallax.outside], that computes the parallax offset from the percentage
16 | /// of the scrollable's container extent.
17 | /// Useful for a list or grid background.
18 | ///
19 | /// 3. The [Parallax.custom] takes a [ParallaxDelegate], which provides the ability
20 | /// to customize additional aspects of the child model. For example, a [ParallaxDelegate]
21 | /// can control the algorithm used to computes the parallax offset of the child within its parent.
22 | ///
23 | /// See also:
24 | ///
25 | /// * [ParallaxSingleChildLayout], which uses a delegate to control the parallax layout of
26 | /// a single child.
27 | class Parallax extends StatelessWidget {
28 | /// Creates a parallax widget for a widget inside a scroll view.
29 | ///
30 | /// The [mainAxisExtent] and [flipDirection] arguments must not be null.
31 | /// The [mainAxisExtent] argument must be positive.
32 | const Parallax.inside({
33 | Key key,
34 | @required this.child,
35 | @required this.mainAxisExtent,
36 | this.direction,
37 | this.flipDirection = false,
38 | }) : assert(mainAxisExtent != null && mainAxisExtent >= 0.0),
39 | delegate = null,
40 | super(key: key);
41 |
42 | /// Creates a parallax widget for a widget outside a scroll view.
43 | ///
44 | /// The [controller] and [flipDirection] arguments must not be null.
45 | Parallax.outside({
46 | Key key,
47 | @required this.child,
48 | @required ScrollController controller,
49 | this.direction,
50 | this.flipDirection = false,
51 | }) : assert(controller != null),
52 | mainAxisExtent = null,
53 | delegate = new ParallaxOutsideDelegate(
54 | controller: controller,
55 | direction: direction,
56 | flipDirection: flipDirection),
57 | super(key: key);
58 |
59 | /// Creates a parallax widget with a custom parallax layout.
60 | ///
61 | /// The [delegate] argument must not be null.
62 | const Parallax.custom({
63 | Key key,
64 | @required this.child,
65 | @required this.delegate,
66 | }) : assert(delegate != null),
67 | mainAxisExtent = null,
68 | direction = null,
69 | flipDirection = null,
70 | super(key: key);
71 |
72 | /// The child of this widget.
73 | final Widget child;
74 |
75 | /// The delegate that controls the algorithm used to position the child within its parent.
76 | final ParallaxDelegate delegate;
77 |
78 | /// The extent of the child in the same axis as the scrolling.
79 | final double mainAxisExtent;
80 |
81 | /// The direction of the parallax effect when scroll offset increases.
82 | ///
83 | /// When null, the direction is the same as the [controller].
84 | final AxisDirection direction;
85 |
86 | /// Whether to flip the given [direction].
87 | ///
88 | /// Defaults to false.
89 | final bool flipDirection;
90 |
91 | @override
92 | Widget build(BuildContext context) {
93 | ParallaxDelegate parallaxDelegate = delegate;
94 | if (parallaxDelegate == null) {
95 | final ScrollPosition position = Scrollable.of(context).position;
96 | final ScrollController controller = new ScrollController();
97 | controller.attach(position);
98 | parallaxDelegate = new ParallaxInsideDelegate(
99 | mainAxisExtent: mainAxisExtent,
100 | direction: direction,
101 | controller: controller,
102 | flipDirection: flipDirection,
103 | );
104 | }
105 |
106 | return new ClipRect(
107 | child: new ParallaxSingleChildLayout(
108 | delegate: parallaxDelegate,
109 | child: child,
110 | ),
111 | );
112 | }
113 | }
114 |
115 | /// A widget that defers the parallax layout of its single child to a delegate.
116 | ///
117 | /// The delegate can determine the layout constraints for the child and can
118 | /// decide where to position the child. The delegate can also determine the size
119 | /// of the parent, but the size of the parent cannot depend on the size of the
120 | /// child.
121 | ///
122 | /// See also:
123 | ///
124 | /// * [ParallaxDelegate], which controls the parallax layout of the child.
125 | class ParallaxSingleChildLayout extends SingleChildRenderObjectWidget {
126 | /// Creates a custom single child layout.
127 | ///
128 | /// The [delegate] argument must not be null.
129 | const ParallaxSingleChildLayout({
130 | Key key,
131 | @required this.delegate,
132 | Widget child,
133 | }) : assert(delegate != null),
134 | super(key: key, child: child);
135 |
136 | /// The delegate that controls the layout of the child.
137 | final ParallaxDelegate delegate;
138 |
139 | @override
140 | RenderParallaxSingleChildLayoutBox createRenderObject(BuildContext context) {
141 | return new RenderParallaxSingleChildLayoutBox(delegate: delegate);
142 | }
143 |
144 | @override
145 | void updateRenderObject(
146 | BuildContext context, RenderParallaxSingleChildLayoutBox renderObject) {
147 | renderObject.delegate = delegate;
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_parallax
2 | description: A Flutter widget that moves according to a scroll controller.
3 | version: 0.1.2
4 | author: Romain Rastel
5 | homepage: https://github.com/letsar/flutter_parallax
6 |
7 | dependencies:
8 | flutter:
9 | sdk: flutter
10 |
11 | dev_dependencies:
12 | test: ^0.12.0
13 | flutter_test:
14 | sdk: flutter
15 |
16 | environment:
17 | sdk: ">=1.19.0 <3.0.0"
--------------------------------------------------------------------------------
/test/flutter_parallax_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:test/test.dart';
2 |
3 | import 'package:flutter_parallax/flutter_parallax.dart';
4 |
5 | void main() {}
6 |
--------------------------------------------------------------------------------