├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── parse_video │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ ├── ic_download.png │ │ │ └── ic_stat_flutter.png │ │ │ ├── drawable-mdpi │ │ │ ├── ic_download.png │ │ │ └── ic_stat_flutter.png │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable-xhdpi │ │ │ ├── ic_download.png │ │ │ └── ic_stat_flutter.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── ic_download.png │ │ │ └── ic_stat_flutter.png │ │ │ ├── drawable-xxxhdpi │ │ │ ├── ic_download.png │ │ │ └── ic_stat_flutter.png │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── 2.png ├── bg.png └── icon_android.png ├── 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.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 ├── components │ ├── bottom_sheet.dart │ ├── drawer_common_page.dart │ ├── loading.dart │ ├── nice_button.dart │ ├── simple_list_tile.dart │ ├── task_list_item.dart │ └── text_search_field.dart ├── database │ ├── download_video_database.dart │ └── ready_to_down_database.dart ├── main.dart ├── model │ └── current_down_load.dart ├── page │ ├── download_page.dart │ ├── home_page.dart │ ├── local_video_page.dart │ ├── ready_to_down_page.dart │ └── video_page.dart └── plugin │ ├── download.dart │ ├── flutter_toast_manage.dart │ └── http_manage.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /.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: 097d3313d8e2c7f901932d63e537c1acefb87800 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # 去水印下载 3 | 4 | 粘贴视频链接并提供播放以及下载 5 | 6 | 网页版 7 | 8 | 9 | ## 功能 10 | 11 | 已实现粘贴,播放,本地下载,待下载,分享等功能 12 | 13 | ## 支持平台 14 | 15 | 抖音/皮皮虾/火山/微视/微博/绿洲/最右/轻视频/instagram/哔哩哔哩/快手/全民小视频/皮皮搞笑/全民k歌/巴塞电影/陌陌/Before避风/开眼/Vue Vlog/小咖秀/西瓜视频/逗拍/虎牙/6间房/新片场/Acfun/美拍 16 | 17 | 下载地址 [去水印下载](https://wwvr.lanzouw.com/b01f8mehi "下载地址") 18 | 密码:1234 19 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /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 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /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 | def keystorePropertiesFile = rootProject.file("key.properties") 29 | def keystoreProperties = new Properties() 30 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 31 | android { 32 | compileSdkVersion 33 33 | ndkVersion "25.1.8937393" //flutter.ndkVersion 34 | compileOptions { 35 | sourceCompatibility JavaVersion.VERSION_1_8 36 | targetCompatibility JavaVersion.VERSION_1_8 37 | } 38 | 39 | kotlinOptions { 40 | jvmTarget = '1.8' 41 | } 42 | 43 | sourceSets { 44 | main.java.srcDirs += 'src/main/kotlin' 45 | } 46 | 47 | defaultConfig { 48 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 49 | applicationId "com.sup.android.parse" 50 | minSdkVersion 21 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | multiDexEnabled true 55 | } 56 | signingConfigs { 57 | release { 58 | keyAlias keystoreProperties['keyAlias'] 59 | keyPassword keystoreProperties['keyPassword'] 60 | storeFile file(keystoreProperties['storeFile']) 61 | storePassword keystoreProperties['storePassword'] 62 | } 63 | } 64 | buildTypes { 65 | release { 66 | // TODO: Add your own signing config for the release build. 67 | // Signing with the debug keys for now, so `flutter run --release` works. 68 | signingConfig signingConfigs.release 69 | minifyEnabled true 70 | proguardFiles getDefaultProguardFile( 71 | 'proguard-android-optimize.txt'), 72 | 'proguard-rules.pro' 73 | } 74 | debug { 75 | signingConfig signingConfigs.release 76 | } 77 | } 78 | } 79 | 80 | flutter { 81 | source '../..' 82 | } 83 | 84 | dependencies { 85 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 86 | } -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | #Flutter Wrapper 2 | -keep class io.flutter.app.** { *; } 3 | -keep class io.flutter.plugin.** { *; } 4 | -keep class io.flutter.util.** { *; } 5 | -keep class io.flutter.view.** { *; } 6 | -keep class io.flutter.** { *; } 7 | -keep class io.flutter.plugins.** { *; } 8 | -keep class de.prosiebensat1digital.** { *; } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 26 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 47 | 48 | 49 | 50 | 55 | 59 | 60 | 61 | 62 | 66 | 67 | 70 | 71 | 74 | 75 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/parse_video/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.sup.android.parse 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-hdpi/ic_download.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_stat_flutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-hdpi/ic_stat_flutter.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-mdpi/ic_download.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_stat_flutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-mdpi/ic_stat_flutter.png -------------------------------------------------------------------------------- /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-xhdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-xhdpi/ic_download.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_stat_flutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-xhdpi/ic_stat_flutter.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-xxhdpi/ic_download.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_stat_flutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-xxhdpi/ic_stat_flutter.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-xxxhdpi/ic_download.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_stat_flutter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/drawable-xxxhdpi/ic_stat_flutter.png -------------------------------------------------------------------------------- /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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-hdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-mdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.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 | 8 | 开始下载 9 | 正在下载 10 | 取消下载 11 | 下载失败 12 | 下载完成 13 | 下载暂停 14 | 15 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.9.0' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | configurations.classpath { 13 | resolutionStrategy.activateDependencyLocking() 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | rootProject.buildDir = '../build' 25 | subprojects { 26 | project.buildDir = "${rootProject.buildDir}/${project.name}" 27 | } 28 | subprojects { 29 | project.evaluationDependsOn(':app') 30 | dependencyLocking { 31 | ignoredDependencies.add('io.flutter:*') 32 | lockFile = file("${rootProject.projectDir}/project-${project.name}.lockfile") 33 | lockAllConfigurations() 34 | } 35 | } 36 | 37 | tasks.register("clean", Delete) { 38 | delete rootProject.buildDir 39 | } 40 | -------------------------------------------------------------------------------- /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-7.6.1-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 | -------------------------------------------------------------------------------- /assets/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/assets/2.png -------------------------------------------------------------------------------- /assets/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/assets/bg.png -------------------------------------------------------------------------------- /assets/icon_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/assets/icon_android.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /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 | 9.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 = 50; 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 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | ENABLE_BITCODE = NO; 292 | INFOPLIST_FILE = Runner/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = ( 294 | "$(inherited)", 295 | "@executable_path/Frameworks", 296 | ); 297 | PRODUCT_BUNDLE_IDENTIFIER = com.example.parseVideo; 298 | PRODUCT_NAME = "$(TARGET_NAME)"; 299 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 300 | SWIFT_VERSION = 5.0; 301 | VERSIONING_SYSTEM = "apple-generic"; 302 | }; 303 | name = Profile; 304 | }; 305 | 97C147031CF9000F007C117D /* Debug */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | CLANG_ANALYZER_NONNULL = YES; 310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 311 | CLANG_CXX_LIBRARY = "libc++"; 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_ENABLE_OBJC_ARC = YES; 314 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_COMMA = YES; 317 | CLANG_WARN_CONSTANT_CONVERSION = YES; 318 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INFINITE_RECURSION = YES; 323 | CLANG_WARN_INT_CONVERSION = YES; 324 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 326 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 329 | CLANG_WARN_STRICT_PROTOTYPES = YES; 330 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | DEBUG_INFORMATION_FORMAT = dwarf; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | ENABLE_TESTABILITY = YES; 338 | GCC_C_LANGUAGE_STANDARD = gnu99; 339 | GCC_DYNAMIC_NO_PIC = NO; 340 | GCC_NO_COMMON_BLOCKS = YES; 341 | GCC_OPTIMIZATION_LEVEL = 0; 342 | GCC_PREPROCESSOR_DEFINITIONS = ( 343 | "DEBUG=1", 344 | "$(inherited)", 345 | ); 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 353 | MTL_ENABLE_DEBUG_INFO = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = iphoneos; 356 | TARGETED_DEVICE_FAMILY = "1,2"; 357 | }; 358 | name = Debug; 359 | }; 360 | 97C147041CF9000F007C117D /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_ANALYZER_NONNULL = YES; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_COMMA = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 374 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 375 | CLANG_WARN_EMPTY_BODY = YES; 376 | CLANG_WARN_ENUM_CONVERSION = YES; 377 | CLANG_WARN_INFINITE_RECURSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 380 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 381 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 382 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 383 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 384 | CLANG_WARN_STRICT_PROTOTYPES = YES; 385 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 391 | ENABLE_NS_ASSERTIONS = NO; 392 | ENABLE_STRICT_OBJC_MSGSEND = YES; 393 | GCC_C_LANGUAGE_STANDARD = gnu99; 394 | GCC_NO_COMMON_BLOCKS = YES; 395 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 396 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 397 | GCC_WARN_UNDECLARED_SELECTOR = YES; 398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 399 | GCC_WARN_UNUSED_FUNCTION = YES; 400 | GCC_WARN_UNUSED_VARIABLE = YES; 401 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 402 | MTL_ENABLE_DEBUG_INFO = NO; 403 | SDKROOT = iphoneos; 404 | SUPPORTED_PLATFORMS = iphoneos; 405 | SWIFT_COMPILATION_MODE = wholemodule; 406 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 407 | TARGETED_DEVICE_FAMILY = "1,2"; 408 | VALIDATE_PRODUCT = YES; 409 | }; 410 | name = Release; 411 | }; 412 | 97C147061CF9000F007C117D /* Debug */ = { 413 | isa = XCBuildConfiguration; 414 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | CLANG_ENABLE_MODULES = YES; 418 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 419 | ENABLE_BITCODE = NO; 420 | INFOPLIST_FILE = Runner/Info.plist; 421 | LD_RUNPATH_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "@executable_path/Frameworks", 424 | ); 425 | PRODUCT_BUNDLE_IDENTIFIER = com.example.parseVideo; 426 | PRODUCT_NAME = "$(TARGET_NAME)"; 427 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 428 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 429 | SWIFT_VERSION = 5.0; 430 | VERSIONING_SYSTEM = "apple-generic"; 431 | }; 432 | name = Debug; 433 | }; 434 | 97C147071CF9000F007C117D /* Release */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CLANG_ENABLE_MODULES = YES; 440 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 441 | ENABLE_BITCODE = NO; 442 | INFOPLIST_FILE = Runner/Info.plist; 443 | LD_RUNPATH_SEARCH_PATHS = ( 444 | "$(inherited)", 445 | "@executable_path/Frameworks", 446 | ); 447 | PRODUCT_BUNDLE_IDENTIFIER = com.example.parseVideo; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 450 | SWIFT_VERSION = 5.0; 451 | VERSIONING_SYSTEM = "apple-generic"; 452 | }; 453 | name = Release; 454 | }; 455 | /* End XCBuildConfiguration section */ 456 | 457 | /* Begin XCConfigurationList section */ 458 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | 97C147031CF9000F007C117D /* Debug */, 462 | 97C147041CF9000F007C117D /* Release */, 463 | 249021D3217E4FDB00AE95B9 /* Profile */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 469 | isa = XCConfigurationList; 470 | buildConfigurations = ( 471 | 97C147061CF9000F007C117D /* Debug */, 472 | 97C147071CF9000F007C117D /* Release */, 473 | 249021D4217E4FDB00AE95B9 /* Profile */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | /* End XCConfigurationList section */ 479 | }; 480 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 481 | } 482 | -------------------------------------------------------------------------------- /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 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /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.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: [UIApplication.LaunchOptionsKey: 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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/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 | CFBundleDisplayName 8 | Parse Video 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | parse_video 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/components/bottom_sheet.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class BottomSheetManage { 4 | Future showDownLoadBottomSheet( 5 | BuildContext context, List optionList) { 6 | return showModalBottomSheet( 7 | context: context, 8 | shape: const RoundedRectangleBorder( 9 | borderRadius: BorderRadius.only( 10 | topLeft: Radius.circular(25.0), 11 | topRight: Radius.circular(25.0), 12 | ), 13 | ), 14 | builder: (context) => StatefulBuilder( 15 | builder: (context, setState) => SafeArea( 16 | child: Column(mainAxisSize: MainAxisSize.min, children: optionList), 17 | ), 18 | ), 19 | ); 20 | } 21 | 22 | Future showNormalBottomSheet(BuildContext context, List optionList) { 23 | return showModalBottomSheet( 24 | context: context, 25 | shape: const RoundedRectangleBorder( 26 | borderRadius: BorderRadius.only( 27 | topLeft: Radius.circular(25.0), 28 | topRight: Radius.circular(25.0), 29 | ), 30 | ), 31 | builder: (BuildContext bc) { 32 | return SafeArea( 33 | child: Column(mainAxisSize: MainAxisSize.min, children: optionList), 34 | ); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/components/drawer_common_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 2 | 3 | class DrawerCommonPage extends StatefulWidget { 4 | final Widget page; 5 | const DrawerCommonPage({Key? key, required this.page}) : super(key: key); 6 | 7 | @override 8 | State createState() => _DrawerCommonPageState(); 9 | } 10 | 11 | class _DrawerCommonPageState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return NeumorphicTheme( 15 | themeMode: ThemeMode.light, 16 | theme: const NeumorphicThemeData( 17 | baseColor: Color(0xFFFFFFFF), 18 | lightSource: LightSource.topLeft, 19 | depth: 10, 20 | ), 21 | darkTheme: neumorphicDefaultDarkTheme.copyWith( 22 | defaultTextColor: Colors.white70), 23 | child: widget.page); 24 | } 25 | } -------------------------------------------------------------------------------- /lib/components/loading.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_spinkit/flutter_spinkit.dart'; 3 | 4 | class LoginLoading extends StatelessWidget { 5 | const LoginLoading({ 6 | Key? key, 7 | }) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Positioned( 12 | child: Container( 13 | width: double.infinity, 14 | height: double.infinity, 15 | color: Colors.black12.withOpacity(0.2), 16 | child: Center( 17 | child: Container( 18 | width: MediaQuery.of(context).size.width * 0.7 , 19 | height: MediaQuery.of(context).size.width / 5, 20 | decoration: BoxDecoration( 21 | borderRadius: BorderRadius.circular(5.0), 22 | color: Colors.black.withOpacity(0.9)), 23 | child: const Row( 24 | mainAxisAlignment: MainAxisAlignment.start, 25 | children: [ 26 | SizedBox( 27 | width: 30, 28 | ), 29 | SpinKitRing( 30 | color: Colors.white, 31 | lineWidth: 3, 32 | size: 30, 33 | ), 34 | SizedBox( 35 | width: 30, 36 | ), 37 | Text( 38 | '正在努力查找视频中...', 39 | style: TextStyle( 40 | fontSize: 14, 41 | color: Colors.white, 42 | fontWeight: FontWeight.w500), 43 | ) 44 | ], 45 | ), 46 | ), 47 | ), 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/components/nice_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | @immutable 4 | class NiceButton extends StatelessWidget { 5 | /// This is a builder class for a nice button 6 | /// 7 | /// Icon can be used to define the button design 8 | /// User can use Flutter built-in Icons or font-awesome flutter's Icon final bool mini; 9 | final IconData? icon; 10 | 11 | /// specify the color of the icon 12 | final Color iconColor; 13 | 14 | /// radius can be used to specify the button border radius 15 | final double radius; 16 | 17 | /// List of gradient colors to define the gradients 18 | final List gradientColors; 19 | 20 | /// This is the button's text 21 | final String? text; 22 | 23 | /// This is the color of the button's text 24 | final Color textColor; 25 | 26 | /// User can define the background color of the button 27 | final Color background; 28 | 29 | /// User can define the width of the button 30 | final double width; 31 | 32 | /// Here user can define what to do when the button is clicked or pressed 33 | final void Function()? onPressed; 34 | 35 | /// This is the elevation of the button 36 | final double elevation; 37 | 38 | /// This is the padding of the button 39 | final EdgeInsets padding; 40 | 41 | /// `mini` tag is used to switch from a full-width button to a small button 42 | final bool mini; 43 | 44 | /// This is the font size of the text 45 | final double fontSize; 46 | 47 | const NiceButton( 48 | {Key? key, 49 | this.mini = false, 50 | this.radius = 4.0, 51 | this.elevation = 1.8, 52 | this.textColor = Colors.white, 53 | this.iconColor = Colors.white, 54 | this.width = 62.0, 55 | this.padding = const EdgeInsets.all(2.0), 56 | @required this.onPressed, 57 | @required this.text, 58 | this.background = Colors.white, 59 | this.gradientColors = const [], 60 | this.icon, 61 | this.fontSize = 18.0}) 62 | : super(key: key); 63 | 64 | bool get existGradientColors => gradientColors.isNotEmpty; 65 | 66 | LinearGradient get linearGradient => existGradientColors 67 | ? LinearGradient( 68 | colors: gradientColors, 69 | begin: Alignment.topLeft, 70 | end: Alignment.topRight) 71 | : LinearGradient(colors: [background, background]); 72 | 73 | BoxDecoration get boxDecoration => BoxDecoration( 74 | gradient: linearGradient, 75 | borderRadius: BorderRadius.circular(radius), 76 | color: background); 77 | 78 | TextStyle get textStyle => TextStyle( 79 | fontFamily: 'Montserrat', 80 | color: textColor, 81 | fontSize: fontSize, 82 | fontWeight: FontWeight.bold); 83 | 84 | Widget createContainer(BuildContext context) => mini 85 | ? Container( 86 | decoration: boxDecoration, 87 | width: width, 88 | height: width, 89 | child: Icon(icon, color: iconColor), 90 | ) 91 | : Container( 92 | padding: padding, 93 | decoration: boxDecoration, 94 | constraints: BoxConstraints(maxWidth: width), 95 | child: Row( 96 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 97 | crossAxisAlignment: CrossAxisAlignment.center, 98 | children: [ 99 | Text( 100 | text!, 101 | textAlign: TextAlign.center, 102 | style: textStyle, 103 | ), 104 | if (icon != null) 105 | Icon( 106 | icon, 107 | color: Colors.white, 108 | ), 109 | ], 110 | ), 111 | ); 112 | 113 | @override 114 | Widget build(BuildContext context) { 115 | return TextButton( 116 | onPressed: onPressed, 117 | style: ButtonStyle( 118 | overlayColor: MaterialStateProperty.all(Colors.transparent), 119 | backgroundColor: MaterialStateProperty.all(background), 120 | padding: MaterialStateProperty.all(padding), 121 | shape: MaterialStateProperty.all( 122 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(radius))), 123 | elevation: MaterialStateProperty.all(elevation), 124 | ), 125 | child: createContainer(context), 126 | ); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /lib/components/simple_list_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 2 | 3 | class SimpleListTile extends StatelessWidget { 4 | const SimpleListTile({Key? key, this.title, this.onTap, this.leading, this.trailing}) : super(key: key); 5 | final String? title; 6 | final void Function()? onTap; 7 | final Widget? leading; 8 | final Widget? trailing; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Column( 13 | children: [ 14 | ListTile( 15 | title: Text( 16 | title!, 17 | style: const TextStyle(fontSize: 16), 18 | softWrap: false, 19 | overflow: TextOverflow.ellipsis, 20 | ), 21 | leading: leading, 22 | trailing: trailing, 23 | onTap: onTap, 24 | ), 25 | ], 26 | ); 27 | } 28 | } -------------------------------------------------------------------------------- /lib/components/task_list_item.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter_downloader/flutter_downloader.dart'; 3 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 4 | import 'package:parse_video/model/current_down_load.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | class TaskListTile extends StatefulWidget { 8 | final DownloadTask movie; 9 | final void Function()? onPressed; 10 | final Function refrish; 11 | const TaskListTile( 12 | {Key? key, 13 | required this.movie, 14 | required this.onPressed, 15 | required this.refrish}) 16 | : super(key: key); 17 | 18 | @override 19 | State createState() => TaskListTileState(); 20 | } 21 | 22 | class TaskListTileState extends State { 23 | String fileSize = ''; 24 | @override 25 | void initState() { 26 | super.initState(); 27 | getFileSize(widget.movie.status); 28 | } 29 | 30 | getFileSize(status) { 31 | if (status == DownloadTaskStatus.complete || 32 | status == DownloadTaskStatus.running || 33 | status == DownloadTaskStatus.paused) { 34 | var file = File(widget.movie.savedDir + Platform.pathSeparator + widget.movie.filename!); 35 | setState(() { 36 | fileSize = (file.lengthSync() / (1024 * 1024)).toStringAsFixed(2); 37 | }); 38 | } 39 | } 40 | 41 | Widget _buildDownLoadStatus() { 42 | DownloadTaskStatus? status; 43 | if (widget.movie.taskId == 44 | context.watch().downLoadAbleItem.id) { 45 | status = context.watch().downLoadAbleItem.status; 46 | getFileSize(status); 47 | if (context.watch().downLoadAbleItem.progress == 100) { 48 | widget.refrish(); 49 | } 50 | } else { 51 | status = widget.movie.status; 52 | } 53 | if (status == DownloadTaskStatus.running) { 54 | return SizedBox( 55 | width: 200, 56 | child: NeumorphicSlider( 57 | height: 2.0, 58 | min: 0.0, 59 | max: 100.0, 60 | value: widget.movie.taskId == 61 | context.watch().downLoadAbleItem.id 62 | ? context 63 | .watch() 64 | .downLoadAbleItem 65 | .progress 66 | .toDouble() 67 | : 0.1, 68 | ), 69 | ); 70 | } else if (status == DownloadTaskStatus.canceled) { 71 | return const Text('下载取消'); 72 | } else if (status == DownloadTaskStatus.complete) { 73 | return const Text('下载完成'); 74 | } else if (status == DownloadTaskStatus.failed) { 75 | return const Text('下载失败'); 76 | } else if (status == DownloadTaskStatus.paused) { 77 | return const Text('下载暂停'); 78 | } else if (status == DownloadTaskStatus.undefined) { 79 | return const Text('未知错误'); 80 | } else if (status == DownloadTaskStatus.enqueued) { 81 | return const Text('等待下载'); 82 | } else { 83 | return Container(); 84 | } 85 | } 86 | 87 | bool getConditions() { 88 | bool widgetFlag = false; 89 | bool downLoadFlag = false; 90 | DownloadTaskStatus widgetStatus = widget.movie.status; 91 | DownloadTaskStatus? downLoadStatus = 92 | context.watch().downLoadAbleItem.status; 93 | if ((widgetStatus == DownloadTaskStatus.complete || 94 | widgetStatus == DownloadTaskStatus.running || 95 | widgetStatus == DownloadTaskStatus.paused)) { 96 | widgetFlag = true; 97 | } 98 | if (widget.movie.taskId == 99 | context.watch().downLoadAbleItem.id) { 100 | if ((downLoadStatus == DownloadTaskStatus.complete || 101 | downLoadStatus == DownloadTaskStatus.running || 102 | downLoadStatus == DownloadTaskStatus.paused)) { 103 | downLoadFlag = true; 104 | } 105 | } 106 | 107 | return widgetFlag || downLoadFlag; 108 | } 109 | 110 | @override 111 | Widget build(BuildContext context) { 112 | return Column( 113 | children: [ 114 | Container( 115 | padding: const EdgeInsets.all(6.0), 116 | child: ListTile( 117 | title: Text( 118 | widget.movie.filename!, 119 | softWrap: false, 120 | ), 121 | subtitle: Column( 122 | mainAxisAlignment: MainAxisAlignment.start, 123 | crossAxisAlignment: CrossAxisAlignment.start, 124 | children: [ 125 | getConditions() 126 | ? Text( 127 | '$fileSize MB', 128 | softWrap: false, 129 | ) 130 | : Container(), 131 | _buildDownLoadStatus() 132 | ], 133 | ), 134 | onTap: widget.onPressed, 135 | ), 136 | ), 137 | ], 138 | ); 139 | } 140 | } 141 | 142 | class SimpleListTile extends StatelessWidget { 143 | final String title; 144 | final void Function()? onTap; 145 | final Widget? leading; 146 | final Widget? trailing; 147 | 148 | const SimpleListTile( 149 | {Key? key, 150 | required this.title, 151 | required this.onTap, 152 | this.leading, 153 | this.trailing}) 154 | : super(key: key); 155 | @override 156 | Widget build(BuildContext context) { 157 | return Column( 158 | children: [ 159 | ListTile( 160 | title: Text( 161 | title, 162 | style: const TextStyle(fontSize: 16), 163 | softWrap: false, 164 | overflow: TextOverflow.ellipsis, 165 | ), 166 | leading: leading, 167 | trailing: trailing, 168 | onTap: onTap, 169 | ), 170 | ], 171 | ); 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /lib/components/text_search_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 3 | import 'package:parse_video/components/nice_button.dart'; 4 | 5 | class TextSearchField extends StatefulWidget { 6 | final String? hint; 7 | final ValueChanged? onChanged; 8 | final ValueChanged? onSubmit; 9 | final Function? clear; 10 | const TextSearchField( 11 | {Key? key, 12 | @required this.hint, 13 | this.onChanged, 14 | this.onSubmit, 15 | this.clear}) 16 | : super(key: key); 17 | 18 | @override 19 | State createState() => TextSearchFieldState(); 20 | } 21 | 22 | class TextSearchFieldState extends State { 23 | late TextEditingController _controller; 24 | final double _height = 100.0; 25 | @override 26 | void initState() { 27 | _controller = TextEditingController(); 28 | super.initState(); 29 | } 30 | 31 | ///使用异步调用获取返回值 32 | getClipboardDatas() async { 33 | ClipboardData? clipboardData = await Clipboard.getData(Clipboard.kTextPlain); 34 | if (clipboardData != null) { 35 | setState(() { 36 | _controller.text = clipboardData.text!; 37 | widget.onChanged!(clipboardData.text ?? ''); 38 | _controller.selection = TextSelection.fromPosition(TextPosition( 39 | affinity: TextAffinity.downstream, 40 | offset: _controller.text.length)); 41 | }); 42 | } 43 | } 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | 48 | return Column( 49 | children: [ 50 | Row( 51 | crossAxisAlignment: CrossAxisAlignment.center, 52 | children: [ 53 | Container( 54 | width: MediaQuery.of(context).size.width - 100, 55 | padding: const EdgeInsets.symmetric(vertical: 20), 56 | height: _height, 57 | child: Neumorphic( 58 | margin: const EdgeInsets.only( 59 | left: 18, right: 18, top: 2, bottom: 4), 60 | style: NeumorphicStyle( 61 | color: Colors.white, 62 | depth: NeumorphicTheme.embossDepth(context), 63 | boxShape: const NeumorphicBoxShape.stadium(), 64 | ), 65 | padding: 66 | const EdgeInsets.symmetric(vertical: 2, horizontal: 18), 67 | child: Center( 68 | child: TextField( 69 | onChanged: widget.onChanged, 70 | controller: _controller, 71 | decoration: 72 | InputDecoration.collapsed(hintText: widget.hint), 73 | ), 74 | ), 75 | ), 76 | ), 77 | NiceButton( 78 | width: 60, 79 | elevation: 8.0, 80 | radius: 5.0, 81 | text: "搜索", 82 | fontSize: 12, 83 | padding: const EdgeInsets.symmetric(vertical: 2), 84 | background: const Color(0xff000000), 85 | onPressed: () { 86 | widget.onSubmit!(_controller.text); 87 | }, 88 | ), 89 | ], 90 | ), 91 | Wrap( 92 | spacing: 10.0, 93 | runSpacing: 10.0, 94 | children: [ 95 | NiceButton( 96 | width: MediaQuery.of(context).size.width / 3, 97 | radius: 52.0, 98 | text: "粘贴", 99 | fontSize: 12, 100 | background: const Color(0xff000000), 101 | onPressed: () { 102 | getClipboardDatas(); 103 | }, 104 | ), 105 | NiceButton( 106 | width: MediaQuery.of(context).size.width / 3, 107 | elevation: 8.0, 108 | radius: 52.0, 109 | text: "清空", 110 | fontSize: 12, 111 | background: const Color(0xff000000), 112 | onPressed: () { 113 | widget.clear!(); 114 | setState(() { 115 | _controller.clear(); 116 | }); 117 | }, 118 | ), 119 | ], 120 | ) 121 | ], 122 | ); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /lib/database/download_video_database.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:path/path.dart'; 3 | import 'package:sqflite/sqflite.dart'; 4 | 5 | class DataBaseDownLoadListProvider { 6 | DataBaseDownLoadListProvider._(); 7 | static const table = 'download_video_database'; 8 | static final DataBaseDownLoadListProvider db = 9 | DataBaseDownLoadListProvider._(); 10 | static Database? _database; 11 | Future get dataBase async { 12 | if (_database != null) { 13 | return _database!; 14 | } 15 | _database = await initializeDB(); 16 | return _database!; 17 | } 18 | 19 | initializeDB() async { 20 | var databasesPath = await getDatabasesPath(); 21 | String path = join(databasesPath, "download_play_list.db"); 22 | return await openDatabase( 23 | path, 24 | version: 1, 25 | readOnly: false, 26 | onCreate: (Database db, int version) async { 27 | await db.execute( 28 | "CREATE TABLE $table (" 29 | "id INTEGER PRIMARY KEY AUTOINCREMENT," 30 | "movie_name VARCHAR ( 256 )," 31 | "task_id VARCHAR ( 256 )" 32 | ")", 33 | ); 34 | }, 35 | ); 36 | } 37 | 38 | Future insetDB({ 39 | required String taskId, 40 | required String movieName, 41 | }) async { 42 | Database db = await dataBase; 43 | await db.insert(table, { 44 | 'movie_name': movieName, 45 | 'task_id': taskId, 46 | }); 47 | } 48 | 49 | Future> queryAll() async { 50 | var db = await dataBase; 51 | var result = await db.query(table); 52 | List list = result.isNotEmpty 53 | ? result.map((movie) => DwonloadDBInfoMation.formMap(movie)).toList() 54 | : []; 55 | return list; 56 | } 57 | 58 | Future queryWithFileName(String fileName) async { 59 | var db = await dataBase; 60 | var result = await db.rawQuery( 61 | "SELECT * FROM $table WHERE task_id='${fileName.toString()}'"); 62 | List list = result.isNotEmpty 63 | ? result.map((movie) => DwonloadDBInfoMation.formMap(movie)).toList() 64 | : []; 65 | if (list.isEmpty) { 66 | return false; 67 | } 68 | return true; 69 | } 70 | Future deleteMovieWithTaskId(String taskId) async { 71 | var db = await dataBase; 72 | var result = await db.rawQuery( 73 | "SELECT * FROM $table WHERE task_id='$taskId'"); 74 | List list = result.isNotEmpty ? result.map((movie) => DwonloadDBInfoMation.formMap(movie)).toList() : []; 75 | if(list.isNotEmpty){ 76 | for (var item in list) { 77 | int movieId = item.id; 78 | await deleteMovieWithId(movieId); 79 | } 80 | return true; 81 | } 82 | return false; 83 | } 84 | Future deleteMovieWithId(int movieId) async { 85 | var db = await dataBase; 86 | await db.rawQuery("DELETE FROM $table WHERE id=$movieId"); 87 | } 88 | } 89 | 90 | class DwonloadDBInfoMation { 91 | int id; 92 | String taskId; 93 | String movieName; 94 | DwonloadDBInfoMation( 95 | {required this.id, required this.taskId, required this.movieName}); 96 | 97 | factory DwonloadDBInfoMation.formMap(Map json) => 98 | DwonloadDBInfoMation( 99 | id: json['id'], 100 | movieName: json['movie_name'], 101 | taskId: json['task_id'], 102 | ); 103 | 104 | Map toMap() => 105 | {'id': id, 'movie_name': movieName, 'task_id': taskId}; 106 | } 107 | -------------------------------------------------------------------------------- /lib/database/ready_to_down_database.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:path/path.dart'; 3 | import 'package:sqflite/sqflite.dart'; 4 | 5 | // 注册时模拟表 6 | class DataBaseReadyDownLoadProvider { 7 | DataBaseReadyDownLoadProvider._(); 8 | static const table = 'ready_to_down_database'; 9 | static final DataBaseReadyDownLoadProvider db = 10 | DataBaseReadyDownLoadProvider._(); 11 | static Database? _database; 12 | Future get dataBase async { 13 | if (_database != null) { 14 | return _database!; 15 | } 16 | _database = await initializeDB(); 17 | return _database!; 18 | } 19 | 20 | initializeDB() async { 21 | var databasesPath = await getDatabasesPath(); 22 | String path = join(databasesPath, "ready_to_download_list.db"); 23 | return await openDatabase( 24 | path, 25 | version: 1, 26 | onOpen: (db) {}, 27 | onCreate: (Database db, int version) async { 28 | await db.execute( 29 | "CREATE TABLE $table (" 30 | "id INTEGER PRIMARY KEY AUTOINCREMENT," 31 | "url VARCHAR ( 256 )" 32 | ")", 33 | ); 34 | }, 35 | ); 36 | } 37 | 38 | Future insetDB({ 39 | required String url, 40 | }) async { 41 | Database db = await dataBase; 42 | await db.insert(table, { 43 | 'url': url, 44 | }); 45 | } 46 | 47 | Future> queryAll() async { 48 | var db = await dataBase; 49 | var result = await db.query(table); 50 | List list = result.isNotEmpty 51 | ? result.map((movie) => ReadyDownLoad.formMap(movie)).toList() 52 | : []; 53 | return list; 54 | } 55 | 56 | Future queryWithUrl(String url) async { 57 | var db = await dataBase; 58 | var result = 59 | await db.rawQuery("SELECT * FROM $table WHERE url='${url.toString()}'"); 60 | List list = result.isNotEmpty 61 | ? result.map((movie) => ReadyDownLoad.formMap(movie)).toList() 62 | : []; 63 | if (list.isEmpty) { 64 | return false; 65 | } 66 | return true; 67 | } 68 | 69 | Future deleteMovieWithId(int movieId) async { 70 | var db = await dataBase; 71 | await db.rawQuery("DELETE FROM $table WHERE id=$movieId"); 72 | } 73 | } 74 | 75 | class ReadyDownLoad { 76 | int id; 77 | String url; 78 | ReadyDownLoad({required this.id, required this.url}); 79 | 80 | factory ReadyDownLoad.formMap(Map json) => ReadyDownLoad( 81 | id: json['id'], 82 | url: json['url'], 83 | ); 84 | 85 | Map toMap() => {'id': id, 'url': url}; 86 | } 87 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:parse_video/model/current_down_load.dart'; 3 | import 'package:provider/provider.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:flutter_downloader/flutter_downloader.dart'; 6 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 7 | import 'package:parse_video/page/home_page.dart'; 8 | 9 | Future main() async { 10 | WidgetsFlutterBinding.ensureInitialized(); 11 | await FlutterDownloader.initialize(debug: false); 12 | if (Platform.isAndroid) { 13 | SystemUiOverlayStyle systemUiOverlayStyle = 14 | const SystemUiOverlayStyle(statusBarColor: Colors.black); 15 | SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); 16 | SystemChrome.setPreferredOrientations([ 17 | DeviceOrientation.portraitUp, 18 | ]); 19 | } 20 | runApp(MultiProvider(providers: [ 21 | ChangeNotifierProvider(create: (_) => CurrentDownLoad()), 22 | ], child: const MyApp())); 23 | } 24 | 25 | class MyApp extends StatelessWidget { 26 | const MyApp({Key? key}) : super(key: key); 27 | 28 | // This widget is the root of your application. 29 | @override 30 | Widget build(BuildContext context) { 31 | return const NeumorphicApp( 32 | debugShowCheckedModeBanner: false, 33 | title: '去水印视频下载', 34 | themeMode: ThemeMode.light, 35 | theme: NeumorphicThemeData( 36 | baseColor: Color(0xFFFFFFFF), 37 | lightSource: LightSource.topLeft, 38 | depth: 10, 39 | ), 40 | darkTheme: NeumorphicThemeData( 41 | baseColor: Color(0xFF3E3E3E), 42 | lightSource: LightSource.topLeft, 43 | depth: 6, 44 | ), 45 | home: HomePage(), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/model/current_down_load.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_downloader/flutter_downloader.dart'; 3 | 4 | class CurrentDownLoad with ChangeNotifier { 5 | DownLoadAbleItem _downLoadAbleItem = DownLoadAbleItem(); 6 | DownLoadAbleItem get downLoadAbleItem => _downLoadAbleItem; 7 | void setDownLoadAbleItem(DownLoadAbleItem downLoadAbleItem) { 8 | _downLoadAbleItem = downLoadAbleItem; 9 | notifyListeners(); 10 | } 11 | } 12 | 13 | class DownLoadAbleItem { 14 | final int progress; 15 | final String? id; 16 | final DownloadTaskStatus? status; 17 | DownLoadAbleItem({this.progress = 0, this.id, this.status}); 18 | } 19 | -------------------------------------------------------------------------------- /lib/page/download_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flashy_tab_bar2/flashy_tab_bar2.dart'; 3 | import 'package:flutter_downloader/flutter_downloader.dart'; 4 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 5 | import 'package:parse_video/components/bottom_sheet.dart'; 6 | import 'package:parse_video/components/drawer_common_page.dart'; 7 | import 'package:parse_video/components/loading.dart'; 8 | import 'package:parse_video/components/task_list_item.dart'; 9 | import 'package:parse_video/database/download_video_database.dart'; 10 | import 'package:parse_video/plugin/download.dart'; 11 | import 'package:parse_video/plugin/flutter_toast_manage.dart'; 12 | 13 | class DownloadPage extends StatefulWidget { 14 | const DownloadPage({Key? key}) : super(key: key); 15 | 16 | @override 17 | State createState() => _DownloadPageState(); 18 | } 19 | 20 | class _DownloadPageState extends State { 21 | @override 22 | Widget build(BuildContext context) { 23 | return DrawerCommonPage( 24 | page: _Page(), 25 | ); 26 | } 27 | } 28 | 29 | class _Page extends StatefulWidget { 30 | @override 31 | __PageState createState() => __PageState(); 32 | } 33 | 34 | class __PageState extends State<_Page> { 35 | List tasksList = []; 36 | int _selectedIndex = 0; 37 | bool showLoading = false; 38 | List tasks = []; 39 | Widget _buildTopBar(BuildContext context) { 40 | return Container( 41 | decoration: const BoxDecoration(color: Colors.black), 42 | padding: const EdgeInsets.symmetric(horizontal: 16), 43 | child: Stack( 44 | alignment: Alignment.center, 45 | children: [ 46 | Align( 47 | alignment: Alignment.centerLeft, 48 | child: IconButton( 49 | icon: const Icon( 50 | Icons.navigate_before, 51 | color: Colors.white, 52 | ), 53 | onPressed: () { 54 | Navigator.of(context).pop(); 55 | }, 56 | )), 57 | Align( 58 | alignment: Alignment.center, 59 | child: SizedBox( 60 | width: 150, 61 | child: FlashyTabBar( 62 | backgroundColor: Colors.black, 63 | animationCurve: Curves.linear, 64 | selectedIndex: _selectedIndex, 65 | showElevation: false, // use this to remove appBar's elevation 66 | onItemSelected: (index) => loadTasks(index), 67 | items: [ 68 | FlashyTabBarItem( 69 | activeColor: Colors.white, 70 | icon: const Icon( 71 | Icons.cloud_download, 72 | color: Colors.white, 73 | ), 74 | title: const Text( 75 | '下载中', 76 | style: TextStyle(color: Colors.white), 77 | ), 78 | ), 79 | FlashyTabBarItem( 80 | activeColor: Colors.white, 81 | icon: const Icon( 82 | Icons.queue_music, 83 | color: Colors.white, 84 | ), 85 | title: const Text( 86 | '已下载', 87 | style: TextStyle(color: Colors.white), 88 | ), 89 | ), 90 | ], 91 | ), 92 | ), 93 | ), 94 | ], 95 | ), 96 | ); 97 | } 98 | 99 | ///验证URL 100 | bool isUrl(String value) { 101 | final urlRegExp = RegExp( 102 | r"((https?:www\.)|(https?:\/\/)|(www\.))[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(\/[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)?"); 103 | List urlMatches = 104 | urlRegExp.allMatches(value).map((m) => m.group(0)).toList(); 105 | return urlMatches.isNotEmpty; 106 | } 107 | 108 | 109 | _startDownLoad(DownloadTask movie) async { 110 | String? fileName = movie.filename; 111 | await DataBaseDownLoadListProvider.db.deleteMovieWithTaskId(movie.taskId); 112 | await DownLoadInstance().startDownLoad(movie.url, fileName!,fullFileName: true); 113 | FlutterToastManage().showToast("正在下载中~"); 114 | loadTasks(_selectedIndex); 115 | } 116 | 117 | @override 118 | void initState() { 119 | loadTasks(_selectedIndex); 120 | super.initState(); 121 | } 122 | 123 | loadTasks(int index) async { 124 | String query = ''; 125 | if (index == 0) { 126 | query = 'SELECT * FROM task WHERE status!=3'; 127 | } else { 128 | query = 'SELECT * FROM task WHERE status=3'; 129 | } 130 | tasks = (await FlutterDownloader.loadTasksWithRawQuery(query: query))!; 131 | List taskTemp = []; 132 | if (tasks.isNotEmpty) { 133 | for (var i = 0; i < tasks.length; i++) { 134 | File file = File( 135 | tasks[i].savedDir + Platform.pathSeparator + tasks[i].filename!); 136 | bool exits = await file.exists(); 137 | if (exits) { 138 | taskTemp.add(tasks[i]); 139 | } else { 140 | DownLoadInstance().delete(tasks[i].taskId); 141 | } 142 | } 143 | tasksList = taskTemp 144 | .map((DownloadTask movie) => TaskListTile( 145 | movie: movie, 146 | refrish: () { 147 | loadTasks(_selectedIndex); 148 | }, 149 | onPressed: () { 150 | showBottomOperateSheet(movie); 151 | }, 152 | )) 153 | .toList(); 154 | } else { 155 | tasksList = []; 156 | } 157 | 158 | setState(() { 159 | _selectedIndex = index; 160 | }); 161 | } 162 | 163 | showBottomOperateSheet(DownloadTask movie) async { 164 | if (_selectedIndex == 0) { 165 | await BottomSheetManage().showDownLoadBottomSheet( 166 | context, 167 | [ 168 | SimpleListTile( 169 | title: '取消下载', 170 | onTap: () { 171 | Navigator.pop(context); 172 | setState(() {}); 173 | DownLoadInstance().cancel(movie.taskId); 174 | }, 175 | ), 176 | SimpleListTile( 177 | title: '暂停下载', 178 | onTap: () { 179 | Navigator.pop(context); 180 | setState(() {}); 181 | DownLoadInstance().pause(movie.taskId); 182 | }, 183 | ), 184 | SimpleListTile( 185 | title: '恢复下载', 186 | onTap: () { 187 | Navigator.pop(context); 188 | setState(() {}); 189 | DownLoadInstance() 190 | .resume(movie.taskId) 191 | .then((value) => {loadTasks(_selectedIndex)}); 192 | }, 193 | ), 194 | SimpleListTile( 195 | title: '重试', 196 | onTap: () { 197 | Navigator.pop(context); 198 | setState(() {}); 199 | DownLoadInstance() 200 | .remove(movie.taskId) 201 | .then((_) => {_startDownLoad(movie)}); 202 | }, 203 | ), 204 | SimpleListTile( 205 | title: '删除', 206 | onTap: () { 207 | Navigator.pop(context); 208 | setState(() {}); 209 | DownLoadInstance().remove(movie.taskId); 210 | }, 211 | ), 212 | ], 213 | ); 214 | } 215 | } 216 | 217 | @override 218 | Widget build(BuildContext context) { 219 | return Scaffold( 220 | body: Stack( 221 | children: [ 222 | SafeArea( 223 | child: Container( 224 | color: Colors.black, 225 | child: Column( 226 | children: [ 227 | _buildTopBar(context), 228 | Expanded( 229 | child: Container( 230 | decoration: const BoxDecoration( 231 | color: Colors.white, 232 | //设置四周圆角 角度 233 | borderRadius: BorderRadius.only( 234 | topLeft: Radius.circular(20.0), 235 | topRight: Radius.circular(20.0)), 236 | ), 237 | child: ListView(children: tasksList), 238 | ), 239 | ), 240 | ], 241 | ), 242 | ), 243 | ), 244 | showLoading ? const LoginLoading() : Container() 245 | ], 246 | ), 247 | ); 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /lib/page/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:isolate'; 3 | import 'dart:ui'; 4 | 5 | import 'package:dio/dio.dart'; 6 | import 'package:flutter_downloader/flutter_downloader.dart'; 7 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 8 | import 'package:parse_video/components/loading.dart'; 9 | import 'package:parse_video/components/nice_button.dart'; 10 | import 'package:parse_video/components/simple_list_tile.dart'; 11 | import 'package:parse_video/components/text_search_field.dart'; 12 | import 'package:parse_video/database/download_video_database.dart'; 13 | import 'package:parse_video/database/ready_to_down_database.dart'; 14 | import 'package:parse_video/model/current_down_load.dart'; 15 | import 'package:parse_video/page/download_page.dart'; 16 | import 'package:parse_video/page/local_video_page.dart'; 17 | import 'package:parse_video/page/ready_to_down_page.dart'; 18 | import 'package:parse_video/page/video_page.dart'; 19 | import 'package:parse_video/plugin/download.dart'; 20 | import 'package:parse_video/plugin/flutter_toast_manage.dart'; 21 | import 'package:parse_video/plugin/http_manage.dart'; 22 | import 'package:provider/provider.dart'; 23 | 24 | class HomePage extends StatefulWidget { 25 | const HomePage({Key? key}) : super(key: key); 26 | 27 | @override 28 | State createState() => _HomePageState(); 29 | } 30 | 31 | class _HomePageState extends State { 32 | final GlobalKey _scaffoldKey = GlobalKey(); 33 | String result = ''; 34 | String _videoLink = ''; 35 | final ReceivePort _port = ReceivePort(); 36 | bool showLoading = false; 37 | late DateTime lastPopTime = DateTime.now().subtract(const Duration(days: 1)); 38 | _openRoute({required Widget page}) { 39 | //打开B路由 40 | Navigator.push(context, PageRouteBuilder(pageBuilder: (BuildContext context, 41 | Animation animation, Animation secondaryAnimation) { 42 | return FadeTransition( 43 | opacity: animation, 44 | child: page, 45 | ); 46 | })); 47 | } 48 | 49 | _onTextSearchFiledChanged(String text) { 50 | final urlRegExp = RegExp( 51 | r"((https?:www\.)|(https?:\/\/)|(www\.))[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(\/[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)?"); 52 | List urlMatches = 53 | urlRegExp.allMatches(text).map((m) => m.group(0)).toList(); 54 | if (urlMatches.isNotEmpty) { 55 | result = urlMatches.first!; 56 | } 57 | } 58 | 59 | _onTextSearchFiledSubmited(String text) { 60 | if (DateTime.now().difference(lastPopTime) > const Duration(seconds: 2)) { 61 | lastPopTime = DateTime.now(); 62 | _futureGetLink(text); 63 | } else { 64 | lastPopTime = DateTime.now(); 65 | } 66 | } 67 | 68 | ///验证URL 69 | bool isUrl(String value) { 70 | final urlRegExp = RegExp( 71 | r"((https?:www\.)|(https?:\/\/)|(www\.))[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(\/[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)?"); 72 | List urlMatches = 73 | urlRegExp.allMatches(value).map((m) => m.group(0)).toList(); 74 | return urlMatches.isNotEmpty; 75 | } 76 | 77 | Future _futureGetLink(String url) async { 78 | FocusScope.of(context).requestFocus(FocusNode()); // 获取焦点 79 | if (url.isEmpty) { 80 | FlutterToastManage().showToast("请输入网址~"); 81 | return; 82 | } 83 | bool validate = isUrl(url); 84 | if (!validate) { 85 | FlutterToastManage().showToast("请输入正确的网址哦~"); 86 | return; 87 | } 88 | final urlRegExp = RegExp( 89 | r"((https?:www\.)|(https?:\/\/)|(www\.))[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(\/[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)?"); 90 | List urlMatches = 91 | urlRegExp.allMatches(url).map((m) => m.group(0)).toList(); 92 | setState(() { 93 | showLoading = true; 94 | }); 95 | Response? response = 96 | await HttpManager().get('video/', data: {'url': urlMatches.first}); 97 | setState(() { 98 | showLoading = false; 99 | result = urlMatches.first ?? ''; 100 | }); 101 | if (response != null) { 102 | var responseData = jsonDecode(response.data); 103 | if (responseData['code'] == 200) { 104 | _videoLink = responseData['data']['url']; 105 | FlutterToastManage().showToast("已找到视频,您可选择播放或者下载视频"); 106 | } else { 107 | FlutterToastManage().showToast(responseData['msg']); 108 | } 109 | } 110 | } 111 | 112 | _startDownLoad() async { 113 | if (_videoLink.isEmpty) { 114 | FlutterToastManage().showToast("请先搜索下载视频~"); 115 | return; 116 | } 117 | var str = result.split('/'); 118 | Iterable urlArr = str.where((item) { 119 | return item.isNotEmpty; 120 | }); 121 | 122 | String fileName = urlArr.last; 123 | bool hasDownLoad = await DataBaseDownLoadListProvider.db 124 | .queryWithFileName('$fileName.mp4'); 125 | if (hasDownLoad) { 126 | FlutterToastManage().showToast("已经下载过该视频了哦~"); 127 | return; 128 | } 129 | DownLoadInstance().startDownLoad(_videoLink, fileName); 130 | } 131 | 132 | _addVideoToReadyDownload() async { 133 | if (result.isEmpty) { 134 | FlutterToastManage().showToast("请输入视频链接~"); 135 | return; 136 | } 137 | bool hasadded = await DataBaseReadyDownLoadProvider.db.queryWithUrl(result); 138 | if (!hasadded) { 139 | await DataBaseReadyDownLoadProvider.db.insetDB(url: result); 140 | FlutterToastManage().showToast("已添加到待下载列表了~"); 141 | } else { 142 | FlutterToastManage().showToast("已经添加过了~"); 143 | } 144 | } 145 | 146 | @pragma('vm:entry-point') 147 | static void downloadCallback( 148 | String id, int status, int progress) { 149 | final SendPort? send = 150 | IsolateNameServer.lookupPortByName('downloader_send_port'); 151 | send?.send([id, status, progress]); 152 | } 153 | 154 | _portListen() { 155 | IsolateNameServer.registerPortWithName( 156 | _port.sendPort, 'downloader_send_port'); 157 | _port.listen((dynamic data) { 158 | String id = data[0]; 159 | DownloadTaskStatus status = data[1]; 160 | int progress = data[2]; 161 | context.read().setDownLoadAbleItem(DownLoadAbleItem(id: id, progress: progress, status: status)); 162 | }); 163 | FlutterDownloader.registerCallback(downloadCallback); 164 | } 165 | 166 | Future _onBackPressed() async { 167 | if (_scaffoldKey.currentState?.isDrawerOpen ?? false) { 168 | Navigator.of(context).pop(); 169 | } 170 | return await showDialog( 171 | context: context, 172 | builder: (context) => AlertDialog( 173 | shape: const RoundedRectangleBorder( 174 | borderRadius: BorderRadius.all(Radius.circular(10.0))), 175 | contentPadding: const EdgeInsets.only(top: 10.0), 176 | title: const Text('确定退出程序吗?'), 177 | actions: [ 178 | TextButton( 179 | child: 180 | const Text('暂不', style: TextStyle(color: Colors.black)), 181 | onPressed: () { 182 | Navigator.pop(context, false); 183 | }, 184 | ), 185 | TextButton( 186 | child: const Text( 187 | '确定', 188 | style: TextStyle(color: Colors.red), 189 | ), 190 | onPressed: () { 191 | Navigator.pop(context, true); 192 | }), 193 | ], 194 | )); 195 | } 196 | 197 | @override 198 | void initState() { 199 | DownLoadInstance().prepare(); 200 | _portListen(); 201 | super.initState(); 202 | } 203 | 204 | @override 205 | void dispose() { 206 | super.dispose(); 207 | } 208 | 209 | @override 210 | Widget build(BuildContext context) { 211 | return WillPopScope( 212 | onWillPop: _onBackPressed, 213 | child: Scaffold( 214 | key: _scaffoldKey, 215 | appBar: AppBar( 216 | backgroundColor: const Color(0xFF000000), 217 | actionsIconTheme: NeumorphicTheme.currentTheme(context).iconTheme, 218 | leading: IconButton( 219 | icon: NeumorphicIcon(Icons.menu), 220 | onPressed: () { 221 | _scaffoldKey.currentState?.openDrawer(); 222 | }, 223 | ), 224 | title: NeumorphicText( 225 | "去水印视频下载", 226 | style: const NeumorphicStyle( 227 | depth: 4, //customize depth here 228 | color: Colors.white, //customize color here 229 | ), 230 | textStyle: NeumorphicTextStyle( 231 | fontSize: 16, //customize size here 232 | ), 233 | ), 234 | ), 235 | drawer: Drawer( 236 | child: Column( 237 | children: [ 238 | const UserAccountsDrawerHeader( 239 | decoration: BoxDecoration( 240 | image: DecorationImage( 241 | image: AssetImage("assets/2.png"), fit: BoxFit.cover)), 242 | accountEmail: Text(''), 243 | accountName: Text(''), 244 | ), 245 | SimpleListTile( 246 | title: '待下载列表', 247 | trailing: const Icon(Icons.chevron_right), 248 | onTap: () { 249 | _openRoute(page: const ReadyToDownPage()); 250 | }, 251 | ), 252 | SimpleListTile( 253 | title: '本地视频', 254 | trailing: const Icon(Icons.chevron_right), 255 | onTap: () { 256 | _openRoute(page: const LocalVideoPage()); 257 | }, 258 | ), 259 | SimpleListTile( 260 | title: '我的下载', 261 | trailing: const Icon(Icons.chevron_right), 262 | onTap: () { 263 | _openRoute(page: const DownloadPage()); 264 | }, 265 | ) 266 | ], 267 | ), 268 | ), 269 | body: Container( 270 | decoration: const BoxDecoration( 271 | color: Colors.black, 272 | ), 273 | child: Container( 274 | width: double.maxFinite, 275 | decoration: const BoxDecoration( 276 | color: Colors.white, 277 | //设置四周圆角 角度 278 | borderRadius: BorderRadius.only( 279 | topLeft: Radius.circular(20.0), 280 | topRight: Radius.circular(20.0)), 281 | ), 282 | child: Stack( 283 | children: [ 284 | ListView( 285 | children: [ 286 | const SizedBox( 287 | height: 20, 288 | ), 289 | TextSearchField( 290 | hint: "请输入视频链接", 291 | onChanged: (text) { 292 | _onTextSearchFiledChanged(text); 293 | }, 294 | onSubmit: (text) { 295 | _onTextSearchFiledSubmited(text); 296 | }, 297 | clear: () {}, 298 | ), 299 | const SizedBox( 300 | height: 10, 301 | ), 302 | Column( 303 | children: [ 304 | Wrap( 305 | spacing: 10.0, 306 | runSpacing: 10.0, 307 | children: [ 308 | NiceButton( 309 | width: MediaQuery.of(context).size.width / 3, 310 | elevation: 8.0, 311 | radius: 52.0, 312 | text: "下载", 313 | fontSize: 12, 314 | background: const Color(0xff000000), 315 | onPressed: () { 316 | _startDownLoad(); 317 | }, 318 | ), 319 | NiceButton( 320 | width: MediaQuery.of(context).size.width / 3, 321 | elevation: 8.0, 322 | radius: 52.0, 323 | text: "播放", 324 | fontSize: 12, 325 | background: const Color(0xff000000), 326 | onPressed: () { 327 | if (_videoLink.isEmpty) { 328 | FlutterToastManage().showToast("请先搜索下载视频~"); 329 | return; 330 | } 331 | _openRoute(page: VideoScreen(url: _videoLink)); 332 | }, 333 | ), 334 | NiceButton( 335 | width: MediaQuery.of(context).size.width / 3, 336 | elevation: 8.0, 337 | radius: 52.0, 338 | fontSize: 12, 339 | text: "添加到待下载", 340 | background: const Color(0xff000000), 341 | onPressed: () { 342 | _addVideoToReadyDownload(); 343 | }, 344 | ), 345 | ], 346 | ), 347 | ], 348 | ), 349 | Container( 350 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 351 | child: const Column( 352 | mainAxisAlignment: MainAxisAlignment.start, 353 | crossAxisAlignment: CrossAxisAlignment.start, 354 | children: [ 355 | SizedBox( 356 | height: 20, 357 | ), 358 | Text( 359 | '抖音/皮皮虾/火山/微视/微博/绿洲/最右/轻视频/instagram/哔哩哔哩/快手/全民小视频/皮皮搞笑/全民k歌/巴塞电影/陌陌/Before避风/开眼/Vue Vlog/小咖秀/西瓜视频/逗拍/虎牙/6间房/新片场/Acfun/美拍', 360 | style: TextStyle( 361 | fontSize: 14, 362 | ), 363 | ), 364 | ], 365 | ), 366 | ) 367 | ], 368 | ), 369 | showLoading ? const LoginLoading() : Container() 370 | ], 371 | ), 372 | ), 373 | ), 374 | ), 375 | ); 376 | } 377 | } 378 | -------------------------------------------------------------------------------- /lib/page/local_video_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:android_path_provider/android_path_provider.dart'; 4 | import 'package:awesome_dialog/awesome_dialog.dart'; 5 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 6 | import 'package:parse_video/components/drawer_common_page.dart'; 7 | import 'package:parse_video/components/simple_list_tile.dart'; 8 | import 'package:parse_video/database/download_video_database.dart'; 9 | import 'package:parse_video/page/video_page.dart'; 10 | import 'package:parse_video/plugin/download.dart'; 11 | import 'package:share_plus/share_plus.dart'; 12 | 13 | class LocalVideoPage extends StatefulWidget { 14 | const LocalVideoPage({Key? key}) : super(key: key); 15 | 16 | @override 17 | State createState() => _LocalVideoPageState(); 18 | } 19 | 20 | class _LocalVideoPageState extends State { 21 | @override 22 | Widget build(BuildContext context) { 23 | return DrawerCommonPage( 24 | page: _Page(), 25 | ); 26 | } 27 | } 28 | 29 | class _Page extends StatefulWidget { 30 | @override 31 | __PageState createState() => __PageState(); 32 | } 33 | 34 | class __PageState extends State<_Page> { 35 | List playList = []; 36 | List allLocalFiles = []; 37 | Widget _buildTopBar(BuildContext context) { 38 | return Container( 39 | decoration: const BoxDecoration(color: Colors.black), 40 | padding: const EdgeInsets.symmetric(horizontal: 16), 41 | child: Stack( 42 | alignment: Alignment.center, 43 | children: [ 44 | Align( 45 | alignment: Alignment.centerLeft, 46 | child: IconButton( 47 | icon: const Icon( 48 | Icons.navigate_before, 49 | color: Colors.white, 50 | ), 51 | onPressed: () { 52 | Navigator.of(context).pop(); 53 | }, 54 | )), 55 | const Align( 56 | alignment: Alignment.center, 57 | child: Text( 58 | '本地视频', 59 | style: TextStyle(color: Colors.white, fontSize: 20), 60 | ), 61 | ), 62 | ], 63 | ), 64 | ); 65 | } 66 | 67 | @override 68 | void initState() { 69 | super.initState(); 70 | _getLocalVideos(); 71 | } 72 | 73 | _openRoute({required Widget page}) { 74 | //打开B路由 75 | Navigator.push(context, PageRouteBuilder(pageBuilder: (BuildContext context, 76 | Animation animation, Animation secondaryAnimation) { 77 | return FadeTransition( 78 | opacity: animation, 79 | child: page, 80 | ); 81 | })); 82 | } 83 | 84 | _deleteLocalFile(DwonloadDBInfoMation video) async { 85 | await DataBaseDownLoadListProvider.db.deleteMovieWithId(video.id); 86 | await DownLoadInstance().delete(video.taskId); 87 | _getLocalVideos(); 88 | } 89 | 90 | void _playLocalFile(DwonloadDBInfoMation video) async { 91 | String moviesPath = await AndroidPathProvider.moviesPath; 92 | String localPath = '$moviesPath${Platform.pathSeparator}Downloads${Platform.pathSeparator}${video.movieName}'; 93 | _openRoute(page: VideoScreen(url: localPath)); 94 | } 95 | _shareVideo(DwonloadDBInfoMation video) async{ 96 | String moviesPath = await AndroidPathProvider.moviesPath; 97 | String localPath = '$moviesPath${Platform.pathSeparator}Downloads${Platform.pathSeparator}${video.movieName}'; 98 | Share.shareXFiles ([XFile(localPath)]); 99 | } 100 | _getLocalVideos() async { 101 | final List playDownLoadList = 102 | await DataBaseDownLoadListProvider.db.queryAll(); 103 | allLocalFiles = playDownLoadList; 104 | var tempList = playDownLoadList.map((video) { 105 | return SimpleListTile( 106 | title: video.movieName, 107 | trailing: Row( 108 | mainAxisSize: MainAxisSize.min, 109 | children: [ 110 | IconButton( 111 | icon: const Icon(Icons.delete_outline), 112 | onPressed: () { 113 | _showDeleteDialog(video); 114 | }), 115 | IconButton( 116 | icon: const Icon(Icons.play_circle_outline), 117 | onPressed: () { 118 | _playLocalFile(video); 119 | }), 120 | IconButton( 121 | icon: const Icon(Icons.share), 122 | onPressed: () { 123 | _shareVideo(video); 124 | }), 125 | ], 126 | ), 127 | ); 128 | }).toList(); 129 | 130 | setState(() { 131 | playList = tempList; 132 | }); 133 | } 134 | 135 | Future _showDeleteDialog(DwonloadDBInfoMation video) async { 136 | AwesomeDialog( 137 | context: context, 138 | animType: AnimType.scale, 139 | dialogType: DialogType.noHeader, 140 | body: Column( 141 | children: [ 142 | const SimpleListTile( 143 | title: '确定删除该视频吗?', 144 | onTap: null, 145 | ), 146 | Row(mainAxisAlignment: MainAxisAlignment.end, children: [ 147 | SizedBox( 148 | width: 60, 149 | child: TextButton( 150 | onPressed: () { 151 | Navigator.of(context).pop(); 152 | }, 153 | child: const Text('取消')), 154 | ), 155 | SizedBox( 156 | width: 60, 157 | child: TextButton( 158 | onPressed: () { 159 | _deleteLocalFile(video); 160 | Navigator.of(context).pop(); 161 | }, 162 | child: const Text('确定')), 163 | ), 164 | ]) 165 | ], 166 | ), 167 | ).show(); 168 | } 169 | 170 | @override 171 | Widget build(BuildContext context) { 172 | return Scaffold( 173 | body: SafeArea( 174 | child: NeumorphicBackground( 175 | child: Column( 176 | children: [ 177 | _buildTopBar(context), 178 | Expanded( 179 | child: Container( 180 | decoration: const BoxDecoration( 181 | color: Colors.black, 182 | ), 183 | child: Container( 184 | decoration: const BoxDecoration( 185 | color: Colors.white, 186 | //设置四周圆角 角度 187 | borderRadius: BorderRadius.only( 188 | topLeft: Radius.circular(20.0), 189 | topRight: Radius.circular(20.0)), 190 | ), 191 | child: ListView( 192 | children: 193 | ListTile.divideTiles(tiles: playList, context: context) 194 | .toList(), 195 | ), 196 | ), 197 | )), 198 | ], 199 | ), 200 | ), 201 | ), 202 | ); 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /lib/page/ready_to_down_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:awesome_dialog/awesome_dialog.dart'; 4 | import 'package:dio/dio.dart'; 5 | import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart'; 6 | import 'package:parse_video/components/drawer_common_page.dart'; 7 | import 'package:parse_video/components/loading.dart'; 8 | import 'package:parse_video/components/simple_list_tile.dart'; 9 | import 'package:parse_video/database/download_video_database.dart'; 10 | import 'package:parse_video/database/ready_to_down_database.dart'; 11 | import 'package:parse_video/plugin/download.dart'; 12 | import 'package:parse_video/plugin/flutter_toast_manage.dart'; 13 | import 'package:parse_video/plugin/http_manage.dart'; 14 | 15 | class ReadyToDownPage extends StatefulWidget { 16 | const ReadyToDownPage({Key? key}) : super(key: key); 17 | 18 | @override 19 | State createState() => _ReadyToDownPageState(); 20 | } 21 | 22 | class _ReadyToDownPageState extends State { 23 | @override 24 | Widget build(BuildContext context) { 25 | return DrawerCommonPage( 26 | page: _Page(), 27 | ); 28 | } 29 | } 30 | 31 | class _Page extends StatefulWidget { 32 | @override 33 | __PageState createState() => __PageState(); 34 | } 35 | 36 | class __PageState extends State<_Page> { 37 | List playList = []; 38 | List allLocalFiles = []; 39 | bool showLoading = false; 40 | Widget _buildTopBar(BuildContext context) { 41 | return Container( 42 | decoration: const BoxDecoration(color: Colors.black), 43 | padding: const EdgeInsets.symmetric(horizontal: 16), 44 | child: Stack( 45 | alignment: Alignment.center, 46 | children: [ 47 | Align( 48 | alignment: Alignment.centerLeft, 49 | child: IconButton( 50 | icon: const Icon( 51 | Icons.navigate_before, 52 | color: Colors.white, 53 | ), 54 | onPressed: () { 55 | Navigator.of(context).pop(); 56 | }, 57 | )), 58 | const Align( 59 | alignment: Alignment.center, 60 | child: Text( 61 | '待下载列表', 62 | style: TextStyle(color: Colors.white, fontSize: 20), 63 | ), 64 | ), 65 | ], 66 | ), 67 | ); 68 | } 69 | 70 | @override 71 | void initState() { 72 | super.initState(); 73 | _getLocalMusics(); 74 | } 75 | 76 | _deleteLocalFile(ReadyDownLoad video) async { 77 | await DataBaseReadyDownLoadProvider.db.deleteMovieWithId(video.id); 78 | _getLocalMusics(); 79 | } 80 | 81 | _getLocalMusics() async { 82 | final List playDownLoadList = 83 | await DataBaseReadyDownLoadProvider.db.queryAll(); 84 | allLocalFiles = playDownLoadList; 85 | var tempList = playDownLoadList.map((video) { 86 | return SimpleListTile( 87 | title: video.url, 88 | trailing: Row( 89 | mainAxisSize: MainAxisSize.min, 90 | children: [ 91 | IconButton( 92 | icon: const Icon(Icons.file_download), 93 | onPressed: () { 94 | _startDownLoad(video); 95 | }), 96 | IconButton( 97 | icon: const Icon(Icons.delete_outline), 98 | onPressed: () { 99 | _showDeleteDialog(video); 100 | }), 101 | ], 102 | )); 103 | }).toList(); 104 | 105 | setState(() { 106 | playList = tempList; 107 | }); 108 | } 109 | 110 | ///验证URL 111 | bool isUrl(String value) { 112 | final urlRegExp = RegExp( 113 | r"((https?:www\.)|(https?:\/\/)|(www\.))[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(\/[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)?"); 114 | List urlMatches = 115 | urlRegExp.allMatches(value).map((m) => m.group(0)).toList(); 116 | return urlMatches.isNotEmpty; 117 | } 118 | 119 | Future _futureGetLink(String url) async { 120 | bool validate = isUrl(url); 121 | String videoLink = ''; 122 | if (!validate) { 123 | FlutterToastManage().showToast("请输入正确的网址哦~"); 124 | return; 125 | } 126 | final urlRegExp = RegExp( 127 | r"((https?:www\.)|(https?:\/\/)|(www\.))[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9]{1,6}(\/[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)?"); 128 | List urlMatches = 129 | urlRegExp.allMatches(url).map((m) => m.group(0)).toList(); 130 | setState(() { 131 | showLoading = true; 132 | }); 133 | Response? response = 134 | await HttpManager().get('video/', data: {'url': urlMatches.first}); 135 | setState(() { 136 | showLoading = false; 137 | }); 138 | 139 | if (response != null) { 140 | var responseData = jsonDecode(response.data); 141 | if (responseData['code'] == 200) { 142 | videoLink = responseData['data']['url']; 143 | FlutterToastManage().showToast("已找到视频,您可选择播放或者下载视频"); 144 | } else { 145 | FlutterToastManage().showToast(responseData['msg']); 146 | } 147 | } 148 | return videoLink; 149 | } 150 | 151 | _startDownLoad(ReadyDownLoad readyDownLoad) async { 152 | final url = await _futureGetLink(readyDownLoad.url); 153 | if (url.isEmpty) { 154 | return; 155 | } 156 | var str = readyDownLoad.url.split('/'); 157 | Iterable urlArr = str.where((item) { 158 | return item.isNotEmpty; 159 | }); 160 | 161 | String fileName = urlArr.last; 162 | bool hasDownLoad = await DataBaseDownLoadListProvider.db 163 | .queryWithFileName('$fileName.mp4'); 164 | if (hasDownLoad) { 165 | FlutterToastManage().showToast("已经下载过该视频了哦~"); 166 | _deleteLocalFile(readyDownLoad); 167 | return; 168 | } 169 | await DownLoadInstance().startDownLoad(url, fileName); 170 | FlutterToastManage().showToast("正在下载中~"); 171 | _deleteLocalFile(readyDownLoad); 172 | } 173 | 174 | Future _showDeleteDialog(ReadyDownLoad video) async { 175 | AwesomeDialog( 176 | context: context, 177 | animType: AnimType.scale, 178 | dialogType: DialogType.noHeader, 179 | body: Column( 180 | children: [ 181 | const SimpleListTile( 182 | title: '确定删除该视频吗?', 183 | onTap: null, 184 | ), 185 | Row(mainAxisAlignment: MainAxisAlignment.end, children: [ 186 | SizedBox( 187 | width: 60, 188 | child: TextButton( 189 | onPressed: () { 190 | Navigator.of(context).pop(); 191 | }, 192 | child: const Text('取消')), 193 | ), 194 | SizedBox( 195 | width: 60, 196 | child: TextButton( 197 | onPressed: () { 198 | _deleteLocalFile(video); 199 | Navigator.of(context).pop(); 200 | }, 201 | child: const Text('确定')), 202 | ), 203 | ]) 204 | ], 205 | ), 206 | ).show(); 207 | } 208 | 209 | @override 210 | Widget build(BuildContext context) { 211 | return Scaffold( 212 | body: SafeArea( 213 | child: NeumorphicBackground( 214 | backendColor: Colors.red, 215 | child: Column( 216 | children: [ 217 | _buildTopBar(context), 218 | Expanded( 219 | child: Container( 220 | decoration: const BoxDecoration( 221 | color: Colors.black, 222 | ), 223 | child: Container( 224 | decoration: const BoxDecoration( 225 | color: Colors.white, 226 | //设置四周圆角 角度 227 | borderRadius: BorderRadius.only( 228 | topLeft: Radius.circular(20.0), 229 | topRight: Radius.circular(20.0)), 230 | ), 231 | child: Stack( 232 | children: [ 233 | ListView( 234 | children: ListTile.divideTiles( 235 | tiles: playList, context: context) 236 | .toList(), 237 | ), 238 | showLoading ? const LoginLoading() : Container() 239 | ], 240 | ), 241 | ), 242 | )), 243 | ], 244 | ), 245 | ), 246 | ), 247 | ); 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /lib/page/video_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:fijkplayer/fijkplayer.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | // import 'custom_ui.dart'; 5 | class VideoScreen extends StatefulWidget { 6 | final String url; 7 | const VideoScreen({Key? key, required this.url}) : super(key: key); 8 | @override 9 | State createState() => VideoScreenState(); 10 | } 11 | 12 | class VideoScreenState extends State { 13 | final FijkPlayer player = FijkPlayer(); 14 | 15 | VideoScreenState(); 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | player.setOption(FijkOption.hostCategory, "enable-snapshot", 1); 21 | player.setOption(FijkOption.playerCategory, "mediacodec-all-videos", 1); 22 | startPlay(); 23 | } 24 | 25 | void startPlay() async { 26 | await player.setOption(FijkOption.hostCategory, "request-screen-on", 1); 27 | await player.setOption(FijkOption.hostCategory, "request-audio-focus", 1); 28 | await player.setDataSource(widget.url, autoPlay: true); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Scaffold( 34 | appBar: AppBar(title: const Text("播放"),backgroundColor: const Color.fromARGB(255, 0, 8, 12),), 35 | body: Center( 36 | child: FijkView( 37 | color: Colors.black, 38 | player: player, 39 | panelBuilder: fijkPanel2Builder(snapShot: true), 40 | fsFit: FijkFit.fill, 41 | ), 42 | ), 43 | ); 44 | } 45 | 46 | @override 47 | void dispose() { 48 | super.dispose(); 49 | player.release(); 50 | } 51 | } 52 | 53 | class FijkAppBar extends StatelessWidget implements PreferredSizeWidget { 54 | const FijkAppBar({Key? key, required this.title, required this.actions}) 55 | : super(key: key); 56 | 57 | final String title; 58 | final List actions; 59 | 60 | @override 61 | Widget build(BuildContext context) { 62 | return PreferredSize( 63 | preferredSize: preferredSize, 64 | child: AppBar( 65 | title: Text(title), 66 | actions: actions, 67 | centerTitle: true, 68 | backgroundColor: Colors.black, 69 | ), 70 | ); 71 | } 72 | 73 | @override 74 | Size get preferredSize => const Size.fromHeight(45.0); 75 | } 76 | -------------------------------------------------------------------------------- /lib/plugin/download.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:android_path_provider/android_path_provider.dart'; 3 | import 'package:flutter_downloader/flutter_downloader.dart'; 4 | import 'package:parse_video/database/download_video_database.dart'; 5 | import 'package:parse_video/plugin/flutter_toast_manage.dart'; 6 | import 'package:permission_handler/permission_handler.dart'; 7 | 8 | class DownLoadInstance { 9 | // 单例公开访问点 10 | factory DownLoadInstance() => _getInstance(); 11 | // 静态私有成员,没有初始化 12 | static late DownLoadInstance _instance; 13 | static DownLoadInstance get instance => _getInstance(); 14 | // 私有构造函数 15 | DownLoadInstance._internal(); 16 | 17 | // 静态、同步、私有访问点 18 | static DownLoadInstance _getInstance() { 19 | _instance = DownLoadInstance._internal(); 20 | return _instance; 21 | } 22 | 23 | Future startDownLoad(String url, String fileName,{bool fullFileName = false}) async { 24 | final downloadPath = await prepare(); 25 | FlutterToastManage().showToast("正在下载"); 26 | final taskId = await FlutterDownloader.enqueue( 27 | url: url, 28 | fileName: !fullFileName ? '$fileName.mp4' : fileName, 29 | savedDir: downloadPath, 30 | showNotification: true, 31 | openFileFromNotification: true, 32 | ); 33 | await DataBaseDownLoadListProvider.db.insetDB(taskId: taskId ?? '', movieName: !fullFileName ? '$fileName.mp4' : fileName); 34 | } 35 | 36 | // 申请权限 37 | Future requestPermission() async { 38 | var status = await Permission.storage.status; 39 | if (status.isDenied) { 40 | await Permission.storage.request(); 41 | } 42 | } 43 | 44 | Future prepare() async { 45 | await requestPermission(); 46 | String moviesPath = await AndroidPathProvider.moviesPath; 47 | String localPath = '$moviesPath${Platform.pathSeparator}Downloads'; 48 | final savedDir = Directory(localPath); 49 | bool hasExisted = await savedDir.exists(); 50 | if (!hasExisted) { 51 | savedDir.create(); 52 | } 53 | return savedDir.path; 54 | } 55 | 56 | void showCenterShortToast() { 57 | FlutterToastManage().showToast("下载失败"); 58 | } 59 | 60 | Future?> loadTasks() async { 61 | return await FlutterDownloader.loadTasks(); 62 | } 63 | 64 | Future cancel(String taskId) async { 65 | await DataBaseDownLoadListProvider.db.deleteMovieWithTaskId(taskId); 66 | FlutterDownloader.cancel(taskId: taskId); 67 | } 68 | 69 | Future pause(String taskId) async { 70 | FlutterDownloader.pause(taskId: taskId); 71 | } 72 | 73 | Future resume(String taskId) async { 74 | FlutterDownloader.resume(taskId: taskId); 75 | } 76 | 77 | Future retry(String taskId) async { 78 | FlutterDownloader.retry(taskId: taskId); 79 | } 80 | 81 | Future remove(String taskId) async { 82 | FlutterDownloader.remove(taskId: taskId, shouldDeleteContent: false); 83 | } 84 | 85 | Future delete(String taskId) async { 86 | FlutterDownloader.remove(taskId: taskId, shouldDeleteContent: true); 87 | } 88 | 89 | Future cancelAll(String taskId) async { 90 | FlutterDownloader.cancelAll(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /lib/plugin/flutter_toast_manage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluttertoast/fluttertoast.dart'; 3 | 4 | class FlutterToastManage { 5 | showToast(String msg, 6 | {int seconds = 1, 7 | Color color = Colors.white, 8 | ToastGravity gravity = ToastGravity.CENTER}) { 9 | Fluttertoast.showToast( 10 | msg: msg, 11 | toastLength: Toast.LENGTH_SHORT, 12 | gravity: gravity, 13 | timeInSecForIosWeb: seconds, 14 | backgroundColor: Colors.black, 15 | textColor: color, 16 | fontSize: 14.0, 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/plugin/http_manage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:dio/dio.dart'; 3 | import 'flutter_toast_manage.dart'; 4 | 5 | class HttpManager { 6 | final String baseUrl = 'https://tenapi.cn/v2/'; 7 | final int connectTimeOut = 10; 8 | final int receiveTimeOut = 10; 9 | 10 | //单例模式 11 | static late HttpManager _instance; 12 | late Dio _dio; 13 | BaseOptions _options = BaseOptions(); 14 | HttpManager._internal(); 15 | //单例模式,只创建一次实例 16 | static HttpManager getInstance() { 17 | _instance = HttpManager._internal(); 18 | return _instance; 19 | } 20 | 21 | //构造函数 22 | HttpManager() { 23 | _options = BaseOptions( 24 | baseUrl: baseUrl, 25 | //连接时间为5秒 26 | connectTimeout: Duration(seconds: connectTimeOut), 27 | //响应时间为3秒 28 | receiveTimeout: Duration(seconds: receiveTimeOut), 29 | //设置请求头 30 | headers: {}, 31 | responseType: ResponseType.json, 32 | contentType: 33 | ContentType.parse("application/json;charset=utf-8").toString()); 34 | _dio = Dio(_options); 35 | 36 | //添加拦截器 37 | _dio.interceptors.add(InterceptorsWrapper(onRequest: (options, handler) { 38 | return handler.next(options); 39 | }, onResponse: (response, handler) { 40 | return handler.next(response); 41 | }, onError: (DioException e, handler) { 42 | return handler.next(e); 43 | })); 44 | } 45 | 46 | //get请求方法 47 | Future get(url, {data, options, cancelToken}) async { 48 | Response? response; 49 | try { 50 | response = await _dio.get(url, 51 | queryParameters: data, options: options, cancelToken: cancelToken); 52 | } on DioException catch (e) { 53 | formatError(e); 54 | } 55 | return response; 56 | } 57 | 58 | //post请求 59 | Future post(url, {params, options, cancelToken, data}) async { 60 | Response? response; 61 | try { 62 | response = await _dio.post( 63 | url, 64 | queryParameters: params, 65 | options: options, 66 | cancelToken: cancelToken, 67 | data: data, 68 | ); 69 | } on DioException catch (e) { 70 | formatError(e); 71 | } 72 | return response; 73 | } 74 | 75 | //post Form请求 76 | Future postForm(url, {data, options, cancelToken}) async { 77 | Response? response; 78 | try { 79 | response = await _dio.post(url, 80 | options: options, cancelToken: cancelToken, data: data); 81 | } on DioException catch (e) { 82 | formatError(e); 83 | } 84 | return response; 85 | } 86 | 87 | //取消请求 88 | cancleRequests(CancelToken token) { 89 | token.cancel("cancelled"); 90 | } 91 | 92 | void formatError(DioException e) { 93 | if (e.type == DioExceptionType.connectionTimeout) { 94 | FlutterToastManage().showToast("连接超时"); 95 | } else if (e.type == DioExceptionType .sendTimeout) { 96 | FlutterToastManage().showToast("请求超时"); 97 | } else if (e.type == DioExceptionType .receiveTimeout) { 98 | FlutterToastManage().showToast("响应超时"); 99 | } else if (e.type == DioExceptionType.badResponse) { 100 | FlutterToastManage().showToast("出现异常"); 101 | } else if (e.type == DioExceptionType .cancel) { 102 | FlutterToastManage().showToast("请求取消"); 103 | } else { 104 | FlutterToastManage().showToast("未知错误"); 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | android_path_provider: 5 | dependency: "direct main" 6 | description: 7 | name: android_path_provider 8 | sha256: "398fb6f83476ba2c6b0930d997ca19376a242d3264c615d3f09ea77382fa09c3" 9 | url: "https://pub.flutter-io.cn" 10 | source: hosted 11 | version: "0.3.0" 12 | archive: 13 | dependency: transitive 14 | description: 15 | name: archive 16 | sha256: "0c8368c9b3f0abbc193b9d6133649a614204b528982bebc7026372d61677ce3a" 17 | url: "https://pub.flutter-io.cn" 18 | source: hosted 19 | version: "3.3.7" 20 | args: 21 | dependency: transitive 22 | description: 23 | name: args 24 | sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 25 | url: "https://pub.flutter-io.cn" 26 | source: hosted 27 | version: "2.4.2" 28 | async: 29 | dependency: transitive 30 | description: 31 | name: async 32 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 33 | url: "https://pub.flutter-io.cn" 34 | source: hosted 35 | version: "2.11.0" 36 | awesome_dialog: 37 | dependency: "direct main" 38 | description: 39 | name: awesome_dialog 40 | sha256: "7da175ea284fa5da0a4d0cbdfe835c5b71d30c7b38c1770c0f27f48272ff5a08" 41 | url: "https://pub.flutter-io.cn" 42 | source: hosted 43 | version: "3.1.0" 44 | boolean_selector: 45 | dependency: transitive 46 | description: 47 | name: boolean_selector 48 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 49 | url: "https://pub.flutter-io.cn" 50 | source: hosted 51 | version: "2.1.1" 52 | characters: 53 | dependency: transitive 54 | description: 55 | name: characters 56 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.3.0" 60 | checked_yaml: 61 | dependency: transitive 62 | description: 63 | name: checked_yaml 64 | sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff 65 | url: "https://pub.flutter-io.cn" 66 | source: hosted 67 | version: "2.0.3" 68 | cli_util: 69 | dependency: transitive 70 | description: 71 | name: cli_util 72 | sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 73 | url: "https://pub.flutter-io.cn" 74 | source: hosted 75 | version: "0.4.0" 76 | clock: 77 | dependency: transitive 78 | description: 79 | name: clock 80 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "1.1.1" 84 | collection: 85 | dependency: transitive 86 | description: 87 | name: collection 88 | sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" 89 | url: "https://pub.flutter-io.cn" 90 | source: hosted 91 | version: "1.17.1" 92 | convert: 93 | dependency: transitive 94 | description: 95 | name: convert 96 | sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" 97 | url: "https://pub.flutter-io.cn" 98 | source: hosted 99 | version: "3.1.1" 100 | cross_file: 101 | dependency: transitive 102 | description: 103 | name: cross_file 104 | sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" 105 | url: "https://pub.flutter-io.cn" 106 | source: hosted 107 | version: "0.3.3+4" 108 | crypto: 109 | dependency: transitive 110 | description: 111 | name: crypto 112 | sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab 113 | url: "https://pub.flutter-io.cn" 114 | source: hosted 115 | version: "3.0.3" 116 | cupertino_icons: 117 | dependency: "direct main" 118 | description: 119 | name: cupertino_icons 120 | sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "1.0.5" 124 | dio: 125 | dependency: "direct main" 126 | description: 127 | name: dio 128 | sha256: ce75a1b40947fea0a0e16ce73337122a86762e38b982e1ccb909daa3b9bc4197 129 | url: "https://pub.flutter-io.cn" 130 | source: hosted 131 | version: "5.3.2" 132 | fake_async: 133 | dependency: transitive 134 | description: 135 | name: fake_async 136 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 137 | url: "https://pub.flutter-io.cn" 138 | source: hosted 139 | version: "1.3.1" 140 | ffi: 141 | dependency: transitive 142 | description: 143 | name: ffi 144 | sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" 145 | url: "https://pub.flutter-io.cn" 146 | source: hosted 147 | version: "2.1.0" 148 | fijkplayer: 149 | dependency: "direct main" 150 | description: 151 | name: fijkplayer 152 | sha256: e6098034e696ce448f5f289fb5b3fa363df5e606bdb418d52944c1dcb8e14cba 153 | url: "https://pub.flutter-io.cn" 154 | source: hosted 155 | version: "0.11.0" 156 | file: 157 | dependency: transitive 158 | description: 159 | name: file 160 | sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" 161 | url: "https://pub.flutter-io.cn" 162 | source: hosted 163 | version: "6.1.4" 164 | flashy_tab_bar2: 165 | dependency: "direct main" 166 | description: 167 | name: flashy_tab_bar2 168 | sha256: "895affd69b757ae2a1461ddc42a3c04954a5bb4e2292373697e40c377e836153" 169 | url: "https://pub.flutter-io.cn" 170 | source: hosted 171 | version: "0.0.6" 172 | flutter: 173 | dependency: "direct main" 174 | description: flutter 175 | source: sdk 176 | version: "0.0.0" 177 | flutter_downloader: 178 | dependency: "direct main" 179 | description: 180 | name: flutter_downloader 181 | sha256: "2b126083d2e6b7c09755bca12012c4c734bcf7666cf07ba00c508fcb83e8d0d7" 182 | url: "https://pub.flutter-io.cn" 183 | source: hosted 184 | version: "1.11.1" 185 | flutter_launcher_icons: 186 | dependency: "direct main" 187 | description: 188 | name: flutter_launcher_icons 189 | sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" 190 | url: "https://pub.flutter-io.cn" 191 | source: hosted 192 | version: "0.13.1" 193 | flutter_lints: 194 | dependency: "direct main" 195 | description: 196 | name: flutter_lints 197 | sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4" 198 | url: "https://pub.flutter-io.cn" 199 | source: hosted 200 | version: "2.0.2" 201 | flutter_neumorphic_plus: 202 | dependency: "direct main" 203 | description: 204 | name: flutter_neumorphic_plus 205 | sha256: fc702c6414c6d9e1498f84ca124b59104e0dcbac59f92a47c5776e023d985e63 206 | url: "https://pub.flutter-io.cn" 207 | source: hosted 208 | version: "3.3.0" 209 | flutter_spinkit: 210 | dependency: "direct main" 211 | description: 212 | name: flutter_spinkit 213 | sha256: b39c753e909d4796906c5696a14daf33639a76e017136c8d82bf3e620ce5bb8e 214 | url: "https://pub.flutter-io.cn" 215 | source: hosted 216 | version: "5.2.0" 217 | flutter_test: 218 | dependency: "direct dev" 219 | description: flutter 220 | source: sdk 221 | version: "0.0.0" 222 | flutter_web_plugins: 223 | dependency: transitive 224 | description: flutter 225 | source: sdk 226 | version: "0.0.0" 227 | fluttertoast: 228 | dependency: "direct main" 229 | description: 230 | name: fluttertoast 231 | sha256: "474f7d506230897a3cd28c965ec21c5328ae5605fc9c400cd330e9e9d6ac175c" 232 | url: "https://pub.flutter-io.cn" 233 | source: hosted 234 | version: "8.2.2" 235 | graphs: 236 | dependency: transitive 237 | description: 238 | name: graphs 239 | sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 240 | url: "https://pub.flutter-io.cn" 241 | source: hosted 242 | version: "2.3.1" 243 | http: 244 | dependency: transitive 245 | description: 246 | name: http 247 | sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" 248 | url: "https://pub.flutter-io.cn" 249 | source: hosted 250 | version: "1.1.0" 251 | http_parser: 252 | dependency: transitive 253 | description: 254 | name: http_parser 255 | sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" 256 | url: "https://pub.flutter-io.cn" 257 | source: hosted 258 | version: "4.0.2" 259 | image: 260 | dependency: transitive 261 | description: 262 | name: image 263 | sha256: a72242c9a0ffb65d03de1b7113bc4e189686fc07c7147b8b41811d0dd0e0d9bf 264 | url: "https://pub.flutter-io.cn" 265 | source: hosted 266 | version: "4.0.17" 267 | js: 268 | dependency: transitive 269 | description: 270 | name: js 271 | sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 272 | url: "https://pub.flutter-io.cn" 273 | source: hosted 274 | version: "0.6.7" 275 | json_annotation: 276 | dependency: transitive 277 | description: 278 | name: json_annotation 279 | sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 280 | url: "https://pub.flutter-io.cn" 281 | source: hosted 282 | version: "4.8.1" 283 | lints: 284 | dependency: transitive 285 | description: 286 | name: lints 287 | sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" 288 | url: "https://pub.flutter-io.cn" 289 | source: hosted 290 | version: "2.1.1" 291 | matcher: 292 | dependency: transitive 293 | description: 294 | name: matcher 295 | sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" 296 | url: "https://pub.flutter-io.cn" 297 | source: hosted 298 | version: "0.12.15" 299 | material_color_utilities: 300 | dependency: transitive 301 | description: 302 | name: material_color_utilities 303 | sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 304 | url: "https://pub.flutter-io.cn" 305 | source: hosted 306 | version: "0.2.0" 307 | meta: 308 | dependency: transitive 309 | description: 310 | name: meta 311 | sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" 312 | url: "https://pub.flutter-io.cn" 313 | source: hosted 314 | version: "1.9.1" 315 | mime: 316 | dependency: transitive 317 | description: 318 | name: mime 319 | sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e 320 | url: "https://pub.flutter-io.cn" 321 | source: hosted 322 | version: "1.0.4" 323 | nested: 324 | dependency: transitive 325 | description: 326 | name: nested 327 | sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" 328 | url: "https://pub.flutter-io.cn" 329 | source: hosted 330 | version: "1.0.0" 331 | path: 332 | dependency: "direct main" 333 | description: 334 | name: path 335 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" 336 | url: "https://pub.flutter-io.cn" 337 | source: hosted 338 | version: "1.8.3" 339 | path_provider: 340 | dependency: transitive 341 | description: 342 | name: path_provider 343 | sha256: "909b84830485dbcd0308edf6f7368bc8fd76afa26a270420f34cabea2a6467a0" 344 | url: "https://pub.flutter-io.cn" 345 | source: hosted 346 | version: "2.1.0" 347 | path_provider_android: 348 | dependency: transitive 349 | description: 350 | name: path_provider_android 351 | sha256: "5d44fc3314d969b84816b569070d7ace0f1dea04bd94a83f74c4829615d22ad8" 352 | url: "https://pub.flutter-io.cn" 353 | source: hosted 354 | version: "2.1.0" 355 | path_provider_foundation: 356 | dependency: transitive 357 | description: 358 | name: path_provider_foundation 359 | sha256: "1b744d3d774e5a879bb76d6cd1ecee2ba2c6960c03b1020cd35212f6aa267ac5" 360 | url: "https://pub.flutter-io.cn" 361 | source: hosted 362 | version: "2.3.0" 363 | path_provider_linux: 364 | dependency: transitive 365 | description: 366 | name: path_provider_linux 367 | sha256: ba2b77f0c52a33db09fc8caf85b12df691bf28d983e84cf87ff6d693cfa007b3 368 | url: "https://pub.flutter-io.cn" 369 | source: hosted 370 | version: "2.2.0" 371 | path_provider_platform_interface: 372 | dependency: transitive 373 | description: 374 | name: path_provider_platform_interface 375 | sha256: bced5679c7df11190e1ddc35f3222c858f328fff85c3942e46e7f5589bf9eb84 376 | url: "https://pub.flutter-io.cn" 377 | source: hosted 378 | version: "2.1.0" 379 | path_provider_windows: 380 | dependency: transitive 381 | description: 382 | name: path_provider_windows 383 | sha256: ee0e0d164516b90ae1f970bdf29f726f1aa730d7cfc449ecc74c495378b705da 384 | url: "https://pub.flutter-io.cn" 385 | source: hosted 386 | version: "2.2.0" 387 | permission_handler: 388 | dependency: "direct main" 389 | description: 390 | name: permission_handler 391 | sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81" 392 | url: "https://pub.flutter-io.cn" 393 | source: hosted 394 | version: "10.4.3" 395 | permission_handler_android: 396 | dependency: transitive 397 | description: 398 | name: permission_handler_android 399 | sha256: "2ffaf52a21f64ac9b35fe7369bb9533edbd4f698e5604db8645b1064ff4cf221" 400 | url: "https://pub.flutter-io.cn" 401 | source: hosted 402 | version: "10.3.3" 403 | permission_handler_apple: 404 | dependency: transitive 405 | description: 406 | name: permission_handler_apple 407 | sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" 408 | url: "https://pub.flutter-io.cn" 409 | source: hosted 410 | version: "9.1.4" 411 | permission_handler_platform_interface: 412 | dependency: transitive 413 | description: 414 | name: permission_handler_platform_interface 415 | sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9" 416 | url: "https://pub.flutter-io.cn" 417 | source: hosted 418 | version: "3.11.3" 419 | permission_handler_windows: 420 | dependency: transitive 421 | description: 422 | name: permission_handler_windows 423 | sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 424 | url: "https://pub.flutter-io.cn" 425 | source: hosted 426 | version: "0.1.3" 427 | petitparser: 428 | dependency: transitive 429 | description: 430 | name: petitparser 431 | sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 432 | url: "https://pub.flutter-io.cn" 433 | source: hosted 434 | version: "5.4.0" 435 | platform: 436 | dependency: transitive 437 | description: 438 | name: platform 439 | sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" 440 | url: "https://pub.flutter-io.cn" 441 | source: hosted 442 | version: "3.1.0" 443 | plugin_platform_interface: 444 | dependency: transitive 445 | description: 446 | name: plugin_platform_interface 447 | sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd" 448 | url: "https://pub.flutter-io.cn" 449 | source: hosted 450 | version: "2.1.5" 451 | pointycastle: 452 | dependency: transitive 453 | description: 454 | name: pointycastle 455 | sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" 456 | url: "https://pub.flutter-io.cn" 457 | source: hosted 458 | version: "3.7.3" 459 | provider: 460 | dependency: "direct main" 461 | description: 462 | name: provider 463 | sha256: cdbe7530b12ecd9eb455bdaa2fcb8d4dad22e80b8afb4798b41479d5ce26847f 464 | url: "https://pub.flutter-io.cn" 465 | source: hosted 466 | version: "6.0.5" 467 | rive: 468 | dependency: transitive 469 | description: 470 | name: rive 471 | sha256: b7780ebdc56320da1f02a39a18f050a6079cad60c0cb92003c0801cc4eec6673 472 | url: "https://pub.flutter-io.cn" 473 | source: hosted 474 | version: "0.11.14" 475 | rive_common: 476 | dependency: transitive 477 | description: 478 | name: rive_common 479 | sha256: "1431b99c9f361234cc6fa9aee7987b20030622df25ff64343a4010f9446b275e" 480 | url: "https://pub.flutter-io.cn" 481 | source: hosted 482 | version: "0.2.6" 483 | share_plus: 484 | dependency: "direct main" 485 | description: 486 | name: share_plus 487 | sha256: "6cec740fa0943a826951223e76218df002804adb588235a8910dc3d6b0654e11" 488 | url: "https://pub.flutter-io.cn" 489 | source: hosted 490 | version: "7.1.0" 491 | share_plus_platform_interface: 492 | dependency: transitive 493 | description: 494 | name: share_plus_platform_interface 495 | sha256: "357412af4178d8e11d14f41723f80f12caea54cf0d5cd29af9dcdab85d58aea7" 496 | url: "https://pub.flutter-io.cn" 497 | source: hosted 498 | version: "3.3.0" 499 | sky_engine: 500 | dependency: transitive 501 | description: flutter 502 | source: sdk 503 | version: "0.0.99" 504 | source_span: 505 | dependency: transitive 506 | description: 507 | name: source_span 508 | sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 509 | url: "https://pub.flutter-io.cn" 510 | source: hosted 511 | version: "1.9.1" 512 | sqflite: 513 | dependency: "direct main" 514 | description: 515 | name: sqflite 516 | sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a" 517 | url: "https://pub.flutter-io.cn" 518 | source: hosted 519 | version: "2.3.0" 520 | sqflite_common: 521 | dependency: transitive 522 | description: 523 | name: sqflite_common 524 | sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a" 525 | url: "https://pub.flutter-io.cn" 526 | source: hosted 527 | version: "2.5.0" 528 | stack_trace: 529 | dependency: transitive 530 | description: 531 | name: stack_trace 532 | sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 533 | url: "https://pub.flutter-io.cn" 534 | source: hosted 535 | version: "1.11.0" 536 | stream_channel: 537 | dependency: transitive 538 | description: 539 | name: stream_channel 540 | sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" 541 | url: "https://pub.flutter-io.cn" 542 | source: hosted 543 | version: "2.1.1" 544 | string_scanner: 545 | dependency: transitive 546 | description: 547 | name: string_scanner 548 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 549 | url: "https://pub.flutter-io.cn" 550 | source: hosted 551 | version: "1.2.0" 552 | synchronized: 553 | dependency: transitive 554 | description: 555 | name: synchronized 556 | sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" 557 | url: "https://pub.flutter-io.cn" 558 | source: hosted 559 | version: "3.1.0" 560 | term_glyph: 561 | dependency: transitive 562 | description: 563 | name: term_glyph 564 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 565 | url: "https://pub.flutter-io.cn" 566 | source: hosted 567 | version: "1.2.1" 568 | test_api: 569 | dependency: transitive 570 | description: 571 | name: test_api 572 | sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb 573 | url: "https://pub.flutter-io.cn" 574 | source: hosted 575 | version: "0.5.1" 576 | typed_data: 577 | dependency: transitive 578 | description: 579 | name: typed_data 580 | sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c 581 | url: "https://pub.flutter-io.cn" 582 | source: hosted 583 | version: "1.3.2" 584 | url_launcher_linux: 585 | dependency: transitive 586 | description: 587 | name: url_launcher_linux 588 | sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5" 589 | url: "https://pub.flutter-io.cn" 590 | source: hosted 591 | version: "3.0.5" 592 | url_launcher_platform_interface: 593 | dependency: transitive 594 | description: 595 | name: url_launcher_platform_interface 596 | sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea 597 | url: "https://pub.flutter-io.cn" 598 | source: hosted 599 | version: "2.1.3" 600 | url_launcher_web: 601 | dependency: transitive 602 | description: 603 | name: url_launcher_web 604 | sha256: cc26720eefe98c1b71d85f9dc7ef0cada5132617046369d9dc296b3ecaa5cbb4 605 | url: "https://pub.flutter-io.cn" 606 | source: hosted 607 | version: "2.0.18" 608 | url_launcher_windows: 609 | dependency: transitive 610 | description: 611 | name: url_launcher_windows 612 | sha256: "7967065dd2b5fccc18c653b97958fdf839c5478c28e767c61ee879f4e7882422" 613 | url: "https://pub.flutter-io.cn" 614 | source: hosted 615 | version: "3.0.7" 616 | uuid: 617 | dependency: transitive 618 | description: 619 | name: uuid 620 | sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" 621 | url: "https://pub.flutter-io.cn" 622 | source: hosted 623 | version: "3.0.7" 624 | vector_math: 625 | dependency: transitive 626 | description: 627 | name: vector_math 628 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 629 | url: "https://pub.flutter-io.cn" 630 | source: hosted 631 | version: "2.1.4" 632 | win32: 633 | dependency: transitive 634 | description: 635 | name: win32 636 | sha256: f2add6fa510d3ae152903412227bda57d0d5a8da61d2c39c1fb022c9429a41c0 637 | url: "https://pub.flutter-io.cn" 638 | source: hosted 639 | version: "5.0.6" 640 | xdg_directories: 641 | dependency: transitive 642 | description: 643 | name: xdg_directories 644 | sha256: f0c26453a2d47aa4c2570c6a033246a3fc62da2fe23c7ffdd0a7495086dc0247 645 | url: "https://pub.flutter-io.cn" 646 | source: hosted 647 | version: "1.0.2" 648 | xml: 649 | dependency: transitive 650 | description: 651 | name: xml 652 | sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" 653 | url: "https://pub.flutter-io.cn" 654 | source: hosted 655 | version: "6.3.0" 656 | yaml: 657 | dependency: transitive 658 | description: 659 | name: yaml 660 | sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" 661 | url: "https://pub.flutter-io.cn" 662 | source: hosted 663 | version: "3.1.2" 664 | sdks: 665 | dart: ">=3.0.0 <4.0.0" 666 | flutter: ">=3.10.0" 667 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: parse_video 2 | description: A new Flutter project. 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.16.1 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | dio: ^5.3.2 27 | # The following adds the Cupertino Icons font to your application. 28 | # Use with the CupertinoIcons class for iOS style icons. 29 | flutter_lints: ^2.0.2 30 | flashy_tab_bar2: ^0.0.4 31 | fijkplayer: ^0.11.0 32 | flutter_spinkit: ^5.1.0 33 | flutter_downloader: ^1.7.3 34 | share_plus: ^7.1.0 35 | path: ^1.8.3 36 | cupertino_icons: ^1.0.4 37 | flutter_neumorphic_plus: ^3.3.0 38 | android_path_provider: ^0.3.0 39 | provider: ^6.0.2 40 | permission_handler: ^10.4.3 41 | sqflite: ^2.0.0+4 42 | awesome_dialog: ^3.1.0 43 | fluttertoast: ^8.0.9 44 | flutter_launcher_icons: ^0.13.1 45 | 46 | dev_dependencies: 47 | flutter_test: 48 | sdk: flutter 49 | # For information on the generic Dart part of this file, see the 50 | # following page: https://dart.dev/tools/pub/pubspec 51 | flutter_icons: 52 | android: "launcher_icon" 53 | ios: false 54 | image_path: "assets/icon_android.png" 55 | # The following section is specific to Flutter. 56 | flutter: 57 | 58 | # The following line ensures that the Material Icons font is 59 | # included with your application, so that you can use the icons in 60 | # the material Icons class. 61 | uses-material-design: true 62 | 63 | # To add assets to your application, add an assets section, like this: 64 | assets: 65 | - assets/ 66 | # - images/a_dot_ham.jpeg 67 | 68 | # An image asset can refer to one or more resolution-specific "variants", see 69 | # https://flutter.dev/assets-and-images/#resolution-aware. 70 | 71 | # For details regarding adding assets from package dependencies, see 72 | # https://flutter.dev/assets-and-images/#from-packages 73 | 74 | # To add custom fonts to your application, add a fonts section here, 75 | # in this "flutter" section. Each entry in this list should have a 76 | # "family" key with the font family name, and a "fonts" key with a 77 | # list giving the asset and other descriptors for the font. For 78 | # example: 79 | # fonts: 80 | # - family: Schyler 81 | # fonts: 82 | # - asset: fonts/Schyler-Regular.ttf 83 | # - asset: fonts/Schyler-Italic.ttf 84 | # style: italic 85 | # - family: Trajan Pro 86 | # fonts: 87 | # - asset: fonts/TrajanPro.ttf 88 | # - asset: fonts/TrajanPro_Bold.ttf 89 | # weight: 700 90 | # 91 | # For details regarding fonts from package dependencies, 92 | # see https://flutter.dev/custom-fonts/#from-packages 93 | -------------------------------------------------------------------------------- /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:parse_video/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(const 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 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | parse_video 33 | 34 | 35 | 36 | 39 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parse_video", 3 | "short_name": "parse_video", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(parse_video LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "parse_video") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | void RegisterPlugins(flutter::PluginRegistry* registry) { 15 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 17 | RivePluginRegisterWithRegistrar( 18 | registry->GetRegistrarForPlugin("RivePlugin")); 19 | SharePlusWindowsPluginCApiRegisterWithRegistrar( 20 | registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); 21 | UrlLauncherWindowsRegisterWithRegistrar( 22 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 23 | } 24 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | permission_handler_windows 7 | rive_common 8 | share_plus 9 | url_launcher_windows 10 | ) 11 | 12 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 13 | ) 14 | 15 | set(PLUGIN_BUNDLED_LIBRARIES) 16 | 17 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 18 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 19 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 21 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 22 | endforeach(plugin) 23 | 24 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 25 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 26 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 27 | endforeach(ffi_plugin) 28 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "parse_video" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "parse_video" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "parse_video.exe" "\0" 98 | VALUE "ProductName", "parse_video" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"parse_video", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liuchuancong/parse_video/1833ce102b215326a5f81ca858a6757ab5d46c46/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------