├── .gitignore ├── .metadata ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ ├── demo │ │ │ │ └── MainActivity.kt │ │ │ │ └── eye_video │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── art └── art.png ├── assets ├── fonts │ ├── NotoSansHans-Medium.otf │ ├── NotoSansHans-Regular.otf │ └── Oswald-Regular.otf └── images │ ├── biz_app_icon_attention.png │ ├── biz_app_icon_collection.png │ ├── biz_app_icon_dynamic.png │ ├── biz_app_icon_fans.png │ ├── biz_app_icon_reply.png │ ├── biz_app_icon_share.png │ └── biz_app_icon_works.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── 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 ├── bizmodule │ ├── bizwidget │ │ ├── cover_image_item.dart │ │ ├── follow_list_head.dart │ │ └── header_item.dart │ ├── blocs.dart │ └── main │ │ ├── category │ │ ├── blocs │ │ │ ├── category_bloc.dart │ │ │ ├── category_event.dart │ │ │ └── category_state.dart │ │ ├── category_page.dart │ │ ├── model │ │ │ ├── category_model.dart │ │ │ └── category_model.g.dart │ │ └── repositories │ │ │ ├── category_repository.dart │ │ │ └── mock │ │ │ └── mock_category_repository.dart │ │ ├── community │ │ ├── blocs │ │ │ ├── community_bloc.dart │ │ │ ├── community_event.dart │ │ │ └── community_state.dart │ │ ├── community_page.dart │ │ ├── extension │ │ │ └── ext_community.dart │ │ ├── model │ │ │ ├── community_model.dart │ │ │ └── community_model.g.dart │ │ ├── respositories │ │ │ ├── community_repository.dart │ │ │ └── mock │ │ │ │ └── mock_community_repository.dart │ │ └── widget │ │ │ └── ugc_item.dart │ │ ├── discovery │ │ ├── blocs │ │ │ ├── discovery_bloc.dart │ │ │ ├── discovery_event.dart │ │ │ └── discovery_state.dart │ │ ├── discovery_page.dart │ │ ├── extension │ │ │ └── ext_discovery.dart │ │ ├── model │ │ │ ├── discovery_model.dart │ │ │ └── discovery_model.g.dart │ │ ├── respositories │ │ │ ├── discovery_repository.dart │ │ │ └── mock │ │ │ │ └── mock_discovery_repository.dart │ │ └── widgets │ │ │ ├── column_card_items.dart │ │ │ └── hot_category_items.dart │ │ ├── selections │ │ ├── blocs │ │ │ ├── selection_bloc.dart │ │ │ ├── selection_event.dart │ │ │ ├── selection_state.dart │ │ │ └── ugc │ │ │ │ ├── ugc_bloc.dart │ │ │ │ ├── ugc_event.dart │ │ │ │ └── ugc_state.dart │ │ ├── extension │ │ │ └── ext_selection.dart │ │ ├── model │ │ │ ├── selection_model.dart │ │ │ ├── selection_model.g.dart │ │ │ └── ugc │ │ │ │ ├── ugc_author_model.dart │ │ │ │ ├── ugc_author_model.g.dart │ │ │ │ ├── ugc_list_model.dart │ │ │ │ ├── ugc_list_model.g.dart │ │ │ │ ├── ugc_model.dart │ │ │ │ ├── ugc_model.g.dart │ │ │ │ ├── ugc_tag_model.dart │ │ │ │ └── ugc_tag_model.g.dart │ │ ├── respositories │ │ │ ├── mock │ │ │ │ ├── mock_selection_repository.dart │ │ │ │ └── mock_ugc_repository.dart │ │ │ ├── selection_repository.dart │ │ │ └── ugc_repository.dart │ │ ├── ugc_page.dart │ │ └── widgets │ │ │ ├── follow_Item.dart │ │ │ └── small_video_item.dart │ │ └── thiz │ │ ├── blocs │ │ ├── main_bloc.dart │ │ ├── main_event.dart │ │ └── main_state.dart │ │ ├── main_page.dart │ │ ├── model │ │ ├── drawer_configs.dart │ │ ├── drawer_configs.g.dart │ │ ├── user_model.dart │ │ └── user_model.g.dart │ │ ├── repositories │ │ ├── main_repository.dart │ │ └── mock │ │ │ └── mock_main_repository.dart │ │ └── widgets │ │ └── drawer_widget.dart ├── framework │ ├── extension │ │ ├── context_extension.dart │ │ ├── image_compress.dart │ │ ├── screen_ruler.dart │ │ └── size_extension.dart │ ├── network │ │ ├── cookie │ │ │ └── pretty_cookie.dart │ │ ├── dio_client.dart │ │ ├── interceptor │ │ │ └── log_interceptor.dart │ │ └── pretty_http.dart │ └── uikit │ │ ├── carousel │ │ ├── carousel_controller.dart │ │ ├── carousel_option.dart │ │ ├── carousel_slider.dart │ │ ├── carousel_state.dart │ │ └── utils.dart │ │ ├── layout │ │ └── nine_layout.dart │ │ ├── refresher │ │ ├── empty │ │ │ └── empty_widget.dart │ │ ├── indicator │ │ │ ├── classic │ │ │ │ ├── classic_footer.dart │ │ │ │ └── classic_header.dart │ │ │ ├── core │ │ │ │ ├── abstract_footer.dart │ │ │ │ ├── abstract_header.dart │ │ │ │ ├── first_refresh_header.dart │ │ │ │ ├── footer_link_notifier.dart │ │ │ │ └── header_link_notifier.dart │ │ │ └── material │ │ │ │ ├── material_footer.dart │ │ │ │ └── material_header.dart │ │ ├── listener │ │ │ ├── scroll_notification_interceptor.dart │ │ │ └── scroll_notification_listener.dart │ │ ├── physics │ │ │ └── scroll_physics.dart │ │ ├── pretty_refresher.dart │ │ └── sliver │ │ │ ├── sliver_loading.dart │ │ │ └── sliver_refresh.dart │ │ └── scrollview │ │ └── overscroll_behavior.dart └── main.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon_1024.png │ │ ├── app_icon_128.png │ │ ├── app_icon_16.png │ │ ├── app_icon_256.png │ │ ├── app_icon_32.png │ │ ├── app_icon_512.png │ │ └── app_icon_64.png │ ├── Base.lproj │ └── MainMenu.xib │ ├── Configs │ ├── AppInfo.xcconfig │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── pubspec.yaml ├── release_apk └── app-release.apk ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ └── Icon-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 ├── run_loop.cpp ├── run_loop.h ├── 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 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | pubspec.lock 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Exceptions to above rules. 44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 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: 15a28159bcf4b3db13411cbc8d9b5fc51adc0a93 8 | channel: dev 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EyeVideo 2 | 3 | 这是一款使用Flutter开发的高仿开眼视频的短视频APP 4 | 5 | ## Dart基础学习 6 | 7 | 如果你对Dart基础还不是很熟悉,欢迎参考我的 [《Dart入门实践》系列专栏](https://gitbook.cn/gitchat/column/5e8eddebf33069503095f54a) 8 | 9 | 主要涉及到的Dart知识点: 10 | 11 | ### 基础篇 12 | * 初探 Dart 语法 01 13 | * 初探 Dart 语法 02 14 | * 掌握如何让函数更好地调用 15 | * 掌握 Dart 集合的使用 16 | * 深入分析 Dart 集合源码 17 | * 掌握 Dart 集合操作符函数使用 18 | * 深入分析 Dart 集合操作符源码 19 | * 掌握 Dart 的面向对象基础 20 | * 深入理解 Dart 中的继承和 Minxins 21 | * 深入理解 Dart 中的类型系统和泛型 22 | * 掌握 Dart 中库 library 的使用 23 | * 尝鲜 Dart 2.7 最新语法之可空与非空类型 24 | * 尝鲜 Dart 2.7 最新语法之扩展方法 25 | * 尝鲜 Dart 2.7 最新语法之泛型强化:声明处型变 26 | ### 进阶篇 27 | * 异步编程之 Isolate 28 | * 异步编程之 EventLoop 29 | * 异步编程之 Future 30 | * 异步编程之 Stream 31 | * 异步编程之 async和await 32 | * 异步编程之同步异步生成器函数 33 | ### 实战篇 34 | * Dart 与 C 的互相调用 35 | * Dart 虚拟机运行原理 36 | * Flutter 实现高仿开眼 APP 的页面开发 01 37 | * Flutter 实现高仿开眼 APP 的页面开发 02 38 | * Flutter 实现高仿开眼 APP 的页面开发 03 39 | 40 | ## 主要使用的技术点 41 | 42 | * Dart扩展函数的使用 43 | 44 | * Dio网络库优雅封装以及使用 45 | 46 | * Bloc状态管理以及实现UI和逻辑分离 47 | 48 | * json_serializable的使用 49 | 50 | * ScreenRuler Flutter UI尺寸和字体大小的统一适配 51 | 52 | * 列表刷新和加载更多组件实现 53 | 54 | ## 目前支持的平台有 55 | 56 | * Android 57 | 58 | * iOS 59 | 60 | * Mac Desktop 61 | 62 | * Linux Desktop 63 | 64 | * Web Chrome 65 | 66 | * Web Server 67 | 68 | ## 运行效果 69 | 70 | * iOS 71 | 72 | ![art.png](art/art.png) -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.demo" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig signingConfigs.debug 53 | ndk { 54 | abiFilters "armeabi-v7a" 55 | } 56 | } 57 | } 58 | } 59 | 60 | flutter { 61 | source '../..' 62 | } 63 | 64 | dependencies { 65 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 66 | } 67 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 14 | 21 | 25 | 29 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/demo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.demo 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/eye_video/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.eye_video 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /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-5.6.2-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 | -------------------------------------------------------------------------------- /art/art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/art/art.png -------------------------------------------------------------------------------- /assets/fonts/NotoSansHans-Medium.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/fonts/NotoSansHans-Medium.otf -------------------------------------------------------------------------------- /assets/fonts/NotoSansHans-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/fonts/NotoSansHans-Regular.otf -------------------------------------------------------------------------------- /assets/fonts/Oswald-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/fonts/Oswald-Regular.otf -------------------------------------------------------------------------------- /assets/images/biz_app_icon_attention.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/images/biz_app_icon_attention.png -------------------------------------------------------------------------------- /assets/images/biz_app_icon_collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/images/biz_app_icon_collection.png -------------------------------------------------------------------------------- /assets/images/biz_app_icon_dynamic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/images/biz_app_icon_dynamic.png -------------------------------------------------------------------------------- /assets/images/biz_app_icon_fans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/images/biz_app_icon_fans.png -------------------------------------------------------------------------------- /assets/images/biz_app_icon_reply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/images/biz_app_icon_reply.png -------------------------------------------------------------------------------- /assets/images/biz_app_icon_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/images/biz_app_icon_share.png -------------------------------------------------------------------------------- /assets/images/biz_app_icon_works.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/assets/images/biz_app_icon_works.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - shared_preferences (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | shared_preferences: 14 | :path: ".symlinks/plugins/shared_preferences/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec 18 | shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d 19 | 20 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 21 | 22 | COCOAPODS: 1.9.1 23 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | demo 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/bizmodule/bizwidget/cover_image_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CoverImageItem extends StatelessWidget { 4 | final double width; 5 | final String coverUrl; 6 | final int duration; 7 | 8 | const CoverImageItem( 9 | {Key key, this.width: 0, this.coverUrl, this.duration: -1}) 10 | : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | var coverImageWidget = Container( 15 | width: width == 0 ? double.infinity : width, 16 | height: (width == 0 ? MediaQuery.of(context).size.width : width) * 0.5, 17 | decoration: ShapeDecoration( 18 | image: DecorationImage( 19 | image: NetworkImage(coverUrl), 20 | fit: BoxFit.cover, 21 | ), 22 | shape: RoundedRectangleBorder( 23 | borderRadius: BorderRadius.circular(5), 24 | ), 25 | ), 26 | ); 27 | 28 | if (duration >= 0) { 29 | var tvTimeLabel = Container( 30 | decoration: ShapeDecoration( 31 | color: Color(0xff333333), 32 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(3)), 33 | ), 34 | child: Padding( 35 | padding: const EdgeInsets.only(left: 6, top: 1, right: 6, bottom: 1), 36 | child: Text( 37 | getTimeLabel(duration), 38 | style: TextStyle( 39 | fontSize: 12, 40 | fontWeight: FontWeight.bold, 41 | fontFamily: 'Oswald-Regular', 42 | color: Color(0xffffffff), 43 | ), 44 | ), 45 | ), 46 | ); 47 | 48 | return Stack( 49 | alignment: AlignmentDirectional.bottomEnd, 50 | children: [ 51 | coverImageWidget, 52 | Positioned( 53 | child: tvTimeLabel, 54 | bottom: 3, 55 | right: 3, 56 | ), 57 | ], 58 | ); 59 | } 60 | 61 | return coverImageWidget; 62 | } 63 | 64 | String getTimeLabel(int duration) { 65 | if (duration < 60) { 66 | return "00 : $duration"; 67 | } else if (duration >= 60) { 68 | int minute = duration ~/ 60; 69 | int second = duration % 60; 70 | String minuteStr = minute < 10 ? "0$minute" : "$minute"; 71 | String secondStr = second < 10 ? "0$second" : "$second"; 72 | return "$minuteStr : $secondStr"; 73 | } 74 | return "00 : 00"; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /lib/bizmodule/bizwidget/follow_list_head.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class FollowListHead extends StatelessWidget { 4 | final String title; 5 | final String avatarUrl; 6 | final String description; 7 | 8 | const FollowListHead({Key key, this.title, this.avatarUrl, this.description}) 9 | : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | var ivAvatar = CircleAvatar( 14 | backgroundImage: NetworkImage(avatarUrl), 15 | ); 16 | 17 | var tvTitle = Text( 18 | title, 19 | style: TextStyle( 20 | fontSize: 14, 21 | color: Color(0xff333333), 22 | fontFamily: 'NotoSansHans-Medium', 23 | ), 24 | ); 25 | 26 | var tvSubtitle = Text( 27 | description, 28 | maxLines: 1, 29 | overflow: TextOverflow.ellipsis, 30 | style: TextStyle( 31 | fontSize: 12, 32 | color: Color(0xff666666), 33 | ), 34 | ); 35 | 36 | var btnFollow = Container( 37 | width: 40, 38 | height: 20, 39 | child: OutlineButton( 40 | padding: EdgeInsets.all(0), 41 | child: Text( 42 | '+关注', 43 | style: TextStyle( 44 | fontSize: 12, 45 | fontFamily: 'NotoSansHans-Regular', 46 | color: Color(0xff666666), 47 | ), 48 | ), 49 | borderSide: BorderSide( 50 | color: Color(0xff333333), 51 | width: 0.5, 52 | style: BorderStyle.solid, 53 | ), 54 | onPressed: () => null, 55 | ), 56 | ); 57 | 58 | return ListTile( 59 | leading: ivAvatar, 60 | contentPadding: EdgeInsets.zero, 61 | title: tvTitle, 62 | subtitle: tvSubtitle, 63 | trailing: btnFollow, 64 | enabled: false, 65 | onTap: () {}, 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/bizmodule/bizwidget/header_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class HeaderItem extends StatelessWidget { 4 | final String title; 5 | 6 | const HeaderItem({Key key, this.title}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Column( 11 | crossAxisAlignment: CrossAxisAlignment.start, 12 | children: [ 13 | Divider( 14 | color: Color(0xFFBDBDBD), 15 | thickness: 0.1, 16 | ), 17 | Container( 18 | margin: EdgeInsets.only(left: 10, top: 5, right: 10), 19 | child: Row( 20 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 21 | children: [ 22 | Text( 23 | title, 24 | style: TextStyle( 25 | fontSize: 18, 26 | color: Color(0xff333333), 27 | fontFamily: 'NotoSansHans-Medium', 28 | ), 29 | ), 30 | Container( 31 | width: 60, 32 | height: 20, 33 | child: OutlineButton( 34 | padding: EdgeInsets.all(0), 35 | child: Text( 36 | '查看更多', 37 | style: TextStyle( 38 | fontSize: 12, 39 | fontFamily: 'NotoSansHans-Regular', 40 | color: Color(0xff666666), 41 | ), 42 | ), 43 | borderSide: BorderSide( 44 | color: Color(0xff333333), 45 | width: 0.5, 46 | style: BorderStyle.solid, 47 | ), 48 | onPressed: () => null, 49 | ), 50 | ) 51 | ], 52 | ), 53 | ), 54 | ], 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/bizmodule/blocs.dart: -------------------------------------------------------------------------------- 1 | library bloc_unit; 2 | 3 | export 'main/thiz/blocs/main_bloc.dart'; 4 | export 'main/thiz/blocs/main_state.dart'; 5 | export 'main/thiz/blocs/main_event.dart'; 6 | 7 | export 'main/category/blocs/category_bloc.dart'; 8 | export 'main/category/blocs/category_event.dart'; 9 | export 'main/category/blocs/category_state.dart'; 10 | 11 | export 'main/selections/blocs/selection_bloc.dart'; 12 | export 'main/selections/blocs/selection_state.dart'; 13 | export 'main/selections/blocs/selection_event.dart'; 14 | 15 | -------------------------------------------------------------------------------- /lib/bizmodule/main/category/blocs/category_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/blocs.dart'; 2 | import 'package:eye_video/bizmodule/main/category/model/category_model.dart'; 3 | import 'package:eye_video/bizmodule/main/category/repositories/category_repository.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | 7 | class CategoryBloc extends Bloc { 8 | final CategoryRepository categoryRepository; 9 | 10 | CategoryBloc({@required this.categoryRepository}) : super(null) { 11 | add(EventRequestCategory()); //初始状态,手动添加首次请求事件 12 | } 13 | 14 | @override 15 | Stream mapEventToState(CategoryEvent event) async* { 16 | if (event is EventRequestCategory) { 17 | yield StateLoading(); 18 | try { 19 | final CategoryModel categoryModel = 20 | await categoryRepository.fetchCategories(); 21 | if (categoryModel == null || categoryModel.categoryList.isEmpty) { 22 | yield StateEmpty(); 23 | } else { 24 | yield StateLoadSuccess(categoryModel: categoryModel); 25 | } 26 | } catch (e) { 27 | yield StateLoadFailure(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/bizmodule/main/category/blocs/category_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class CategoryEvent extends Equatable { 4 | const CategoryEvent(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class EventRequestCategory extends CategoryEvent { 11 | const EventRequestCategory(); 12 | 13 | @override 14 | List get props => []; 15 | } 16 | -------------------------------------------------------------------------------- /lib/bizmodule/main/category/blocs/category_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:eye_video/bizmodule/main/category/model/category_model.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | abstract class CategoryState extends Equatable { 6 | @override 7 | List get props => []; 8 | 9 | const CategoryState(); 10 | } 11 | 12 | class StateLoadSuccess extends CategoryState { 13 | final CategoryModel categoryModel; 14 | 15 | const StateLoadSuccess({@required this.categoryModel}) 16 | : assert(categoryModel != null); 17 | 18 | @override 19 | List get props => [categoryModel]; 20 | } 21 | 22 | class StateLoadFailure extends CategoryState { 23 | List get props => []; 24 | } 25 | 26 | class StateLoading extends CategoryState { 27 | List get props => []; 28 | } 29 | 30 | class StateEmpty extends CategoryState { 31 | List get props => []; 32 | } -------------------------------------------------------------------------------- /lib/bizmodule/main/category/category_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/blocs.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:eye_video/framework/extension/image_compress.dart'; 5 | 6 | class CategoryPage extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return BlocBuilder(builder: (context, state) { 10 | if (state is StateLoading) { 11 | return Center( 12 | child: CircularProgressIndicator(), 13 | ); 14 | } else if (state is StateEmpty) { 15 | return Center( 16 | child: Text('数据请求为空'), 17 | ); 18 | } else if (state is StateLoadFailure) { 19 | return Center( 20 | child: Text('数据请求失败'), 21 | ); 22 | } else if (state is StateLoadSuccess) { 23 | return GridView.count( 24 | crossAxisCount: 2, 25 | crossAxisSpacing: 3, 26 | padding: EdgeInsets.all(3), 27 | mainAxisSpacing: 3, 28 | 29 | children: state.categoryModel.categoryList.map((itemData) { 30 | var coverImage = itemData.item.image.compress_value(); 31 | String title = itemData.item.title; 32 | return Stack( 33 | alignment: Alignment.center, 34 | children: [ 35 | Container( 36 | width: double.infinity, 37 | height: double.infinity, 38 | child: Image.network( 39 | coverImage, 40 | fit: BoxFit.cover, 41 | ), 42 | ), 43 | Positioned( 44 | child: Text( 45 | '${title.replaceAll("#", "")}', 46 | style: TextStyle( 47 | fontFamily: 'NotoSansHans-Medium', 48 | fontSize: 16, 49 | color: Colors.white, 50 | ), 51 | ), 52 | ), 53 | ], 54 | ); 55 | }).toList(), 56 | ); 57 | } 58 | return Container(); 59 | }); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/bizmodule/main/category/model/category_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'category_model.g.dart'; 5 | 6 | @JsonSerializable() 7 | class CategoryModel extends Equatable { 8 | @JsonKey(name: 'itemList') 9 | final List categoryList; 10 | 11 | @JsonKey(name: 'count') 12 | final int count; 13 | 14 | @JsonKey(name: 'total') 15 | final int total; 16 | 17 | @JsonKey(name: 'adExist') 18 | final bool adExist; 19 | 20 | CategoryModel(this.categoryList, this.count, this.total, this.adExist); 21 | 22 | factory CategoryModel.fromJson(Map srcJson) => 23 | _$CategoryModelFromJson(srcJson); 24 | 25 | Map toJson() => _$CategoryModelToJson(this); 26 | 27 | @override 28 | List get props => [categoryList, count, total, adExist]; 29 | } 30 | 31 | @JsonSerializable() 32 | class CategoryList extends Equatable { 33 | @JsonKey(name: 'type') 34 | final String type; 35 | 36 | @JsonKey(name: 'data') 37 | final CategoryItem item; 38 | 39 | @JsonKey(name: 'id') 40 | final int id; 41 | 42 | @JsonKey(name: 'adIndex') 43 | final int adIndex; 44 | 45 | CategoryList(this.type, this.item, this.id, this.adIndex); 46 | 47 | factory CategoryList.fromJson(Map srcJson) => 48 | _$CategoryListFromJson(srcJson); 49 | 50 | Map toJson() => _$CategoryListToJson(this); 51 | 52 | @override 53 | List get props => [ 54 | type, 55 | item, 56 | id, 57 | adIndex 58 | ]; 59 | } 60 | 61 | @JsonSerializable() 62 | class CategoryItem extends Equatable { 63 | @JsonKey(name: 'dataType') 64 | final String dataType; 65 | 66 | @JsonKey(name: 'id') 67 | final int id; 68 | 69 | @JsonKey(name: 'title') 70 | final String title; 71 | 72 | @JsonKey(name: 'image') 73 | final String image; 74 | 75 | @JsonKey(name: 'actionUrl') 76 | final String actionUrl; 77 | 78 | @JsonKey(name: 'shade') 79 | final bool shade; 80 | 81 | CategoryItem(this.dataType, this.id, this.title, this.image, this.actionUrl, 82 | this.shade); 83 | 84 | factory CategoryItem.fromJson(Map srcJson) => 85 | _$CategoryItemFromJson(srcJson); 86 | 87 | Map toJson() => _$CategoryItemToJson(this); 88 | 89 | @override 90 | List get props => [ 91 | dataType, 92 | id, 93 | title, 94 | image, 95 | actionUrl, 96 | shade 97 | ]; 98 | } 99 | -------------------------------------------------------------------------------- /lib/bizmodule/main/category/model/category_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'category_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | CategoryModel _$CategoryModelFromJson(Map json) { 10 | return CategoryModel( 11 | (json['itemList'] as List) 12 | ?.map((e) => 13 | e == null ? null : CategoryList.fromJson(e as Map)) 14 | ?.toList(), 15 | json['count'] as int, 16 | json['total'] as int, 17 | json['adExist'] as bool, 18 | ); 19 | } 20 | 21 | Map _$CategoryModelToJson(CategoryModel instance) => 22 | { 23 | 'itemList': instance.categoryList, 24 | 'count': instance.count, 25 | 'total': instance.total, 26 | 'adExist': instance.adExist, 27 | }; 28 | 29 | CategoryList _$CategoryListFromJson(Map json) { 30 | return CategoryList( 31 | json['type'] as String, 32 | json['data'] == null 33 | ? null 34 | : CategoryItem.fromJson(json['data'] as Map), 35 | json['id'] as int, 36 | json['adIndex'] as int, 37 | ); 38 | } 39 | 40 | Map _$CategoryListToJson(CategoryList instance) => 41 | { 42 | 'type': instance.type, 43 | 'data': instance.item, 44 | 'id': instance.id, 45 | 'adIndex': instance.adIndex, 46 | }; 47 | 48 | CategoryItem _$CategoryItemFromJson(Map json) { 49 | return CategoryItem( 50 | json['dataType'] as String, 51 | json['id'] as int, 52 | json['title'] as String, 53 | json['image'] as String, 54 | json['actionUrl'] as String, 55 | json['shade'] as bool, 56 | ); 57 | } 58 | 59 | Map _$CategoryItemToJson(CategoryItem instance) => 60 | { 61 | 'dataType': instance.dataType, 62 | 'id': instance.id, 63 | 'title': instance.title, 64 | 'image': instance.image, 65 | 'actionUrl': instance.actionUrl, 66 | 'shade': instance.shade, 67 | }; 68 | -------------------------------------------------------------------------------- /lib/bizmodule/main/category/repositories/category_repository.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:eye_video/bizmodule/main/category/model/category_model.dart'; 3 | 4 | abstract class CategoryRepository { 5 | Future fetchCategories(); 6 | } -------------------------------------------------------------------------------- /lib/bizmodule/main/category/repositories/mock/mock_category_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/category/model/category_model.dart'; 2 | import 'package:eye_video/bizmodule/main/category/repositories/category_repository.dart'; 3 | import 'package:eye_video/framework/network/pretty_http.dart'; 4 | 5 | class MockCategoryRepository extends CategoryRepository { 6 | @override 7 | Future fetchCategories() async { 8 | var resData = await PrettyHttp.get('api/categories/list'); 9 | return Future.value(CategoryModel.fromJson(resData)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/bizmodule/main/community/blocs/community_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/community/blocs/community_event.dart'; 2 | import 'package:eye_video/bizmodule/main/community/blocs/community_state.dart'; 3 | import 'package:eye_video/bizmodule/main/community/model/community_model.dart'; 4 | import 'package:eye_video/bizmodule/main/community/respositories/community_repository.dart'; 5 | import 'package:eye_video/bizmodule/main/community/extension/ext_community.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_bloc/flutter_bloc.dart'; 8 | 9 | class CommunityBloc extends Bloc { 10 | final CommunityRepository communityRepository; 11 | List mCommunityList = []; 12 | String nextPageUrl; 13 | 14 | CommunityBloc({@required this.communityRepository}) : super(null){ 15 | add(EventRequest(isFirst: true, isRefresh: true)); 16 | } 17 | 18 | @override 19 | Stream mapEventToState(CommunityEvent event) async* { 20 | if (event is EventRequest) { 21 | if (event.isFirst) { 22 | yield StateRequestLoading(); 23 | } 24 | try { 25 | if (event.isRefresh) { 26 | //刷新 27 | mCommunityList.clear(); 28 | var communityModel = await communityRepository.fetchCommunity(); 29 | nextPageUrl = communityModel.nextPageUrl ?? ""; 30 | mCommunityList.addAll(communityModel.communityList); 31 | } else { 32 | //加载更多 33 | if (_hasNextPage(nextPageUrl)) { 34 | var communityModel = await communityRepository.fetchCommunity(); 35 | nextPageUrl = communityModel.nextPageUrl ?? ""; 36 | mCommunityList.addAll(communityModel.communityList.where((element) => !element.isHorizontalScrollCard)); 37 | } 38 | } 39 | 40 | if (mCommunityList.isEmpty) { 41 | yield StateRequestEmpty(); 42 | } else { 43 | yield StateRequestSuccess(List.of(mCommunityList), _hasNextPage(nextPageUrl)); 44 | } 45 | } catch (e) { 46 | yield StateRequestFailure(); 47 | } 48 | } 49 | } 50 | 51 | bool _hasNextPage(String nextPageUrl) { 52 | if (nextPageUrl == null || nextPageUrl.isEmpty) { 53 | return false; 54 | } 55 | try { 56 | Uri uri = Uri.parse(nextPageUrl); 57 | // ignore: unrelated_type_equality_checks 58 | if (uri.queryParameters['smallCardLast'] == null && uri.queryParameters['smallCardLast'] == 0 && 59 | uri.queryParameters['pageCount'] == '0') { 60 | return false; 61 | } 62 | } catch (e) { 63 | return false; 64 | } 65 | return true; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /lib/bizmodule/main/community/blocs/community_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class CommunityEvent extends Equatable { 4 | @override 5 | List get props => []; 6 | 7 | const CommunityEvent(); 8 | } 9 | 10 | class EventRequest extends CommunityEvent { 11 | @override 12 | List get props => [isFirst]; 13 | 14 | final bool isFirst; 15 | 16 | final bool isRefresh; 17 | 18 | const EventRequest({this.isFirst: true, this.isRefresh: true}); 19 | } -------------------------------------------------------------------------------- /lib/bizmodule/main/community/blocs/community_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:eye_video/bizmodule/main/community/model/community_model.dart'; 3 | 4 | abstract class CommunityState extends Equatable { 5 | @override 6 | List get props => []; 7 | 8 | const CommunityState(); 9 | } 10 | 11 | class StateRequestSuccess extends CommunityState { 12 | final List communityList; 13 | 14 | final bool hasNextPage; 15 | 16 | const StateRequestSuccess(this.communityList, this.hasNextPage); 17 | 18 | List get props => [communityList, hasNextPage]; 19 | } 20 | 21 | class StateRequestLoading extends CommunityState { 22 | List get props => []; 23 | } 24 | 25 | class StateRequestFailure extends CommunityState { 26 | List get props => []; 27 | } 28 | 29 | class StateRequestEmpty extends CommunityState { 30 | List get props => []; 31 | } 32 | -------------------------------------------------------------------------------- /lib/bizmodule/main/community/extension/ext_community.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/community/model/community_model.dart'; 2 | 3 | const int _MINUTE = 60; // 1分钟 4 | const int _HOUR = 60 * _MINUTE; // 1小时 5 | const int _DAY = 24 * _HOUR; // 1天 6 | const int _MONTH = 31 * _DAY; // 月 7 | const int _YEAR = 12 * _MONTH; // 年 8 | 9 | String prettyTime(int timeMillis) { 10 | if (timeMillis < 0) return ""; 11 | var currentMills = DateTime.now().millisecondsSinceEpoch; 12 | int seconds = (currentMills - timeMillis) ~/ 1000; 13 | if (seconds <= 0) { 14 | return "刚刚"; 15 | } 16 | 17 | if (seconds < 60) { 18 | return "${seconds.toString()}秒前"; 19 | } 20 | 21 | int minutes = seconds ~/ _MINUTE; 22 | if (seconds < 60) { 23 | return "${minutes.toString()}分钟前"; 24 | } 25 | 26 | int hours = seconds ~/ _HOUR; 27 | if (hours < 24) { 28 | return "${hours.toString()}小时前"; 29 | } 30 | 31 | int days = seconds ~/ _DAY; 32 | if (days < 31) { 33 | return "${days.toString()}天前"; 34 | } 35 | 36 | int months = seconds ~/ _MONTH; 37 | if (months < 12) { 38 | return "${months.toString()}月前"; 39 | } 40 | 41 | int years = seconds ~/ _YEAR; 42 | return "${years.toString()}年前"; 43 | } 44 | 45 | extension ExtCommunity on Community { 46 | bool get isHorizontalScrollCard => 47 | this.type == 'horizontalScrollCard' && 48 | data != null && 49 | data.dataType == 'HorizontalScrollCard' && 50 | data.communityList.isNotEmpty; 51 | 52 | bool get isPicFollowCard => 53 | this.type == 'pictureFollowCard' && 54 | data != null && 55 | data.dataType == 'FollowCard' && 56 | data.header != null && 57 | data.content != null; 58 | } 59 | -------------------------------------------------------------------------------- /lib/bizmodule/main/community/respositories/community_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/community/model/community_model.dart'; 2 | 3 | abstract class CommunityRepository { 4 | Future fetchCommunity({String nextPageUrl}); 5 | } 6 | -------------------------------------------------------------------------------- /lib/bizmodule/main/community/respositories/mock/mock_community_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/community/model/community_model.dart'; 2 | import 'package:eye_video/bizmodule/main/community/respositories/community_repository.dart'; 3 | import 'package:eye_video/framework/network/pretty_http.dart'; 4 | 5 | class MockCommunityRepository extends CommunityRepository { 6 | @override 7 | Future fetchCommunity({String nextPageUrl}) async { 8 | try { 9 | Map reqParams; 10 | if (nextPageUrl == null || nextPageUrl.isEmpty) { 11 | reqParams = {}; 12 | } else { 13 | reqParams = Uri.parse(nextPageUrl).queryParameters; 14 | } 15 | var resData = await PrettyHttp.get( 16 | "api/community/recommend/list", 17 | reqParams: reqParams, 18 | ); 19 | return Future.value(CommunityModel.fromJson(resData)); 20 | } catch (e) { 21 | return Future.error(e); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/blocs/discovery_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/discovery/blocs/discovery_event.dart'; 2 | import 'package:eye_video/bizmodule/main/discovery/blocs/discovery_state.dart'; 3 | import 'package:eye_video/bizmodule/main/discovery/respositories/discovery_repository.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart'; 6 | import 'package:flutter_bloc/flutter_bloc.dart'; 7 | 8 | class DiscoveryBloc extends Bloc { 9 | final DiscoveryRepository discoveryRepository; 10 | 11 | DiscoveryBloc({@required this.discoveryRepository}) : super(null) { 12 | add(DiscoveryRequestEvent()); 13 | } 14 | 15 | @override 16 | Stream mapEventToState(DiscoveryEvent event) async* { 17 | if (event is DiscoveryRequestEvent) { 18 | yield StateLoading(); 19 | try { 20 | final DiscoveryModel discoveryModel = 21 | await discoveryRepository.fetchDiscovery(); 22 | if (discoveryModel == null || discoveryModel.discoveryList.isEmpty) { 23 | yield StateEmpty(); 24 | } else { 25 | yield StateLoadSuccess(discoveryModel: discoveryModel); 26 | } 27 | } catch (e) { 28 | yield StateLoadFailure(); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/blocs/discovery_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class DiscoveryEvent extends Equatable { 4 | const DiscoveryEvent(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class DiscoveryRequestEvent extends DiscoveryEvent { 11 | const DiscoveryRequestEvent(); 12 | 13 | @override 14 | List get props => []; 15 | } 16 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/blocs/discovery_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart'; 4 | 5 | abstract class DiscoveryState extends Equatable { 6 | const DiscoveryState(); 7 | 8 | @override 9 | List get props => []; 10 | } 11 | 12 | class StateLoadSuccess extends DiscoveryState { 13 | final DiscoveryModel discoveryModel; 14 | 15 | const StateLoadSuccess({@required this.discoveryModel}) 16 | : assert(discoveryModel != null); 17 | 18 | @override 19 | List get props => [discoveryModel]; 20 | } 21 | 22 | class StateLoadFailure extends DiscoveryState { 23 | List get props => []; 24 | } 25 | 26 | class StateLoading extends DiscoveryState { 27 | List get props => []; 28 | } 29 | 30 | class StateEmpty extends DiscoveryState { 31 | List get props => []; 32 | } 33 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/extension/ext_discovery.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart'; 2 | 3 | extension ExtDiscovery on Discovery { 4 | bool get isHorizontalScrollCard => 5 | this.type == 'horizontalScrollCard' && 6 | this.data != null && 7 | this.data.discoveryList.isNotEmpty && 8 | this.data.discoveryList[0] != null && 9 | this.data.discoveryList[0].data.dataType == 'Banner'; 10 | 11 | bool get isSpecialSquareHeader => 12 | type == 'specialSquareCardCollection' && 13 | this.data != null && 14 | this.data.header != null && 15 | this.data.header.title != null; 16 | 17 | bool get isSpecialSquareCard => 18 | type == 'specialSquareCardCollection' && 19 | this.data != null && 20 | this.data.discoveryList != null && 21 | this.data.discoveryList.isNotEmpty && 22 | this.data.discoveryList[0].type == 'squareCardOfCategory' && 23 | this.data.discoveryList[0].data.dataType == 'SquareCard'; 24 | 25 | bool get isColumnCardListHeader => 26 | type == 'columnCardList' && 27 | this.data != null && 28 | this.data.header != null && 29 | this.data.header.title != null; 30 | 31 | bool get isColumnCardList => 32 | type == 'columnCardList' && 33 | this.data != null && 34 | this.data.discoveryList != null && 35 | this.data.discoveryList.isNotEmpty && 36 | this.data.discoveryList[0].type == 'squareCardOfColumn' && 37 | this.data.discoveryList[0].data.dataType == 'SquareCard'; 38 | 39 | bool get isHeaderCard => 40 | type == 'textCard' && data != null && data.text.isNotEmpty; 41 | 42 | bool get isBriefCard => 43 | type == 'briefCard' && data != null; 44 | } 45 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/model/discovery_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'discovery_model.g.dart'; 5 | 6 | @JsonSerializable() 7 | class DiscoveryModel extends Equatable { 8 | @JsonKey(name: 'itemList') 9 | final List discoveryList; 10 | 11 | @JsonKey(name: 'count') 12 | final int count; 13 | 14 | @JsonKey(name: 'total') 15 | final int total; 16 | 17 | @JsonKey(name: 'nextPageUrl') 18 | final String nextPageUrl; 19 | 20 | @JsonKey(name: 'adExist') 21 | final bool adExist; 22 | 23 | DiscoveryModel(this.discoveryList, this.count, this.total, this.nextPageUrl, 24 | this.adExist); 25 | 26 | factory DiscoveryModel.fromJson(Map srcJson) => 27 | _$DiscoveryModelFromJson(srcJson); 28 | 29 | Map toJson() => _$DiscoveryModelToJson(this); 30 | 31 | @override 32 | List get props => [discoveryList, count, total, nextPageUrl, adExist]; 33 | } 34 | 35 | @JsonSerializable() 36 | class Discovery extends Equatable { 37 | @JsonKey(name: 'type') 38 | final String type; 39 | 40 | @JsonKey(name: 'data') 41 | final DiscoveryData data; 42 | 43 | @JsonKey(name: 'tag') 44 | final String tag; 45 | 46 | @JsonKey(name: 'id') 47 | final int id; 48 | 49 | @JsonKey(name: 'adIndex') 50 | final int adIndex; 51 | 52 | Discovery(this.type, this.data, this.tag, this.id, this.adIndex); 53 | 54 | factory Discovery.fromJson(Map srcJson) { 55 | try { 56 | return _$DiscoveryFromJson(srcJson); 57 | } catch (e) { 58 | print('$e'); 59 | } 60 | } 61 | 62 | Map toJson() => _$DiscoveryToJson(this); 63 | 64 | @override 65 | List get props => [type, data, tag, id, adIndex]; 66 | } 67 | 68 | @JsonSerializable() 69 | class DiscoveryData extends Equatable { 70 | @JsonKey(name: 'dataType') 71 | final String dataType; 72 | 73 | @JsonKey(name: 'itemList') 74 | final List discoveryList; 75 | 76 | @JsonKey(name: 'header') 77 | final DiscoveryData header; 78 | 79 | @JsonKey(name: 'id') 80 | final int id; 81 | 82 | @JsonKey(name: 'type') 83 | final String type; 84 | 85 | @JsonKey(name: 'text') 86 | final String text; 87 | 88 | @JsonKey(name: 'title') 89 | final String title; 90 | 91 | @JsonKey(name: 'subTitle') 92 | final String subTitle; 93 | 94 | @JsonKey(name: 'icon') 95 | final String icon; 96 | 97 | @JsonKey(name: 'iconType') 98 | final String iconType; 99 | 100 | @JsonKey(name: 'actionUrl') 101 | final String actionUrl; 102 | 103 | @JsonKey(name: 'description') 104 | final String description; 105 | 106 | @JsonKey(name: 'image') 107 | final String image; 108 | 109 | DiscoveryData( 110 | this.dataType, 111 | this.discoveryList, 112 | this.header, 113 | this.id, 114 | this.type, 115 | this.text, 116 | this.title, 117 | this.subTitle, 118 | this.icon, 119 | this.iconType, 120 | this.actionUrl, 121 | this.description, 122 | this.image); 123 | 124 | @override 125 | List get props => [ 126 | dataType, 127 | discoveryList, 128 | header, 129 | id, 130 | type, 131 | text, 132 | title, 133 | subTitle, 134 | icon, 135 | iconType, 136 | actionUrl, 137 | description, 138 | image 139 | ]; 140 | 141 | factory DiscoveryData.fromJson(Map srcJson) { 142 | try { 143 | return _$DiscoveryDataFromJson(srcJson); 144 | } catch (e) { 145 | print('$e'); 146 | } 147 | } 148 | 149 | Map toJson() => _$DiscoveryDataToJson(this); 150 | } 151 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/model/discovery_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'discovery_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DiscoveryModel _$DiscoveryModelFromJson(Map json) { 10 | return DiscoveryModel( 11 | (json['itemList'] as List) 12 | ?.map((e) => 13 | e == null ? null : Discovery.fromJson(e as Map)) 14 | ?.toList(), 15 | json['count'] as int, 16 | json['total'] as int, 17 | json['nextPageUrl'] as String, 18 | json['adExist'] as bool, 19 | ); 20 | } 21 | 22 | Map _$DiscoveryModelToJson(DiscoveryModel instance) => 23 | { 24 | 'itemList': instance.discoveryList, 25 | 'count': instance.count, 26 | 'total': instance.total, 27 | 'nextPageUrl': instance.nextPageUrl, 28 | 'adExist': instance.adExist, 29 | }; 30 | 31 | Discovery _$DiscoveryFromJson(Map json) { 32 | return Discovery( 33 | json['type'] as String, 34 | json['data'] == null 35 | ? null 36 | : DiscoveryData.fromJson(json['data'] as Map), 37 | json['tag'] as String, 38 | json['id'] as int, 39 | json['adIndex'] as int, 40 | ); 41 | } 42 | 43 | Map _$DiscoveryToJson(Discovery instance) => { 44 | 'type': instance.type, 45 | 'data': instance.data, 46 | 'tag': instance.tag, 47 | 'id': instance.id, 48 | 'adIndex': instance.adIndex, 49 | }; 50 | 51 | DiscoveryData _$DiscoveryDataFromJson(Map json) { 52 | return DiscoveryData( 53 | json['dataType'] as String, 54 | (json['itemList'] as List) 55 | ?.map((e) => 56 | e == null ? null : Discovery.fromJson(e as Map)) 57 | ?.toList(), 58 | json['header'] == null 59 | ? null 60 | : DiscoveryData.fromJson(json['header'] as Map), 61 | json['id'] as int, 62 | json['type'] as String, 63 | json['text'] as String, 64 | json['title'] as String, 65 | json['subTitle'] as String, 66 | json['icon'] as String, 67 | json['iconType'] as String, 68 | json['actionUrl'] as String, 69 | json['description'] as String, 70 | json['image'] as String, 71 | ); 72 | } 73 | 74 | Map _$DiscoveryDataToJson(DiscoveryData instance) => 75 | { 76 | 'dataType': instance.dataType, 77 | 'itemList': instance.discoveryList, 78 | 'header': instance.header, 79 | 'id': instance.id, 80 | 'type': instance.type, 81 | 'text': instance.text, 82 | 'title': instance.title, 83 | 'subTitle': instance.subTitle, 84 | 'icon': instance.icon, 85 | 'iconType': instance.iconType, 86 | 'actionUrl': instance.actionUrl, 87 | 'description': instance.description, 88 | 'image': instance.image, 89 | }; 90 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/respositories/discovery_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart'; 2 | 3 | abstract class DiscoveryRepository { 4 | Future fetchDiscovery(); 5 | } 6 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/respositories/mock/mock_discovery_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart'; 2 | import 'package:eye_video/bizmodule/main/discovery/respositories/discovery_repository.dart'; 3 | import 'package:eye_video/framework/network/pretty_http.dart'; 4 | 5 | class MockDiscoveryRepository extends DiscoveryRepository { 6 | @override 7 | Future fetchDiscovery() async { 8 | var resData = await PrettyHttp.get("api/discovery/list"); 9 | return Future.value(DiscoveryModel.fromJson(resData)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/bizmodule/main/discovery/widgets/hot_category_items.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:eye_video/bizmodule/main/discovery/model/discovery_model.dart'; 3 | 4 | class HotCategoryItems extends StatelessWidget { 5 | final List discoveryList; 6 | 7 | const HotCategoryItems({Key key, this.discoveryList}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | height: 210, 13 | child: GridView.count( 14 | primary: false, 15 | scrollDirection: Axis.horizontal, 16 | shrinkWrap: true, 17 | crossAxisCount: 2, 18 | mainAxisSpacing: 7, 19 | padding: EdgeInsets.only(top: 15), 20 | children: discoveryList 21 | .map( 22 | (discovery) => Column( 23 | children: [ 24 | Container( 25 | width: 60, 26 | height: 60, 27 | child: CircleAvatar( 28 | backgroundImage: NetworkImage(discovery.data.image), 29 | ), 30 | ), 31 | Padding( 32 | padding: EdgeInsets.only(top: 8), 33 | child: Text(discovery.data.title.replaceAll("#", "")), 34 | ), 35 | ], 36 | ), 37 | ) 38 | .toList(), 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/blocs/selection_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class SelectionEvent extends Equatable { 4 | @override 5 | List get props => []; 6 | 7 | const SelectionEvent(); 8 | } 9 | 10 | class EventRequest extends SelectionEvent { 11 | @override 12 | List get props => [isFirst]; 13 | 14 | final bool isFirst; 15 | 16 | final bool isRefresh; 17 | 18 | const EventRequest({this.isFirst: true, this.isRefresh: true}); 19 | } -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/blocs/selection_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:eye_video/bizmodule/main/selections/model/selection_model.dart'; 3 | 4 | abstract class SelectionState extends Equatable { 5 | @override 6 | List get props => []; 7 | 8 | const SelectionState(); 9 | } 10 | 11 | class StateRequestSuccess extends SelectionState { 12 | final List selections; 13 | 14 | final bool hasNextPage; 15 | 16 | const StateRequestSuccess(this.selections, this.hasNextPage); 17 | 18 | List get props => [selections, hasNextPage]; 19 | } 20 | 21 | class StateRequestLoading extends SelectionState { 22 | List get props => []; 23 | } 24 | 25 | class StateRequestFailure extends SelectionState { 26 | List get props => []; 27 | } 28 | 29 | class StateRequestEmpty extends SelectionState { 30 | List get props => []; 31 | } -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/blocs/ugc/ugc_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/selections/blocs/ugc/ugc_event.dart'; 2 | import 'package:eye_video/bizmodule/main/selections/blocs/ugc/ugc_state.dart'; 3 | import 'package:eye_video/bizmodule/main/selections/model/ugc/ugc_model.dart'; 4 | import 'package:eye_video/bizmodule/main/selections/respositories/ugc_repository.dart'; 5 | import 'package:flutter/cupertino.dart'; 6 | import 'package:flutter_bloc/flutter_bloc.dart'; 7 | 8 | class UgcBloc extends Bloc { 9 | final UgcRepository ugcRepository; 10 | List mUgcList = []; 11 | int currPage = 1; 12 | int totalCount = 0; 13 | 14 | UgcBloc({@required this.ugcRepository}) : super(null) { 15 | add(UgcEventRequest(isFirst: true, isRefresh: true)); 16 | } 17 | 18 | @override 19 | Stream mapEventToState(UgcEvent event) async* { 20 | try { 21 | if (event is UgcEventRequest) { 22 | if (event.isFirst) { 23 | yield UgcStateRequestLoading(); 24 | } 25 | 26 | if (event.isRefresh) { 27 | mUgcList.clear(); 28 | currPage = 1; 29 | var ugcListModel = await ugcRepository.fetchUgcList(page: currPage, pageSize: 20); 30 | totalCount = ugcListModel.totalCount; 31 | mUgcList.addAll(ugcListModel.list); 32 | } else { 33 | if (_hasNextPage) { 34 | var ugcListModel = await ugcRepository.fetchUgcList( 35 | page: ++currPage, pageSize: 20); 36 | totalCount = ugcListModel.totalCount; 37 | mUgcList.addAll(ugcListModel.list); 38 | } 39 | } 40 | if (mUgcList.isEmpty) { 41 | yield UgcStateRequestEmpty(); 42 | } else { 43 | yield UgcStateRequestSuccess(List.of(mUgcList), _hasNextPage); 44 | } 45 | } 46 | } catch (e) { 47 | yield UgcStateRequestFailure(); 48 | } 49 | } 50 | 51 | bool get _hasNextPage => totalCount > mUgcList.length; 52 | } 53 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/blocs/ugc/ugc_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class UgcEvent extends Equatable { 4 | @override 5 | List get props => []; 6 | 7 | const UgcEvent(); 8 | } 9 | 10 | class UgcEventRequest extends UgcEvent { 11 | @override 12 | List get props => [isFirst]; 13 | 14 | final bool isFirst; 15 | 16 | final bool isRefresh; 17 | 18 | const UgcEventRequest({this.isFirst: true, this.isRefresh: true}); 19 | } 20 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/blocs/ugc/ugc_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:eye_video/bizmodule/main/selections/model/ugc/ugc_model.dart'; 3 | 4 | abstract class UgcState extends Equatable { 5 | @override 6 | List get props => []; 7 | 8 | const UgcState(); 9 | } 10 | 11 | class UgcStateRequestSuccess extends UgcState { 12 | final List ugcList; 13 | final bool hasNextPage; 14 | 15 | const UgcStateRequestSuccess(this.ugcList, this.hasNextPage); 16 | 17 | List get props => [ugcList, hasNextPage]; 18 | } 19 | 20 | class UgcStateRequestLoading extends UgcState { 21 | List get props => []; 22 | } 23 | 24 | class UgcStateRequestFailure extends UgcState { 25 | List get props => []; 26 | } 27 | 28 | class UgcStateRequestEmpty extends UgcState { 29 | List get props => []; 30 | } 31 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/extension/ext_selection.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/selections/model/selection_model.dart'; 2 | 3 | extension ExtSelection on Selection { 4 | bool get isFollowCard => 5 | type == 'followCard' && 6 | data != null && 7 | data.content != null && 8 | data.content.data != null && 9 | data.content.data.cover != null; 10 | 11 | bool get isSmallVideoCard => 12 | type == 'videoSmallCard' && data != null && data.cover != null; 13 | 14 | bool get isHeaderCard => 15 | type == 'textCard' && 16 | data != null && 17 | data.type == 'header5' && 18 | data.text.isNotEmpty; 19 | 20 | bool get isSquareCard => 21 | type == 'squareCardCollection' && 22 | data != null && 23 | data.header != null && 24 | data.selectionList != null; 25 | } 26 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_author_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'ugc_author_model.g.dart'; 5 | 6 | @JsonSerializable() 7 | class Author extends Equatable { 8 | factory Author.fromJson(Map json) => _$AuthorFromJson(json); 9 | 10 | Map toJson(instance) => _$AuthorToJson(this); 11 | @JsonKey(name: "id") 12 | final int id; 13 | 14 | @JsonKey(name: "icon") 15 | final String icon; 16 | 17 | @JsonKey(name: "name") 18 | final String name; 19 | 20 | @JsonKey(name: "description") 21 | final String description; 22 | 23 | Author({this.id, this.icon, this.name, this.description}); 24 | 25 | @override 26 | List get props => [id, icon, name, description]; 27 | } 28 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_author_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'ugc_author_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Author _$AuthorFromJson(Map json) { 10 | return Author( 11 | id: json['id'] as int, 12 | icon: json['icon'] as String, 13 | name: json['name'] as String, 14 | description: json['description'] as String, 15 | ); 16 | } 17 | 18 | Map _$AuthorToJson(Author instance) => { 19 | 'id': instance.id, 20 | 'icon': instance.icon, 21 | 'name': instance.name, 22 | 'description': instance.description, 23 | }; 24 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_list_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | import 'ugc_model.dart'; 5 | 6 | part 'ugc_list_model.g.dart'; 7 | 8 | @JsonSerializable() 9 | class UgcListModel extends Equatable { 10 | factory UgcListModel.fromJson(Map json) => 11 | _$UgcListModelFromJson(json); 12 | 13 | Map toJson(instance) => _$UgcListModelToJson(this); 14 | @JsonKey(name: "count") 15 | final int count; 16 | 17 | @JsonKey(name: "totalCount") 18 | final int totalCount; 19 | 20 | @JsonKey(name: "list") 21 | final List list; 22 | 23 | @override 24 | List get props => [count, totalCount, list]; 25 | 26 | UgcListModel({ 27 | this.count, 28 | this.totalCount, 29 | this.list, 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_list_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'ugc_list_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | UgcListModel _$UgcListModelFromJson(Map json) { 10 | return UgcListModel( 11 | count: json['count'] as int, 12 | totalCount: json['totalCount'] as int, 13 | list: (json['list'] as List) 14 | ?.map((e) => 15 | e == null ? null : UgcModel.fromJson(e as Map)) 16 | ?.toList(), 17 | ); 18 | } 19 | 20 | Map _$UgcListModelToJson(UgcListModel instance) => 21 | { 22 | 'count': instance.count, 23 | 'totalCount': instance.totalCount, 24 | 'list': instance.list, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | import 'ugc_author_model.dart'; 5 | import 'ugc_tag_model.dart'; 6 | 7 | part 'ugc_model.g.dart'; 8 | 9 | @JsonSerializable() 10 | class UgcModel extends Equatable { 11 | factory UgcModel.fromJson(Map json) => 12 | _$UgcModelFromJson(json); 13 | 14 | Map toJson(instance) => _$UgcModelToJson(this); 15 | @JsonKey(name: "id") 16 | final int id; 17 | 18 | @JsonKey(name: "title") 19 | final String title; 20 | 21 | @JsonKey(name: "description") 22 | final String description; 23 | 24 | @JsonKey(name: "category") 25 | final String category; 26 | 27 | @JsonKey(name: "cover") 28 | final String cover; 29 | 30 | @JsonKey(name: "coverBlurredBg") 31 | final String coverBlurredBg; 32 | 33 | @JsonKey(name: "playUrl") 34 | final String playUrl; 35 | 36 | @JsonKey(name: "duration") 37 | final int duration; 38 | 39 | @JsonKey(name: "syncTime") 40 | final String syncTime; 41 | 42 | @JsonKey(name: "author") 43 | final Author author; 44 | 45 | @JsonKey(name: "tags") 46 | final List tags; 47 | 48 | UgcModel({ 49 | this.id, 50 | this.title, 51 | this.description, 52 | this.category, 53 | this.cover, 54 | this.coverBlurredBg, 55 | this.playUrl, 56 | this.duration, 57 | this.syncTime, 58 | this.author, 59 | this.tags, 60 | }); 61 | 62 | @override 63 | List get props => [ 64 | id, 65 | title, 66 | description, 67 | category, 68 | cover, 69 | coverBlurredBg, 70 | playUrl, 71 | duration, 72 | syncTime, 73 | author, 74 | tags 75 | ]; 76 | } 77 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'ugc_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | UgcModel _$UgcModelFromJson(Map json) { 10 | return UgcModel( 11 | id: json['id'] as int, 12 | title: json['title'] as String, 13 | description: json['description'] as String, 14 | category: json['category'] as String, 15 | cover: json['cover'] as String, 16 | coverBlurredBg: json['coverBlurredBg'] as String, 17 | playUrl: json['playUrl'] as String, 18 | duration: json['duration'] as int, 19 | syncTime: json['syncTime'] as String, 20 | author: json['author'] == null 21 | ? null 22 | : Author.fromJson(json['author'] as Map), 23 | tags: (json['tags'] as List) 24 | ?.map((e) => e == null ? null : Tag.fromJson(e as Map)) 25 | ?.toList(), 26 | ); 27 | } 28 | 29 | Map _$UgcModelToJson(UgcModel instance) => { 30 | 'id': instance.id, 31 | 'title': instance.title, 32 | 'description': instance.description, 33 | 'category': instance.category, 34 | 'cover': instance.cover, 35 | 'coverBlurredBg': instance.coverBlurredBg, 36 | 'playUrl': instance.playUrl, 37 | 'duration': instance.duration, 38 | 'syncTime': instance.syncTime, 39 | 'author': instance.author, 40 | 'tags': instance.tags, 41 | }; 42 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_tag_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'ugc_tag_model.g.dart'; 5 | 6 | @JsonSerializable() 7 | class Tag extends Equatable { 8 | factory Tag.fromJson(Map json) => _$TagFromJson(json); 9 | 10 | Map toJson(instance) => _$TagToJson(this); 11 | @JsonKey(name: "id") 12 | final int id; 13 | 14 | @JsonKey(name: "text") 15 | final String text; 16 | 17 | Tag({ 18 | this.id, 19 | this.text, 20 | }); 21 | 22 | @override 23 | List get props => [id, text]; 24 | } 25 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/model/ugc/ugc_tag_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'ugc_tag_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Tag _$TagFromJson(Map json) { 10 | return Tag( 11 | id: json['id'] as int, 12 | text: json['text'] as String, 13 | ); 14 | } 15 | 16 | Map _$TagToJson(Tag instance) => { 17 | 'id': instance.id, 18 | 'text': instance.text, 19 | }; 20 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/respositories/mock/mock_selection_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/selections/model/selection_model.dart'; 2 | import 'package:eye_video/bizmodule/main/selections/respositories/selection_repository.dart'; 3 | import 'package:eye_video/framework/network/pretty_http.dart'; 4 | 5 | class MockSelectionRepository extends SelectionRepository { 6 | @override 7 | Future fetchSelections({String nextPageUrl}) async { 8 | Map reqParams; 9 | if (nextPageUrl == null || nextPageUrl.isEmpty) { 10 | reqParams = {}; 11 | } else { 12 | reqParams = Uri.parse(nextPageUrl).queryParameters; 13 | } 14 | var resData = await PrettyHttp.get( 15 | "api/selection/recommend/list", 16 | reqParams: reqParams, 17 | ); 18 | 19 | return Future.value(SelectionModel.fromJson(resData)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/respositories/mock/mock_ugc_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/selections/model/ugc/ugc_list_model.dart'; 2 | import 'package:eye_video/bizmodule/main/selections/respositories/ugc_repository.dart'; 3 | import 'package:eye_video/framework/network/pretty_http.dart'; 4 | 5 | class MockUgcRepository extends UgcRepository { 6 | @override 7 | Future fetchUgcList({int page, int pageSize = 20}) async { 8 | var reqParams = { 9 | 'page': page, 10 | 'pageSize': pageSize, 11 | }; 12 | 13 | var response = await PrettyHttp.get( 14 | "api/v1/ugc/list", 15 | baseUrl: "http://www.youkmi.cn:8889/eyes/", 16 | reqParams: reqParams, 17 | ); 18 | 19 | return Future.value(UgcListModel.fromJson(response["data"])); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/respositories/selection_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/selections/model/selection_model.dart'; 2 | 3 | abstract class SelectionRepository { 4 | Future fetchSelections({String nextPageUrl}); 5 | } 6 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/respositories/ugc_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/selections/model/ugc/ugc_list_model.dart'; 2 | 3 | abstract class UgcRepository { 4 | Future fetchUgcList({ 5 | int page, 6 | int pageSize: 20, 7 | }); 8 | } 9 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/ugc_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/selections/blocs/ugc/ugc_bloc.dart'; 2 | import 'package:eye_video/bizmodule/main/selections/blocs/ugc/ugc_state.dart'; 3 | import 'package:eye_video/bizmodule/main/selections/widgets/follow_Item.dart'; 4 | import 'package:eye_video/framework/extension/context_extension.dart'; 5 | import 'package:eye_video/framework/uikit/carousel/carousel_option.dart'; 6 | import 'package:eye_video/framework/uikit/carousel/carousel_slider.dart'; 7 | import 'package:eye_video/framework/uikit/refresher/indicator/material/material_footer.dart'; 8 | import 'package:eye_video/framework/uikit/refresher/indicator/material/material_header.dart'; 9 | import 'package:eye_video/framework/uikit/refresher/pretty_refresher.dart'; 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter_bloc/flutter_bloc.dart'; 12 | 13 | import 'blocs/ugc/ugc_event.dart'; 14 | import 'widgets/small_video_item.dart'; 15 | 16 | class UgcPage extends StatelessWidget { 17 | final RefreshController _controller = RefreshController(); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return BlocBuilder(builder: (context, state) { 22 | if (state is UgcStateRequestLoading) { 23 | return Center( 24 | child: CircularProgressIndicator(), 25 | ); 26 | } else if (state is UgcStateRequestEmpty) { 27 | return Center( 28 | child: Text('数据请求为空'), 29 | ); 30 | } else if (state is UgcStateRequestFailure) { 31 | return Center( 32 | child: Text('数据请求失败'), 33 | ); 34 | } else if (state is UgcStateRequestSuccess) { 35 | return PrettyRefresher( 36 | header: MaterialHeader(), 37 | footer: MaterialFooter(), 38 | enableControlFinishLoad: false, 39 | enableControlFinishRefresh: false, 40 | controller: _controller, 41 | child: ListView.builder( 42 | itemCount: state.ugcList.length, 43 | itemBuilder: (BuildContext context, int pos) { 44 | return buildItemWidget(context, state, pos); 45 | }, 46 | ), 47 | onLoad: () async { 48 | if (!state.hasNextPage) { 49 | _controller.finishLoad(noMore: true); 50 | context.showSnackBar(msg: '已经到底了~'); 51 | } else { 52 | BlocProvider.of(context) 53 | .add(UgcEventRequest(isFirst: false, isRefresh: false)); 54 | } 55 | }, 56 | onRefresh: () async { 57 | BlocProvider.of(context) 58 | .add(UgcEventRequest(isFirst: false, isRefresh: true)); 59 | _controller.resetLoadState(); 60 | }, 61 | ); 62 | } 63 | return Container(); 64 | }); 65 | } 66 | 67 | Widget buildItemWidget( 68 | BuildContext context, UgcStateRequestSuccess state, int pos) { 69 | var itemData = state.ugcList[pos]; 70 | if(pos % 3 == 0 || pos >= 50) { 71 | return FollowItemVideo( 72 | coverUrl: itemData.cover, 73 | duration: itemData.duration, 74 | avatarUrl: itemData.author.icon, 75 | title: itemData.title, 76 | tag: itemData.tags.take(3).map((e) => "#${e.text}").join(" "), 77 | ); 78 | } else { 79 | return SmallItemVideo( 80 | coverUrl: itemData.cover, 81 | duration: itemData.duration, 82 | title: itemData.title, 83 | tag: itemData.tags.take(3).map((e) => "#${e.text}").join(" "), 84 | ); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/widgets/follow_Item.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/bizwidget/cover_image_item.dart'; 2 | import 'package:eye_video/bizmodule/bizwidget/follow_list_head.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class FollowItemVideo extends StatelessWidget { 6 | final String coverUrl; 7 | final int duration; 8 | final String avatarUrl; 9 | final String title; 10 | final String tag; 11 | 12 | const FollowItemVideo( 13 | {Key key, 14 | this.coverUrl, 15 | this.duration, 16 | this.avatarUrl, 17 | this.title, 18 | this.tag}) 19 | : assert(coverUrl != null), 20 | assert(avatarUrl != null), 21 | super(key: key); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Container( 26 | margin: EdgeInsets.all(10), 27 | child: Column( 28 | children: [ 29 | CoverImageItem( 30 | coverUrl: coverUrl, 31 | duration: duration, 32 | ), 33 | FollowListHead( 34 | title: title, 35 | avatarUrl: avatarUrl, 36 | description: tag, 37 | ), 38 | ], 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/bizmodule/main/selections/widgets/small_video_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/bizwidget/cover_image_item.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class SmallItemVideo extends StatelessWidget { 5 | final String coverUrl; 6 | final int duration; 7 | final String title; 8 | final String tag; 9 | 10 | const SmallItemVideo( 11 | {Key key, this.title, this.tag, this.coverUrl, this.duration}) 12 | : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Container( 17 | margin: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 10), 18 | child: Wrap( 19 | spacing: 16, 20 | direction: Axis.horizontal, 21 | children: [ 22 | CoverImageItem( 23 | width: MediaQuery.of(context).size.width * 0.5, 24 | coverUrl: coverUrl, 25 | duration: duration, 26 | ), 27 | Column( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | Container( 31 | child: Text( 32 | title, 33 | overflow: TextOverflow.ellipsis, 34 | style: TextStyle( 35 | fontSize: 14, 36 | color: Color(0xff333333), 37 | fontFamily: 'NotoSansHans-Medium', 38 | ), 39 | ), 40 | width: MediaQuery.of(context).size.width * 0.5 - 38, 41 | margin: EdgeInsets.only(top: 10, bottom: 30), 42 | ), 43 | Container( 44 | width: MediaQuery.of(context).size.width * 0.5 - 38, 45 | child: Text( 46 | tag, 47 | overflow: TextOverflow.ellipsis, 48 | style: TextStyle( 49 | fontSize: 12, 50 | color: Color(0xff666666), 51 | ), 52 | ), 53 | ), 54 | ], 55 | ), 56 | ], 57 | ), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/blocs/main_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/thiz/blocs/main_event.dart'; 2 | import 'package:eye_video/bizmodule/main/thiz/blocs/main_state.dart'; 3 | import 'package:eye_video/bizmodule/main/thiz/repositories/main_repository.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | 6 | class MainBloc extends Bloc { 7 | final MainRepository mainRepository; 8 | 9 | MainBloc({this.mainRepository}) : super(null) { 10 | add(DrawerRequestEvent()); 11 | } 12 | 13 | @override 14 | Stream mapEventToState(MainEvent event) async* { 15 | if (event is DrawerRequestEvent) { 16 | try { 17 | var userModel = await mainRepository.fetchUserInfo(); 18 | var drawerConfigsModel = await mainRepository.fetchDrawerConfigs(); 19 | if (drawerConfigsModel.configs.isEmpty && 20 | drawerConfigsModel.extendConfigs.isEmpty && 21 | userModel == null) { 22 | yield DrawerLoadedEmptyState(); 23 | } 24 | yield DrawerLoadedState( 25 | userModel: userModel, configsModel: drawerConfigsModel); 26 | } catch (e) { 27 | yield DrawerLoadedErrorState(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/blocs/main_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class MainEvent extends Equatable { 4 | const MainEvent(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class DrawerRequestEvent extends MainEvent { 11 | const DrawerRequestEvent(); 12 | 13 | @override 14 | List get props => []; 15 | } 16 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/blocs/main_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:eye_video/bizmodule/main/thiz/model/drawer_configs.dart'; 3 | import 'package:eye_video/bizmodule/main/thiz/model/user_model.dart'; 4 | import 'package:flutter/cupertino.dart'; 5 | 6 | abstract class MainState extends Equatable { 7 | const MainState(); 8 | 9 | @override 10 | List get props => []; 11 | } 12 | 13 | class DrawerLoadedState extends MainState { 14 | final UserModel userModel; 15 | final DrawerConfigsModel configsModel; 16 | 17 | DrawerLoadedState({@required this.userModel, @required this.configsModel}); 18 | 19 | @override 20 | List get props => [this.userModel, configsModel]; 21 | } 22 | 23 | class DrawerLoadedErrorState extends MainState {} 24 | 25 | class DrawerLoadedEmptyState extends MainState {} 26 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/model/drawer_configs.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'drawer_configs.g.dart'; 6 | 7 | @JsonSerializable() 8 | class DrawerConfigsModel extends Equatable { 9 | @JsonKey(name: 'configs') 10 | final List configs; 11 | 12 | @JsonKey(name: 'extend_configs') 13 | final List extendConfigs; 14 | 15 | factory DrawerConfigsModel.fromJson(Map srcJson) => 16 | _$DrawerConfigsModelFromJson(srcJson); 17 | 18 | DrawerConfigsModel({this.configs, this.extendConfigs}); 19 | 20 | Map toJson() => _$DrawerConfigsModelToJson(this); 21 | 22 | @override 23 | List get props => [configs, extendConfigs]; 24 | } 25 | 26 | @JsonSerializable() 27 | class DrawerConfig extends Equatable { 28 | @JsonKey(name: 'is_divider') 29 | final bool isDivider; 30 | 31 | @JsonKey(name: 'text') 32 | final String text; 33 | 34 | final IconData iconData; 35 | 36 | @JsonKey(name: 'asset_icon') 37 | final String assetIcon; 38 | 39 | @JsonKey(name: 'url_icon') 40 | final String urlIcon; 41 | 42 | DrawerConfig({ 43 | this.isDivider: false, 44 | this.text, 45 | this.iconData, 46 | this.assetIcon, 47 | this.urlIcon, 48 | }); 49 | 50 | factory DrawerConfig.fromJson(Map srcJson) => 51 | _$DrawerConfigFromJson(srcJson); 52 | 53 | Map toJson() => _$DrawerConfigToJson(this); 54 | 55 | @override 56 | List get props => [ 57 | isDivider, 58 | text, 59 | iconData, 60 | assetIcon, 61 | urlIcon 62 | ]; 63 | } 64 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/model/drawer_configs.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'drawer_configs.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DrawerConfigsModel _$DrawerConfigsModelFromJson(Map json) { 10 | return DrawerConfigsModel( 11 | configs: (json['configs'] as List) 12 | ?.map((e) => 13 | e == null ? null : DrawerConfig.fromJson(e as Map)) 14 | ?.toList(), 15 | extendConfigs: (json['extend_configs'] as List) 16 | ?.map((e) => 17 | e == null ? null : DrawerConfig.fromJson(e as Map)) 18 | ?.toList(), 19 | ); 20 | } 21 | 22 | Map _$DrawerConfigsModelToJson(DrawerConfigsModel instance) => 23 | { 24 | 'configs': instance.configs, 25 | 'extend_configs': instance.extendConfigs, 26 | }; 27 | 28 | DrawerConfig _$DrawerConfigFromJson(Map json) { 29 | return DrawerConfig( 30 | isDivider: json['is_divider'] as bool, 31 | text: json['text'] as String, 32 | assetIcon: json['asset_icon'] as String, 33 | urlIcon: json['url_icon'] as String, 34 | ); 35 | } 36 | 37 | Map _$DrawerConfigToJson(DrawerConfig instance) => 38 | { 39 | 'is_divider': instance.isDivider, 40 | 'text': instance.text, 41 | 'asset_icon': instance.assetIcon, 42 | 'url_icon': instance.urlIcon, 43 | }; 44 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/model/user_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | 4 | part 'user_model.g.dart'; 5 | 6 | @JsonSerializable() 7 | class UserModel extends Equatable { 8 | @JsonKey(name: 'user_name') 9 | final String username; 10 | 11 | @JsonKey(name: 'avatar_url') 12 | final String avatarUrl; 13 | 14 | @JsonKey(name: 'cover_url') 15 | final String coverUrl; 16 | 17 | @JsonKey(name: 'introduce') 18 | final String introduce; 19 | 20 | UserModel({this.username, this.avatarUrl, this.coverUrl, this.introduce}); 21 | 22 | factory UserModel.fromJson(Map srcJson) => 23 | _$UserModelFromJson(srcJson); 24 | 25 | Map toJson() => _$UserModelToJson(this); 26 | 27 | @override 28 | List get props => [username, avatarUrl, coverUrl, introduce]; 29 | } 30 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/model/user_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'user_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | UserModel _$UserModelFromJson(Map json) { 10 | return UserModel( 11 | username: json['user_name'] as String, 12 | avatarUrl: json['avatar_url'] as String, 13 | coverUrl: json['cover_url'] as String, 14 | introduce: json['introduce'] as String, 15 | ); 16 | } 17 | 18 | Map _$UserModelToJson(UserModel instance) => { 19 | 'user_name': instance.username, 20 | 'avatar_url': instance.avatarUrl, 21 | 'cover_url': instance.coverUrl, 22 | 'introduce': instance.introduce, 23 | }; 24 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/repositories/main_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/thiz/model/drawer_configs.dart'; 2 | import 'package:eye_video/bizmodule/main/thiz/model/user_model.dart'; 3 | 4 | abstract class MainRepository { 5 | Future fetchUserInfo(); 6 | 7 | Future fetchDrawerConfigs(); 8 | } 9 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/repositories/mock/mock_main_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/thiz/model/drawer_configs.dart'; 2 | import 'package:eye_video/bizmodule/main/thiz/model/user_model.dart'; 3 | import 'package:eye_video/bizmodule/main/thiz/repositories/main_repository.dart'; 4 | import 'package:eye_video/framework/extension/image_compress.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class MockMainRepository extends MainRepository { 8 | @override 9 | Future fetchDrawerConfigs() { 10 | List configs = [ 11 | DrawerConfig(text: '日报精选', iconData: Icons.movie_filter), 12 | DrawerConfig(text: '附近动态', iconData: Icons.location_city), 13 | DrawerConfig(text: '我的喜欢', iconData: Icons.favorite), 14 | DrawerConfig(text: '我的关注', iconData: Icons.visibility), 15 | DrawerConfig(isDivider: true), 16 | DrawerConfig(text: '消息通知', iconData: Icons.notifications), 17 | DrawerConfig(text: '观看记录', iconData: Icons.history), 18 | DrawerConfig(text: '视频缓存', iconData: Icons.cloud_download), 19 | DrawerConfig(isDivider: true), 20 | DrawerConfig(text: '界面主题', iconData: Icons.color_lens), 21 | DrawerConfig(text: '意见反馈', iconData: Icons.help), 22 | DrawerConfig(text: '设置', iconData: Icons.settings), 23 | ]; 24 | 25 | List extendConfigs = [ 26 | DrawerConfig( 27 | text: '动态', assetIcon: 'assets/images/biz_app_icon_dynamic.png'), 28 | DrawerConfig( 29 | text: '作品', assetIcon: 'assets/images/biz_app_icon_works.png'), 30 | DrawerConfig( 31 | text: '关注', assetIcon: 'assets/images/biz_app_icon_attention.png'), 32 | DrawerConfig( 33 | text: '粉丝', assetIcon: 'assets/images/biz_app_icon_fans.png'), 34 | ]; 35 | 36 | DrawerConfigsModel drawerConfigs = DrawerConfigsModel( 37 | configs: configs, 38 | extendConfigs: extendConfigs, 39 | ); 40 | 41 | return Future.value(drawerConfigs); 42 | } 43 | 44 | @override 45 | Future fetchUserInfo() { 46 | UserModel user = UserModel( 47 | username: 'Flutter', 48 | introduce: '专注一下', 49 | coverUrl: 'http://img.kaiyanapp.com/8a93b20e5eaf3feef60eef882d29261b.jpeg?imageMogr2/quality/60/format/jpg'.compress_value(), 50 | avatarUrl: 'https://upload.jianshu.io/users/upload_avatars/3992846/618951f1-59e2-4309-a768-9bc0a15aa907.jpeg?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240'); 51 | 52 | return Future.value(user); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/bizmodule/main/thiz/widgets/drawer_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/thiz/blocs/main_bloc.dart'; 2 | import 'package:eye_video/bizmodule/main/thiz/blocs/main_state.dart'; 3 | import 'package:eye_video/bizmodule/main/thiz/model/drawer_configs.dart'; 4 | import 'package:eye_video/bizmodule/main/thiz/model/user_model.dart'; 5 | import 'package:eye_video/framework/extension/size_extension.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_bloc/flutter_bloc.dart'; 8 | 9 | class DrawerWidget extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) => BlocBuilder( 12 | builder: (context, state) { 13 | return Drawer( 14 | child: getDrawerWidget(context, state), 15 | ); 16 | }, 17 | ); 18 | } 19 | 20 | Widget getDrawerWidget(BuildContext context, MainState state) { 21 | if (state is DrawerLoadedErrorState) { 22 | return Center( 23 | child: Text('数据请求失败'), 24 | ); 25 | } else if (state is DrawerLoadedState) { 26 | return ListView( 27 | padding: EdgeInsets.zero, 28 | children: [ 29 | buildDrawerHeader(state.userModel), 30 | buildExtendWidget(context, state.configsModel.extendConfigs), 31 | ] 32 | .followedBy(buildListTiles(context, state.configsModel.configs)) 33 | .toList(), 34 | ); 35 | } else { 36 | return Center( 37 | child: Text('数据为空'), 38 | ); 39 | } 40 | } 41 | 42 | Widget buildDrawerHeader(UserModel userModel) { 43 | return UserAccountsDrawerHeader( 44 | accountName: Text( 45 | userModel.username, 46 | style: TextStyle(color: Colors.white, fontSize: 28.sp), 47 | ), 48 | accountEmail: Text( 49 | userModel.introduce, 50 | style: TextStyle(color: Colors.white, fontSize: 24.sp), 51 | ), 52 | currentAccountPicture: CircleAvatar( 53 | backgroundImage: NetworkImage(userModel.avatarUrl), 54 | ), 55 | decoration: BoxDecoration( 56 | image: DecorationImage( 57 | fit: BoxFit.cover, 58 | image: NetworkImage(userModel.coverUrl), 59 | ), 60 | ), 61 | ); 62 | } 63 | 64 | Widget buildExtendWidget( 65 | BuildContext context, List extendConfigs) { 66 | return Row( 67 | mainAxisSize: MainAxisSize.max, 68 | mainAxisAlignment: MainAxisAlignment.spaceAround, 69 | crossAxisAlignment: CrossAxisAlignment.center, 70 | children: extendConfigs.map((config) { 71 | return GestureDetector( 72 | child: Tab( 73 | iconMargin: EdgeInsets.only(bottom: 12.dp), 74 | icon: Image.asset(config.assetIcon, width: 50.dp, height: 50.dp), 75 | child: Text(config.text, style: TextStyle(fontSize: 26.sp)), 76 | ), 77 | onTap: () => Navigator.pop(context), 78 | ); 79 | }).toList(), 80 | ); 81 | } 82 | 83 | List buildListTiles(BuildContext context, List configs) { 84 | return configs.map((config) { 85 | if (config.isDivider) { 86 | return Divider( 87 | height: 1.dp, 88 | color: Colors.grey, 89 | ); 90 | } else { 91 | return ListTile( 92 | leading: Icon(config.iconData), 93 | title: Text(config.text, style: TextStyle(fontSize: 26.sp) ), 94 | onTap: () => Navigator.pop(context), 95 | ); 96 | } 97 | }).toList(); 98 | } 99 | -------------------------------------------------------------------------------- /lib/framework/extension/context_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | extension ContextExtension on BuildContext { 4 | void showSnackBar( 5 | {@required String msg, Duration duration: const Duration(seconds: 3)}) { 6 | Scaffold.of(this).showSnackBar( 7 | SnackBar( 8 | shape: RoundedRectangleBorder( 9 | borderRadius: BorderRadius.only( 10 | topLeft: Radius.circular(5), 11 | topRight: Radius.circular(5), 12 | )), 13 | content: Text(msg), 14 | duration: duration, 15 | ), 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/framework/extension/image_compress.dart: -------------------------------------------------------------------------------- 1 | const String COMPRESS_LEVEL_1 = "10"; 2 | const String COMPRESS_LEVEL_2 = "20"; 3 | const String COMPRESS_LEVEL_3 = "30"; 4 | const String COMPRESS_LEVEL_4 = "40"; 5 | const String COMPRESS_LEVEL_5 = "50"; 6 | const String COMPRESS_LEVEL_6 = "60"; 7 | const String COMPRESS_LEVEL_7 = "70"; 8 | const String COMPRESS_LEVEL_8 = "80"; 9 | const String COMPRESS_LEVEL_9 = "90"; 10 | const String COMPRESS_LEVEL_10 = "100"; 11 | 12 | extension ImageCompress on String { 13 | // ignore: non_constant_identifier_names 14 | String compress_value() { 15 | bool isHttpUrl = this.startsWith("http://img.kaiyanapp.com/") || 16 | this.startsWith("https://img.kaiyanapp.com/"); 17 | bool isImageRes = this.contains(".png") || 18 | this.contains(".jpeg") || 19 | this.contains(".jpg") || 20 | this.contains(".gif"); 21 | 22 | if (isHttpUrl && isImageRes) { 23 | Uri uri = Uri.parse(this); 24 | String compressUrl = "http://${uri.host}${uri.path}?imageMogr2/thumbnail"; 25 | if (!this.contains("?imageMogr2/quality")) { 26 | compressUrl = "$compressUrl/!${COMPRESS_LEVEL_3}p"; 27 | } else { 28 | compressUrl = "$compressUrl/!${COMPRESS_LEVEL_5}p"; 29 | } 30 | return compressUrl; 31 | } 32 | return this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/framework/extension/screen_ruler.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ScreenRuler { 4 | static ScreenRuler _instance; 5 | 6 | ScreenRuler._internal(); 7 | 8 | factory ScreenRuler.getInstance() => _instance; 9 | 10 | static const int defaultWidth = 750; 11 | 12 | //UI设计中手机尺寸 , px 13 | num uiWidthPx; 14 | 15 | //控制字体是否要根据系统的“字体大小”辅助选项来进行缩放。默认值为false。 16 | bool allowFontScaling; 17 | 18 | static double _screenWidth; 19 | static double _screenHeight; 20 | static double _pixelRatio; 21 | static double _statusBarHeight; 22 | static double _bottomBarHeight; 23 | static double _textScaleFactor; 24 | 25 | static void init(BuildContext context, 26 | {num width = defaultWidth, bool allowFontScaling = false}) { 27 | if (_instance == null) { 28 | _instance = ScreenRuler._internal(); 29 | } 30 | _instance.uiWidthPx = width; 31 | _instance.allowFontScaling = allowFontScaling; 32 | 33 | MediaQueryData mediaQuery = MediaQuery.of(context); 34 | _pixelRatio = mediaQuery.devicePixelRatio; 35 | _screenWidth = mediaQuery.size.width; 36 | _screenHeight = mediaQuery.size.height; 37 | _statusBarHeight = mediaQuery.padding.top; 38 | _bottomBarHeight = mediaQuery.padding.bottom; 39 | _textScaleFactor = mediaQuery.textScaleFactor; 40 | } 41 | 42 | // 每个逻辑像素的字体像素数,字体的缩放比例 43 | static double get textScaleFactor => _textScaleFactor; 44 | 45 | // 设备的像素密度 46 | static double get pixelRatio => _pixelRatio; 47 | 48 | // 当前设备宽度 dp 49 | static double get screenWidth => _screenWidth; 50 | 51 | // 当前设备高度 dp 52 | static double get screenHeight => _screenHeight; 53 | 54 | // 当前设备宽度 px 55 | static double get screenWidthPx => _screenWidth * _pixelRatio; 56 | 57 | // 当前设备高度 px 58 | static double get screenHeightPx => _screenHeight * _pixelRatio; 59 | 60 | // 状态栏高度 dp 刘海屏会更高 61 | static double get statusBarHeight => _statusBarHeight; 62 | 63 | // 状态栏高度 dp 刘海屏会更高 64 | static double get statusBarHeightPx => _statusBarHeight * _pixelRatio; 65 | 66 | // 底部安全区距离 dp 67 | static double get bottomBarHeight => _bottomBarHeight; 68 | 69 | // 实际的dp与UI设计px的比例 70 | double get scale => screenWidth == 0 ? 0.5 : screenWidth / uiWidthPx; 71 | 72 | //根据UI设计的设备尺寸适配 73 | num compactDimenSize(num size) => size * scale; 74 | 75 | //根据UI设计的设备字体大小适配 76 | num compactScreenFontSize(num fontSize) => allowFontScaling 77 | ? (fontSize * scale) 78 | : ((fontSize * scale) / _textScaleFactor); 79 | } -------------------------------------------------------------------------------- /lib/framework/extension/size_extension.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:eye_video/framework/extension/screen_ruler.dart'; 3 | 4 | extension ScreenSizeExtension on num { 5 | //适配后的尺寸大小dp,包括长宽 6 | // num get dp => ScreenRuler.getInstance().compactDimenSize(this); 7 | num get dp => (this / 2.0).toDouble(); 8 | 9 | //适配后的字体大小 10 | // num get sp => ScreenRuler.getInstance().compactScreenFontSize(this); 11 | num get sp => (this / 2.0).toDouble(); 12 | } 13 | -------------------------------------------------------------------------------- /lib/framework/network/cookie/pretty_cookie.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:cookie_jar/cookie_jar.dart'; 4 | 5 | class CookieJarImpl implements CookieJar { 6 | static const String _COOKIE_KEY_AUTH = 'ky_auth'; 7 | static const String _COOKIE_KEY_SDK = 'sdk'; 8 | static const String _COOKIE_AUTH_SAVE_KEY = 'KeyAuthCookie'; 9 | 10 | @override 11 | List loadForRequest(Uri uri) { 12 | List cookies = []; 13 | var cookie1 = Cookie(_COOKIE_KEY_SDK, '28')..domain = uri.host; 14 | cookies.add(cookie1); 15 | var cookie2 = Cookie(_COOKIE_KEY_AUTH, getCookieValue())..domain = uri.host; 16 | cookies.add(cookie2); 17 | return cookies; 18 | } 19 | 20 | @override 21 | void saveFromResponse(Uri uri, List cookies) { 22 | Cookie cookieValue = 23 | cookies.singleWhere((element) => element.name == _COOKIE_KEY_AUTH); 24 | if (cookieValue != null) { 25 | saveCookieValue(cookieValue.value); 26 | } 27 | } 28 | 29 | void saveCookieValue(String value) { 30 | //save cookie into sp 31 | 32 | } 33 | 34 | String getCookieValue() { 35 | //get cookie from sp 36 | return ""; 37 | } 38 | 39 | @override 40 | bool get ignoreExpires => false; 41 | } 42 | -------------------------------------------------------------------------------- /lib/framework/network/dio_client.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class DioHttpClient { 4 | static const int _DEFAULT_CONNECT_TIMEOUT = 60 * 1000; 5 | static const int _DEFAULT_SEND_TIMEOUT = 60 * 1000; 6 | static const int _DEFAULT_RECEIVE_TIMEOUT = 60 * 1000; 7 | 8 | final Map _mClientMap = {}; 9 | 10 | DioHttpClient._internal(); 11 | 12 | static final DioHttpClient _instance = DioHttpClient._internal(); 13 | 14 | factory DioHttpClient.getInstance() => _instance; 15 | 16 | Dio getClient(String baseUrl, 17 | {BaseOptions newOptions, List interceptors}) { 18 | if (baseUrl == null || baseUrl.isEmpty) { 19 | throw Exception('baseUrl not be allowed null'); 20 | } 21 | 22 | Dio client = _mClientMap[baseUrl]; 23 | if (client != null) { 24 | if (interceptors != null) { 25 | client.interceptors.addAll(interceptors); 26 | } 27 | return client; 28 | } 29 | 30 | client = _createDioClient(baseUrl, options: newOptions); 31 | if (interceptors != null) { 32 | client.interceptors.addAll(interceptors); 33 | } 34 | _mClientMap[baseUrl] = client; 35 | 36 | return client; 37 | } 38 | 39 | Dio _createDioClient(String baseUrl, {BaseOptions options}) { 40 | if (options == null) { 41 | options = createOptions(baseUrl); 42 | } 43 | return Dio(options); 44 | } 45 | 46 | static BaseOptions createOptions(String baseUrl, 47 | {Map headers, Map queryParameters}) { 48 | return BaseOptions( 49 | connectTimeout: _DEFAULT_CONNECT_TIMEOUT, 50 | sendTimeout: _DEFAULT_SEND_TIMEOUT, 51 | receiveTimeout: _DEFAULT_RECEIVE_TIMEOUT, 52 | baseUrl: baseUrl, 53 | responseType: ResponseType.json, 54 | validateStatus: (status) { 55 | return true; 56 | }, 57 | headers: headers, 58 | queryParameters: queryParameters, 59 | ); 60 | } 61 | 62 | void release() { 63 | _mClientMap.clear(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/framework/network/interceptor/log_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class PrettyLogInterceptor extends Interceptor { 4 | PrettyLogInterceptor({ 5 | this.request = true, 6 | this.requestHeader = true, 7 | this.requestBody = false, 8 | this.responseHeader = true, 9 | this.responseBody = false, 10 | this.error = true, 11 | }); 12 | 13 | /// Print request [Options] 14 | bool request; 15 | 16 | /// Print request header [Options.headers] 17 | bool requestHeader; 18 | 19 | /// Print request data [Options.data] 20 | bool requestBody; 21 | 22 | /// Print [Response.data] 23 | bool responseBody; 24 | 25 | /// Print [Response.headers] 26 | bool responseHeader; 27 | 28 | /// Print error message 29 | bool error; 30 | 31 | 32 | @override 33 | Future onRequest(RequestOptions options) async { 34 | _printRequest(options); 35 | } 36 | 37 | @override 38 | Future onError(DioError err) async { 39 | if (error) { 40 | print('*** DioError ***:'); 41 | print('uri: ${err.request.uri}'); 42 | print('$err'); 43 | if (err.response != null) { 44 | _printResponse(err.response); 45 | } 46 | print(''); 47 | } 48 | } 49 | 50 | void _printRequest(RequestOptions options) async { 51 | print('*** Request ***'); 52 | _printKV('uri', options.uri); 53 | 54 | if (request) { 55 | _printKV('method', options.method); 56 | _printKV('responseType', options.responseType?.toString()); 57 | _printKV('followRedirects', options.followRedirects); 58 | _printKV('connectTimeout', options.connectTimeout); 59 | _printKV('receiveTimeout', options.receiveTimeout); 60 | _printKV('extra', options.extra); 61 | } 62 | if (requestHeader) { 63 | print('headers:'); 64 | options.headers.forEach((key, v) => _printKV(' $key', v)); 65 | } 66 | if (requestBody) { 67 | print('data:'); 68 | _printAll(options.data); 69 | } 70 | print(''); 71 | } 72 | 73 | @override 74 | Future onResponse(Response response) async { 75 | print('*** Response ***'); 76 | _printResponse(response); 77 | } 78 | 79 | void _printResponse(Response response) { 80 | _printKV('uri', response.request?.uri); 81 | if (responseHeader) { 82 | _printKV('statusCode', response.statusCode); 83 | if (response.isRedirect == true) { 84 | _printKV('redirect', response.realUri); 85 | } 86 | if (response.headers != null) { 87 | print('headers:'); 88 | response.headers.forEach((key, v) => _printKV(' $key', v.join(','))); 89 | } 90 | } 91 | if (responseBody) { 92 | print('Response Text:'); 93 | _printAll(response.toString()); 94 | } 95 | print(''); 96 | } 97 | 98 | void _printKV(String key, Object v) { 99 | print('$key: $v'); 100 | } 101 | 102 | void _printAll(msg) { 103 | msg.toString().split('\n').forEach(print); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/framework/uikit/carousel/carousel_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:eye_video/framework/uikit/carousel/carousel_option.dart'; 4 | import 'package:eye_video/framework/uikit/carousel/carousel_state.dart'; 5 | import 'package:eye_video/framework/uikit/carousel/utils.dart'; 6 | import 'package:flutter/material.dart'; 7 | 8 | 9 | abstract class AbsCarouselController { 10 | bool get ready; 11 | 12 | Future get onReady; 13 | 14 | void nextPage({Duration duration, Curve curve}); 15 | 16 | void prevPage({Duration duration, Curve curve}); 17 | 18 | void seekToPage(int page); 19 | 20 | void seekToPageAnim(int page, {Duration duration, Curve curve}); 21 | 22 | factory AbsCarouselController() => CarouselController(); 23 | } 24 | 25 | class CarouselController implements AbsCarouselController { 26 | final Completer _readyCompleter = Completer(); 27 | 28 | CarouselState _state; 29 | 30 | set state(CarouselState state) { 31 | _state = state; 32 | if (!_readyCompleter.isCompleted) { 33 | _readyCompleter.complete(); 34 | } 35 | } 36 | 37 | void _setModeController() => 38 | _state.changeMode(CarouselPageChangedReason.controller); 39 | 40 | @override 41 | bool get ready => _state != null; 42 | 43 | @override 44 | Future get onReady => _readyCompleter.future; 45 | 46 | @override 47 | Future nextPage( 48 | {Duration duration = const Duration(milliseconds: 300), 49 | Curve curve = Curves.linear}) async { 50 | final bool isNeedResetTimer = _state.options.pauseAutoPlayOnManualNavigate; 51 | if (isNeedResetTimer) { 52 | _state.onResetTimer(); 53 | } 54 | await _state.pageController.nextPage(duration: duration, curve: curve); 55 | _setModeController(); 56 | if (isNeedResetTimer) { 57 | _state.onResumeTimer(); 58 | } 59 | } 60 | 61 | @override 62 | Future prevPage( 63 | {Duration duration = const Duration(milliseconds: 300), 64 | Curve curve = Curves.linear}) async { 65 | final bool isNeedResetTimer = _state.options.pauseAutoPlayOnManualNavigate; 66 | if (isNeedResetTimer) { 67 | _state.onResetTimer(); 68 | } 69 | _setModeController(); 70 | await _state.pageController.previousPage(duration: duration, curve: curve); 71 | if (isNeedResetTimer) { 72 | _state.onResumeTimer(); 73 | } 74 | } 75 | 76 | @override 77 | void seekToPage(int page) { 78 | final index = getRealIndex(_state.pageController.page.toInt(), 79 | _state.realIndex - _state.initIndex, _state.itemCount); 80 | 81 | _setModeController(); 82 | final int pageToJump = _state.pageController.page.toInt() + page - index; 83 | return _state.pageController.jumpToPage(pageToJump); 84 | } 85 | 86 | @override 87 | Future seekToPageAnim(int page, 88 | {Duration duration = const Duration(milliseconds: 300), 89 | Curve curve = Curves.linear}) async { 90 | final bool isNeedResetTimer = _state.options.pauseAutoPlayOnManualNavigate; 91 | if (isNeedResetTimer) { 92 | _state.onResetTimer(); 93 | } 94 | final index = getRealIndex(_state.pageController.page.toInt(), 95 | _state.realIndex - _state.initIndex, _state.itemCount); 96 | _setModeController(); 97 | await _state.pageController.animateToPage( 98 | _state.pageController.page.toInt() + page - index, 99 | duration: duration, 100 | curve: curve); 101 | if (isNeedResetTimer) { 102 | _state.onResumeTimer(); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/framework/uikit/carousel/carousel_option.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | enum CarouselPageChangedReason { timed, manual, controller } 4 | 5 | enum CenterPageEnlargeStrategy { scale, normal } 6 | 7 | class CarouselOption { 8 | //设置轮播组件的高度,如果aspectRatio设置就会使用aspectRatio计算的高度 9 | final double height; 10 | 11 | //如果没有设置height就会使用宽高比aspectRatio,默认是16:9 12 | final double aspectRatio; 13 | 14 | //每个页面应占据的轮播窗口比例, 默认是0.8 15 | final double viewportFraction; 16 | 17 | //初始index, 默认为0 18 | final int initIndex; 19 | 20 | //是否开启无限循环, 默认true(开启) 21 | final bool isEnableLoop; 22 | 23 | //是否开启数据反序,默认false(关闭) 24 | final bool isEnableReverse; 25 | 26 | //是否开启自动播放, 默认true(开启) 27 | final bool autoPlay; 28 | 29 | //自动播放时间间隔 30 | final Duration autoPlayInterval; 31 | 32 | //自动播放动画切换时间 33 | final Duration autoPlayAnimationDuration; 34 | 35 | //自动播放动画插值器 36 | final Curve autoPlayCurve; 37 | 38 | //是否开启当前页面尺寸大于侧面图,主要凸显切换大小过渡动画 39 | final bool isEnableLargeCenterPage; 40 | 41 | //滚动方向, 默认是horizontal水平滚动 42 | final Axis scrollDirection; 43 | 44 | //页面切换的回调 45 | final Function(int index, CarouselPageChangedReason reason) onPageChanged; 46 | 47 | //页面滚动回调值 48 | final ValueChanged onScrolled; 49 | 50 | //轮播应如何响应用户输入。例如,确定用户停止拖动页面视图后项目如何继续进行动画处理。 51 | final ScrollPhysics scrollPhysics; 52 | 53 | //如果为true,则自动播放功能在用户与轮播互动时会暂停,在用户完成互动后会恢复。 默认为`true` 54 | final bool pauseAutoPlayOnTouch; 55 | 56 | //如果为true,则自动播放功能在用户与轮播互动时会暂停,在用户完成交互后会恢复。默认为true 57 | final bool pauseAutoPlayOnManualNavigate; 58 | 59 | //如果enableInfiniteScroll是false,而autoPlay是true,则此选项 60 | // 决定轮播是否应到达最后一个项目而转到第一个项目。 61 | // 如果设置为“ true”,则自动播放到达最后一项时将暂停。 62 | // 如果设置为“ false”,则自动播放功能将在第一项 63 | // 位于最后一项时为其动画。 64 | final bool pauseAutoPlayInFiniteScroll; 65 | 66 | //如果要在重新创建页面视图时保持其位置,请传递一个“ PageStoragekey”。 67 | final PageStorageKey pageViewKey; 68 | 69 | //确定哪种方法可以放大中心页面 70 | final CenterPageEnlargeStrategy enlargeStrategy; 71 | 72 | //是否禁用每张幻灯片的“居中”小部件 73 | final bool disableCenter; 74 | 75 | CarouselOption( 76 | {this.height, 77 | this.aspectRatio: 16 / 9, 78 | this.viewportFraction: 0.8, 79 | this.initIndex: 0, 80 | this.isEnableLoop: true, 81 | this.isEnableReverse: false, 82 | this.autoPlay: true, 83 | this.autoPlayInterval: const Duration(seconds: 4), 84 | this.autoPlayAnimationDuration: const Duration(milliseconds: 800), 85 | this.autoPlayCurve: Curves.fastOutSlowIn, 86 | this.isEnableLargeCenterPage = false, 87 | this.onPageChanged, 88 | this.onScrolled, 89 | this.scrollPhysics, 90 | this.scrollDirection: Axis.horizontal, 91 | this.pauseAutoPlayOnTouch: true, 92 | this.pauseAutoPlayOnManualNavigate: true, 93 | this.pauseAutoPlayInFiniteScroll: false, 94 | this.pageViewKey, 95 | this.enlargeStrategy: CenterPageEnlargeStrategy.scale, 96 | this.disableCenter: false}); 97 | } 98 | -------------------------------------------------------------------------------- /lib/framework/uikit/carousel/carousel_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/framework/uikit/carousel/carousel_option.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CarouselState { 5 | CarouselOption options; 6 | 7 | PageController pageController; 8 | 9 | int realIndex = 10000; 10 | 11 | int initIndex = 0; 12 | 13 | int itemCount; 14 | 15 | Function onResetTimer; 16 | 17 | Function onResumeTimer; 18 | 19 | Function(CarouselPageChangedReason) changeMode; 20 | 21 | CarouselState( 22 | this.options, this.onResetTimer, this.onResumeTimer, this.changeMode); 23 | } 24 | -------------------------------------------------------------------------------- /lib/framework/uikit/carousel/utils.dart: -------------------------------------------------------------------------------- 1 | int remainder(int input, int source) { 2 | if (source == 0) return 0; 3 | final int result = input % source; 4 | return result < 0 ? source + result : result; 5 | } 6 | 7 | int getRealIndex(int position, int base, int length) { 8 | final int offset = position - base; 9 | return remainder(offset, length); 10 | } -------------------------------------------------------------------------------- /lib/framework/uikit/layout/nine_layout.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | //九宫格布局 4 | class NineLayout extends StatelessWidget { 5 | final List children; 6 | final double width; 7 | final int count; 8 | final double gap; 9 | 10 | NineLayout( 11 | {Key key, this.children, this.width, @required this.count, this.gap}) 12 | : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Flow( 17 | delegate: 18 | NineLayoutDelegate(context: context, count: count, width: width), 19 | children: children, 20 | ); 21 | } 22 | } 23 | 24 | class NineLayoutDelegate extends FlowDelegate { 25 | final BuildContext context; 26 | final double width; 27 | final int count; 28 | final double gap; 29 | 30 | NineLayoutDelegate({ 31 | @required this.context, 32 | @required this.count, 33 | this.width = 300, 34 | this.gap = 5.0, 35 | }); 36 | 37 | var columns = 3; 38 | var rows = 3; 39 | double itemW = 0; 40 | double itemH = 0; 41 | double totalW = 0; 42 | 43 | @override 44 | void paintChildren(FlowPaintingContext context) { 45 | var x = gap; 46 | var y = 0.0; 47 | 48 | /// 需要重新计算,解决刷新值为0的问题 49 | getItemSize(); 50 | getColumnsNumber(count); 51 | totalW = (itemW * rows) + (gap * (rows + 1)); 52 | 53 | //计算每一个子widget的位置 54 | for (int i = 0; i < count; i++) { 55 | var w = context.getChildSize(i).width + x; 56 | if (w < totalW) { 57 | context.paintChild(i, 58 | transform: new Matrix4.translationValues(x, y, 0.0)); 59 | x += context.getChildSize(i).width + gap; 60 | } else { 61 | x = gap; 62 | y += context.getChildSize(i).height + gap; 63 | context.paintChild(i, 64 | transform: new Matrix4.translationValues(x, y, 0.0)); 65 | x += context.getChildSize(i).width + gap; 66 | } 67 | } 68 | } 69 | 70 | getColumnsNumber(int length) { 71 | if (length <= 3) { 72 | rows = length; 73 | columns = 1; 74 | } else if (length <= 6) { 75 | rows = 3; 76 | columns = 2; 77 | if (length == 4) { 78 | rows = 2; 79 | } 80 | } else { 81 | rows = 3; 82 | columns = 3; 83 | } 84 | } 85 | 86 | getItemSize() { 87 | if (count == 1) { 88 | itemW = width; 89 | itemH = itemW / 2; 90 | } else if (count == 2) { 91 | itemW = (width - gap) / 2; 92 | itemH = itemW; 93 | } else if (count == 3) { 94 | itemW = (width - 2 * gap) / 3; 95 | itemH = itemW; 96 | } else if (count == 4) { 97 | itemW = (width - gap) / 2; 98 | itemH = itemW - 20; 99 | } else { 100 | itemW = (width - 2 * gap) / 3; 101 | itemH = itemW; 102 | } 103 | } 104 | 105 | getConstraintsForChild(int i, BoxConstraints constraints) { 106 | getItemSize(); 107 | return BoxConstraints( 108 | minWidth: itemW, minHeight: itemH, maxWidth: itemW, maxHeight: itemH); 109 | } 110 | 111 | getSize(BoxConstraints constraints) { 112 | getColumnsNumber(count); 113 | getItemSize(); 114 | double h = (columns * itemH) + ((columns - 1) * gap); 115 | totalW = (itemW * rows) + (gap * (rows + 1)); 116 | return Size(totalW, h); 117 | } 118 | 119 | @override 120 | bool shouldRepaint(FlowDelegate oldDelegate) { 121 | return oldDelegate != this; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /lib/framework/uikit/refresher/indicator/core/abstract_footer.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/framework/uikit/refresher/pretty_refresher.dart'; 2 | import 'package:eye_video/framework/uikit/refresher/sliver/sliver_loading.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | abstract class Footer { 6 | // Footer容器高度 7 | final double extent; 8 | 9 | // 高度(超过这个高度触发加载) 10 | final double triggerDistance; 11 | @Deprecated('目前还没有找到方案,设置无效') 12 | final bool float; 13 | // 完成延时 14 | final Duration completeDuration; 15 | 16 | // 是否开启无限加载 17 | final bool enableInfiniteLoad; 18 | 19 | // 开启震动反馈 20 | final bool enableHapticFeedback; 21 | 22 | // 越界滚动(enableInfiniteLoad为true生效) 23 | final bool overScroll; 24 | 25 | Footer({ 26 | this.extent = 60.0, 27 | this.triggerDistance = 70.0, 28 | this.float = false, 29 | this.completeDuration, 30 | this.enableInfiniteLoad = true, 31 | this.enableHapticFeedback = false, 32 | this.overScroll = false, 33 | }); 34 | 35 | // 构造器 36 | Widget builder( 37 | BuildContext context, 38 | PrettyRefresher polestarRefresh, 39 | ValueNotifier focusNotifier, 40 | ValueNotifier taskNotifier, 41 | ValueNotifier callLoadNotifier) { 42 | return RefreshSliverLoadControl( 43 | loadIndicatorExtent: extent, 44 | loadTriggerPullDistance: triggerDistance, 45 | builder: contentBuilder, 46 | completeDuration: completeDuration, 47 | onLoad: polestarRefresh.onLoad, 48 | focusNotifier: focusNotifier, 49 | taskNotifier: taskNotifier, 50 | callLoadNotifier: callLoadNotifier, 51 | taskIndependence: polestarRefresh.taskIndependence, 52 | enableControlFinishLoad: polestarRefresh.enableControlFinishLoad, 53 | enableInfiniteLoad: enableInfiniteLoad, 54 | enableHapticFeedback: enableHapticFeedback, 55 | bindLoadIndicator: (finishLoad, resetLoadState) { 56 | if (polestarRefresh.controller != null) { 57 | polestarRefresh.controller.finishLoadCallBack = finishLoad; 58 | polestarRefresh.controller.resetLoadStateCallBack = resetLoadState; 59 | } 60 | }, 61 | ); 62 | } 63 | 64 | // Header构造器 65 | Widget contentBuilder( 66 | BuildContext context, 67 | LoadMode loadState, 68 | double pulledExtent, 69 | double loadTriggerPullDistance, 70 | double loadIndicatorExtent, 71 | AxisDirection axisDirection, 72 | bool float, 73 | Duration completeDuration, 74 | bool enableInfiniteLoad, 75 | bool success, 76 | bool noMore); 77 | } -------------------------------------------------------------------------------- /lib/framework/uikit/refresher/indicator/core/abstract_header.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/framework/uikit/refresher/pretty_refresher.dart'; 2 | import 'package:eye_video/framework/uikit/refresher/sliver/sliver_refresh.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | abstract class Header { 6 | // Header容器高度 7 | final double extent; 8 | 9 | // 触发刷新高度 10 | final double triggerDistance; 11 | 12 | // 是否浮动 13 | final bool float; 14 | 15 | // 完成延时 16 | final Duration completeDuration; 17 | 18 | // 是否开启无限刷新 19 | final bool enableInfiniteRefresh; 20 | 21 | // 开启震动反馈 22 | final bool enableHapticFeedback; 23 | 24 | // 越界滚动(enableInfiniteRefresh为true生效) 25 | final bool overScroll; 26 | 27 | Header({ 28 | this.extent = 60.0, 29 | this.triggerDistance = 70.0, 30 | this.float = false, 31 | this.completeDuration, 32 | this.enableInfiniteRefresh = false, 33 | this.enableHapticFeedback = false, 34 | this.overScroll = true, 35 | }); 36 | 37 | // 构造器 38 | Widget builder( 39 | BuildContext context, 40 | PrettyRefresher polestarRefresh, 41 | ValueNotifier focusNotifier, 42 | ValueNotifier taskNotifier, 43 | ValueNotifier callRefreshNotifier) { 44 | return RefreshSliverRefreshControl( 45 | refreshIndicatorExtent: extent, 46 | refreshTriggerPullDistance: triggerDistance, 47 | builder: contentBuilder, 48 | completeDuration: completeDuration, 49 | onRefresh: polestarRefresh.onRefresh, 50 | focusNotifier: focusNotifier, 51 | taskNotifier: taskNotifier, 52 | callRefreshNotifier: callRefreshNotifier, 53 | taskIndependence: polestarRefresh.taskIndependence, 54 | enableControlFinishRefresh: polestarRefresh.enableControlFinishRefresh, 55 | enableInfiniteRefresh: enableInfiniteRefresh && !float, 56 | enableHapticFeedback: enableHapticFeedback, 57 | headerFloat: float, 58 | bindRefreshIndicator: (finishRefresh, resetRefreshState) { 59 | if (polestarRefresh.controller != null) { 60 | polestarRefresh.controller.finishRefreshCallBack = finishRefresh; 61 | polestarRefresh.controller.resetRefreshStateCallBack = 62 | resetRefreshState; 63 | } 64 | }, 65 | ); 66 | } 67 | 68 | // Header构造器 69 | Widget contentBuilder( 70 | BuildContext context, 71 | RefreshMode refreshState, 72 | double pulledExtent, 73 | double refreshTriggerPullDistance, 74 | double refreshIndicatorExtent, 75 | AxisDirection axisDirection, 76 | bool float, 77 | Duration completeDuration, 78 | bool enableInfiniteRefresh, 79 | bool success, 80 | bool noMore); 81 | } -------------------------------------------------------------------------------- /lib/framework/uikit/refresher/indicator/core/first_refresh_header.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/framework/uikit/refresher/indicator/core/abstract_header.dart'; 2 | import 'package:eye_video/framework/uikit/refresher/pretty_refresher.dart'; 3 | import 'package:eye_video/framework/uikit/refresher/sliver/sliver_refresh.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | // 首次刷新Header 7 | class FirstRefreshHeader extends Header { 8 | // 子组件 9 | final Widget child; 10 | 11 | FirstRefreshHeader(this.child) 12 | : super( 13 | extent: double.infinity, 14 | triggerDistance: 60.0, 15 | float: true, 16 | enableInfiniteRefresh: false, 17 | enableHapticFeedback: false, 18 | ); 19 | 20 | @override 21 | Widget contentBuilder( 22 | BuildContext context, 23 | RefreshMode refreshState, 24 | double pulledExtent, 25 | double refreshTriggerPullDistance, 26 | double refreshIndicatorExtent, 27 | AxisDirection axisDirection, 28 | bool float, 29 | Duration completeDuration, 30 | bool enableInfiniteRefresh, 31 | bool success, 32 | bool noMore) { 33 | return (refreshState == RefreshMode.armed || 34 | refreshState == RefreshMode.refresh) && 35 | pulledExtent > 36 | refreshTriggerPullDistance + PrettyRefresher.callOverExtent 37 | ? child 38 | : Container(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/framework/uikit/refresher/indicator/core/footer_link_notifier.dart: -------------------------------------------------------------------------------- 1 | // 链接通知器 2 | import 'package:eye_video/framework/uikit/refresher/sliver/sliver_loading.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/scheduler.dart'; 5 | 6 | class LinkFooterNotifier extends ChangeNotifier { 7 | BuildContext context; 8 | LoadMode loadState = LoadMode.inactive; 9 | double pulledExtent = 0.0; 10 | double loadTriggerPullDistance; 11 | double loadIndicatorExtent; 12 | AxisDirection axisDirection; 13 | bool float; 14 | Duration completeDuration; 15 | bool enableInfiniteLoad; 16 | bool success = true; 17 | bool noMore = false; 18 | 19 | void contentBuilder( 20 | BuildContext context, 21 | LoadMode loadState, 22 | double pulledExtent, 23 | double loadTriggerPullDistance, 24 | double loadIndicatorExtent, 25 | AxisDirection axisDirection, 26 | bool float, 27 | Duration completeDuration, 28 | bool enableInfiniteLoad, 29 | bool success, 30 | bool noMore) { 31 | this.context = context; 32 | this.loadState = loadState; 33 | this.pulledExtent = pulledExtent; 34 | this.loadTriggerPullDistance = loadTriggerPullDistance; 35 | this.loadIndicatorExtent = loadIndicatorExtent; 36 | this.axisDirection = axisDirection; 37 | this.float = float; 38 | this.completeDuration = completeDuration; 39 | this.enableInfiniteLoad = enableInfiniteLoad; 40 | this.success = success; 41 | this.noMore = noMore; 42 | SchedulerBinding.instance.addPostFrameCallback((Duration timestamp) { 43 | notifyListeners(); 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/framework/uikit/refresher/indicator/core/header_link_notifier.dart: -------------------------------------------------------------------------------- 1 | // 链接通知器 2 | import 'package:eye_video/framework/uikit/refresher/sliver/sliver_refresh.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/scheduler.dart'; 5 | 6 | class LinkHeaderNotifier extends ChangeNotifier { 7 | BuildContext context; 8 | RefreshMode refreshState = RefreshMode.inactive; 9 | double pulledExtent = 0.0; 10 | double refreshTriggerPullDistance; 11 | double refreshIndicatorExtent; 12 | AxisDirection axisDirection; 13 | bool float; 14 | Duration completeDuration; 15 | bool enableInfiniteRefresh; 16 | bool success = true; 17 | bool noMore = false; 18 | 19 | void contentBuilder( 20 | BuildContext context, 21 | RefreshMode refreshState, 22 | double pulledExtent, 23 | double refreshTriggerPullDistance, 24 | double refreshIndicatorExtent, 25 | AxisDirection axisDirection, 26 | bool float, 27 | Duration completeDuration, 28 | bool enableInfiniteRefresh, 29 | bool success, 30 | bool noMore) { 31 | this.context = context; 32 | this.refreshState = refreshState; 33 | this.pulledExtent = pulledExtent; 34 | this.refreshTriggerPullDistance = refreshTriggerPullDistance; 35 | this.refreshIndicatorExtent = refreshIndicatorExtent; 36 | this.axisDirection = axisDirection; 37 | this.float = float; 38 | this.completeDuration = completeDuration; 39 | this.enableInfiniteRefresh = enableInfiniteRefresh; 40 | this.success = success; 41 | this.noMore = noMore; 42 | SchedulerBinding.instance.addPostFrameCallback((Duration timestamp) { 43 | notifyListeners(); 44 | }); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/framework/uikit/refresher/listener/scroll_notification_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | // 滚动通知拦截器(用于拦截其他UI组件的滑动事件) 4 | class ScrollNotificationInterceptor extends StatelessWidget { 5 | final Widget child; 6 | 7 | ScrollNotificationInterceptor({ 8 | Key key, 9 | @required this.child, 10 | }) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return NotificationListener( 15 | onNotification: (ScrollNotification notification) { 16 | return true; 17 | }, 18 | child: this.child, 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/framework/uikit/refresher/listener/scroll_notification_listener.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | /// 滚动焦点回调 4 | /// focus为是否存在焦点(手指按下放开状态) 5 | typedef ScrollFocusCallback = void Function(bool focus); 6 | 7 | /// 滚动事件监听器 8 | class ScrollNotificationListener extends StatefulWidget { 9 | const ScrollNotificationListener({ 10 | Key key, 11 | @required this.child, 12 | this.onNotification, 13 | this.onFocus, 14 | }) : super(key: key); 15 | 16 | final Widget child; 17 | 18 | // 通知回调 19 | final NotificationListenerCallback onNotification; 20 | 21 | // 滚动焦点回调 22 | final ScrollFocusCallback onFocus; 23 | 24 | @override 25 | ScrollNotificationListenerState createState() { 26 | return ScrollNotificationListenerState(); 27 | } 28 | } 29 | 30 | class ScrollNotificationListenerState 31 | extends State { 32 | // 焦点状态 33 | bool _focusState = false; 34 | set _focus(bool focus) { 35 | _focusState = focus; 36 | if (widget.onFocus != null) widget.onFocus(_focusState); 37 | } 38 | 39 | // 处理滚动通知 40 | void _handleScrollNotification(ScrollNotification notification) { 41 | if (notification is ScrollStartNotification) { 42 | if (notification.dragDetails != null) { 43 | _focus = true; 44 | } 45 | } else if (notification is ScrollUpdateNotification) { 46 | if (_focusState && notification.dragDetails == null) _focus = false; 47 | } else if (notification is ScrollEndNotification) { 48 | if (_focusState) _focus = false; 49 | } 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) => 54 | NotificationListener( 55 | onNotification: (ScrollNotification notification) { 56 | _handleScrollNotification(notification); 57 | return widget.onNotification == null 58 | ? true 59 | : widget.onNotification(notification); 60 | }, 61 | child: widget.child, 62 | ); 63 | } 64 | -------------------------------------------------------------------------------- /lib/framework/uikit/scrollview/overscroll_behavior.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class OverScrollBehavior extends ScrollBehavior { 4 | final bool isShowLeading; 5 | final bool isShowTrailing; 6 | 7 | OverScrollBehavior({this.isShowLeading = true, this.isShowTrailing = true}); 8 | 9 | @override 10 | Widget buildViewportChrome( 11 | BuildContext context, Widget child, AxisDirection axisDirection) { 12 | switch (getPlatform(context)) { 13 | case TargetPlatform.iOS: 14 | return child; 15 | case TargetPlatform.android: 16 | case TargetPlatform.fuchsia: 17 | return GlowingOverscrollIndicator( 18 | child: child, 19 | //不显示头部水波纹 20 | showLeading: false, 21 | //不显示尾部水波纹 22 | showTrailing: false, 23 | axisDirection: axisDirection, 24 | color: Theme.of(context).accentColor, 25 | ); 26 | } 27 | return child; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:eye_video/bizmodule/main/thiz/main_page.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | void main() => runApp(MyApp()); 5 | 6 | class MyApp extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return MaterialApp( 10 | title: 'EyeVideo', 11 | theme: ThemeData( 12 | primaryColor: Colors.blue, 13 | ), 14 | home: MainPage(title: 'EyeVideo'), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 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 | 11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 12 | # which isn't available in 3.10. 13 | function(list_prepend LIST_NAME PREFIX) 14 | set(NEW_LIST "") 15 | foreach(element ${${LIST_NAME}}) 16 | list(APPEND NEW_LIST "${PREFIX}${element}") 17 | endforeach(element) 18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 19 | endfunction() 20 | 21 | # === Flutter Library === 22 | # System-level dependencies. 23 | find_package(PkgConfig REQUIRED) 24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 27 | pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid) 28 | pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma) 29 | 30 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 31 | 32 | # Published to parent scope for install step. 33 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 34 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 35 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 36 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 37 | 38 | list(APPEND FLUTTER_LIBRARY_HEADERS 39 | "fl_basic_message_channel.h" 40 | "fl_binary_codec.h" 41 | "fl_binary_messenger.h" 42 | "fl_dart_project.h" 43 | "fl_engine.h" 44 | "fl_json_message_codec.h" 45 | "fl_json_method_codec.h" 46 | "fl_message_codec.h" 47 | "fl_method_call.h" 48 | "fl_method_channel.h" 49 | "fl_method_codec.h" 50 | "fl_method_response.h" 51 | "fl_plugin_registrar.h" 52 | "fl_plugin_registry.h" 53 | "fl_standard_message_codec.h" 54 | "fl_standard_method_codec.h" 55 | "fl_string_codec.h" 56 | "fl_value.h" 57 | "fl_view.h" 58 | "flutter_linux.h" 59 | ) 60 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 61 | add_library(flutter INTERFACE) 62 | target_include_directories(flutter INTERFACE 63 | "${EPHEMERAL_DIR}" 64 | ) 65 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 66 | target_link_libraries(flutter INTERFACE 67 | PkgConfig::GTK 68 | PkgConfig::GLIB 69 | PkgConfig::GIO 70 | PkgConfig::BLKID 71 | PkgConfig::LZMA 72 | ) 73 | add_dependencies(flutter flutter_assemble) 74 | 75 | # === Flutter tool backend === 76 | # _phony_ is a non-existent file to force this command to run every time, 77 | # since currently there's no way to get a full input/output list from the 78 | # flutter tool. 79 | add_custom_command( 80 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 81 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 82 | COMMAND ${CMAKE_COMMAND} -E env 83 | ${FLUTTER_TOOL_ENVIRONMENT} 84 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 85 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 86 | VERBATIM 87 | ) 88 | add_custom_target(flutter_assemble DEPENDS 89 | "${FLUTTER_LIBRARY}" 90 | ${FLUTTER_LIBRARY_HEADERS} 91 | ) 92 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #include "generated_plugin_registrant.h" 6 | 7 | 8 | void fl_register_plugins(FlPluginRegistry* registry) { 9 | } 10 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 6 | #define GENERATED_PLUGIN_REGISTRANT_ 7 | 8 | #include 9 | 10 | // Registers Flutter plugins. 11 | void fl_register_plugins(FlPluginRegistry* registry); 12 | 13 | #endif // GENERATED_PLUGIN_REGISTRANT_ 14 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | set(PLUGIN_BUNDLED_LIBRARIES) 9 | 10 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 15 | endforeach(plugin) 16 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/xcuserdata/ 7 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/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 | 64 | 65 | 71 | 73 | 79 | 80 | 81 | 82 | 84 | 85 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = eye_video 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.eyeVideo 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | com.apple.security.network.client 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: eye_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.7.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^0.1.3 31 | flutter_bloc: ^5.0.1 32 | dio: ^3.0.0 33 | cookie_jar: ^1.0.1 34 | dio_cookie_manager: ^1.0.0 35 | json_annotation: ^3.0.1 36 | equatable: ^1.2.1 37 | flutter_easyrefresh: ^2.1.1 38 | dwds: ^5.0.0 39 | 40 | 41 | dev_dependencies: 42 | flutter_test: 43 | sdk: flutter 44 | json_serializable: ^3.3.0 45 | build_runner: ^1.10.0 46 | 47 | # For information on the generic Dart part of this file, see the 48 | # following page: https://dart.dev/tools/pub/pubspec 49 | 50 | # The following section is specific to Flutter. 51 | flutter: 52 | 53 | # The following line ensures that the Material Icons font is 54 | # included with your application, so that you can use the icons in 55 | # the material Icons class. 56 | uses-material-design: true 57 | 58 | # To add assets to your application, add an assets section, like this: 59 | assets: 60 | - assets/images/ 61 | - assets/images/2.0x/ 62 | - assets/images/3.0x/ 63 | # An image asset can refer to one or more resolution-specific "variants", see 64 | # https://flutter.dev/assets-and-images/#resolution-aware. 65 | 66 | # For details regarding adding assets from package dependencies, see 67 | # https://flutter.dev/assets-and-images/#from-packages 68 | 69 | # To add custom fonts to your application, add a fonts section here, 70 | # in this "flutter" section. Each entry in this list should have a 71 | # "family" key with the font family name, and a "fonts" key with a 72 | # list giving the asset and other descriptors for the font. For 73 | # example: 74 | fonts: 75 | - family: NotoSansHans-Medium 76 | fonts: 77 | - asset: assets/fonts/NotoSansHans-Medium.otf 78 | - family: NotoSansHans-Regular 79 | fonts: 80 | - asset: assets/fonts/NotoSansHans-Regular.otf 81 | - family: Oswald-Regular 82 | fonts: 83 | - asset: assets/fonts/Oswald-Regular.otf 84 | # For details regarding fonts from package dependencies, 85 | # see https://flutter.dev/custom-fonts/#from-packages 86 | -------------------------------------------------------------------------------- /release_apk/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/release_apk/app-release.apk -------------------------------------------------------------------------------- /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:eye_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(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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | eye_video 18 | 19 | 20 | 21 | 24 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eye_video", 3 | "short_name": "eye_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 | } 24 | -------------------------------------------------------------------------------- /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.15) 2 | project(eye_video LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "eye_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.15) 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 | #include "generated_plugin_registrant.h" 6 | 7 | 8 | void RegisterPlugins(flutter::PluginRegistry* registry) { 9 | } 10 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 6 | #define GENERATED_PLUGIN_REGISTRANT_ 7 | 8 | #include 9 | 10 | // Registers Flutter plugins. 11 | void RegisterPlugins(flutter::PluginRegistry* registry); 12 | 13 | #endif // GENERATED_PLUGIN_REGISTRANT_ 14 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | set(PLUGIN_BUNDLED_LIBRARIES) 9 | 10 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 11 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 12 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 15 | endforeach(plugin) 16 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "run_loop.cpp" 8 | "utils.cpp" 9 | "win32_window.cpp" 10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 11 | "Runner.rc" 12 | "runner.exe.manifest" 13 | ) 14 | apply_standard_settings(${BINARY_NAME}) 15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 18 | add_dependencies(${BINARY_NAME} flutter_assemble) 19 | -------------------------------------------------------------------------------- /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", "A new Flutter project." "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "eye_video" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "eye_video.exe" "\0" 98 | VALUE "ProductName", "eye_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(RunLoop* run_loop, 8 | const flutter::DartProject& project) 9 | : run_loop_(run_loop), project_(project) {} 10 | 11 | FlutterWindow::~FlutterWindow() {} 12 | 13 | bool FlutterWindow::OnCreate() { 14 | if (!Win32Window::OnCreate()) { 15 | return false; 16 | } 17 | 18 | RECT frame = GetClientArea(); 19 | 20 | // The size here must match the window dimensions to avoid unnecessary surface 21 | // creation / destruction in the startup path. 22 | flutter_controller_ = std::make_unique( 23 | frame.right - frame.left, frame.bottom - frame.top, project_); 24 | // Ensure that basic setup of the controller was successful. 25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 26 | return false; 27 | } 28 | RegisterPlugins(flutter_controller_->engine()); 29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine()); 30 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 31 | return true; 32 | } 33 | 34 | void FlutterWindow::OnDestroy() { 35 | if (flutter_controller_) { 36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine()); 37 | flutter_controller_ = nullptr; 38 | } 39 | 40 | Win32Window::OnDestroy(); 41 | } 42 | 43 | LRESULT 44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 45 | WPARAM const wparam, 46 | LPARAM const lparam) noexcept { 47 | // Give Flutter, including plugins, an opporutunity to handle window messages. 48 | if (flutter_controller_) { 49 | std::optional result = 50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 51 | lparam); 52 | if (result) { 53 | return *result; 54 | } 55 | } 56 | 57 | switch (message) { 58 | case WM_FONTCHANGE: 59 | flutter_controller_->engine()->ReloadSystemFonts(); 60 | break; 61 | } 62 | 63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 64 | } 65 | -------------------------------------------------------------------------------- /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 "run_loop.h" 10 | #include "win32_window.h" 11 | 12 | // A window that does nothing but host a Flutter view. 13 | class FlutterWindow : public Win32Window { 14 | public: 15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a 16 | // Flutter view running |project|. 17 | explicit FlutterWindow(RunLoop* run_loop, 18 | const flutter::DartProject& project); 19 | virtual ~FlutterWindow(); 20 | 21 | protected: 22 | // Win32Window: 23 | bool OnCreate() override; 24 | void OnDestroy() override; 25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 26 | LPARAM const lparam) noexcept override; 27 | 28 | private: 29 | // The run loop driving events for this window. 30 | RunLoop* run_loop_; 31 | 32 | // The project to run. 33 | flutter::DartProject project_; 34 | 35 | // The Flutter instance hosted by this window. 36 | std::unique_ptr flutter_controller_; 37 | }; 38 | 39 | #endif // RUNNER_FLUTTER_WINDOW_H_ 40 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "run_loop.h" 7 | #include "utils.h" 8 | 9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 10 | _In_ wchar_t *command_line, _In_ int show_command) { 11 | // Attach to console when present (e.g., 'flutter run') or create a 12 | // new console when running with a debugger. 13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 14 | CreateAndAttachConsole(); 15 | } 16 | 17 | // Initialize COM, so that it is available for use in the library and/or 18 | // plugins. 19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 20 | 21 | RunLoop run_loop; 22 | 23 | flutter::DartProject project(L"data"); 24 | 25 | std::vector command_line_arguments = 26 | GetCommandLineArguments(); 27 | 28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 29 | 30 | FlutterWindow window(&run_loop, project); 31 | Win32Window::Point origin(10, 10); 32 | Win32Window::Size size(1280, 720); 33 | if (!window.CreateAndShow(L"eye_video", origin, size)) { 34 | return EXIT_FAILURE; 35 | } 36 | window.SetQuitOnClose(true); 37 | 38 | run_loop.Run(); 39 | 40 | ::CoUninitialize(); 41 | return EXIT_SUCCESS; 42 | } 43 | -------------------------------------------------------------------------------- /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/BayMikyou/EyeVideo-Flutter/6f1e4dfd1b9b2cb0fe6a894f000f9225db2ec0a0/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/run_loop.cpp: -------------------------------------------------------------------------------- 1 | #include "run_loop.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | RunLoop::RunLoop() {} 8 | 9 | RunLoop::~RunLoop() {} 10 | 11 | void RunLoop::Run() { 12 | bool keep_running = true; 13 | TimePoint next_flutter_event_time = TimePoint::clock::now(); 14 | while (keep_running) { 15 | std::chrono::nanoseconds wait_duration = 16 | std::max(std::chrono::nanoseconds(0), 17 | next_flutter_event_time - TimePoint::clock::now()); 18 | ::MsgWaitForMultipleObjects( 19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000), 20 | QS_ALLINPUT); 21 | bool processed_events = false; 22 | MSG message; 23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects 24 | // won't return again for items left in the queue after PeekMessage. 25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) { 26 | processed_events = true; 27 | if (message.message == WM_QUIT) { 28 | keep_running = false; 29 | break; 30 | } 31 | ::TranslateMessage(&message); 32 | ::DispatchMessage(&message); 33 | // Allow Flutter to process messages each time a Windows message is 34 | // processed, to prevent starvation. 35 | next_flutter_event_time = 36 | std::min(next_flutter_event_time, ProcessFlutterMessages()); 37 | } 38 | // If the PeekMessage loop didn't run, process Flutter messages. 39 | if (!processed_events) { 40 | next_flutter_event_time = 41 | std::min(next_flutter_event_time, ProcessFlutterMessages()); 42 | } 43 | } 44 | } 45 | 46 | void RunLoop::RegisterFlutterInstance( 47 | flutter::FlutterEngine* flutter_instance) { 48 | flutter_instances_.insert(flutter_instance); 49 | } 50 | 51 | void RunLoop::UnregisterFlutterInstance( 52 | flutter::FlutterEngine* flutter_instance) { 53 | flutter_instances_.erase(flutter_instance); 54 | } 55 | 56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() { 57 | TimePoint next_event_time = TimePoint::max(); 58 | for (auto instance : flutter_instances_) { 59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages(); 60 | if (wait_duration != std::chrono::nanoseconds::max()) { 61 | next_event_time = 62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration); 63 | } 64 | } 65 | return next_event_time; 66 | } 67 | -------------------------------------------------------------------------------- /windows/runner/run_loop.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_RUN_LOOP_H_ 2 | #define RUNNER_RUN_LOOP_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | // A runloop that will service events for Flutter instances as well 10 | // as native messages. 11 | class RunLoop { 12 | public: 13 | RunLoop(); 14 | ~RunLoop(); 15 | 16 | // Prevent copying 17 | RunLoop(RunLoop const&) = delete; 18 | RunLoop& operator=(RunLoop const&) = delete; 19 | 20 | // Runs the run loop until the application quits. 21 | void Run(); 22 | 23 | // Registers the given Flutter instance for event servicing. 24 | void RegisterFlutterInstance( 25 | flutter::FlutterEngine* flutter_instance); 26 | 27 | // Unregisters the given Flutter instance from event servicing. 28 | void UnregisterFlutterInstance( 29 | flutter::FlutterEngine* flutter_instance); 30 | 31 | private: 32 | using TimePoint = std::chrono::steady_clock::time_point; 33 | 34 | // Processes all currently pending messages for registered Flutter instances. 35 | TimePoint ProcessFlutterMessages(); 36 | 37 | std::set flutter_instances_; 38 | }; 39 | 40 | #endif // RUNNER_RUN_LOOP_H_ 41 | -------------------------------------------------------------------------------- /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.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 | --------------------------------------------------------------------------------