├── .gitignore ├── LICENSE ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── io │ │ │ │ └── ditclear │ │ │ │ └── tiktok_gestures │ │ │ │ └── MainActivity.kt │ │ └── 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 │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── bottom.png ├── comment.png ├── detail.png ├── detail2.png ├── left.png ├── middle.png └── right.png ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── helper │ └── transparent_page.dart ├── main.dart └── page │ ├── detail_page.dart │ ├── left_page.dart │ ├── middle_page.dart │ ├── right_page.dart │ └── tiktok_page.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Licensed under the Apache License, Version 2.0 (the "License"); you 2 | may not use this file except in compliance with the License. You may 3 | obtain a copy of the License at 4 | 5 | http://www.apache.org/licenses/LICENSE-2.0 6 | 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 10 | implied. See the License for the specific language governing permissions 11 | and limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TikTok_Gestures 2 | 3 | 使用Flutter模仿TikTok中的手势交互效果 4 | 5 | 主要用到了Flutter中的 6 | 7 | - [GestureDetector](https://flutterchina.club/gestures/):手势检测 8 | - [Transform](https://book.flutterchina.club/chapter5/transform.html):scale、translate、rotate订单变换 9 | - [Hero动画](https://book.flutterchina.club/chapter9/hero.html):提供**共享元素转换**的效果 10 | 11 | > 原理:通过检测手指的滑动,得到一个x坐标或者y坐标的偏移量,然后配合Transform进行各种不同的变换 12 | 13 | #### 实现效果 14 | 15 | ![](https://media.giphy.com/media/Y0nMQwaOg14vWmwQDz/giphy.gif)![](https://media.giphy.com/media/lTSnqbKdZvPXbjColu/giphy.gif) 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | #### demo下载 24 | 25 | 26 | 27 | ![](https://user-gold-cdn.xitu.io/2019/5/6/16a8ac81ef65bd2b?w=300&h=300&f=png&s=13949) 28 | 29 | 30 | 31 | #### 相关文章 32 | 33 | [使用Flutter仿写TikTok的手势交互(一)](https://mp.weixin.qq.com/s?__biz=Mzg3NTA2NTE4Mg==&mid=2247483735&idx=1&sn=3bd27e18d4756ea9b2e40946d6430f86&chksm=cec67b66f9b1f270a91032923f13f9e4c09209977ac8261ed40af1e2b98835bdf11c7904af4a&token=1288983233&lang=zh_CN#rd) 34 | 35 | [使用Flutter仿写TikTok的手势交互(二)](https://mp.weixin.qq.com/s?__biz=Mzg3NTA2NTE4Mg==&mid=2247483740&idx=1&sn=5fdc4e1b3fa13737b9b32c1cddbc5940&chksm=cec67b6df9b1f27b416ebc40d427f866ac6628187134ecc64b9832405633258a740436f7184d&token=935911284&lang=zh_CN#rd) 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "io.ditclear.tiktok_gestures" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 10 | 14 | 21 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/io/ditclear/tiktok_gestures/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.ditclear.tiktok_gestures 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /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.10.2-all.zip 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/assets/bottom.png -------------------------------------------------------------------------------- /assets/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/assets/comment.png -------------------------------------------------------------------------------- /assets/detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/assets/detail.png -------------------------------------------------------------------------------- /assets/detail2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/assets/detail2.png -------------------------------------------------------------------------------- /assets/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/assets/left.png -------------------------------------------------------------------------------- /assets/middle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/assets/middle.png -------------------------------------------------------------------------------- /assets/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/assets/right.png -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 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 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 62 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B80C3931E831B6300D905FE /* App.framework */, 73 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 74 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 75 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 76 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 77 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 78 | ); 79 | name = Flutter; 80 | sourceTree = ""; 81 | }; 82 | 97C146E51CF9000F007C117D = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9740EEB11CF90186004384FC /* Flutter */, 86 | 97C146F01CF9000F007C117D /* Runner */, 87 | 97C146EF1CF9000F007C117D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 97C146EF1CF9000F007C117D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 97C146EE1CF9000F007C117D /* Runner.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 97C146F01CF9000F007C117D /* Runner */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 103 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 104 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 105 | 97C147021CF9000F007C117D /* Info.plist */, 106 | 97C146F11CF9000F007C117D /* Supporting Files */, 107 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 108 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 109 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 110 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 111 | ); 112 | path = Runner; 113 | sourceTree = ""; 114 | }; 115 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 97C146ED1CF9000F007C117D /* Runner */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 128 | buildPhases = ( 129 | 9740EEB61CF901F6004384FC /* Run Script */, 130 | 97C146EA1CF9000F007C117D /* Sources */, 131 | 97C146EB1CF9000F007C117D /* Frameworks */, 132 | 97C146EC1CF9000F007C117D /* Resources */, 133 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 134 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = Runner; 141 | productName = Runner; 142 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 97C146E61CF9000F007C117D /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 0910; 152 | ORGANIZATIONNAME = "The Chromium Authors"; 153 | TargetAttributes = { 154 | 97C146ED1CF9000F007C117D = { 155 | CreatedOnToolsVersion = 7.3.1; 156 | DevelopmentTeam = 878W62G5Y7; 157 | LastSwiftMigration = 0910; 158 | }; 159 | }; 160 | }; 161 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 162 | compatibilityVersion = "Xcode 3.2"; 163 | developmentRegion = English; 164 | hasScannedForEncodings = 0; 165 | knownRegions = ( 166 | en, 167 | Base, 168 | ); 169 | mainGroup = 97C146E51CF9000F007C117D; 170 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 171 | projectDirPath = ""; 172 | projectRoot = ""; 173 | targets = ( 174 | 97C146ED1CF9000F007C117D /* Runner */, 175 | ); 176 | }; 177 | /* End PBXProject section */ 178 | 179 | /* Begin PBXResourcesBuildPhase section */ 180 | 97C146EC1CF9000F007C117D /* Resources */ = { 181 | isa = PBXResourcesBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 185 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 186 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 187 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 188 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | /* End PBXResourcesBuildPhase section */ 193 | 194 | /* Begin PBXShellScriptBuildPhase section */ 195 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 196 | isa = PBXShellScriptBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | ); 200 | inputPaths = ( 201 | ); 202 | name = "Thin Binary"; 203 | outputPaths = ( 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | shellPath = /bin/sh; 207 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 208 | }; 209 | 9740EEB61CF901F6004384FC /* Run Script */ = { 210 | isa = PBXShellScriptBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | ); 214 | inputPaths = ( 215 | ); 216 | name = "Run Script"; 217 | outputPaths = ( 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | shellPath = /bin/sh; 221 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 222 | }; 223 | /* End PBXShellScriptBuildPhase section */ 224 | 225 | /* Begin PBXSourcesBuildPhase section */ 226 | 97C146EA1CF9000F007C117D /* Sources */ = { 227 | isa = PBXSourcesBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 231 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXSourcesBuildPhase section */ 236 | 237 | /* Begin PBXVariantGroup section */ 238 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 239 | isa = PBXVariantGroup; 240 | children = ( 241 | 97C146FB1CF9000F007C117D /* Base */, 242 | ); 243 | name = Main.storyboard; 244 | sourceTree = ""; 245 | }; 246 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 247 | isa = PBXVariantGroup; 248 | children = ( 249 | 97C147001CF9000F007C117D /* Base */, 250 | ); 251 | name = LaunchScreen.storyboard; 252 | sourceTree = ""; 253 | }; 254 | /* End PBXVariantGroup section */ 255 | 256 | /* Begin XCBuildConfiguration section */ 257 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 258 | isa = XCBuildConfiguration; 259 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 260 | buildSettings = { 261 | ALWAYS_SEARCH_USER_PATHS = NO; 262 | CLANG_ANALYZER_NONNULL = YES; 263 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 264 | CLANG_CXX_LIBRARY = "libc++"; 265 | CLANG_ENABLE_MODULES = YES; 266 | CLANG_ENABLE_OBJC_ARC = YES; 267 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 268 | CLANG_WARN_BOOL_CONVERSION = YES; 269 | CLANG_WARN_COMMA = YES; 270 | CLANG_WARN_CONSTANT_CONVERSION = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 278 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 279 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 280 | CLANG_WARN_STRICT_PROTOTYPES = YES; 281 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 282 | CLANG_WARN_UNREACHABLE_CODE = YES; 283 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 284 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 285 | COPY_PHASE_STRIP = NO; 286 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 287 | ENABLE_NS_ASSERTIONS = NO; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu99; 290 | GCC_NO_COMMON_BLOCKS = YES; 291 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 293 | GCC_WARN_UNDECLARED_SELECTOR = YES; 294 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 295 | GCC_WARN_UNUSED_FUNCTION = YES; 296 | GCC_WARN_UNUSED_VARIABLE = YES; 297 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 298 | MTL_ENABLE_DEBUG_INFO = NO; 299 | SDKROOT = iphoneos; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | VALIDATE_PRODUCT = YES; 302 | }; 303 | name = Profile; 304 | }; 305 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 306 | isa = XCBuildConfiguration; 307 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 308 | buildSettings = { 309 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 310 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 311 | DEVELOPMENT_TEAM = 878W62G5Y7; 312 | ENABLE_BITCODE = NO; 313 | FRAMEWORK_SEARCH_PATHS = ( 314 | "$(inherited)", 315 | "$(PROJECT_DIR)/Flutter", 316 | ); 317 | INFOPLIST_FILE = Runner/Info.plist; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 319 | LIBRARY_SEARCH_PATHS = ( 320 | "$(inherited)", 321 | "$(PROJECT_DIR)/Flutter", 322 | ); 323 | PRODUCT_BUNDLE_IDENTIFIER = io.ditclear.tiktokGestures; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | SWIFT_VERSION = 4.0; 326 | VERSIONING_SYSTEM = "apple-generic"; 327 | }; 328 | name = Profile; 329 | }; 330 | 97C147031CF9000F007C117D /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_ANALYZER_NONNULL = YES; 336 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 337 | CLANG_CXX_LIBRARY = "libc++"; 338 | CLANG_ENABLE_MODULES = YES; 339 | CLANG_ENABLE_OBJC_ARC = YES; 340 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 341 | CLANG_WARN_BOOL_CONVERSION = YES; 342 | CLANG_WARN_COMMA = YES; 343 | CLANG_WARN_CONSTANT_CONVERSION = YES; 344 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 345 | CLANG_WARN_EMPTY_BODY = YES; 346 | CLANG_WARN_ENUM_CONVERSION = YES; 347 | CLANG_WARN_INFINITE_RECURSION = YES; 348 | CLANG_WARN_INT_CONVERSION = YES; 349 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 350 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 351 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 352 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 353 | CLANG_WARN_STRICT_PROTOTYPES = YES; 354 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 355 | CLANG_WARN_UNREACHABLE_CODE = YES; 356 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 357 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 358 | COPY_PHASE_STRIP = NO; 359 | DEBUG_INFORMATION_FORMAT = dwarf; 360 | ENABLE_STRICT_OBJC_MSGSEND = YES; 361 | ENABLE_TESTABILITY = YES; 362 | GCC_C_LANGUAGE_STANDARD = gnu99; 363 | GCC_DYNAMIC_NO_PIC = NO; 364 | GCC_NO_COMMON_BLOCKS = YES; 365 | GCC_OPTIMIZATION_LEVEL = 0; 366 | GCC_PREPROCESSOR_DEFINITIONS = ( 367 | "DEBUG=1", 368 | "$(inherited)", 369 | ); 370 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 372 | GCC_WARN_UNDECLARED_SELECTOR = YES; 373 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 374 | GCC_WARN_UNUSED_FUNCTION = YES; 375 | GCC_WARN_UNUSED_VARIABLE = YES; 376 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 377 | MTL_ENABLE_DEBUG_INFO = YES; 378 | ONLY_ACTIVE_ARCH = YES; 379 | SDKROOT = iphoneos; 380 | TARGETED_DEVICE_FAMILY = "1,2"; 381 | }; 382 | name = Debug; 383 | }; 384 | 97C147041CF9000F007C117D /* Release */ = { 385 | isa = XCBuildConfiguration; 386 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 387 | buildSettings = { 388 | ALWAYS_SEARCH_USER_PATHS = NO; 389 | CLANG_ANALYZER_NONNULL = YES; 390 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 391 | CLANG_CXX_LIBRARY = "libc++"; 392 | CLANG_ENABLE_MODULES = YES; 393 | CLANG_ENABLE_OBJC_ARC = YES; 394 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_COMMA = YES; 397 | CLANG_WARN_CONSTANT_CONVERSION = YES; 398 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 399 | CLANG_WARN_EMPTY_BODY = YES; 400 | CLANG_WARN_ENUM_CONVERSION = YES; 401 | CLANG_WARN_INFINITE_RECURSION = YES; 402 | CLANG_WARN_INT_CONVERSION = YES; 403 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 404 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 405 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 406 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 407 | CLANG_WARN_STRICT_PROTOTYPES = YES; 408 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 409 | CLANG_WARN_UNREACHABLE_CODE = YES; 410 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 411 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 412 | COPY_PHASE_STRIP = NO; 413 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 414 | ENABLE_NS_ASSERTIONS = NO; 415 | ENABLE_STRICT_OBJC_MSGSEND = YES; 416 | GCC_C_LANGUAGE_STANDARD = gnu99; 417 | GCC_NO_COMMON_BLOCKS = YES; 418 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 419 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 420 | GCC_WARN_UNDECLARED_SELECTOR = YES; 421 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 422 | GCC_WARN_UNUSED_FUNCTION = YES; 423 | GCC_WARN_UNUSED_VARIABLE = YES; 424 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 425 | MTL_ENABLE_DEBUG_INFO = NO; 426 | SDKROOT = iphoneos; 427 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 428 | TARGETED_DEVICE_FAMILY = "1,2"; 429 | VALIDATE_PRODUCT = YES; 430 | }; 431 | name = Release; 432 | }; 433 | 97C147061CF9000F007C117D /* Debug */ = { 434 | isa = XCBuildConfiguration; 435 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 436 | buildSettings = { 437 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 438 | CLANG_ENABLE_MODULES = YES; 439 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 440 | DEVELOPMENT_TEAM = 878W62G5Y7; 441 | ENABLE_BITCODE = NO; 442 | FRAMEWORK_SEARCH_PATHS = ( 443 | "$(inherited)", 444 | "$(PROJECT_DIR)/Flutter", 445 | ); 446 | INFOPLIST_FILE = Runner/Info.plist; 447 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 448 | LIBRARY_SEARCH_PATHS = ( 449 | "$(inherited)", 450 | "$(PROJECT_DIR)/Flutter", 451 | ); 452 | PRODUCT_BUNDLE_IDENTIFIER = io.ditclear.tiktokGestures; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 455 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 456 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 457 | SWIFT_VERSION = 4.0; 458 | VERSIONING_SYSTEM = "apple-generic"; 459 | }; 460 | name = Debug; 461 | }; 462 | 97C147071CF9000F007C117D /* Release */ = { 463 | isa = XCBuildConfiguration; 464 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 465 | buildSettings = { 466 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 467 | CLANG_ENABLE_MODULES = YES; 468 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 469 | DEVELOPMENT_TEAM = 878W62G5Y7; 470 | ENABLE_BITCODE = NO; 471 | FRAMEWORK_SEARCH_PATHS = ( 472 | "$(inherited)", 473 | "$(PROJECT_DIR)/Flutter", 474 | ); 475 | INFOPLIST_FILE = Runner/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 477 | LIBRARY_SEARCH_PATHS = ( 478 | "$(inherited)", 479 | "$(PROJECT_DIR)/Flutter", 480 | ); 481 | PRODUCT_BUNDLE_IDENTIFIER = io.ditclear.tiktokGestures; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 484 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 485 | SWIFT_VERSION = 4.0; 486 | VERSIONING_SYSTEM = "apple-generic"; 487 | }; 488 | name = Release; 489 | }; 490 | /* End XCBuildConfiguration section */ 491 | 492 | /* Begin XCConfigurationList section */ 493 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147031CF9000F007C117D /* Debug */, 497 | 97C147041CF9000F007C117D /* Release */, 498 | 249021D3217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 504 | isa = XCConfigurationList; 505 | buildConfigurations = ( 506 | 97C147061CF9000F007C117D /* Debug */, 507 | 97C147071CF9000F007C117D /* Release */, 508 | 249021D4217E4FDB00AE95B9 /* Profile */, 509 | ); 510 | defaultConfigurationIsVisible = 0; 511 | defaultConfigurationName = Release; 512 | }; 513 | /* End XCConfigurationList section */ 514 | }; 515 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 516 | } 517 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ditclear/tiktok_gestures/3ad12c7917fc6db6d3d57032c1624dee8300bac1/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | tiktok_gestures 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /lib/helper/transparent_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | /// 使Page的背景透明 4 | /// 5 | /// 由于[MaterialPageRoute]等等的背景都是不透明的, 6 | /// 因此copy了[MaterialPageRoute]的代码将背景改为了透明,opaque = false 7 | class TransparentPage extends PageRoute { 8 | /// Construct a MaterialPageRoute whose contents are defined by [builder]. 9 | /// 10 | /// The values of [builder], [maintainState], and [fullScreenDialog] must not 11 | /// be null. 12 | TransparentPage({ 13 | @required this.builder, 14 | RouteSettings settings, 15 | this.maintainState = true, 16 | bool fullscreenDialog = false, 17 | }) : assert(builder != null), 18 | assert(maintainState != null), 19 | assert(fullscreenDialog != null), 20 | super(settings: settings, fullscreenDialog: fullscreenDialog); 21 | 22 | /// Builds the primary contents of the route. 23 | final WidgetBuilder builder; 24 | 25 | @override 26 | final bool maintainState; 27 | 28 | @override 29 | Duration get transitionDuration => const Duration(milliseconds: 300); 30 | 31 | @override 32 | Color get barrierColor => null; 33 | 34 | /// false 代表背景透明 35 | @override 36 | bool get opaque => false; 37 | 38 | @override 39 | String get barrierLabel => null; 40 | 41 | @override 42 | bool canTransitionFrom(TransitionRoute previousRoute) { 43 | return previousRoute is MaterialPageRoute || previousRoute is CupertinoPageRoute; 44 | } 45 | 46 | @override 47 | bool canTransitionTo(TransitionRoute nextRoute) { 48 | // Don't perform outgoing animation if the next route is a fullscreen dialog. 49 | return (nextRoute is MaterialPageRoute && !nextRoute.fullscreenDialog) 50 | || (nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog); 51 | } 52 | 53 | @override 54 | Widget buildPage(BuildContext context, Animation animation, 55 | Animation secondaryAnimation) { 56 | final Widget result = builder(context); 57 | assert(() { 58 | if (result == null) { 59 | throw FlutterError( 60 | 'The builder for route "${settings.name}" returned null.\n' 61 | 'Route builders must never return null.' 62 | ); 63 | } 64 | return true; 65 | }()); 66 | return Semantics( 67 | scopesRoute: true, 68 | explicitChildNodes: true, 69 | child: result, 70 | ); 71 | } 72 | 73 | @override 74 | Widget buildTransitions(BuildContext context, Animation animation, Animation secondaryAnimation, Widget child) { 75 | final PageTransitionsTheme theme = Theme.of(context).pageTransitionsTheme; 76 | return theme.buildTransitions(this, context, animation, secondaryAnimation, child); 77 | } 78 | 79 | @override 80 | String get debugLabel => '${super.debugLabel}(${settings.name})'; 81 | } 82 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:tiktok_gestures/page/tiktok_page.dart'; 4 | void main() => runApp(MyApp()); 5 | 6 | class MyApp extends StatelessWidget { 7 | // This widget is the root of your application. 8 | @override 9 | Widget build(BuildContext context) { 10 | return MaterialApp( 11 | title: "Tiktok Gestures", 12 | theme: ThemeData( 13 | // This is the theme of your application. 14 | // 15 | // Try running your application with "flutter run". You'll see the 16 | // application has a blue toolbar. Then, without quitting the app, try 17 | // changing the primarySwatch below to Colors.green and then invoke 18 | // "hot reload" (press "r" in the console where you ran "flutter run", 19 | // or simply save your changes to "hot reload" in a Flutter IDE). 20 | // Notice that the counter didn't reset back to zero; the application 21 | // is not restarted. 22 | primarySwatch: Colors.blue, 23 | canvasColor: Colors.black, 24 | ), 25 | home: TikTokPage(), 26 | ); 27 | } 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /lib/page/detail_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/rendering.dart'; 5 | 6 | import 'right_page.dart'; 7 | 8 | enum DragState { 9 | /// 拖动返回 10 | Back, 11 | 12 | /// 正常情况 13 | Normal, 14 | 15 | /// 上拉comment布局 16 | PullUp 17 | } 18 | 19 | /// 详情页面 20 | /// 21 | /// 接收来自[RightPage]传递来的[index]参数,用于演示[Hero]效果 22 | /// 本页的手势交互有:下拉返回、上拉显示评论 23 | class DetailPage extends StatefulWidget { 24 | final int index; 25 | 26 | const DetailPage({Key key, this.index}) : super(key: key); 27 | 28 | @override 29 | State createState() { 30 | return _DetailState(); 31 | } 32 | } 33 | 34 | class _DetailState extends State with TickerProviderStateMixin { 35 | 36 | double offsetY = 0.0; 37 | double offsetX = 0.0; 38 | AnimationController animationController; 39 | Animation animation; 40 | Animation animationX; 41 | bool isCommentShow = false; 42 | /// 进行hero动画 43 | int currentIndex; 44 | 45 | var dragState = DragState.Normal; 46 | 47 | @override 48 | void initState() { 49 | super.initState(); 50 | currentIndex = widget.index; 51 | } 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | final screenWidth = MediaQuery.of(context).size.width; 56 | final screenHeight = MediaQuery.of(context).size.height; 57 | return Transform.scale( 58 | scale: dragState == DragState.Normal ? 1 : min(1, 1 - 0.5 * offsetY.abs() / screenHeight), 59 | child: Transform.translate( 60 | offset: dragState == DragState.Back ? Offset(offsetX, offsetY) : Offset(0, max(0, offsetY)), 61 | child: Hero( 62 | tag: "detail_$currentIndex", 63 | child: GestureDetector( 64 | onTap: () { 65 | // 如果 isCommentShow 为true ,代表 评论布局已经展开,点击的时候先关闭 评论布局 66 | if (isCommentShow) { 67 | animateToBottom(screenHeight); 68 | } 69 | }, 70 | onPanDown: (_) { 71 | dragState = DragState.Normal; 72 | }, 73 | // 滑动开始时 74 | onPanStart: (details) { 75 | animationController?.stop(); 76 | }, 77 | // 滑动截止时 78 | onPanEnd: (_) { 79 | dispatchPanEnd(context, screenHeight); 80 | }, 81 | // 滑动中 82 | onPanUpdate: (details) { 83 | if (offsetY == 0.0 && details.delta.dy > 0 && dragState == DragState.Normal) { 84 | dragState = DragState.Back; 85 | } 86 | if (dragState == DragState.Back) { 87 | offsetX += details.delta.dx; 88 | } 89 | // dy 不超过 -screenHeight * 0.6 90 | offsetY += details.delta.dy; 91 | if (offsetY < 0 && offsetY.abs() > screenHeight * 0.6) { 92 | offsetY = -screenHeight * 0.6; 93 | offsetX = 0; 94 | } else {} 95 | 96 | setState(() {}); 97 | }, 98 | child: Stack( 99 | children: [ 100 | AbsorbPointer( 101 | // offsetY != 0 || offsetX != 0 ||isCommentShow 时,禁止PageView滑动 102 | absorbing: offsetY != 0 || offsetX != 0 ||isCommentShow, 103 | child: SizedBox( 104 | width: screenWidth, 105 | height: screenHeight, 106 | child: PageView( 107 | onPageChanged: (index) { 108 | setState(() { 109 | currentIndex = (widget.index + index) % 2; 110 | }); 111 | }, 112 | children: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((index) { 113 | return Image.asset( 114 | (index + widget.index) % 2 == 0 ? "assets/detail.png" : "assets/detail2.png", 115 | fit: BoxFit.fitWidth, 116 | width: screenWidth, 117 | height: screenHeight, 118 | ); 119 | }).toList(), 120 | ), 121 | ), 122 | ), 123 | dragState != DragState.Back ? buildTransformComment(screenHeight, screenWidth) : Container(), 124 | ], 125 | ), 126 | ), 127 | ), 128 | ), 129 | ); 130 | } 131 | 132 | /// 滑动截止时,根据[offsetY]进行处理 133 | void dispatchPanEnd(BuildContext context, double screenHeight) { 134 | if (offsetY > 100) { 135 | // 下拉距离超过100,即退出页面 136 | Navigator.pop(context); 137 | } else if (offsetY > 0) { 138 | // 下拉距离小于100,恢复原样 139 | animateToBottom(screenHeight); 140 | } else if (dragState == DragState.Back) { 141 | Navigator.pop(context); 142 | } else if (offsetY < 0) { 143 | // 上拉根据是否已经显示评论框 [isCommentShow]和offsetY来判断是展开还是收缩 144 | if (!isCommentShow && offsetY.abs() > screenHeight * 0.2) { 145 | if (offsetY.abs() > screenHeight * 0.2) { 146 | animateToTop(screenHeight); 147 | } else { 148 | animateToBottom(screenHeight); 149 | } 150 | } else { 151 | if (offsetY.abs() > screenHeight * 0.4) { 152 | animateToTop(screenHeight); 153 | } else { 154 | animateToBottom(screenHeight); 155 | } 156 | } 157 | } 158 | } 159 | 160 | /// comment 布局 161 | Transform buildTransformComment(double screenHeight, double screenWidth) { 162 | return Transform.translate( 163 | offset: Offset(0, offsetY > 0 ? screenHeight : offsetY + screenHeight), 164 | child: Container( 165 | height: screenHeight * 0.6, 166 | child: GestureDetector( 167 | onTap: () {}, 168 | child: Image.asset( 169 | "assets/comment.png", 170 | fit: BoxFit.fitWidth, 171 | width: screenWidth, 172 | ), 173 | )), 174 | ); 175 | } 176 | 177 | /// 将comment布局滑动到顶部 178 | /// 179 | /// 动画结束后 [isCommentShow] 为 true 180 | void animateToTop(double screenHeight) { 181 | animationController = 182 | AnimationController(duration: Duration(milliseconds: offsetY.abs() * 1000 ~/ 800), vsync: this); 183 | final curve = CurvedAnimation(parent: animationController, curve: Curves.decelerate); 184 | animation = Tween(begin: offsetY, end: -screenHeight * 0.6).animate(curve) 185 | ..addListener(() { 186 | setState(() { 187 | offsetY = animation.value; 188 | }); 189 | }) 190 | ..addStatusListener((status) { 191 | if (status == AnimationStatus.completed) { 192 | isCommentShow = true; 193 | } 194 | }); 195 | animationController.forward(from: offsetY); 196 | } 197 | 198 | /// 将comment布局滑动到底部 199 | /// 200 | /// 动画结束后 [isCommentShow] 为 false 201 | void animateToBottom(double screenHeight) { 202 | animationController = AnimationController(duration: Duration(milliseconds: offsetY.abs().floor()), vsync: this); 203 | final curve = CurvedAnimation(parent: animationController, curve: Curves.decelerate); 204 | animation = Tween(begin: offsetY, end: 0.0).animate(curve) 205 | ..addListener(() { 206 | setState(() { 207 | offsetY = animation.value; 208 | }); 209 | }) 210 | ..addStatusListener((status) { 211 | if (status == AnimationStatus.completed) { 212 | isCommentShow = false; 213 | } 214 | }); 215 | animationX = Tween(begin: offsetX, end: 0.0).animate(curve) 216 | ..addListener(() { 217 | setState(() { 218 | offsetX = animationX.value; 219 | }); 220 | }); 221 | animationController.forward(from: offsetY); 222 | } 223 | 224 | @override 225 | void dispose() { 226 | animationController?.dispose(); 227 | super.dispose(); 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /lib/page/left_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:flutter/material.dart'; 3 | 4 | /// 拍摄页 5 | /// 6 | /// 包含的交互包括:前景色,scale 7 | class LeftPage extends StatelessWidget{ 8 | final double offsetX; 9 | 10 | const LeftPage({Key key, this.offsetX}) : super(key: key); 11 | @override 12 | Widget build(BuildContext context) { 13 | final screenWidth = MediaQuery.of(context).size.width; 14 | return buildLeftPage(screenWidth); 15 | } 16 | 17 | 18 | /// 左侧Widget 19 | /// 20 | /// 通过 [Transform.scale] 进行根据 [offsetX] 缩放 21 | /// 最小 0.88 最大为 1 22 | Transform buildLeftPage(double screenWidth) { 23 | return Transform.scale( 24 | scale: 0.88 + 0.12 * offsetX / screenWidth < 0.88 ? 0.88 : 0.88 + 0.12 * offsetX / screenWidth, 25 | child: Container( 26 | child: Image.asset( 27 | "assets/left.png", 28 | fit: BoxFit.fitWidth, 29 | width: screenWidth, 30 | ), 31 | foregroundDecoration: BoxDecoration( 32 | color: Color.fromRGBO(0, 0, 0, 1 - (offsetX / screenWidth)), 33 | ), 34 | ), 35 | ); 36 | } 37 | } -------------------------------------------------------------------------------- /lib/page/middle_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | /// 主页面 6 | /// 7 | /// 手势交互包括:下拉刷新,和左右两侧的translate动画 8 | class MiddlePage extends StatelessWidget { 9 | final double offsetX; 10 | final double offsetY; 11 | final Function onPageChanged; 12 | const MiddlePage({Key key, this.offsetX, this.offsetY,this.onPageChanged }) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return buildMiddlePage(); 17 | } 18 | 19 | /// 中间 Widget 20 | /// 21 | /// 通过 [Transform.translate] 根据 [offsetX] 进行偏移 22 | /// 水平偏移量为 [ offsetX] /5 产生视差效果 23 | Transform buildMiddlePage() { 24 | return Transform.translate( 25 | offset: Offset(offsetX > 0 ? offsetX : offsetX / 5, 0), 26 | child: Stack( 27 | children: [ 28 | Container( 29 | child: Column( 30 | verticalDirection: VerticalDirection.down, 31 | children: [ 32 | Expanded( 33 | child: PageView( 34 | onPageChanged: onPageChanged, 35 | pageSnapping: true, 36 | physics: ClampingScrollPhysics(), 37 | scrollDirection: Axis.vertical, 38 | children: List.generate( 39 | 10, 40 | (_) => Image.asset( 41 | "assets/middle.png", 42 | fit: BoxFit.fill, 43 | ), 44 | )), 45 | ), 46 | Image.asset( 47 | "assets/bottom.png", 48 | fit: BoxFit.fill, 49 | ), 50 | ], 51 | ), 52 | ), 53 | Padding( 54 | padding: const EdgeInsets.only(top: 24), 55 | child: buildHeader(), 56 | ) 57 | ], 58 | ), 59 | ); 60 | } 61 | 62 | /// 顶部header 63 | Widget buildHeader() { 64 | if (offsetY >= 20) { 65 | return Opacity( 66 | opacity: (offsetY - 20) / 20, 67 | child: Transform.translate( 68 | offset: Offset(0, offsetY), 69 | child: Container( 70 | height: 44, 71 | child: Center( 72 | child: const Text( 73 | "下拉刷新内容", 74 | style: TextStyle(color: Colors.white, fontSize: 18), 75 | ), 76 | ), 77 | ), 78 | ), 79 | ); 80 | } else { 81 | return Opacity( 82 | opacity: max(0, 1 - offsetY / 20), 83 | child: Transform.translate( 84 | offset: Offset(0, offsetY), 85 | child: DefaultTextStyle( 86 | style: TextStyle(fontSize: 18, color: Colors.grey), 87 | child: Container( 88 | height: 44, 89 | child: Row( 90 | children: [ 91 | Padding( 92 | padding: const EdgeInsets.fromLTRB(24, 0, 5, 0), 93 | child: Icon( 94 | Icons.camera_alt, 95 | size: 24, 96 | ), 97 | ), 98 | const Text('随拍'), 99 | Expanded( 100 | child: Row( 101 | mainAxisAlignment: MainAxisAlignment.center, 102 | children: [ 103 | Text( 104 | "推荐", 105 | style: TextStyle(color: Colors.white), 106 | ), 107 | Container( 108 | margin: const EdgeInsets.symmetric(horizontal: 10), 109 | width: 1, 110 | height: 12, 111 | color: Colors.white24, 112 | ), 113 | Text("上海"), 114 | ], 115 | ), 116 | ), 117 | Icon( 118 | Icons.live_tv, 119 | size: 24, 120 | ), 121 | Padding( 122 | padding: const EdgeInsets.fromLTRB(5, 0, 24, 0), 123 | child: Icon( 124 | Icons.search, 125 | size: 24, 126 | ), 127 | ), 128 | ], 129 | ), 130 | ), 131 | ), 132 | ), 133 | ); 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /lib/page/right_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:tiktok_gestures/page/detail_page.dart'; 3 | import 'dart:math'; 4 | import 'middle_page.dart'; 5 | import 'package:tiktok_gestures/helper/transparent_page.dart'; 6 | 7 | /// 用户页 8 | /// 9 | /// 包含的交互包括: 10 | /// - 和主页面[MiddlePage]的视差效果 11 | /// - 和详情页[DetailPage]的[Hero]过渡 12 | class RightPage extends StatelessWidget{ 13 | 14 | final double offsetX; 15 | final double offsetY; 16 | 17 | const RightPage({Key key, this.offsetX, this.offsetY}) : super(key: key); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | final screenWidth = MediaQuery.of(context).size.width; 22 | final screenHeight = MediaQuery.of(context).size.height; 23 | return buildRightPage(screenWidth,screenHeight,context); 24 | } 25 | 26 | /// 右侧Widget 27 | /// 28 | /// 通过 [Transform.translate] 根据 [offsetX] 进行偏移 29 | Transform buildRightPage(double screenWidth, double screenHeight, BuildContext context) { 30 | return Transform.translate( 31 | offset: Offset(max(0, offsetX + screenWidth), 0), 32 | child: Container( 33 | width: screenWidth, 34 | height: screenHeight, 35 | color: Colors.transparent, 36 | child: Stack( 37 | children: [ 38 | Image.asset( 39 | "assets/right.png", 40 | fit: BoxFit.fill, 41 | width: screenWidth, 42 | ), 43 | // 以下是用来进行Hero交互用的 44 | Positioned( 45 | bottom: 190, 46 | child: FlatButton( 47 | padding: EdgeInsets.all(0), 48 | onPressed: () { 49 | // 由于[MaterialPageRoute]等等的背景都是不透明的,所以这里修改了一下 50 | Navigator.push(context, TransparentPage(builder:(BuildContext context) { 51 | return DetailPage(index: 0,); 52 | },fullscreenDialog: true)); 53 | }, 54 | child: SizedBox( 55 | width: 130, 56 | height: 175, 57 | child: Hero( 58 | tag: "detail_0", 59 | child: Image.asset( 60 | "assets/detail.png", 61 | fit: BoxFit.cover, 62 | ), 63 | ), 64 | ), 65 | )), 66 | Positioned( 67 | bottom: 190, 68 | left: 130, 69 | child: FlatButton( 70 | padding: EdgeInsets.all(0), 71 | onPressed: () { 72 | Navigator.push(context, TransparentPage(builder:(BuildContext context) { 73 | return DetailPage(index: 1,); 74 | },fullscreenDialog: true)); 75 | }, 76 | child: SizedBox( 77 | width: 130, 78 | height: 175, 79 | child: Hero( 80 | tag: "detail_1", 81 | child: Image.asset( 82 | "assets/detail2.png", 83 | fit: BoxFit.cover, 84 | ), 85 | ), 86 | ), 87 | )) 88 | ], 89 | ), 90 | )); 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /lib/page/tiktok_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/rendering.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:tiktok_gestures/page/left_page.dart'; 6 | import 'package:tiktok_gestures/page/middle_page.dart'; 7 | import 'package:tiktok_gestures/page/right_page.dart'; 8 | import 'package:vibrate/vibrate.dart'; 9 | 10 | /// 首页 11 | /// 12 | /// 展示类似TikTok的手势交互效果 13 | /// 包含 拍摄页[LeftPage]、主页[MiddlePage]、用户页[RightPage] 14 | class TikTokPage extends StatefulWidget { 15 | @override 16 | State createState() { 17 | return _TikTokState(); 18 | } 19 | } 20 | 21 | class _TikTokState extends State with TickerProviderStateMixin { 22 | AnimationController animationControllerX; 23 | AnimationController animationControllerY; 24 | Animation animationX; 25 | Animation animationY; 26 | double offsetX = 0.0; 27 | double offsetY = 0.0; 28 | int currentIndex = 0; 29 | bool inMiddle = true; 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | SystemChrome.setEnabledSystemUIOverlays([]); 34 | final screenWidth = MediaQuery.of(context).size.width; 35 | final screenHeight = MediaQuery.of(context).size.height; 36 | 37 | return Material( 38 | child: Scaffold( 39 | body: GestureDetector( 40 | // 垂直方向滑动中 41 | onVerticalDragUpdate: inMiddle 42 | ? (details) { 43 | calculateOffsetY(details); 44 | } 45 | : null, 46 | // 垂直方向滑动结束 47 | onVerticalDragEnd: (_) { 48 | if (offsetY != 0) { 49 | animateToTop(); 50 | } 51 | }, 52 | onVerticalDragCancel: (){ 53 | debugPrint("onVerticalDragCancel"); 54 | }, 55 | onVerticalDragStart: (_){ 56 | debugPrint("onVerticalDragStart"); 57 | 58 | }, 59 | onVerticalDragDown: (_){ 60 | debugPrint("onVerticalDragDown"); 61 | }, 62 | // 水平方向滑动结束 63 | onHorizontalDragEnd: (details) { 64 | // 当滑动停止的时候 根据 offsetX 的偏移量进行动画 65 | // 为了方便这里取 screenWidth / 2为临界条件 66 | if (offsetX.abs() < screenWidth / 2) { 67 | animateToMiddle(); 68 | } else if (offsetX > 0) { 69 | animateToLeft(screenWidth); 70 | } else { 71 | animateToRight(screenWidth); 72 | } 73 | }, 74 | // 水平方向滑动开始 75 | onHorizontalDragStart: (_) { 76 | animationControllerX?.stop(); 77 | animationControllerY?.stop(); 78 | }, 79 | // 水平方向滑动中 80 | onHorizontalDragUpdate: (details) { 81 | // 控制 offsetX 的值在 -screenWidth 到 screenWidth 之间 82 | if (offsetX + details.delta.dx >= screenWidth) { 83 | setState(() { 84 | offsetX = screenWidth; 85 | }); 86 | } else if (offsetX + details.delta.dx <= -screenWidth) { 87 | setState(() { 88 | offsetX = -screenWidth; 89 | }); 90 | } else { 91 | setState(() { 92 | offsetX += details.delta.dx; 93 | }); 94 | } 95 | }, 96 | child: Stack( 97 | children: [ 98 | buildLeftPage(), 99 | buildMiddlePage(), 100 | buildRightPage(), 101 | ], 102 | ), 103 | ), 104 | ), 105 | ); 106 | } 107 | 108 | void onPageChanged(index) { 109 | currentIndex = index; 110 | } 111 | /// 计算[offsetY] 112 | /// 113 | /// 手指上滑,[absorbing]为false,事件交给底层PageView处理 114 | /// 处于第一页且是下拉,则拦截滑动事件 115 | void calculateOffsetY(DragUpdateDetails details) { 116 | final tempY = offsetY + details.delta.dy/2; 117 | if (currentIndex == 0) { 118 | absorbing = true; 119 | if (tempY > 0) { 120 | if (tempY < 40) { 121 | offsetY = tempY; 122 | } else if (offsetY != 40) { 123 | offsetY = 40; 124 | vibrate(); 125 | } 126 | }else{ 127 | absorbing =false; 128 | } 129 | setState(() {}); 130 | } else { 131 | absorbing = false; 132 | offsetY = 0; 133 | setState(() {}); 134 | } 135 | } 136 | 137 | /// 左侧Widget 138 | /// 139 | /// 通过 [Transform.scale] 进行根据 [offsetX] 缩放 140 | /// 最小 0.88 最大为 1 141 | Widget buildLeftPage() => LeftPage( 142 | offsetX: offsetX, 143 | ); 144 | 145 | bool absorbing = true; 146 | 147 | /// 中间 Widget 148 | /// 149 | /// 通过 [Transform.translate] 根据 [offsetX] 进行偏移 150 | /// 水平偏移量为 [ offsetX] /5 产生视差效果 151 | Widget buildMiddlePage() { 152 | return AbsorbPointer( 153 | absorbing: absorbing, 154 | child: NotificationListener( 155 | onNotification: (notification) { 156 | notification.disallowGlow(); 157 | }, 158 | child: NotificationListener( 159 | onNotification: (notification) { 160 | debugPrint("userscroll:${notification.metrics.pixels}"); 161 | // 当手指离开时,并且处于顶部则拦截PageView的滑动事件 162 | if (notification.direction == ScrollDirection.idle && notification.metrics.pixels==0.0) { 163 | setState(() { 164 | absorbing = true; 165 | }); 166 | } 167 | }, 168 | child: MiddlePage( 169 | offsetX: offsetX, 170 | offsetY: offsetY, 171 | onPageChanged: onPageChanged, 172 | )))); 173 | } 174 | 175 | /// 右侧Widget 176 | /// 177 | /// 通过 [Transform.translate] 根据 [offsetX] 进行偏移 178 | buildRightPage() => RightPage(offsetX: offsetX, offsetY: offsetY); 179 | 180 | /// 滑动到中间 181 | /// 182 | /// [offsetX] to 0.0 183 | void animateToMiddle() { 184 | animationControllerX = 185 | AnimationController(duration: Duration(milliseconds: offsetX.abs() * 1000 ~/ 500), vsync: this); 186 | final curve = CurvedAnimation(parent: animationControllerX, curve: Curves.easeOutCubic); 187 | animationX = Tween(begin: offsetX, end: 0.0).animate(curve) 188 | ..addListener(() { 189 | setState(() { 190 | offsetX = animationX.value; 191 | }); 192 | }); 193 | inMiddle = true; 194 | animationControllerX.forward(); 195 | } 196 | 197 | /// 滑动到左边 198 | /// 199 | /// [offsetX] to [screenWidth] 200 | void animateToLeft(double screenWidth) { 201 | animationControllerX = 202 | AnimationController(duration: Duration(milliseconds: offsetX.abs() * 1000 ~/ 500), vsync: this); 203 | final curve = CurvedAnimation(parent: animationControllerX, curve: Curves.easeOutCubic); 204 | animationX = Tween(begin: offsetX, end: screenWidth).animate(curve) 205 | ..addListener(() { 206 | setState(() { 207 | offsetX = animationX.value; 208 | }); 209 | }); 210 | inMiddle = false; 211 | animationControllerX.forward(); 212 | } 213 | 214 | /// 滑动到右边 215 | /// 216 | /// [offsetX] to -[screenWidth] 217 | void animateToRight(double screenWidth) { 218 | animationControllerX = 219 | AnimationController(duration: Duration(milliseconds: offsetX.abs() * 1000 ~/ 500), vsync: this); 220 | final curve = CurvedAnimation(parent: animationControllerX, curve: Curves.easeOutCubic); 221 | animationX = Tween(begin: offsetX, end: -screenWidth).animate(curve) 222 | ..addListener(() { 223 | setState(() { 224 | offsetX = animationX.value; 225 | }); 226 | }); 227 | inMiddle = false; 228 | animationControllerX.forward(); 229 | } 230 | 231 | /// 滑动到顶部 232 | /// 233 | /// [offsetY] to 0.0 234 | void animateToTop() { 235 | animationControllerY = 236 | AnimationController(duration: Duration(milliseconds: offsetY.abs() * 1000 ~/ 40), vsync: this); 237 | final curve = CurvedAnimation(parent: animationControllerY, curve: Curves.easeOutCubic); 238 | animationY = Tween(begin: offsetY, end: 0.0).animate(curve) 239 | ..addListener(() { 240 | setState(() { 241 | offsetY = animationY.value; 242 | }); 243 | }) 244 | ..addStatusListener((status) { 245 | // if(status == AnimationStatus.completed){ 246 | // setState(() { 247 | // absorbing = true; 248 | // }); 249 | // } 250 | }); 251 | animationControllerY.forward(); 252 | } 253 | 254 | /// 震动效果 255 | vibrate() { 256 | // Not check if the device can vibrate 257 | Vibrate.feedback(FeedbackType.impact); 258 | } 259 | 260 | @override 261 | void dispose() { 262 | animationControllerX.dispose(); 263 | animationControllerY.dispose(); 264 | super.dispose(); 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.0.8" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.0.4" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.14.11" 32 | cupertino_icons: 33 | dependency: "direct main" 34 | description: 35 | name: cupertino_icons 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "0.1.2" 39 | flutter: 40 | dependency: "direct main" 41 | description: flutter 42 | source: sdk 43 | version: "0.0.0" 44 | flutter_test: 45 | dependency: "direct dev" 46 | description: flutter 47 | source: sdk 48 | version: "0.0.0" 49 | matcher: 50 | dependency: transitive 51 | description: 52 | name: matcher 53 | url: "https://pub.flutter-io.cn" 54 | source: hosted 55 | version: "0.12.3+1" 56 | meta: 57 | dependency: transitive 58 | description: 59 | name: meta 60 | url: "https://pub.flutter-io.cn" 61 | source: hosted 62 | version: "1.1.6" 63 | path: 64 | dependency: transitive 65 | description: 66 | name: path 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "1.6.2" 70 | pedantic: 71 | dependency: transitive 72 | description: 73 | name: pedantic 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "1.4.0" 77 | quiver: 78 | dependency: transitive 79 | description: 80 | name: quiver 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "2.0.1" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "https://pub.flutter-io.cn" 94 | source: hosted 95 | version: "1.5.4" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "1.9.3" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "1.6.8" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "1.0.4" 117 | term_glyph: 118 | dependency: transitive 119 | description: 120 | name: term_glyph 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.1.0" 124 | test_api: 125 | dependency: transitive 126 | description: 127 | name: test_api 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "0.2.2" 131 | typed_data: 132 | dependency: transitive 133 | description: 134 | name: typed_data 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "1.1.6" 138 | vector_math: 139 | dependency: transitive 140 | description: 141 | name: vector_math 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "2.0.8" 145 | vibrate: 146 | dependency: "direct main" 147 | description: 148 | name: vibrate 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "0.0.4" 152 | sdks: 153 | dart: ">=2.1.0 <3.0.0" 154 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: tiktok_gestures 2 | description: use flutter to mimic gestures in tiktok 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+2 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.2 26 | vibrate: ^0.0.4 27 | 28 | dev_dependencies: 29 | flutter_test: 30 | sdk: flutter 31 | 32 | 33 | # For information on the generic Dart part of this file, see the 34 | # following page: https://www.dartlang.org/tools/pub/pubspec 35 | 36 | # The following section is specific to Flutter. 37 | flutter: 38 | 39 | # The following line ensures that the Material Icons font is 40 | # included with your application, so that you can use the icons in 41 | # the material Icons class. 42 | uses-material-design: true 43 | 44 | # To add assets to your application, add an assets section, like this: 45 | assets: 46 | - left.png 47 | - middle.png 48 | - right.png 49 | - detail.png 50 | - detail2.png 51 | - comment.png 52 | - bottom.png 53 | 54 | # An image asset can refer to one or more resolution-specific "variants", see 55 | # https://flutter.io/assets-and-images/#resolution-aware. 56 | 57 | # For details regarding adding assets from package dependencies, see 58 | # https://flutter.io/assets-and-images/#from-packages 59 | 60 | # To add custom fonts to your application, add a fonts section here, 61 | # in this "flutter" section. Each entry in this list should have a 62 | # "family" key with the font family name, and a "fonts" key with a 63 | # list giving the asset and other descriptors for the font. For 64 | # example: 65 | # fonts: 66 | # - family: Schyler 67 | # fonts: 68 | # - asset: fonts/Schyler-Regular.ttf 69 | # - asset: fonts/Schyler-Italic.ttf 70 | # style: italic 71 | # - family: Trajan Pro 72 | # fonts: 73 | # - asset: fonts/TrajanPro.ttf 74 | # - asset: fonts/TrajanPro_Bold.ttf 75 | # weight: 700 76 | # 77 | # For details regarding fonts from package dependencies, 78 | # see https://flutter.io/custom-fonts/#from-packages 79 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:tiktok_gestures/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | --------------------------------------------------------------------------------