Commit 3bfcaf6e authored by 汪林玲's avatar 汪林玲

增加null-safety,和引入说明

parent a2f4b4be
<component name="libraryTable">
<library name="Flutter for Android">
<CLASSES>
<root url="jar:///Users/jzoom/working/flutter/bin/cache/artifacts/engine/android-arm/flutter.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method />
</configuration>
</component>
\ No newline at end of file
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 44b7e7d3f42f050a79712daab253af06e9daf530
channel: beta
# example
A new Flutter project.
## Getting Started
For help getting started with Flutter, view our online
[documentation](https://flutter.io/).
*.iml
*.class
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
GeneratedPluginRegistrant.java
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.example"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example">
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
package com.example.example;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/android/gen" />
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/android/gen" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/android/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/android/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/android/assets" />
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/android/libs" />
<option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/android/proguard_logs" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/android">
<sourceFolder url="file://$MODULE_DIR$/android/app/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/android/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Flutter for Android" level="project" />
</component>
</module>
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/app.flx
/Flutter/app.zip
/Flutter/flutter_assets/
/Flutter/App.framework
/Flutter/Flutter.framework
/Flutter/Generated.xcconfig
/ServiceDefinitions.json
Pods/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>MinimumOSVersion</key>
<string>8.0</string>
</dict>
</plist>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
@interface AppDelegate : FlutterAppDelegate
@end
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
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.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" image="MyLaunch.jpg" translatesAutoresizingMaskIntoConstraints="NO" id="uio-Um-rja">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="uio-Um-rja" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="2KC-gl-GLX"/>
<constraint firstAttribute="trailing" secondItem="uio-Um-rja" secondAttribute="trailing" id="3pb-lM-hI4"/>
<constraint firstItem="uio-Um-rja" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="XiB-5L-JlS"/>
<constraint firstAttribute="bottom" secondItem="uio-Um-rja" secondAttribute="bottom" id="iEo-Jc-AcY"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="MyLaunch.jpg" width="720" height="1280"/>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
#import <UIKit/UIKit.h>
#import <Flutter/Flutter.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new InnerSwiper(),
);
}
}
class InnerSwiper extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new _InnerSwiperState();
}
}
class _InnerSwiperState extends State<InnerSwiper> {
SwiperController controller;
List<bool> autoplayes;
List<SwiperController> controllers;
@override
void initState() {
controller = new SwiperController();
autoplayes = new List.empty(growable: true)
..length = 10
..fillRange(0, 10, false);
controllers = new List.empty(growable: true)
..length = 10
..fillRange(0, 10, new SwiperController());
super.initState();
}
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Swiper(
loop: false,
itemCount: 10,
controller: controller,
pagination: new SwiperPagination(),
itemBuilder: (BuildContext context, int index) {
return new Column(
children: <Widget>[
new SizedBox(
child: new Swiper(
controller: controllers[index],
pagination: new SwiperPagination(),
itemCount: 4,
itemBuilder: (BuildContext context, int index) {
return new Container(
color: Colors.greenAccent,
child: new Text("jkfjkldsfjd"),
);
},
autoplay: autoplayes[index],
),
height: 300.0,
),
new TextButton(
onPressed: () {
setState(() {
autoplayes[index] = true;
});
},
child: new Text("Start autoplay"),
),
new TextButton(
onPressed: () {
setState(() {
autoplayes[index] = false;
});
},
child: new Text("End autoplay"),
),
new Text("is autoplay: ${autoplayes[index]}")
],
);
},
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flutter/cupertino.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(title: 'Flutter Swiper'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Swiper(
itemCount: 10,
itemBuilder: (c, i) {
return new Text("$i");
},
plugins: [],
),
);
}
}
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:flutter_page_indicator/flutter_page_indicator.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'config.dart';
import 'forms/form_widget.dart';
class ExampleCustom extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return new _ExampleCustomState();
}
}
class _ExampleCustomState extends State<ExampleCustom> {
//properties want to custom
int _itemCount;
bool _loop;
bool _autoplay;
int _autoplayDely;
double _padding;
bool _outer;
double _radius;
double _viewportFraction;
SwiperLayout _layout;
int _currentIndex;
double _scale;
Axis _scrollDirection;
Curve _curve;
double _fade;
bool _autoplayDisableOnInteraction;
CustomLayoutOption customLayoutOption;
Widget _buildItem(BuildContext context, int index) {
return ClipRRect(
borderRadius: new BorderRadius.all(new Radius.circular(_radius)),
child: new Image.asset(
images[index % images.length],
fit: BoxFit.fill,
),
);
}
@override
void didUpdateWidget(ExampleCustom oldWidget) {
customLayoutOption = new CustomLayoutOption(startIndex: -1, stateCount: 3)
.addRotate([-45.0 / 180, 0.0, 45.0 / 180]).addTranslate([
new Offset(-370.0, -40.0),
new Offset(0.0, 0.0),
new Offset(370.0, -40.0)
]);
super.didUpdateWidget(oldWidget);
}
@override
void initState() {
customLayoutOption = new CustomLayoutOption(startIndex: -1, stateCount: 3)
.addRotate([-25.0 / 180, 0.0, 25.0 / 180]).addTranslate([
new Offset(-350.0, 0.0),
new Offset(0.0, 0.0),
new Offset(350.0, 0.0)
]);
_fade = 1.0;
_currentIndex = 0;
_curve = Curves.ease;
_scale = 0.8;
_controller = new SwiperController();
_layout = SwiperLayout.TINDER;
_radius = 10.0;
_padding = 0.0;
_loop = true;
_itemCount = 3;
_autoplay = false;
_autoplayDely = 3000;
_viewportFraction = 0.8;
_outer = false;
_scrollDirection = Axis.horizontal;
_autoplayDisableOnInteraction = false;
super.initState();
}
// maintain the index
Widget buildSwiper() {
return new Swiper(
onTap: (int index) {
Navigator.of(context)
.push(new MaterialPageRoute(builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("New page"),
),
body: Container(),
);
}));
},
customLayoutOption: customLayoutOption,
fade: _fade,
index: _currentIndex,
onIndexChanged: (int index) {
setState(() {
_currentIndex = index;
});
},
curve: _curve,
scale: _scale,
itemWidth: 300.0,
controller: _controller,
layout: _layout,
outer: _outer,
itemHeight: 200.0,
viewportFraction: _viewportFraction,
autoplayDelay: _autoplayDely,
loop: _loop,
autoplay: _autoplay,
itemBuilder: _buildItem,
itemCount: _itemCount,
scrollDirection: _scrollDirection,
indicatorLayout: PageIndicatorLayout.COLOR,
autoplayDisableOnInteraction: _autoplayDisableOnInteraction,
pagination: new SwiperPagination(
builder: const DotSwiperPaginationBuilder(
size: 20.0, activeSize: 20.0, space: 10.0)),
);
}
SwiperController _controller;
TextEditingController numberController = new TextEditingController();
@override
Widget build(BuildContext context) {
return new Column(children: <Widget>[
new Container(
color: Colors.black87,
child: new SizedBox(
height: 300.0, width: double.infinity, child: buildSwiper()),
),
new Expanded(
child: new ListView(
children: <Widget>[
new Text("Index:$_currentIndex"),
new Row(
children: <Widget>[
new TextButton(
onPressed: () {
_controller.previous(animation: true);
},
child: new Text("Prev"),
),
new TextButton(
onPressed: () {
_controller.next(animation: true);
},
child: new Text("Next"),
),
new Expanded(
child: new TextField(
controller: numberController,
)),
new TextButton(
onPressed: () {
var text = numberController.text;
setState(() {
_currentIndex = int.parse(text);
});
},
child: new Text("Update"),
),
],
),
new FormWidget(
label: "layout",
child: new FormSelect(
placeholder: "Select layout",
value: _layout,
values: [
SwiperLayout.DEFAULT,
SwiperLayout.STACK,
SwiperLayout.TINDER,
SwiperLayout.CUSTOM
],
valueChanged: (value) {
_layout = value;
setState(() {});
})),
new FormWidget(
label: "scrollDirection",
child: new Switch(
value: _scrollDirection == Axis.horizontal,
onChanged: (bool value) => setState(() => _scrollDirection =
value ? Axis.horizontal : Axis.vertical)),
),
new FormWidget(
label: "autoplayDisableOnInteractio",
child: new Switch(
value: _autoplayDisableOnInteraction,
onChanged: (bool value) =>
setState(() => _autoplayDisableOnInteraction = value)),
),
//Pannel Begin
new FormWidget(
label: "loop",
child: new Switch(
value: _loop,
onChanged: (bool value) => setState(() => _loop = value)),
),
new FormWidget(
label: "outer",
child: new Switch(
value: _outer,
onChanged: (bool value) => setState(() => _outer = value)),
),
//Pannel Begin
new FormWidget(
label: "autoplay",
child: new Switch(
value: _autoplay,
onChanged: (bool value) => setState(() => _autoplay = value)),
),
new FormWidget(
label: "padding",
child: new NumberPad(
number: _padding,
step: 5.0,
min: 0.0,
max: 30.0,
onChangeValue: (num value) {
_padding = value.toDouble();
setState(() {});
},
),
),
new FormWidget(
label: "scale",
child: new NumberPad(
number: _scale,
step: 0.1,
min: 0.0,
max: 1.0,
onChangeValue: (num value) {
_scale = value.toDouble();
setState(() {});
},
),
),
new FormWidget(
label: "fade",
child: new NumberPad(
number: _fade,
step: 0.1,
min: 0.0,
max: 1.0,
onChangeValue: (num value) {
_fade = value.toDouble();
setState(() {});
},
),
),
new FormWidget(
label: "itemCount",
child: new NumberPad(
number: _itemCount,
step: 1,
min: 0,
max: 100,
onChangeValue: (num value) {
_itemCount = value.toInt();
setState(() {});
},
),
),
new FormWidget(
label: "radius",
child: new NumberPad(
number: _radius,
step: 1.0,
min: 0.0,
max: 30.0,
onChangeValue: (num value) {
this._radius = value.toDouble();
setState(() {});
},
),
),
new FormWidget(
label: "viewportFraction",
child: new NumberPad(
number: _viewportFraction,
step: 0.1,
max: 1.0,
min: 0.5,
onChangeValue: (num value) {
_viewportFraction = value.toDouble();
setState(() {});
},
),
),
new FormWidget(
label: "curve",
child: new FormSelect(
placeholder: "Select curve",
value: _layout,
values: [
Curves.easeInOut,
Curves.ease,
Curves.bounceInOut,
Curves.bounceOut,
Curves.bounceIn,
Curves.fastOutSlowIn
],
valueChanged: (value) {
_curve = value;
setState(() {});
})),
],
))
]);
}
}
This diff is collapsed.
const List<String> images = [
"images/bg0.jpeg",
"images/bg1.jpeg",
"images/bg2.jpeg",
];
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
class FormWidget extends StatelessWidget {
final String label;
final Widget child;
FormWidget({this.label, this.child});
@override
Widget build(BuildContext context) {
return new Padding(
padding: new EdgeInsets.all(5.0),
child: new Row(
children: <Widget>[
new Text(label, style: new TextStyle(fontSize: 14.0)),
new Expanded(
child:
new Align(alignment: Alignment.centerRight, child: child))
],
));
}
}
class FormSelect<T> extends StatefulWidget {
final String placeholder;
final ValueChanged<T> valueChanged;
final List<dynamic> values;
final dynamic value;
FormSelect({this.placeholder, this.valueChanged, this.value, this.values});
@override
State<StatefulWidget> createState() {
return _FormSelectState();
}
}
class _FormSelectState extends State<FormSelect> {
int _selectedIndex = 0;
@override
void initState() {
for (int i = 0, c = widget.values.length; i < c; ++i) {
if (widget.values[i] == widget.value) {
_selectedIndex = i;
break;
}
}
super.initState();
}
@override
Widget build(BuildContext context) {
String placeholder = widget.placeholder;
List<dynamic> values = widget.values;
return new Container(
child: new InkWell(
child: new Text(_selectedIndex < 0
? placeholder
: values[_selectedIndex].toString()),
onTap: () {
_selectedIndex = 0;
showBottomSheet(
context: context,
builder: (BuildContext context) {
return new SizedBox(
height: values.length * 30.0 + 200.0,
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new SizedBox(
height: values.length * 30.0 + 70.0,
child: new CupertinoPicker(
itemExtent: 30.0,
children: values.map((dynamic value) {
return new Text(value.toString());
}).toList(),
onSelectedItemChanged: (int index) {
_selectedIndex = index;
},
),
),
new Center(
child: new TextButton(
onPressed: () {
if (_selectedIndex >= 0) {
widget
.valueChanged(widget.values[_selectedIndex]);
}
setState(() {});
Navigator.of(context).pop();
},
child: new Text("ok"),
),
)
],
),
);
});
},
),
);
}
}
class NumberPad extends StatelessWidget {
final num number;
final num step;
final num max;
final num min;
final ValueChanged<num> onChangeValue;
NumberPad({this.number, this.step, this.onChangeValue, this.max, this.min});
void onAdd() {
onChangeValue(number + step > max ? max : number + step);
}
void onSub() {
onChangeValue(number - step < min ? min : number - step);
}
@override
Widget build(BuildContext context) {
return new Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new IconButton(icon: new Icon(Icons.exposure_neg_1), onPressed: onSub),
new Text(
number is int ? number.toString() : number.toStringAsFixed(1),
style: new TextStyle(fontSize: 14.0),
),
new IconButton(icon: new Icon(Icons.exposure_plus_1), onPressed: onAdd)
],
);
}
}
name: example
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.0
flutter_swiper:
path: ../
percent_indicator:
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/bg0.jpeg
- images/bg1.jpeg
- images/bg2.jpeg
- images/bg.jpeg
- images/1.png
- images/2.png
- images/3.png
This diff is collapsed.
This diff is collapsed.
......@@ -12,15 +12,15 @@ class SwiperControl extends SwiperPlugin {
final double size;
///Icon normal color, The theme's [ThemeData.primaryColor] by default.
final Color color;
final Color? color;
///if set loop=false on Swiper, this color will be used when swiper goto the last slide.
///The theme's [ThemeData.disabledColor] by default.
final Color disableColor;
final Color? disableColor;
final EdgeInsetsGeometry padding;
final Key key;
final Key? key;
const SwiperControl(
{this.iconPrevious: Icons.arrow_back_ios,
......@@ -31,15 +31,15 @@ class SwiperControl extends SwiperPlugin {
this.size: 30.0,
this.padding: const EdgeInsets.all(5.0)});
Widget buildButton(SwiperPluginConfig config, Color color, IconData iconDaga,
Widget buildButton(SwiperPluginConfig? config, Color color, IconData iconDaga,
int quarterTurns, bool previous) {
return new GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (previous) {
config.controller.previous(animation: true);
config!.controller.previous(animation: true);
} else {
config.controller.next(animation: true);
config!.controller.next(animation: true);
}
},
child: Padding(
......@@ -56,7 +56,7 @@ class SwiperControl extends SwiperPlugin {
}
@override
Widget build(BuildContext context, SwiperPluginConfig config) {
Widget build(BuildContext context, SwiperPluginConfig? config) {
ThemeData themeData = Theme.of(context);
Color color = this.color ?? themeData.primaryColor;
......@@ -64,11 +64,11 @@ class SwiperControl extends SwiperPlugin {
Color prevColor;
Color nextColor;
if (config.loop) {
if (config!.loop!) {
prevColor = nextColor = color;
} else {
bool next = config.activeIndex < config.itemCount - 1;
bool prev = config.activeIndex > 0;
bool next = config.activeIndex! < config.itemCount! - 1;
bool prev = config.activeIndex! > 0;
prevColor = prev ? color : disableColor;
nextColor = next ? color : disableColor;
}
......
......@@ -16,15 +16,15 @@ class SwiperController extends IndexController {
static const int BUILD = 5;
// available when `event` == SwiperController.BUILD
SwiperPluginConfig config;
SwiperPluginConfig? config;
// available when `event` == SwiperController.SWIPE
// this value is PageViewController.pos
double pos;
double? pos;
int index;
bool animation;
bool autoplay;
int? index;
late bool animation;
bool? autoplay;
SwiperController();
......
......@@ -6,10 +6,10 @@ import 'package:flutter_page_indicator/flutter_page_indicator.dart';
class FractionPaginationBuilder extends SwiperPlugin {
///color ,if set null , will be Theme.of(context).scaffoldBackgroundColor
final Color color;
final Color? color;
///color when active,if set null , will be Theme.of(context).primaryColor
final Color activeColor;
final Color? activeColor;
////font size
final double fontSize;
......@@ -17,7 +17,7 @@ class FractionPaginationBuilder extends SwiperPlugin {
///font size when active
final double activeFontSize;
final Key key;
final Key? key;
const FractionPaginationBuilder(
{this.color,
......@@ -27,18 +27,18 @@ class FractionPaginationBuilder extends SwiperPlugin {
this.activeFontSize: 35.0});
@override
Widget build(BuildContext context, SwiperPluginConfig config) {
Widget build(BuildContext context, SwiperPluginConfig? config) {
ThemeData themeData = Theme.of(context);
Color activeColor = this.activeColor ?? themeData.primaryColor;
Color color = this.color ?? themeData.scaffoldBackgroundColor;
if (Axis.vertical == config.scrollDirection) {
if (Axis.vertical == config!.scrollDirection) {
return new Column(
key: key,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Text(
"${config.activeIndex + 1}",
"${config.activeIndex! + 1}",
style: TextStyle(color: activeColor, fontSize: activeFontSize),
),
new Text(
......@@ -57,7 +57,7 @@ class FractionPaginationBuilder extends SwiperPlugin {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Text(
"${config.activeIndex + 1}",
"${config.activeIndex! + 1}",
style: TextStyle(color: activeColor, fontSize: activeFontSize),
),
new Text(
......@@ -72,10 +72,10 @@ class FractionPaginationBuilder extends SwiperPlugin {
class RectSwiperPaginationBuilder extends SwiperPlugin {
///color when current index,if set null , will be Theme.of(context).primaryColor
final Color activeColor;
final Color? activeColor;
///,if set null , will be Theme.of(context).scaffoldBackgroundColor
final Color color;
final Color? color;
///Size of the rect when activate
final Size activeSize;
......@@ -86,7 +86,7 @@ class RectSwiperPaginationBuilder extends SwiperPlugin {
/// Space between rects
final double space;
final Key key;
final Key? key;
const RectSwiperPaginationBuilder(
{this.activeColor,
......@@ -97,20 +97,20 @@ class RectSwiperPaginationBuilder extends SwiperPlugin {
this.space: 3.0});
@override
Widget build(BuildContext context, SwiperPluginConfig config) {
Widget build(BuildContext context, SwiperPluginConfig? config) {
ThemeData themeData = Theme.of(context);
Color activeColor = this.activeColor ?? themeData.primaryColor;
Color color = this.color ?? themeData.scaffoldBackgroundColor;
List<Widget> list = [];
if (config.itemCount > 20) {
if (config!.itemCount! > 20) {
print(
"The itemCount is too big, we suggest use FractionPaginationBuilder instead of DotSwiperPaginationBuilder in this sitituation");
}
int itemCount = config.itemCount;
int activeIndex = config.activeIndex;
int itemCount = config.itemCount!;
int? activeIndex = config.activeIndex;
for (int i = 0; i < itemCount; ++i) {
bool active = i == activeIndex;
......@@ -144,10 +144,10 @@ class RectSwiperPaginationBuilder extends SwiperPlugin {
class DotSwiperPaginationBuilder extends SwiperPlugin {
///color when current index,if set null , will be Theme.of(context).primaryColor
final Color activeColor;
final Color? activeColor;
///,if set null , will be Theme.of(context).scaffoldBackgroundColor
final Color color;
final Color? color;
///Size of the dot when activate
final double activeSize;
......@@ -158,7 +158,7 @@ class DotSwiperPaginationBuilder extends SwiperPlugin {
/// Space between dots
final double space;
final Key key;
final Key? key;
const DotSwiperPaginationBuilder(
{this.activeColor,
......@@ -169,13 +169,13 @@ class DotSwiperPaginationBuilder extends SwiperPlugin {
this.space: 3.0});
@override
Widget build(BuildContext context, SwiperPluginConfig config) {
if (config.itemCount > 20) {
Widget build(BuildContext context, SwiperPluginConfig? config) {
if (config!.itemCount! > 20) {
print(
"The itemCount is too big, we suggest use FractionPaginationBuilder instead of DotSwiperPaginationBuilder in this sitituation");
}
Color activeColor = this.activeColor;
Color color = this.color;
Color? activeColor = this.activeColor;
Color? color = this.color;
if (activeColor == null || color == null) {
ThemeData themeData = Theme.of(context);
......@@ -186,9 +186,9 @@ class DotSwiperPaginationBuilder extends SwiperPlugin {
if (config.indicatorLayout != PageIndicatorLayout.NONE &&
config.layout == SwiperLayout.DEFAULT) {
return new PageIndicator(
count: config.itemCount,
controller: config.pageController,
layout: config.indicatorLayout,
count: config.itemCount!,
controller: config.pageController!,
layout: config.indicatorLayout!,
size: size,
activeColor: activeColor,
color: color,
......@@ -198,8 +198,8 @@ class DotSwiperPaginationBuilder extends SwiperPlugin {
List<Widget> list = [];
int itemCount = config.itemCount;
int activeIndex = config.activeIndex;
int itemCount = config.itemCount!;
int? activeIndex = config.activeIndex;
for (int i = 0; i < itemCount; ++i) {
bool active = i == activeIndex;
......@@ -233,15 +233,15 @@ class DotSwiperPaginationBuilder extends SwiperPlugin {
}
typedef Widget SwiperPaginationBuilder(
BuildContext context, SwiperPluginConfig config);
BuildContext context, SwiperPluginConfig? config);
class SwiperCustomPagination extends SwiperPlugin {
final SwiperPaginationBuilder builder;
SwiperCustomPagination({@required this.builder}) : assert(builder != null);
SwiperCustomPagination({required this.builder}) : assert(builder != null);
@override
Widget build(BuildContext context, SwiperPluginConfig config) {
Widget build(BuildContext context, SwiperPluginConfig? config) {
return builder(context, config);
}
}
......@@ -257,7 +257,7 @@ class SwiperPagination extends SwiperPlugin {
/// Alignment.bottomCenter by default when scrollDirection== Axis.horizontal
/// Alignment.centerRight by default when scrollDirection== Axis.vertical
final Alignment alignment;
final Alignment? alignment;
/// Distance between pagination and the container
final EdgeInsetsGeometry margin;
......@@ -265,7 +265,7 @@ class SwiperPagination extends SwiperPlugin {
/// Build the widet
final SwiperPlugin builder;
final Key key;
final Key? key;
const SwiperPagination(
{this.alignment,
......@@ -273,16 +273,16 @@ class SwiperPagination extends SwiperPlugin {
this.margin: const EdgeInsets.all(10.0),
this.builder: SwiperPagination.dots});
Widget build(BuildContext context, SwiperPluginConfig config) {
Widget build(BuildContext context, SwiperPluginConfig? config) {
Alignment alignment = this.alignment ??
(config.scrollDirection == Axis.horizontal
(config!.scrollDirection == Axis.horizontal
? Alignment.bottomCenter
: Alignment.centerRight);
Widget child = Container(
margin: margin,
child: this.builder.build(context, config),
);
if (!config.outer) {
if (!config!.outer!) {
child = new Align(
key: key,
alignment: alignment,
......
......@@ -7,27 +7,27 @@ import 'package:flutter_swiper/flutter_swiper.dart';
abstract class SwiperPlugin {
const SwiperPlugin();
Widget build(BuildContext context, SwiperPluginConfig config);
Widget build(BuildContext context, SwiperPluginConfig? config);
}
class SwiperPluginConfig {
final int activeIndex;
final int itemCount;
final PageIndicatorLayout indicatorLayout;
final int? activeIndex;
final int? itemCount;
final PageIndicatorLayout? indicatorLayout;
final Axis scrollDirection;
final bool loop;
final bool outer;
final PageController pageController;
final bool? loop;
final bool? outer;
final PageController? pageController;
final SwiperController controller;
final SwiperLayout layout;
final SwiperLayout? layout;
const SwiperPluginConfig(
{this.activeIndex,
this.itemCount,
this.indicatorLayout,
this.outer,
this.scrollDirection,
this.controller,
required this.scrollDirection,
required this.controller,
this.pageController,
this.layout,
this.loop})
......
.DS_Store
.dart_tool/
.packages
.pub/
build/
ios/.generated/
ios/Flutter/Generated.xcconfig
ios/Runner/GeneratedPluginRegistrant.*
*.log
......@@ -25,5 +25,4 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Android API 27 Platform" project-jdk-type="Android SDK" />
</project>
\ No newline at end of file
......@@ -2,8 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/example.iml" filepath="$PROJECT_DIR$/example.iml" />
<module fileurl="file://$PROJECT_DIR$/example_android.iml" filepath="$PROJECT_DIR$/example_android.iml" />
<module fileurl="file://$PROJECT_DIR$/flutter_page_indicator.iml" filepath="$PROJECT_DIR$/flutter_page_indicator.iml" />
</modules>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
## [0.0.3]
* Fix bugs
* Support loop mode for layout: PageIndicatorLayout.COLOR & PageIndicatorLayout.COLOR.
* Modify all `PageIndicatorLayout` values to uppercase.
## [0.0.2]
* Update readme
## [0.0.1]
* Basic usage
* PageIndicatorLayout.NONE
* PageIndicatorLayout.SLIDE
* PageIndicatorLayout.WARM
* PageIndicatorLayout.COLOR
* PageIndicatorLayout.SCALE
* PageIndicatorLayout.DROP
TODO: Add your license here.
<p align="center">
<a href="https://pub.dartlang.org/packages/flutter_page_indicator">
<img src="https://img.shields.io/pub/v/flutter_page_indicator.svg" alt="pub package" />
</a>
</p>
# flutter_page_indicator
Page indicator for flutter, with multiple build-in layouts.
## Show cases
![showcases](https://github.com/jzoom/images/raw/master/page_indicator.gif)
### Installation
Add
```bash
flutter_page_indicator:
```
to your pubspec.yaml ,and run
```bash
flutter packages get
```
in your project's root directory.
### Basic Usage
```
new PageIndicator(
layout: PageIndicatorLayout.SLIDE,
size: 20.0,
controller: YOUR_PAGE_CONTROLLER,
space: 5.0,
count: 4,
)
```
### All build-in layouts
| Layout | Showcase | Support version |
| :------------ |:---------------:|:---------------:|
| PageIndicatorLayout.NONE | ![](https://raw.githubusercontent.com/jzoom/images/master/indicator1.gif) | From 0.0.1 |
| PageIndicatorLayout.SLIDE | ![](https://raw.githubusercontent.com/jzoom/images/master/indicator2.gif) | From 0.0.1 |
| PageIndicatorLayout.WARM | ![](https://raw.githubusercontent.com/jzoom/images/master/warm.gif) | From 0.0.1 |
| PageIndicatorLayout.COLOR | ![](https://raw.githubusercontent.com/jzoom/images/master/indicator4.gif) | From 0.0.1 |
| PageIndicatorLayout.SCALE | ![](https://raw.githubusercontent.com/jzoom/images/master/indicator5.gif) | From 0.0.1 |
| PageIndicatorLayout.DROP | ![](https://raw.githubusercontent.com/jzoom/images/master/indicator7.gif) | From 0.0.1 |
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment