├── .gitignore ├── .metadata ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── xykj │ │ │ │ └── crop_track │ │ │ │ └── video_crop_track │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── gif ├── screen_1.gif └── screen_2.gif ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── lib ├── main.dart ├── track_custom_paint.dart ├── track_style.dart ├── video_track_painter.dart └── video_track_widget.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 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 一个Flutter视频裁剪编辑的轨道UI交互效果 2 | ### [Flutter视频编辑轨道 | 自定义View实现UI交互效果 | 触摸事件处理](https://blog.csdn.net/a_zhon/article/details/119546032) 3 | ### 效果图展示 4 | 5 | 6 | ### 实现的功能 7 | - 视频轨道最大截取3分钟 8 | - 视频轨道最小截取3秒钟 9 | - 如果小于3分钟则充满整个轨道 10 | - 如果大于3分钟,则轨道上的展示的帧图片可以左右滑动来截取 11 | 12 | ### 示例代码 13 | 14 | ```java 15 | VideoTrackWidget( 16 | imgList: list, 17 | totalDuration: duration, 18 | onSelectDuration: (start, end) {}, 19 | trackWidgetBuilder: 20 | (BuildContext context, String data, Size size) { 21 | return Container( 22 | height: size.height, 23 | width: size.width, 24 | color: Colors.blueAccent, 25 | child: Center( 26 | child: Text( 27 | data, 28 | style: TextStyle(color: Colors.white), 29 | ), 30 | ), 31 | ); 32 | }, 33 | ), 34 | ``` -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 31 29 | 30 | defaultConfig { 31 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 32 | applicationId "com.xykj.crop_track.video_crop_track" 33 | minSdkVersion 16 34 | targetSdkVersion 30 35 | versionCode flutterVersionCode.toInteger() 36 | versionName flutterVersionName 37 | } 38 | 39 | buildTypes { 40 | release { 41 | // TODO: Add your own signing config for the release build. 42 | // Signing with the debug keys for now, so `flutter run --release` works. 43 | signingConfig signingConfigs.debug 44 | } 45 | } 46 | } 47 | 48 | flutter { 49 | source '../..' 50 | } 51 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/xykj/crop_track/video_crop_track/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.xykj.crop_track.video_crop_track; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:4.1.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | project.evaluationDependsOn(':app') 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /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-6.7-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /gif/screen_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/gif/screen_1.gif -------------------------------------------------------------------------------- /gif/screen_2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/gif/screen_2.gif -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/ephemeral/ 22 | Flutter/app.flx 23 | Flutter/app.zip 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /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 "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /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 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 13 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 36 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 37 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 40 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 41 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 9740EEB11CF90186004384FC /* Flutter */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 64 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 65 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 66 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 67 | ); 68 | name = Flutter; 69 | sourceTree = ""; 70 | }; 71 | 97C146E51CF9000F007C117D = { 72 | isa = PBXGroup; 73 | children = ( 74 | 9740EEB11CF90186004384FC /* Flutter */, 75 | 97C146F01CF9000F007C117D /* Runner */, 76 | 97C146EF1CF9000F007C117D /* Products */, 77 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 78 | ); 79 | sourceTree = ""; 80 | }; 81 | 97C146EF1CF9000F007C117D /* Products */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | 97C146EE1CF9000F007C117D /* Runner.app */, 85 | ); 86 | name = Products; 87 | sourceTree = ""; 88 | }; 89 | 97C146F01CF9000F007C117D /* Runner */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 93 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 94 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 95 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 96 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97 | 97C147021CF9000F007C117D /* Info.plist */, 98 | 97C146F11CF9000F007C117D /* Supporting Files */, 99 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 100 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 101 | ); 102 | path = Runner; 103 | sourceTree = ""; 104 | }; 105 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 97C146F21CF9000F007C117D /* main.m */, 109 | ); 110 | name = "Supporting Files"; 111 | sourceTree = ""; 112 | }; 113 | /* End PBXGroup section */ 114 | 115 | /* Begin PBXNativeTarget section */ 116 | 97C146ED1CF9000F007C117D /* Runner */ = { 117 | isa = PBXNativeTarget; 118 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 119 | buildPhases = ( 120 | 9740EEB61CF901F6004384FC /* Run Script */, 121 | 97C146EA1CF9000F007C117D /* Sources */, 122 | 97C146EB1CF9000F007C117D /* Frameworks */, 123 | 97C146EC1CF9000F007C117D /* Resources */, 124 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 125 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 126 | ); 127 | buildRules = ( 128 | ); 129 | dependencies = ( 130 | ); 131 | name = Runner; 132 | productName = Runner; 133 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 134 | productType = "com.apple.product-type.application"; 135 | }; 136 | /* End PBXNativeTarget section */ 137 | 138 | /* Begin PBXProject section */ 139 | 97C146E61CF9000F007C117D /* Project object */ = { 140 | isa = PBXProject; 141 | attributes = { 142 | LastUpgradeCheck = 1020; 143 | ORGANIZATIONNAME = ""; 144 | TargetAttributes = { 145 | 97C146ED1CF9000F007C117D = { 146 | CreatedOnToolsVersion = 7.3.1; 147 | }; 148 | }; 149 | }; 150 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 151 | compatibilityVersion = "Xcode 9.3"; 152 | developmentRegion = en; 153 | hasScannedForEncodings = 0; 154 | knownRegions = ( 155 | en, 156 | Base, 157 | ); 158 | mainGroup = 97C146E51CF9000F007C117D; 159 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 160 | projectDirPath = ""; 161 | projectRoot = ""; 162 | targets = ( 163 | 97C146ED1CF9000F007C117D /* Runner */, 164 | ); 165 | }; 166 | /* End PBXProject section */ 167 | 168 | /* Begin PBXResourcesBuildPhase section */ 169 | 97C146EC1CF9000F007C117D /* Resources */ = { 170 | isa = PBXResourcesBuildPhase; 171 | buildActionMask = 2147483647; 172 | files = ( 173 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 174 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 175 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 176 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXResourcesBuildPhase section */ 181 | 182 | /* Begin PBXShellScriptBuildPhase section */ 183 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 184 | isa = PBXShellScriptBuildPhase; 185 | buildActionMask = 2147483647; 186 | files = ( 187 | ); 188 | inputPaths = ( 189 | ); 190 | name = "Thin Binary"; 191 | outputPaths = ( 192 | ); 193 | runOnlyForDeploymentPostprocessing = 0; 194 | shellPath = /bin/sh; 195 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 196 | }; 197 | 9740EEB61CF901F6004384FC /* Run Script */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Run Script"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 210 | }; 211 | /* End PBXShellScriptBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 97C146EA1CF9000F007C117D /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 219 | 97C146F31CF9000F007C117D /* main.m in Sources */, 220 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | /* End PBXSourcesBuildPhase section */ 225 | 226 | /* Begin PBXVariantGroup section */ 227 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 228 | isa = PBXVariantGroup; 229 | children = ( 230 | 97C146FB1CF9000F007C117D /* Base */, 231 | ); 232 | name = Main.storyboard; 233 | sourceTree = ""; 234 | }; 235 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 236 | isa = PBXVariantGroup; 237 | children = ( 238 | 97C147001CF9000F007C117D /* Base */, 239 | ); 240 | name = LaunchScreen.storyboard; 241 | sourceTree = ""; 242 | }; 243 | /* End PBXVariantGroup section */ 244 | 245 | /* Begin XCBuildConfiguration section */ 246 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | ALWAYS_SEARCH_USER_PATHS = NO; 250 | CLANG_ANALYZER_NONNULL = YES; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 252 | CLANG_CXX_LIBRARY = "libc++"; 253 | CLANG_ENABLE_MODULES = YES; 254 | CLANG_ENABLE_OBJC_ARC = YES; 255 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 256 | CLANG_WARN_BOOL_CONVERSION = YES; 257 | CLANG_WARN_COMMA = YES; 258 | CLANG_WARN_CONSTANT_CONVERSION = YES; 259 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 260 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 261 | CLANG_WARN_EMPTY_BODY = YES; 262 | CLANG_WARN_ENUM_CONVERSION = YES; 263 | CLANG_WARN_INFINITE_RECURSION = YES; 264 | CLANG_WARN_INT_CONVERSION = YES; 265 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 266 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 267 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 270 | CLANG_WARN_STRICT_PROTOTYPES = YES; 271 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 272 | CLANG_WARN_UNREACHABLE_CODE = YES; 273 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 274 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 275 | COPY_PHASE_STRIP = NO; 276 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 277 | ENABLE_NS_ASSERTIONS = NO; 278 | ENABLE_STRICT_OBJC_MSGSEND = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_NO_COMMON_BLOCKS = YES; 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 288 | MTL_ENABLE_DEBUG_INFO = NO; 289 | SDKROOT = iphoneos; 290 | SUPPORTED_PLATFORMS = iphoneos; 291 | TARGETED_DEVICE_FAMILY = "1,2"; 292 | VALIDATE_PRODUCT = YES; 293 | }; 294 | name = Profile; 295 | }; 296 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 297 | isa = XCBuildConfiguration; 298 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 299 | buildSettings = { 300 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 301 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 302 | ENABLE_BITCODE = NO; 303 | INFOPLIST_FILE = Runner/Info.plist; 304 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 305 | PRODUCT_BUNDLE_IDENTIFIER = com.xykj.croptrack.videoCropTrack; 306 | PRODUCT_NAME = "$(TARGET_NAME)"; 307 | VERSIONING_SYSTEM = "apple-generic"; 308 | }; 309 | name = Profile; 310 | }; 311 | 97C147031CF9000F007C117D /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_ANALYZER_NONNULL = YES; 316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 317 | CLANG_CXX_LIBRARY = "libc++"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_COMMA = YES; 323 | CLANG_WARN_CONSTANT_CONVERSION = YES; 324 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INFINITE_RECURSION = YES; 329 | CLANG_WARN_INT_CONVERSION = YES; 330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 331 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 332 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 333 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 334 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 335 | CLANG_WARN_STRICT_PROTOTYPES = YES; 336 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 337 | CLANG_WARN_UNREACHABLE_CODE = YES; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | DEBUG_INFORMATION_FORMAT = dwarf; 342 | ENABLE_STRICT_OBJC_MSGSEND = YES; 343 | ENABLE_TESTABILITY = YES; 344 | GCC_C_LANGUAGE_STANDARD = gnu99; 345 | GCC_DYNAMIC_NO_PIC = NO; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_OPTIMIZATION_LEVEL = 0; 348 | GCC_PREPROCESSOR_DEFINITIONS = ( 349 | "DEBUG=1", 350 | "$(inherited)", 351 | ); 352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 354 | GCC_WARN_UNDECLARED_SELECTOR = YES; 355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 356 | GCC_WARN_UNUSED_FUNCTION = YES; 357 | GCC_WARN_UNUSED_VARIABLE = YES; 358 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 359 | MTL_ENABLE_DEBUG_INFO = YES; 360 | ONLY_ACTIVE_ARCH = YES; 361 | SDKROOT = iphoneos; 362 | TARGETED_DEVICE_FAMILY = "1,2"; 363 | }; 364 | name = Debug; 365 | }; 366 | 97C147041CF9000F007C117D /* Release */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | ALWAYS_SEARCH_USER_PATHS = NO; 370 | CLANG_ANALYZER_NONNULL = YES; 371 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 372 | CLANG_CXX_LIBRARY = "libc++"; 373 | CLANG_ENABLE_MODULES = YES; 374 | CLANG_ENABLE_OBJC_ARC = YES; 375 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 376 | CLANG_WARN_BOOL_CONVERSION = YES; 377 | CLANG_WARN_COMMA = YES; 378 | CLANG_WARN_CONSTANT_CONVERSION = YES; 379 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 380 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 381 | CLANG_WARN_EMPTY_BODY = YES; 382 | CLANG_WARN_ENUM_CONVERSION = YES; 383 | CLANG_WARN_INFINITE_RECURSION = YES; 384 | CLANG_WARN_INT_CONVERSION = YES; 385 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 386 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 387 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 388 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 389 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 390 | CLANG_WARN_STRICT_PROTOTYPES = YES; 391 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 392 | CLANG_WARN_UNREACHABLE_CODE = YES; 393 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 394 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 395 | COPY_PHASE_STRIP = NO; 396 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 397 | ENABLE_NS_ASSERTIONS = NO; 398 | ENABLE_STRICT_OBJC_MSGSEND = YES; 399 | GCC_C_LANGUAGE_STANDARD = gnu99; 400 | GCC_NO_COMMON_BLOCKS = YES; 401 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 402 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 403 | GCC_WARN_UNDECLARED_SELECTOR = YES; 404 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 405 | GCC_WARN_UNUSED_FUNCTION = YES; 406 | GCC_WARN_UNUSED_VARIABLE = YES; 407 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 408 | MTL_ENABLE_DEBUG_INFO = NO; 409 | SDKROOT = iphoneos; 410 | SUPPORTED_PLATFORMS = iphoneos; 411 | TARGETED_DEVICE_FAMILY = "1,2"; 412 | VALIDATE_PRODUCT = YES; 413 | }; 414 | name = Release; 415 | }; 416 | 97C147061CF9000F007C117D /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 419 | buildSettings = { 420 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 421 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 422 | ENABLE_BITCODE = NO; 423 | INFOPLIST_FILE = Runner/Info.plist; 424 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 425 | PRODUCT_BUNDLE_IDENTIFIER = com.xykj.croptrack.videoCropTrack; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | VERSIONING_SYSTEM = "apple-generic"; 428 | }; 429 | name = Debug; 430 | }; 431 | 97C147071CF9000F007C117D /* Release */ = { 432 | isa = XCBuildConfiguration; 433 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 434 | buildSettings = { 435 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 436 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 437 | ENABLE_BITCODE = NO; 438 | INFOPLIST_FILE = Runner/Info.plist; 439 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 440 | PRODUCT_BUNDLE_IDENTIFIER = com.xykj.croptrack.videoCropTrack; 441 | PRODUCT_NAME = "$(TARGET_NAME)"; 442 | VERSIONING_SYSTEM = "apple-generic"; 443 | }; 444 | name = Release; 445 | }; 446 | /* End XCBuildConfiguration section */ 447 | 448 | /* Begin XCConfigurationList section */ 449 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 450 | isa = XCConfigurationList; 451 | buildConfigurations = ( 452 | 97C147031CF9000F007C117D /* Debug */, 453 | 97C147041CF9000F007C117D /* Release */, 454 | 249021D3217E4FDB00AE95B9 /* Profile */, 455 | ); 456 | defaultConfigurationIsVisible = 0; 457 | defaultConfigurationName = Release; 458 | }; 459 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 460 | isa = XCConfigurationList; 461 | buildConfigurations = ( 462 | 97C147061CF9000F007C117D /* Debug */, 463 | 97C147071CF9000F007C117D /* Release */, 464 | 249021D4217E4FDB00AE95B9 /* Profile */, 465 | ); 466 | defaultConfigurationIsVisible = 0; 467 | defaultConfigurationName = Release; 468 | }; 469 | /* End XCConfigurationList section */ 470 | }; 471 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 472 | } 473 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #import "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Xie-Yin/video_crop_track/eab1401654dd38afe36627cc29e367750d94f7ab/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 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | video_crop_track 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/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:video_crop_track/video_track_widget.dart'; 3 | 4 | void main() { 5 | runApp(MyApp()); 6 | } 7 | 8 | class MyApp extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | return MaterialApp( 12 | title: 'Flutter视频裁剪编辑的轨道UI', 13 | debugShowCheckedModeBanner: false, 14 | theme: ThemeData( 15 | primarySwatch: Colors.blue, 16 | ), 17 | home: MyHomePage(), 18 | ); 19 | } 20 | } 21 | 22 | class MyHomePage extends StatefulWidget { 23 | MyHomePage({Key? key}) : super(key: key); 24 | 25 | @override 26 | _MyHomePageState createState() => _MyHomePageState(); 27 | } 28 | 29 | class _MyHomePageState extends State { 30 | List list = [ 31 | '图1', 32 | '图2', 33 | '图3', 34 | '图4', 35 | '图5', 36 | '图6', 37 | '图7', 38 | '图8', 39 | '图9', 40 | ]; 41 | final Duration duration = Duration(minutes: 1); 42 | List list2 = [ 43 | '图1', 44 | '图2', 45 | '图3', 46 | '图4', 47 | '图5', 48 | '图6', 49 | '图7', 50 | '图8', 51 | '图9', 52 | '图10', 53 | '图11', 54 | '图12', 55 | '图13', 56 | '图14', 57 | '图15', 58 | '图16', 59 | ]; 60 | final Duration duration2 = Duration(minutes: 4); 61 | GlobalKey key1 = GlobalKey(); 62 | GlobalKey key2 = GlobalKey(); 63 | 64 | @override 65 | Widget build(BuildContext context) { 66 | return Scaffold( 67 | appBar: AppBar( 68 | title: Text('Flutter视频裁剪编辑的轨道UI'), 69 | ), 70 | body: Column( 71 | children: [ 72 | SizedBox(height: 50), 73 | Text('小于等于3分钟的视频展示'), 74 | SizedBox(height: 8), 75 | Container( 76 | margin: EdgeInsets.symmetric(horizontal: 16), 77 | child: VideoTrackWidget( 78 | key: key1, 79 | imgList: list, 80 | totalDuration: duration, 81 | onSelectDuration: (start, end) { 82 | print('轨道1选择的时间段:$start ~ $end'); 83 | }, 84 | trackWidgetBuilder: 85 | (BuildContext context, String data, Size size) { 86 | return Container( 87 | height: size.height, 88 | width: size.width, 89 | color: Colors.blueAccent, 90 | child: Center( 91 | child: Text( 92 | data, 93 | style: TextStyle(color: Colors.white), 94 | ), 95 | ), 96 | ); 97 | }, 98 | ), 99 | ), 100 | _timelineControl(key1), 101 | SizedBox(height: 50), 102 | Text('大于3分钟的视频展示'), 103 | SizedBox(height: 8), 104 | Container( 105 | margin: EdgeInsets.symmetric(horizontal: 16), 106 | child: VideoTrackWidget( 107 | key: key2, 108 | imgList: list2, 109 | totalDuration: duration2, 110 | onSelectDuration: (start, end) { 111 | print('轨道2选择的时间段:$start ~ $end'); 112 | }, 113 | trackWidgetBuilder: 114 | (BuildContext context, String data, Size size) { 115 | return Container( 116 | height: size.height, 117 | width: size.width, 118 | color: Colors.blueAccent, 119 | child: Center( 120 | child: Text( 121 | data, 122 | style: TextStyle(color: Colors.white), 123 | ), 124 | ), 125 | ); 126 | }, 127 | ), 128 | ), 129 | _timelineControl(key2), 130 | ], 131 | ), 132 | ); 133 | } 134 | 135 | _timelineControl(GlobalKey key) { 136 | return Column( 137 | children: [ 138 | SizedBox(height: 10), 139 | Text('时间线控制'), 140 | Row( 141 | mainAxisAlignment: MainAxisAlignment.center, 142 | children: [ 143 | MaterialButton( 144 | minWidth: 0, 145 | child: Text('开始'), 146 | color: Colors.blue, 147 | textColor: Colors.white, 148 | onPressed: () { 149 | key.currentState!.startTimelineAnimation(); 150 | }, 151 | ), 152 | SizedBox(width: 16), 153 | MaterialButton( 154 | minWidth: 0, 155 | child: Text('暂停'), 156 | color: Colors.blue, 157 | textColor: Colors.white, 158 | onPressed: () { 159 | key.currentState!.stopTimelineAnimation(); 160 | }, 161 | ), 162 | SizedBox(width: 16), 163 | MaterialButton( 164 | minWidth: 0, 165 | child: Text('继续'), 166 | color: Colors.blue, 167 | textColor: Colors.white, 168 | onPressed: () { 169 | key.currentState!.continueTimelineAnimation(); 170 | }, 171 | ), 172 | SizedBox(width: 16), 173 | MaterialButton( 174 | minWidth: 0, 175 | child: Text('重新开始'), 176 | color: Colors.blue, 177 | textColor: Colors.white, 178 | onPressed: () { 179 | key.currentState!.startTimelineAnimation(reset: true); 180 | }, 181 | ) 182 | ], 183 | ), 184 | ], 185 | ); 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /lib/track_custom_paint.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * 项目名: video_crop_track 3 | * 包名 4 | * 文件名: track_custom_paint 5 | * 创建时间: 2021/8/5 on 15:41 6 | * 描述: TODO 7 | * 8 | * @author 阿钟 9 | */ 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter/rendering.dart'; 12 | import 'package:video_crop_track/video_track_painter.dart'; 13 | 14 | class TrackCustomPaint extends CustomPaint { 15 | const TrackCustomPaint({ 16 | Key? key, 17 | CustomPainter? painter, 18 | CustomPainter? foregroundPainter, 19 | Size size = Size.zero, 20 | bool isComplex = false, 21 | bool willChange = false, 22 | Widget? child, 23 | }) : super( 24 | key: key, 25 | painter: painter, 26 | foregroundPainter: foregroundPainter, 27 | size: size, 28 | isComplex: isComplex, 29 | willChange: willChange, 30 | child: child); 31 | 32 | @override 33 | TrackRenderCustomPaint createRenderObject(BuildContext context) { 34 | return TrackRenderCustomPaint( 35 | painter: painter, 36 | foregroundPainter: foregroundPainter, 37 | preferredSize: size, 38 | isComplex: isComplex, 39 | willChange: willChange, 40 | ); 41 | } 42 | } 43 | 44 | class TrackRenderCustomPaint extends RenderCustomPaint { 45 | TrackRenderCustomPaint({ 46 | CustomPainter? painter, 47 | CustomPainter? foregroundPainter, 48 | Size preferredSize = Size.zero, 49 | bool isComplex = false, 50 | bool willChange = false, 51 | RenderBox? child, 52 | }) : super( 53 | painter: painter, 54 | foregroundPainter: foregroundPainter, 55 | preferredSize: preferredSize, 56 | isComplex: isComplex, 57 | willChange: willChange, 58 | child: child, 59 | ); 60 | 61 | @override 62 | bool hitTest(BoxHitTestResult result, {required Offset position}) { 63 | VideoTrackPainter trackPainter = painter as VideoTrackPainter; 64 | return trackPainter.interceptTouchEvent(position); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/track_style.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * 项目名: video_crop_track 3 | * 包名 4 | * 文件名: style_config 5 | * 创建时间: 2021/8/11 on 10:30 6 | * 描述: TODO 7 | * 8 | * @author 阿钟 9 | */ 10 | 11 | import 'package:flutter/material.dart'; 12 | 13 | class TrackStyle { 14 | ///轨道高度 15 | final double trackHeight; 16 | 17 | ///帧图片宽度 18 | final double imgWidth; 19 | 20 | ///轨道颜色 21 | final Color trackColor; 22 | 23 | ///遮罩颜色 24 | final Color maskColor; 25 | 26 | ///拖拽耳朵内矩形的颜色 27 | final Color earRectColor; 28 | 29 | ///拖拽耳朵的大小 30 | final Size earSize; 31 | 32 | ///拖拽耳朵内矩形的大小 33 | final Size earRectSize; 34 | 35 | const TrackStyle({ 36 | this.trackHeight = 48, 37 | this.imgWidth = 48, 38 | this.earSize = const Size(20, 48), 39 | this.earRectSize = const Size(4, 12), 40 | this.trackColor = const Color(0xFFFF443D), 41 | this.maskColor = const Color.fromRGBO(0, 0, 0, 0.6), 42 | this.earRectColor = Colors.white, 43 | }); 44 | } 45 | -------------------------------------------------------------------------------- /lib/video_track_painter.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * 项目名: video_crop_track 3 | * 包名 4 | * 文件名: video_track_painter 5 | * 创建时间: 2021/8/5 on 18:36 6 | * 描述: TODO 7 | * 8 | * @author 阿钟 9 | */ 10 | import 'package:flutter/material.dart'; 11 | import 'package:video_crop_track/track_style.dart'; 12 | 13 | class VideoTrackPainter extends CustomPainter { 14 | late Paint earPaint; 15 | late Paint rectPaint; 16 | late Paint maskPaint; 17 | late Paint timelinePaint; 18 | late Size earSize; 19 | 20 | ///耳朵的位置 21 | final Offset leftEarOffset; 22 | final Offset rightEarOffset; 23 | 24 | ///时间线偏移 25 | final Offset timelineOffset; 26 | final TrackStyle style; 27 | 28 | VideoTrackPainter({ 29 | required this.leftEarOffset, 30 | required this.rightEarOffset, 31 | required this.timelineOffset, 32 | required this.style, 33 | }) { 34 | _init(); 35 | } 36 | 37 | void _init() { 38 | earSize = style.earSize; 39 | earPaint = Paint(); 40 | rectPaint = Paint() 41 | ..color = style.trackColor 42 | ..style = PaintingStyle.stroke 43 | ..strokeWidth = 2; 44 | maskPaint = Paint() 45 | ..color = style.maskColor 46 | ..style = PaintingStyle.fill; 47 | timelinePaint = Paint() 48 | ..color = style.trackColor 49 | ..style = PaintingStyle.fill 50 | ..strokeWidth = 2; 51 | } 52 | 53 | @override 54 | void paint(Canvas canvas, Size size) { 55 | _createMaskLayer(canvas, size); 56 | _createRect(canvas, size, leftEarOffset, rightEarOffset); 57 | _createEar(canvas, leftEarOffset, true); 58 | _createEar(canvas, rightEarOffset, false); 59 | _createTimeLine(canvas, size); 60 | } 61 | 62 | ///创建中间的矩形 63 | void _createRect( 64 | Canvas canvas, Size size, Offset leftEarOffset, Offset rightEarOffset) { 65 | double left = leftEarOffset.dx + earSize.width; 66 | double right = rightEarOffset.dx; 67 | 68 | ///线的宽度 69 | double top = leftEarOffset.dy + 1; 70 | double bottom = size.height - 1; 71 | Rect rect = Rect.fromLTRB(left, top, right, bottom); 72 | canvas.drawRect(rect, rectPaint); 73 | } 74 | 75 | ///创建两边的耳朵 76 | void _createEar(Canvas canvas, Offset offset, bool leftCorner) { 77 | Rect rect = offset & earSize; 78 | Radius radius = Radius.circular(6); 79 | RRect rRect = RRect.fromRectAndCorners( 80 | rect, 81 | topLeft: leftCorner ? radius : Radius.zero, 82 | bottomLeft: leftCorner ? radius : Radius.zero, 83 | topRight: leftCorner ? Radius.zero : radius, 84 | bottomRight: leftCorner ? Radius.zero : radius, 85 | ); 86 | earPaint.color = style.trackColor; 87 | canvas.drawRRect(rRect, earPaint); 88 | 89 | ///白色矩形 90 | Rect whiteRect = Rect.fromCenter( 91 | center: Offset(offset.dx + rect.width / 2, offset.dy + rect.height / 2), 92 | width: style.earRectSize.width, 93 | height: style.earRectSize.height); 94 | earPaint.color = style.earRectColor; 95 | RRect whiteRRect = RRect.fromRectAndRadius(whiteRect, Radius.circular(4)); 96 | canvas.drawRRect(whiteRRect, earPaint); 97 | } 98 | 99 | ///绘制灰色蒙层 100 | void _createMaskLayer(Canvas canvas, Size size) { 101 | Rect leftRect = 102 | Rect.fromLTWH(earSize.width, 0, leftEarOffset.dx, size.height); 103 | canvas.drawRect(leftRect, maskPaint); 104 | Rect rightRect = Rect.fromLTWH(rightEarOffset.dx, 0, 105 | size.width - rightEarOffset.dx - earSize.width, size.height); 106 | canvas.drawRect(rightRect, maskPaint); 107 | } 108 | 109 | ///绘制时间线 110 | void _createTimeLine(Canvas canvas, Size size) { 111 | if (timelineOffset.dx == -1) return; 112 | Offset start = Offset(timelineOffset.dx, 0); 113 | Offset end = Offset(timelineOffset.dx, size.height); 114 | canvas.drawLine(start, end, timelinePaint); 115 | } 116 | 117 | ///是否需要拦截触摸事件 118 | bool interceptTouchEvent(Offset offset) { 119 | Rect leftRect = leftEarOffset & earSize; 120 | Rect rightRect = rightEarOffset & earSize; 121 | return leftRect.contains(offset) || rightRect.contains(offset); 122 | } 123 | 124 | @override 125 | bool shouldRepaint(VideoTrackPainter oldDelegate) { 126 | return true; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /lib/video_track_widget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * 项目名: video_crop_track 3 | * 包名 4 | * 文件名: video_track_widget 5 | * 创建时间: 2021/8/5 on 10:46 6 | * 描述: TODO 7 | * 8 | * @author 阿钟 9 | */ 10 | 11 | import 'package:flutter/material.dart'; 12 | import 'package:flutter/rendering.dart'; 13 | import 'package:video_crop_track/track_style.dart'; 14 | import 'package:video_crop_track/track_custom_paint.dart'; 15 | import 'package:video_crop_track/video_track_painter.dart'; 16 | 17 | typedef OnSelectDuration = void Function(Duration start, Duration end); 18 | typedef TrackWidgetBuilder = Widget Function( 19 | BuildContext context, String data, Size size); 20 | 21 | class VideoTrackWidget extends StatefulWidget { 22 | final OnSelectDuration? onSelectDuration; 23 | final TrackWidgetBuilder trackWidgetBuilder; 24 | 25 | ///拖动事件反馈 26 | final Function? dragDown; 27 | final Function? dragUpdate; 28 | final Function? dragEnd; 29 | 30 | ///视频时长 31 | final Duration totalDuration; 32 | 33 | ///轨道最大显示 秒 34 | final int maxSecond; 35 | 36 | ///最小截取时间 秒 37 | final int minSecond; 38 | 39 | ///帧图片 40 | final List imgList; 41 | 42 | ///图片数量(用于动态加载计算帧图片宽度) 43 | final int? imgCount; 44 | 45 | ///轨道样式 46 | final TrackStyle style; 47 | 48 | VideoTrackWidget({ 49 | Key? key, 50 | required this.totalDuration, 51 | required this.imgList, 52 | required this.trackWidgetBuilder, 53 | this.imgCount, 54 | this.onSelectDuration, 55 | this.dragDown, 56 | this.dragUpdate, 57 | this.dragEnd, 58 | this.maxSecond = 180, 59 | this.minSecond = 3, 60 | this.style = const TrackStyle(), 61 | }) : super(key: key); 62 | 63 | @override 64 | State createState() { 65 | return VideoTrackWidgetState(); 66 | } 67 | } 68 | 69 | class VideoTrackWidgetState extends State 70 | with TickerProviderStateMixin { 71 | late Size viewSize; 72 | late Size trackSize; 73 | late Size earSize; 74 | 75 | ///左右两边拖拽元素的位置偏移量 76 | Offset leftEarOffset = Offset.zero; 77 | Offset timelineOffset = Offset(-1, 0); 78 | Offset? rightEarOffset; 79 | 80 | bool touchLeft = false; 81 | bool touchRight = false; 82 | 83 | ///两个滑块将的最小距离 84 | late double minInsets; 85 | 86 | late Duration duration; 87 | 88 | ///选中的时间 89 | late Duration selectStartDur = Duration.zero; 90 | 91 | late Duration selectEndDur; 92 | 93 | ///时间线动画 94 | AnimationController? _timelineController; 95 | ScrollController _scrollController = ScrollController(); 96 | 97 | @override 98 | void initState() { 99 | super.initState(); 100 | earSize = widget.style.earSize; 101 | 102 | ///最大只能选择[widget.maxSecond],初始默认选择的时间 103 | duration = selectEndDur = widget.totalDuration.inSeconds > widget.maxSecond 104 | ? Duration(seconds: widget.maxSecond) 105 | : widget.totalDuration; 106 | } 107 | 108 | @override 109 | Widget build(BuildContext context) { 110 | return Container( 111 | height: widget.style.trackHeight, 112 | width: double.infinity, 113 | child: LayoutBuilder( 114 | builder: (context, constraints) { 115 | _initView(constraints); 116 | return GestureDetector( 117 | onHorizontalDragDown: (down) { 118 | _onDown(down.localPosition); 119 | widget.dragDown?.call(); 120 | }, 121 | onHorizontalDragUpdate: (move) { 122 | _hideTimeline(); 123 | _onMove(move.delta); 124 | _notificationResult(); 125 | widget.dragUpdate?.call(); 126 | }, 127 | onHorizontalDragEnd: (up) { 128 | touchLeft = false; 129 | touchRight = false; 130 | _notificationResult(); 131 | widget.dragEnd?.call(); 132 | }, 133 | child: Stack( 134 | children: [ 135 | Positioned( 136 | left: earSize.width, 137 | right: earSize.width, 138 | child: NotificationListener( 139 | onNotification: (notification) => 140 | _notificationListener(notification), 141 | child: SingleChildScrollView( 142 | scrollDirection: Axis.horizontal, 143 | controller: _scrollController, 144 | child: _getImageChild(), 145 | ), 146 | ), 147 | ), 148 | TrackCustomPaint( 149 | size: viewSize, 150 | painter: VideoTrackPainter( 151 | leftEarOffset: leftEarOffset, 152 | rightEarOffset: rightEarOffset!, 153 | timelineOffset: timelineOffset, 154 | style: widget.style, 155 | ), 156 | ), 157 | ], 158 | ), 159 | ); 160 | }, 161 | ), 162 | ); 163 | } 164 | 165 | ///通知选中的时间段 166 | void _notificationResult() { 167 | widget.onSelectDuration?.call(selectStartDur, selectEndDur); 168 | } 169 | 170 | ///初始化画布信息 171 | void _initView(BoxConstraints constraints) { 172 | if (rightEarOffset == null) { 173 | viewSize = Size(constraints.maxWidth, constraints.maxHeight); 174 | trackSize = Size(viewSize.width - earSize.width * 2, viewSize.height); 175 | rightEarOffset = Offset(viewSize.width - earSize.width, 0); 176 | minInsets = _calcMinInsets(); 177 | } 178 | } 179 | 180 | ///计算最小[widget.minSecond]秒的间隔 宽度是多少 181 | double _calcMinInsets() { 182 | return trackSize.width / duration.inSeconds * widget.minSecond; 183 | } 184 | 185 | ///滚动监听 186 | bool _notificationListener(ScrollNotification notification) { 187 | if (notification is ScrollEndNotification) { 188 | _notificationResult(); 189 | widget.dragEnd?.call(); 190 | } else if (notification is ScrollUpdateNotification) { 191 | _hideTimeline(); 192 | _calcSelectDuration(); 193 | _notificationResult(); 194 | widget.dragUpdate?.call(); 195 | setState(() {}); 196 | } else if (notification is ScrollStartNotification) { 197 | widget.dragDown?.call(); 198 | } 199 | return false; 200 | } 201 | 202 | _onDown(Offset offset) { 203 | double dx = offset.dx; 204 | if (dx <= 0) dx = 0; 205 | 206 | ///判断选中的是哪一个 207 | Rect leftRect = leftEarOffset & earSize; 208 | if (leftRect.contains(offset)) { 209 | touchLeft = true; 210 | return; 211 | } 212 | Rect rightRect = rightEarOffset! & earSize; 213 | if (rightRect.contains(offset)) { 214 | touchRight = true; 215 | return; 216 | } 217 | } 218 | 219 | _onMove(Offset offset) { 220 | double dx = offset.dx; 221 | if (touchLeft) { 222 | double end = (leftEarOffset.dx + dx) <= 0 ? 0 : leftEarOffset.dx + dx; 223 | 224 | ///距离右边 225 | double max = rightEarOffset!.dx - minInsets; 226 | if (end + earSize.width >= max) end = max - earSize.width; 227 | leftEarOffset = Offset(end, 0); 228 | } 229 | if (touchRight) { 230 | ///偏移量要减去宽度 231 | double end = (rightEarOffset!.dx + dx) >= viewSize.width - earSize.width 232 | ? viewSize.width - earSize.width 233 | : rightEarOffset!.dx + dx; 234 | 235 | ///距离左边 236 | double min = leftEarOffset.dx + earSize.width + minInsets; 237 | if (end <= min) end = min; 238 | rightEarOffset = Offset(end, 0); 239 | } 240 | _calcSelectDuration(); 241 | setState(() {}); 242 | } 243 | 244 | ///计算选中时长 245 | void _calcSelectDuration() { 246 | ///计算滚动的时间 247 | double scrollerSecond = 0; 248 | double perScrollerSecond = _calcScrollerSecond(); 249 | if (perScrollerSecond != 0) { 250 | scrollerSecond = _scrollController.offset / perScrollerSecond; 251 | } 252 | 253 | ///开始的偏移量 254 | double perSeconds = trackSize.width / duration.inSeconds; 255 | double startSecond = leftEarOffset.dx / perSeconds + scrollerSecond; 256 | 257 | ///首尾相差的偏移量 258 | double diffSecond = 259 | (rightEarOffset!.dx - leftEarOffset.dx - earSize.width) / perSeconds; 260 | double endSecond = startSecond + diffSecond; 261 | selectStartDur = Duration(seconds: startSecond.toInt()); 262 | selectEndDur = Duration(seconds: endSecond.toInt()); 263 | } 264 | 265 | ///计算帧图片每秒的偏移量 266 | double _calcScrollerSecond() { 267 | int diffDuration = widget.totalDuration.inSeconds - duration.inSeconds; 268 | if (diffDuration == 0) return 0; 269 | return _scrollController.position.maxScrollExtent / diffDuration; 270 | } 271 | 272 | ///视频帧图片 273 | ///轨道最长显示[widget.maxSecond],多余的超出显示 274 | ///动态计算每张图片的宽度 275 | Widget _getImageChild() { 276 | double width; 277 | int count = widget.imgCount ?? widget.imgList.length; 278 | if (widget.totalDuration.inSeconds > widget.maxSecond) { 279 | width = widget.style.imgWidth; 280 | } else { 281 | width = trackSize.width / count; 282 | } 283 | List widgets = []; 284 | for (int i = 0; i < widget.imgList.length; i++) { 285 | widgets.add( 286 | widget.trackWidgetBuilder 287 | .call(context, widget.imgList[i], Size(width, viewSize.height)), 288 | ); 289 | } 290 | return Row(children: widgets); 291 | } 292 | 293 | ///开始时间线动画 294 | ///[reset] 是否从头开始 295 | startTimelineAnimation({bool reset = false}) { 296 | if (_timelineController != null && !reset) return; 297 | if (reset) _disposeAnimation(); 298 | int selectDuration = 299 | selectEndDur.inMilliseconds - selectStartDur.inMilliseconds; 300 | _timelineController = new AnimationController( 301 | duration: Duration(milliseconds: selectDuration), vsync: this); 302 | CurvedAnimation curve = 303 | CurvedAnimation(parent: _timelineController!, curve: Curves.linear); 304 | Animation animation = 305 | Tween(begin: leftEarOffset.dx + earSize.width, end: rightEarOffset!.dx) 306 | .animate(curve); 307 | animation.addListener(() { 308 | setState(() { 309 | timelineOffset = Offset(animation.value, 0); 310 | }); 311 | }); 312 | _timelineController?.repeat(); 313 | } 314 | 315 | ///停止时间线动画 316 | stopTimelineAnimation() { 317 | _timelineController?.stop(); 318 | } 319 | 320 | ///继续时间线动画 321 | continueTimelineAnimation() { 322 | _timelineController?.repeat(); 323 | } 324 | 325 | ///隐藏时间线 326 | _hideTimeline() { 327 | _disposeAnimation(); 328 | setState(() { 329 | timelineOffset = Offset(-1, 0); 330 | }); 331 | } 332 | 333 | ///停止时间线动画 334 | _disposeAnimation() { 335 | if (_timelineController == null) return; 336 | _timelineController?.dispose(); 337 | _timelineController = null; 338 | } 339 | 340 | @override 341 | void dispose() { 342 | _disposeAnimation(); 343 | _scrollController.dispose(); 344 | super.dispose(); 345 | } 346 | } 347 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.6.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.15.0" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.0.3" 53 | fake_async: 54 | dependency: transitive 55 | description: 56 | name: fake_async 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.2.0" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | matcher: 71 | dependency: transitive 72 | description: 73 | name: matcher 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "0.12.10" 77 | meta: 78 | dependency: transitive 79 | description: 80 | name: meta 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "1.3.0" 84 | path: 85 | dependency: transitive 86 | description: 87 | name: path 88 | url: "https://pub.flutter-io.cn" 89 | source: hosted 90 | version: "1.8.0" 91 | sky_engine: 92 | dependency: transitive 93 | description: flutter 94 | source: sdk 95 | version: "0.0.99" 96 | source_span: 97 | dependency: transitive 98 | description: 99 | name: source_span 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "1.8.1" 103 | stack_trace: 104 | dependency: transitive 105 | description: 106 | name: stack_trace 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "1.10.0" 110 | stream_channel: 111 | dependency: transitive 112 | description: 113 | name: stream_channel 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "2.1.0" 117 | string_scanner: 118 | dependency: transitive 119 | description: 120 | name: string_scanner 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.1.0" 124 | term_glyph: 125 | dependency: transitive 126 | description: 127 | name: term_glyph 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "1.2.0" 131 | test_api: 132 | dependency: transitive 133 | description: 134 | name: test_api 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "0.3.0" 138 | typed_data: 139 | dependency: transitive 140 | description: 141 | name: typed_data 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "1.3.0" 145 | vector_math: 146 | dependency: transitive 147 | description: 148 | name: vector_math 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "2.1.0" 152 | sdks: 153 | dart: ">=2.12.0 <3.0.0" 154 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: video_crop_track 2 | description: 一个Flutter视频裁剪编辑的轨道UI交互效果 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^1.0.2 31 | 32 | dev_dependencies: 33 | flutter_test: 34 | sdk: flutter 35 | 36 | # For information on the generic Dart part of this file, see the 37 | # following page: https://dart.dev/tools/pub/pubspec 38 | 39 | # The following section is specific to Flutter. 40 | flutter: 41 | 42 | # The following line ensures that the Material Icons font is 43 | # included with your application, so that you can use the icons in 44 | # the material Icons class. 45 | uses-material-design: true 46 | 47 | # To add assets to your application, add an assets section, like this: 48 | # assets: 49 | # - images/a_dot_burr.jpeg 50 | # - images/a_dot_ham.jpeg 51 | 52 | # An image asset can refer to one or more resolution-specific "variants", see 53 | # https://flutter.dev/assets-and-images/#resolution-aware. 54 | 55 | # For details regarding adding assets from package dependencies, see 56 | # https://flutter.dev/assets-and-images/#from-packages 57 | 58 | # To add custom fonts to your application, add a fonts section here, 59 | # in this "flutter" section. Each entry in this list should have a 60 | # "family" key with the font family name, and a "fonts" key with a 61 | # list giving the asset and other descriptors for the font. For 62 | # example: 63 | # fonts: 64 | # - family: Schyler 65 | # fonts: 66 | # - asset: fonts/Schyler-Regular.ttf 67 | # - asset: fonts/Schyler-Italic.ttf 68 | # style: italic 69 | # - family: Trajan Pro 70 | # fonts: 71 | # - asset: fonts/TrajanPro.ttf 72 | # - asset: fonts/TrajanPro_Bold.ttf 73 | # weight: 700 74 | # 75 | # For details regarding fonts from package dependencies, 76 | # see https://flutter.dev/custom-fonts/#from-packages 77 | -------------------------------------------------------------------------------- /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:video_crop_track/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 | --------------------------------------------------------------------------------