├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android ├── .project ├── .settings │ └── org.eclipse.buildship.core.prefs ├── app │ ├── .classpath │ ├── .project │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── build.gradle │ ├── my-release-key.jks │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── openeyeflutter │ │ │ └── MainActivity.java │ │ └── res │ │ ├── drawable │ │ └── launch_background.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── launch_image.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── fonts │ ├── FZLanTingHeiS-DB1-GB-Regular.TTF │ └── Lobster-1.4.otf └── images │ ├── icon_default_avatar.png │ ├── icon_empty.webp │ ├── icon_feature_tab.png │ ├── icon_feature_tab_pressed.png │ ├── icon_home_tab.png │ ├── icon_home_tab_pressed.png │ ├── icon_load_error.png │ ├── icon_mine_tab.png │ ├── icon_mine_tab_pressed.png │ ├── icon_movie_tab.png │ ├── icon_movie_tab_pressed.png │ ├── icon_placeholder.png │ ├── icon_popular_tab.png │ ├── icon_popular_tab_pressed.png │ ├── icon_videodetail_desc.png │ ├── icon_videodetail_director.png │ ├── icon_videodetail_jishu.png │ ├── icon_videodetail_name.png │ ├── icon_videodetail_num.png │ ├── icon_videodetail_playlist.png │ └── icon_videodetail_starring.png ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── lib ├── common │ ├── api.dart │ └── status.dart ├── components │ ├── animation_text_component.dart │ ├── cached_image_component.dart │ ├── data_empty_component.dart │ ├── empty_component.dart │ ├── filter_bar_component.dart │ ├── hero_image_component.dart │ ├── list_bottom_indicator.dart │ ├── loading_component.dart │ ├── tabbar_component.dart │ ├── tabbar_indictor_component.dart │ ├── tag_component.dart │ └── video_detail_item_component.dart ├── config │ └── application.dart ├── constants │ ├── filter_menu.dart │ ├── index_tab.dart │ ├── theme.dart │ └── video_detail_tab.dart ├── delegate │ └── sliver_appbar_delegate.dart ├── events │ ├── common_event.dart │ └── theme_event.dart ├── main.dart ├── models │ ├── pood │ │ ├── Index_tab_model.dart │ │ ├── index_tab_page_model.dart │ │ ├── video_detail_model.dart │ │ └── video_model.dart │ └── state_model │ │ ├── base_state_model.dart │ │ ├── filter_state_model.dart │ │ ├── home_state_model.dart │ │ ├── main_state_model.dart │ │ ├── movie_state_model.dart │ │ ├── popular_state_model.dart │ │ ├── tab_state_model.dart │ │ ├── theme_state_model.dart │ │ └── video_detail_state_model.dart ├── pages │ ├── detail │ │ ├── video_desc_tab_page.dart │ │ ├── video_detail_page.dart │ │ ├── video_play_tab_page.dart │ │ └── video_plot_tab_page.dart │ ├── home │ │ ├── home_page.dart │ │ └── tab_pages.dart │ ├── index │ │ ├── index_page.dart │ │ └── index_tab_page.dart │ ├── mine │ │ └── mine_page.dart │ ├── movie │ │ └── movie_page.dart │ ├── popular │ │ ├── popular_page.dart │ │ └── popular_tab_page.dart │ └── theme │ │ └── theme_list_page.dart ├── route │ ├── route_handlers.dart │ └── routes.dart └── utils │ ├── device_util.dart │ ├── http_util.dart │ ├── time_util.dart │ └── time_zh_message.dart ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /.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: 5391447fae6209bb21a89e6a5a6583cac1af9b4b 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vistor-Flutter 视频类 App 2 | 3 | ## 博客链接:https://songlcy.blog.csdn.net/article/details/86621278 4 | 5 | ##### 链接下载Apk安装 6 | https://www.pgyer.com/poE0 7 | 8 | 【注】如果安装apk后,启动发生闪退现象,原因是由于手机 ARM 处理器兼容问题。一般会发生在新款三星、华为等第8代处理器手机,此时可以找到 app/build.gradle 文件,手动修改如下代码: 9 | ```xml 10 | // "arm64-v8a"为8代处理器,一般为三星,华为新手机出现。 11 | ndk { 12 | abiFilters "armeabi-v7a", "armeabi", "arm64-v8a" 13 | } 14 | ``` 15 | 16 | ### 模块 17 | 1.开发环境: 18 | ```xml 19 | Vs Code (1.30.2) 20 | Android Studio 3.+ 21 | ``` 22 | 23 | 2.开发框架 ( Flutter sdk: ">=2.0.0-dev.68.0 <3.0.0" ): 24 | ```xml 25 | 状态管理:Scoped_model 26 | 网络层:Dio 27 | 导航库:Fluro 28 | ``` 29 | 30 | 3.主模块分为首页、精选、电影、我的,以下是功能列表: 31 | ```xml 32 | 使用 scoped_model 状态管理,实现state统一管理。 33 | 使用 TabBar + TabBarView 实现单页面不同模块切换。 34 | 使用 staggered_grid_view、ListView 组件展示图文列表。 35 | 扩展列表组件,结合 NotificationManager 实现上拉加载更多数据,下拉刷新数据。 36 | 精选内容,分类展示,使用SliverAppBar,增加交互动效,提高用户体验。 37 | 自定义过滤菜单组件,结合 ScrollController 实现滑动交互效果。 38 | 代码模块化  实现,组件封装实现代码复用。 39 | ``` 40 | 41 | ### 功能设计 42 | ```xml 43 | 1. 使用 Fluro 管理全局路由,可自由配置 Scene 的转场动画,处理Android端的后退键事件 44 | 2. 使用 Flutter 基本语法进行布局,并封装了一系列通用的组件,比如 AnimationText、过滤菜单,加载状态组件,共享动画组件等,便于全局复用 45 | 3. 数据层使用Dio实现 Http / Https 网络加载,可轻松实现 http header、链接超时等常用配置。 46 | 4. 使用 CachedImage 组件,实现图片的加载缓存,优化渲染显示性能。 47 | 5. 引入 scoped_model 状态管理,Scoped 结合 ScopedModelDescendant ,设定全局 state 结构,管理相关的组件状态。 48 | 6. 使用 shared_preferences 实现小数据的本地化存储。 49 | 7. 使用第三方字体库,实现 FontFamily 的定制显示。 50 | 8. 设置 WillPopScope,实现首页点击返回键提示两次快按退出功能。 51 | 9. 首页非Index Tab 页面下,点击返回键,首先返回 Index Tab,再次点击提示两次退出。 52 | .... 53 | ``` 54 | 55 | ### 项目结构 56 | ```xml 57 | lib 58 | ├── main.dart 59 | ├── common 60 | ├── components 61 | ├── cofig 62 | ├── constants 63 | ├── delegate 64 | ├── events 65 | ├── models 66 | │   ├── pood 67 | │   └── state_model 68 | ├── pages 69 | │   ├── detail 70 | │   └── home 71 | │ ├── index 72 | │   └── mine 73 | │ ├── movie 74 | │   └── popular 75 | │ ├── theme 76 | ├── route 77 | ├── utils 78 | └assets 79 | ``` 80 | 81 | ### 依赖库 82 | 83 | 部分图标采用了icons,查看具体的图标名称可到 ionics官方文档。依赖方式,cd 到项目根目录,执行:flutter get packages 84 | ```xml 85 | dio: ^1.0.13 86 | fluro: ^1.4.0 87 | timeago: ^2.0.10 88 | scoped_model: ^1.0.1 89 | event_bus: ^1.0.1 90 | shimmer: ^0.0.6 91 | connectivity: ^0.3.2 92 | fluttertoast: ^2.2.7 93 | shared_preferences: ^0.4.3 94 | cached_network_image: ^0.5.1 95 | flutter_swiper: ^1.1.4 96 | flutter_spinkit: ^3.0.0 97 | flutter_staggered_grid_view: ^0.2.6 98 | flutter_webview_plugin: ^0.3.0+2 99 | video_player: 100 | git: 101 | url: https://github.com/songxiaoliang/flutter_video_player.git 102 | ``` 103 | 104 | ### 待完善功能 105 | ```xml 106 | 1. 登录 107 | 2. 分享 108 | 3. 支付 109 | 4. 推送 110 | 5. 局部窗口播放 111 | ``` 112 | 113 | ### 效果图 (oneplus 5 Android 设备) 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | strong-mode: true 3 | language: 4 | enableSuperMixins: true 5 | errors: 6 | mixin_inherits_from_not_object: ignore -------------------------------------------------------------------------------- /android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | android 4 | Project android created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir= 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/app/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir=.. 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.openeyeflutter" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | // "arm64-v8a"为8代处理器,一般为三星,华为新手机出现。 43 | ndk { 44 | abiFilters "armeabi-v7a", "armeabi", "x86" 45 | } 46 | } 47 | 48 | signingConfigs { 49 | release { 50 | storeFile file(MYAPP_RELEASE_STORE_FILE) 51 | storePassword MYAPP_RELEASE_STORE_PASSWORD 52 | keyAlias MYAPP_RELEASE_KEY_ALIAS 53 | keyPassword MYAPP_RELEASE_KEY_PASSWORD 54 | } 55 | } 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | // signingConfig signingConfigs.debug 61 | signingConfig signingConfigs.release 62 | zipAlignEnabled true 63 | } 64 | } 65 | } 66 | 67 | flutter { 68 | source '../..' 69 | } 70 | 71 | dependencies { 72 | testImplementation 'junit:junit:4.12' 73 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 74 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 75 | } 76 | -------------------------------------------------------------------------------- /android/app/my-release-key.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/android/app/my-release-key.jks -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 12 | 17 | 22 | 29 | 33 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/openeyeflutter/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.openeyeflutter; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/launch_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/android/app/src/main/res/mipmap-xhdpi/launch_image.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Vistor 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | MYAPP_RELEASE_STORE_FILE=my-release-key.jks 3 | MYAPP_RELEASE_KEY_ALIAS=my-release-key 4 | MYAPP_RELEASE_STORE_PASSWORD=123456 5 | MYAPP_RELEASE_KEY_PASSWORD=123456 -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /assets/fonts/FZLanTingHeiS-DB1-GB-Regular.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/fonts/FZLanTingHeiS-DB1-GB-Regular.TTF -------------------------------------------------------------------------------- /assets/fonts/Lobster-1.4.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/fonts/Lobster-1.4.otf -------------------------------------------------------------------------------- /assets/images/icon_default_avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_default_avatar.png -------------------------------------------------------------------------------- /assets/images/icon_empty.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_empty.webp -------------------------------------------------------------------------------- /assets/images/icon_feature_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_feature_tab.png -------------------------------------------------------------------------------- /assets/images/icon_feature_tab_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_feature_tab_pressed.png -------------------------------------------------------------------------------- /assets/images/icon_home_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_home_tab.png -------------------------------------------------------------------------------- /assets/images/icon_home_tab_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_home_tab_pressed.png -------------------------------------------------------------------------------- /assets/images/icon_load_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_load_error.png -------------------------------------------------------------------------------- /assets/images/icon_mine_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_mine_tab.png -------------------------------------------------------------------------------- /assets/images/icon_mine_tab_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_mine_tab_pressed.png -------------------------------------------------------------------------------- /assets/images/icon_movie_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_movie_tab.png -------------------------------------------------------------------------------- /assets/images/icon_movie_tab_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_movie_tab_pressed.png -------------------------------------------------------------------------------- /assets/images/icon_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_placeholder.png -------------------------------------------------------------------------------- /assets/images/icon_popular_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_popular_tab.png -------------------------------------------------------------------------------- /assets/images/icon_popular_tab_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_popular_tab_pressed.png -------------------------------------------------------------------------------- /assets/images/icon_videodetail_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_videodetail_desc.png -------------------------------------------------------------------------------- /assets/images/icon_videodetail_director.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_videodetail_director.png -------------------------------------------------------------------------------- /assets/images/icon_videodetail_jishu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_videodetail_jishu.png -------------------------------------------------------------------------------- /assets/images/icon_videodetail_name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_videodetail_name.png -------------------------------------------------------------------------------- /assets/images/icon_videodetail_num.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_videodetail_num.png -------------------------------------------------------------------------------- /assets/images/icon_videodetail_playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_videodetail_playlist.png -------------------------------------------------------------------------------- /assets/images/icon_videodetail_starring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/assets/images/icon_videodetail_starring.png -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 9740EEB11CF90186004384FC /* Flutter */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 77 | 3B80C3931E831B6300D905FE /* App.framework */, 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 83 | ); 84 | name = Flutter; 85 | sourceTree = ""; 86 | }; 87 | 97C146E51CF9000F007C117D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9740EEB11CF90186004384FC /* Flutter */, 91 | 97C146F01CF9000F007C117D /* Runner */, 92 | 97C146EF1CF9000F007C117D /* Products */, 93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 97C146EF1CF9000F007C117D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 97C146EE1CF9000F007C117D /* Runner.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 97C146F01CF9000F007C117D /* Runner */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 110 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 113 | 97C147021CF9000F007C117D /* Info.plist */, 114 | 97C146F11CF9000F007C117D /* Supporting Files */, 115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 97C146F21CF9000F007C117D /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 97C146ED1CF9000F007C117D /* Runner */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 135 | buildPhases = ( 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = Runner; 148 | productName = Runner; 149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 97C146E61CF9000F007C117D /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 0910; 159 | ORGANIZATIONNAME = "The Chromium Authors"; 160 | TargetAttributes = { 161 | 97C146ED1CF9000F007C117D = { 162 | CreatedOnToolsVersion = 7.3.1; 163 | }; 164 | }; 165 | }; 166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 167 | compatibilityVersion = "Xcode 3.2"; 168 | developmentRegion = English; 169 | hasScannedForEncodings = 0; 170 | knownRegions = ( 171 | en, 172 | Base, 173 | ); 174 | mainGroup = 97C146E51CF9000F007C117D; 175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 176 | projectDirPath = ""; 177 | projectRoot = ""; 178 | targets = ( 179 | 97C146ED1CF9000F007C117D /* Runner */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | 97C146EC1CF9000F007C117D /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Thin Binary"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 214 | }; 215 | 9740EEB61CF901F6004384FC /* Run Script */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputPaths = ( 221 | ); 222 | name = "Run Script"; 223 | outputPaths = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 228 | }; 229 | /* End PBXShellScriptBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 97C146EA1CF9000F007C117D /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 237 | 97C146F31CF9000F007C117D /* main.m in Sources */, 238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXVariantGroup section */ 245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C146FB1CF9000F007C117D /* Base */, 249 | ); 250 | name = Main.storyboard; 251 | sourceTree = ""; 252 | }; 253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 97C147001CF9000F007C117D /* Base */, 257 | ); 258 | name = LaunchScreen.storyboard; 259 | sourceTree = ""; 260 | }; 261 | /* End PBXVariantGroup section */ 262 | 263 | /* Begin XCBuildConfiguration section */ 264 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 265 | isa = XCBuildConfiguration; 266 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_COMMA = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | GCC_C_LANGUAGE_STANDARD = gnu99; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 305 | MTL_ENABLE_DEBUG_INFO = NO; 306 | SDKROOT = iphoneos; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | VALIDATE_PRODUCT = YES; 309 | }; 310 | name = Profile; 311 | }; 312 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 313 | isa = XCBuildConfiguration; 314 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 318 | DEVELOPMENT_TEAM = S8QB4VV633; 319 | ENABLE_BITCODE = NO; 320 | FRAMEWORK_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | INFOPLIST_FILE = Runner/Info.plist; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | LIBRARY_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "$(PROJECT_DIR)/Flutter", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = com.example.openeyeFlutter; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | VERSIONING_SYSTEM = "apple-generic"; 333 | }; 334 | name = Profile; 335 | }; 336 | 97C147031CF9000F007C117D /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNREACHABLE_CODE = YES; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | DEBUG_INFORMATION_FORMAT = dwarf; 366 | ENABLE_STRICT_OBJC_MSGSEND = YES; 367 | ENABLE_TESTABILITY = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_DYNAMIC_NO_PIC = NO; 370 | GCC_NO_COMMON_BLOCKS = YES; 371 | GCC_OPTIMIZATION_LEVEL = 0; 372 | GCC_PREPROCESSOR_DEFINITIONS = ( 373 | "DEBUG=1", 374 | "$(inherited)", 375 | ); 376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 378 | GCC_WARN_UNDECLARED_SELECTOR = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 380 | GCC_WARN_UNUSED_FUNCTION = YES; 381 | GCC_WARN_UNUSED_VARIABLE = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 383 | MTL_ENABLE_DEBUG_INFO = YES; 384 | ONLY_ACTIVE_ARCH = YES; 385 | SDKROOT = iphoneos; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Debug; 389 | }; 390 | 97C147041CF9000F007C117D /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 393 | buildSettings = { 394 | ALWAYS_SEARCH_USER_PATHS = NO; 395 | CLANG_ANALYZER_NONNULL = YES; 396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 397 | CLANG_CXX_LIBRARY = "libc++"; 398 | CLANG_ENABLE_MODULES = YES; 399 | CLANG_ENABLE_OBJC_ARC = YES; 400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 401 | CLANG_WARN_BOOL_CONVERSION = YES; 402 | CLANG_WARN_COMMA = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | TARGETED_DEVICE_FAMILY = "1,2"; 434 | VALIDATE_PRODUCT = YES; 435 | }; 436 | name = Release; 437 | }; 438 | 97C147061CF9000F007C117D /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 444 | ENABLE_BITCODE = NO; 445 | FRAMEWORK_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "$(PROJECT_DIR)/Flutter", 448 | ); 449 | INFOPLIST_FILE = Runner/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | LIBRARY_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | PRODUCT_BUNDLE_IDENTIFIER = com.example.openeyeFlutter; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | VERSIONING_SYSTEM = "apple-generic"; 458 | }; 459 | name = Debug; 460 | }; 461 | 97C147071CF9000F007C117D /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 464 | buildSettings = { 465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 467 | ENABLE_BITCODE = NO; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | INFOPLIST_FILE = Runner/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 474 | LIBRARY_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | PRODUCT_BUNDLE_IDENTIFIER = com.example.openeyeFlutter; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | VERSIONING_SYSTEM = "apple-generic"; 481 | }; 482 | name = Release; 483 | }; 484 | /* End XCBuildConfiguration section */ 485 | 486 | /* Begin XCConfigurationList section */ 487 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | 97C147031CF9000F007C117D /* Debug */, 491 | 97C147041CF9000F007C117D /* Release */, 492 | 249021D3217E4FDB00AE95B9 /* Profile */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 97C147061CF9000F007C117D /* Debug */, 501 | 97C147071CF9000F007C117D /* Release */, 502 | 249021D4217E4FDB00AE95B9 /* Profile */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | /* End XCConfigurationList section */ 508 | }; 509 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 510 | } 511 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/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/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/songxiaoliang/visitor-flutter/9f5e0e59bf0224f4a2b3298dcb536578d32be47e/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | openeye_flutter 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/common/api.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * api 统一配置 3 | * Create by Songlcy 4 | */ 5 | const String BASE_URL = ""; 6 | 7 | // 首页Tab分类 8 | const String INDEX_TAB_URL = "http://www.wanandroid.com/tools/mockapi/15434/tablist"; 9 | 10 | // 首页视频加载 11 | const String INDEX_VIDEO_LIST = "https://dd.shmy.tech/api/client/v2/video/index"; 12 | 13 | // 分类对应列表 14 | const String VIDEO_LIST_URL = "https://dd.shmy.tech/api/client/classification/"; 15 | 16 | // 视频详情 17 | const String VIDEO_URL = "https://dd.shmy.tech/api/client/video/"; 18 | 19 | // 博客链接 20 | const String WEBSITE_URL = "https://blog.csdn.net/u013718120"; 21 | 22 | // Github链接 23 | const String GITHUB_URL = "https://github.com/songxiaoliang"; 24 | 25 | -------------------------------------------------------------------------------- /lib/common/status.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 网络请求结果枚举类 3 | * Create by Songlcy 4 | */ 5 | enum Status { 6 | READY, // 初始化 7 | LOADING, // 请求中 8 | SUCCESS, // 请求成功 9 | NO_RESULT, // 请求结果为空 10 | ERROR, // 请求失败 11 | NO_MORE, // 没有更多 12 | } 13 | 14 | class Response { 15 | static int OK = 200; 16 | } -------------------------------------------------------------------------------- /lib/components/animation_text_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 动画Text组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | 7 | class AnimationTextComponent extends StatefulWidget { 8 | final String text; 9 | final TextStyle textStyle; 10 | 11 | final int duration; 12 | final int delayTime; 13 | 14 | const AnimationTextComponent({ 15 | this.text = "", 16 | this.textStyle = const TextStyle(color: Colors.black), 17 | this.duration = 1000, 18 | this.delayTime = 0 19 | }); 20 | 21 | @override 22 | State createState() => _AnimationTextComponentState(); 23 | } 24 | 25 | class _AnimationTextComponentState extends State with SingleTickerProviderStateMixin { 26 | 27 | String showText; 28 | String hideText; 29 | Animation animation; 30 | AnimationController animationContainer; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | 36 | animationContainer = AnimationController( 37 | vsync: this, 38 | duration: Duration(microseconds: widget.duration) 39 | ); 40 | 41 | animation = IntTween( 42 | begin: 0, 43 | end: widget.text.length 44 | ).animate(CurvedAnimation(parent: animationContainer, curve: Curves.easeIn)); 45 | 46 | animation.addListener((){ 47 | // 刷新text 48 | setState(() { 49 | showText = widget.text.substring(0, animation.value); 50 | hideText = widget.text.substring(animation.value, widget.text.length); 51 | }); 52 | }); 53 | 54 | Future.delayed(Duration(microseconds: widget.delayTime), (){ 55 | animationContainer.forward(from: 0.0); 56 | }); 57 | } 58 | 59 | @override 60 | Widget build(BuildContext context) { 61 | return RichText( 62 | maxLines: 10, 63 | overflow: TextOverflow.ellipsis, 64 | text: TextSpan( 65 | children: [ 66 | TextSpan(text: showText, style: widget.textStyle), 67 | TextSpan(text: hideText, style: widget.textStyle.copyWith(color: Colors.transparent)) 68 | ] 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lib/components/cached_image_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 自定义图片缓存组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:cached_network_image/cached_network_image.dart'; 7 | 8 | class CachedImageComponent extends StatelessWidget { 9 | 10 | final String imageUrl; 11 | final BoxFit boxFit; 12 | 13 | const CachedImageComponent({ 14 | @required this.imageUrl, 15 | this.boxFit = BoxFit.cover 16 | }); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return CachedNetworkImage( 21 | key: Key(imageUrl), 22 | fit: boxFit, 23 | errorWidget: Image.asset("assets/images/icon_placeholder.png", fit: BoxFit.fill), 24 | placeholder: Image.asset("assets/images/icon_placeholder.png", fit: BoxFit.fill), 25 | imageUrl: imageUrl.startsWith("http://") ? imageUrl.replaceFirst("http://", "https://") : imageUrl, 26 | ); 27 | } 28 | } -------------------------------------------------------------------------------- /lib/components/data_empty_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 加载结果视图组件(数据为空,加载失败) 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import '../common/status.dart'; 7 | 8 | class DataEmptyComponent extends StatelessWidget { 9 | 10 | Status status = Status.READY; 11 | 12 | DataEmptyComponent({ @required this.status }); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Center( 17 | child: _renderBody(status) 18 | ); 19 | } 20 | 21 | _renderBody(Status status) { 22 | return status == Status.NO_RESULT ? _renderNoResultView() : _renderErrorComponent(); 23 | } 24 | 25 | /** 26 | * 无数据 27 | */ 28 | _renderNoResultView() { 29 | return Column( 30 | children: [ 31 | Image.asset("assets/images/icon_empty.webp", 32 | width: 160.0, 33 | height: 100.0, 34 | fit: BoxFit.cover 35 | ), 36 | ], 37 | ); 38 | } 39 | 40 | /** 41 | * 加载失败 42 | */ 43 | _renderErrorComponent() { 44 | return Column( 45 | children: [ 46 | Image.asset("assets/images/icon_load_error.png", 47 | width: 60.0, 48 | height: 60.0, 49 | fit: BoxFit.cover 50 | ), 51 | Container( 52 | margin: EdgeInsets.only(top: 10.0), 53 | child: Text("加载失败,请检查网络连接", style:TextStyle(color: Colors.grey)), 54 | ) 55 | ], 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/components/empty_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 空视图组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | 7 | class EmptyComponent extends StatelessWidget { 8 | 9 | const EmptyComponent(); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | width: 0, 15 | height: 0, 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/components/filter_bar_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 过滤菜单 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | 8 | import '../models/state_model/filter_state_model.dart'; 9 | 10 | class FilterBarComponent extends StatefulWidget { 11 | 12 | final Function onItemSelectCallback; // item 选择回调 13 | final int itemNums; // item 分组数 14 | 15 | FilterBarComponent({ 16 | Key key, 17 | @required this.itemNums, 18 | @required this.onItemSelectCallback 19 | }): super(key: key); 20 | 21 | @override 22 | State createState() => _FilterBarComponentState(); 23 | } 24 | 25 | class _FilterBarComponentState extends State { 26 | 27 | final Duration animatedDuration = Duration(milliseconds: 300); // 动画执行时长 28 | final double FILTER_BAR_ITEM_HEIGHT = 50.0; // item 高度 29 | double filterBarHeight = 0; // 整个过滤菜单栏高度 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | filterBarHeight = widget.itemNums * FILTER_BAR_ITEM_HEIGHT; 35 | } 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return ScopedModelDescendant( 40 | builder: (context, child, model) { 41 | return AnimatedContainer( 42 | duration: animatedDuration, 43 | height: model.isOpen ? filterBarHeight : FILTER_BAR_ITEM_HEIGHT, 44 | child: Wrap( 45 | children: List.generate(model.itemList.length, (index) { 46 | return FilterGroupComponent( 47 | groupIndex: index, 48 | currentIndex: model.itemList[index]["index"], 49 | filterItemList: model.itemList[index]["data"], 50 | onItemSelectCallback: widget.onItemSelectCallback 51 | ); 52 | } 53 | ) 54 | )); 55 | }); 56 | } 57 | } 58 | 59 | /** 60 | * 过滤项组 61 | */ 62 | class FilterGroupComponent extends StatelessWidget { 63 | final int groupIndex; 64 | final int currentIndex; 65 | final List filterItemList; 66 | final double filterItemHeight; 67 | final Function onItemSelectCallback; 68 | 69 | FilterGroupComponent({ 70 | this.groupIndex, 71 | @required this.currentIndex, 72 | @required this.filterItemList, 73 | @required this.onItemSelectCallback, 74 | this.filterItemHeight = 50.0 75 | }); 76 | 77 | @override 78 | Widget build(BuildContext context) { 79 | return Container( 80 | height: filterItemHeight, 81 | child: ListView( 82 | scrollDirection: Axis.horizontal, 83 | children: List.generate(filterItemList.length, (index) { 84 | return FilterItemComponent( 85 | groupIndex: groupIndex, 86 | itemIndex: index, 87 | filterItem: filterItemList[index], 88 | filterItemHeight: filterItemHeight, 89 | currentIndex: currentIndex, 90 | onItemSelectCallback: onItemSelectCallback); 91 | }), 92 | ), 93 | ); 94 | } 95 | } 96 | 97 | /** 98 | * 过滤项 99 | */ 100 | class FilterItemComponent extends StatelessWidget { 101 | final double filterItemHeight; 102 | final Map filterItem; 103 | final int groupIndex; 104 | final int itemIndex; 105 | final int currentIndex; 106 | final Function onItemSelectCallback; 107 | FilterItemComponent({ 108 | this.groupIndex, 109 | this.itemIndex, 110 | @required this.filterItem, 111 | this.filterItemHeight, 112 | @required this.currentIndex, 113 | @required this.onItemSelectCallback 114 | }); 115 | 116 | @override 117 | Widget build(BuildContext context) { 118 | return ScopedModelDescendant( 119 | builder: (context, child, model) { 120 | return Container( 121 | margin: EdgeInsets.all(5.0), 122 | child: Material( 123 | child: InkWell( 124 | child: Container( 125 | padding: EdgeInsets.symmetric(horizontal: 5.0), 126 | height: filterItemHeight - 10.0, 127 | child: Center( 128 | child: Text( 129 | filterItem["title"], 130 | style: TextStyle( 131 | fontWeight: FontWeight.w600, 132 | color: currentIndex == itemIndex 133 | ? Colors.white 134 | : Colors.black12), 135 | ), 136 | ), 137 | decoration: BoxDecoration( 138 | color: currentIndex == itemIndex 139 | ? Theme.of(context).primaryColor 140 | : Colors.transparent, 141 | borderRadius: BorderRadius.all(Radius.circular(5.0))), 142 | ), 143 | onTap: () { 144 | model.setSelectIndex(groupIndex, itemIndex); 145 | onItemSelectCallback(filterItem); // 点击回调 146 | }, 147 | ), 148 | type: MaterialType.transparency, 149 | )); 150 | }, 151 | ); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /lib/components/hero_image_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 转场动画Image组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import './cached_image_component.dart'; 7 | import '../models/pood/video_model.dart'; 8 | 9 | class HeroImageComponent extends StatelessWidget { 10 | 11 | final VideoModel imageItem; 12 | final double imageWidth, imageHeight; 13 | 14 | const HeroImageComponent({ 15 | @required this.imageItem, 16 | this.imageWidth = 200.0, 17 | this.imageHeight = 400.0, 18 | }); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | String thumbnail = imageItem.thumbnail; 23 | if (thumbnail.startsWith("http://")) { 24 | thumbnail = thumbnail.replaceFirst("http://", "https://"); 25 | } 26 | if (imageItem.timestamp == null) { 27 | imageItem.timestamp = "-default"; 28 | } 29 | return SizedBox( 30 | width: imageWidth, 31 | height: imageHeight, 32 | child: Hero( 33 | key: Key(imageItem.id), 34 | tag: "${imageItem.id}${imageItem.timestamp}", 35 | child: CachedImageComponent(imageUrl: thumbnail), 36 | ), 37 | ); 38 | } 39 | } -------------------------------------------------------------------------------- /lib/components/list_bottom_indicator.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 列表底部组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_spinkit/flutter_spinkit.dart'; 7 | 8 | import '../common/status.dart'; 9 | import './empty_component.dart'; 10 | 11 | 12 | class ListBottomIndicator extends StatelessWidget { 13 | 14 | final Status status; 15 | final Function onPressCallback; 16 | ListBottomIndicator({ @required this.status, @required this.onPressCallback }); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | switch (status) { 21 | case Status.LOADING: 22 | // 加载中 23 | return Row( 24 | mainAxisAlignment: MainAxisAlignment.center, 25 | children: [ 26 | // CircularProgressIndicator( 27 | // strokeWidth: 2, 28 | // valueColor: AlwaysStoppedAnimation( 29 | // Theme.of(context).primaryColor)), 30 | SpinKitFadingCircle( 31 | size: 30.0, 32 | itemBuilder: (_, int index) { 33 | return DecoratedBox( 34 | decoration: BoxDecoration( 35 | color: index.isEven ? Colors.red : Colors.green, 36 | ), 37 | ); 38 | }, 39 | ), 40 | Container( 41 | margin: EdgeInsets.only(left: 15.0), 42 | child: Text( 43 | "客官不要急, 正在路上...", 44 | style: TextStyle(color: Color.fromARGB(255,192, 193, 195))), 45 | ) 46 | ], 47 | ); 48 | break; 49 | case Status.ERROR: 50 | return Padding( 51 | padding: EdgeInsets.only(left: 20.0, top: 10.0, right: 20.0), 52 | child: MaterialButton( 53 | color: Theme.of(context).primaryColor, 54 | child: Text("加载失败,重新加载", style: TextStyle(color: Colors.white)), 55 | onPressed: () => onPressCallback(), 56 | ), 57 | ); 58 | case Status.NO_RESULT: 59 | return Center( 60 | child: Text("未发现符合搜索条件的数据...", 61 | style: TextStyle(color: Theme.of(context).primaryColor)), 62 | ); 63 | case Status.NO_MORE: 64 | return Center( 65 | child: Text("--我也是有底线的--", 66 | style: TextStyle(color: Theme.of(context).primaryColor)), 67 | ); 68 | default: 69 | return EmptyComponent(); 70 | break; 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /lib/components/loading_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * Loading 组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter_spinkit/flutter_spinkit.dart'; 7 | 8 | class LoadingComponent extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | return SpinKitFadingCircle( 12 | itemBuilder: (_, int index) { 13 | return DecoratedBox( 14 | decoration: BoxDecoration( 15 | color: index.isEven ? Colors.red : Colors.green, 16 | ), 17 | ); 18 | }, 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/components/tabbar_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页 Tab Item 组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import '../models/state_model/tab_state_model.dart'; 8 | 9 | class TabBarComponent extends StatefulWidget { 10 | 11 | final int tabBarIndex; 12 | final List tabBarIcon; 13 | final String tabBarText; 14 | 15 | TabBarComponent(this.tabBarIndex, this.tabBarText, this.tabBarIcon); 16 | 17 | @override 18 | _TabBarComponentState createState() => _TabBarComponentState(); 19 | } 20 | 21 | class _TabBarComponentState extends State { 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return ScopedModelDescendant( 26 | builder: (context, child, model) { 27 | return Expanded( 28 | child: Column( 29 | children: [ 30 | Image.asset( 31 | model.tabBarCurrentIndex == widget.tabBarIndex ? widget.tabBarIcon[1] : widget.tabBarIcon[0], 32 | width: 24, 33 | height: 24 34 | ), 35 | Text( 36 | widget.tabBarText, 37 | style: TextStyle(color: model.tabBarCurrentIndex == widget.tabBarIndex ? Colors.black : Colors.grey) 38 | ) 39 | ], 40 | ), 41 | ); 42 | }, 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/components/tabbar_indictor_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * TabBar导航自定义指示器 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/widgets.dart'; 7 | 8 | class TabBarIndictorComponent extends Decoration { 9 | 10 | BuildContext context; 11 | Color bgColor; 12 | 13 | TabBarIndictorComponent({ @required this.context, this.bgColor = Colors.white }); 14 | 15 | @override 16 | BoxPainter createBoxPainter([onChanged]) => _TabBarIndictorBoxPainter(context, bgColor); 17 | } 18 | 19 | class _TabBarIndictorBoxPainter extends BoxPainter { 20 | 21 | BuildContext context; 22 | Color bgColor; 23 | 24 | _TabBarIndictorBoxPainter(this.context, this.bgColor); 25 | 26 | @override 27 | void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { 28 | final Paint paint = Paint(); 29 | paint.color = bgColor; 30 | paint.style = PaintingStyle.fill; 31 | final width = 33.0; 32 | final height = 2.0; 33 | canvas.drawRect( 34 | Rect.fromLTWH(offset.dx - width / 2 + configuration.size.width / 2, 35 | configuration.size.height - height - 5.0, width, height), 36 | paint 37 | ); 38 | } 39 | } -------------------------------------------------------------------------------- /lib/components/tag_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 标签组件 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | 7 | class TagComponent extends StatelessWidget { 8 | 9 | final String title; 10 | 11 | const TagComponent({ 12 | this.title = "tag" 13 | }); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Container( 18 | margin: EdgeInsets.symmetric(horizontal: 6.0), 19 | padding: EdgeInsets.fromLTRB(6.0, 3.0, 6.0, 3.0), 20 | child: Center( 21 | child: Text( 22 | title, 23 | style: TextStyle(color: Colors.white, fontSize: 10.0), 24 | ), 25 | ), 26 | decoration: BoxDecoration( 27 | color: Theme.of(context).primaryColor, 28 | borderRadius: BorderRadius.all(Radius.circular(3.0)) 29 | ), 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/components/video_detail_item_component.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频详情描述Item 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import './empty_component.dart'; 7 | 8 | class VideoDetailItemComponent extends StatelessWidget { 9 | 10 | final String icon; 11 | final String content; 12 | final Widget child; 13 | 14 | const VideoDetailItemComponent({ 15 | this.icon, 16 | this.content, 17 | this.child = const EmptyComponent() 18 | }); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return Padding( 23 | padding: EdgeInsets.symmetric(horizontal: 10.0), 24 | child: Row( 25 | crossAxisAlignment: CrossAxisAlignment.center, 26 | children: [ 27 | Image.asset( 28 | icon, 29 | width: 20.0, 30 | height: 20.0, 31 | fit: BoxFit.cover, 32 | ), 33 | SizedBox(width: 6.0), 34 | Text(content), 35 | child 36 | ], 37 | ) 38 | ); 39 | } 40 | } -------------------------------------------------------------------------------- /lib/config/application.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 全局应用 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:fluro/fluro.dart'; 7 | import 'package:event_bus/event_bus.dart'; 8 | 9 | class Application { 10 | static Router router; 11 | static EventBus eventBus; 12 | 13 | static navigateTo({ @required BuildContext context, @required String route, transition = TransitionType.inFromRight }) { 14 | router.navigateTo(context, route, transition: transition); 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /lib/constants/filter_menu.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 过滤菜单项 3 | * Create by Songlcy 4 | */ 5 | final List> FILTER_ITEM = [ 6 | [ 7 | {"title": "不限年代", "key": "year", "value": ""}, 8 | {"title": "2019", "key": "year", "value": "2018"}, 9 | {"title": "2018", "key": "year", "value": "2018"}, 10 | {"title": "2017", "key": "year", "value": "2017"}, 11 | {"title": "2016", "key": "year", "value": "2016"}, 12 | {"title": "2015", "key": "year", "value": "2015"}, 13 | {"title": "2014", "key": "year", "value": "2014"}, 14 | {"title": "2013", "key": "year", "value": "2013"}, 15 | {"title": "2012", "key": "year", "value": "2012"}, 16 | {"title": "2011", "key": "year", "value": "2011"}, 17 | {"title": "2010", "key": "year", "value": "2010"}, 18 | {"title": "00年代", "key": "year", "value": "00"}, 19 | {"title": "更早", "key": "year", "value": "更早"}, 20 | ], 21 | [ 22 | {"title": "不限地区", "key": "area", "value": ""}, 23 | {"title": "大陆", "key": "area", "value": "大陆"}, 24 | {"title": "香港", "key": "area", "value": "香港"}, 25 | {"title": "台湾", "key": "area", "value": "台湾"}, 26 | {"title": "日本", "key": "area", "value": "日本"}, 27 | {"title": "韩国", "key": "area", "value": "韩国"}, 28 | {"title": "美国", "key": "area", "value": "美国"}, 29 | {"title": "法国", "key": "area", "value": "法国"}, 30 | {"title": "德国", "key": "area", "value": "德国"}, 31 | {"title": "英国", "key": "area", "value": "英国"}, 32 | {"title": "其他", "key": "area", "value": "其他"}, 33 | ], 34 | [ 35 | {"title": "不限来源", "key": "source", "value": ""}, 36 | {"title": "最大资源网", "key": "source", "value": "zuidazy"}, 37 | {"title": "酷云资源网", "key": "source", "value": "kuyunzy"} 38 | ], 39 | [ 40 | {"title": "最新收录", "key": "sort", "value": "1"}, 41 | {"title": "最新上映", "key": "sort", "value": "2"}, 42 | {"title": "最多播放", "key": "sort", "value": "3"}, 43 | ], 44 | ]; -------------------------------------------------------------------------------- /lib/constants/index_tab.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页Tab 3 | * Create by Songlcy 4 | */ 5 | final List tabTitle = ["首页", "精选", "电影", "我"]; 6 | final List> tabIcon = [ 7 | [ 8 | "assets/images/icon_home_tab.png", 9 | "assets/images/icon_home_tab_pressed.png" 10 | ], 11 | [ 12 | "assets/images/icon_popular_tab.png", 13 | "assets/images/icon_popular_tab_pressed.png" 14 | ], 15 | [ 16 | "assets/images/icon_movie_tab.png", 17 | "assets/images/icon_movie_tab_pressed.png" 18 | ], 19 | ["assets/images/icon_mine_tab.png", "assets/images/icon_mine_tab_pressed.png"] 20 | ]; 21 | -------------------------------------------------------------------------------- /lib/constants/theme.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 主题选项 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | 7 | final List themeList = [ 8 | Colors.black, 9 | Colors.red, 10 | Colors.teal, 11 | Colors.pink, 12 | Colors.amber, 13 | Colors.orange, 14 | Colors.green, 15 | Colors.blue, 16 | Colors.lightBlue, 17 | Colors.purple, 18 | Colors.deepPurple, 19 | Colors.indigo, 20 | Colors.cyan, 21 | Colors.brown, 22 | Colors.grey, 23 | Colors.blueGrey 24 | ]; -------------------------------------------------------------------------------- /lib/constants/video_detail_tab.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频详情Tab项 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | 7 | final List> VIDEO_DETAIL_TAB = [ 8 | { "icon": Icon(Icons.video_library, size: 18.5), "name": "视频详情" }, 9 | { "icon": Icon(Icons.view_list, size: 18.5), "name": "播放列表" }, 10 | { "icon": Icon(Icons.details, size: 18.5), "name": "剧情介绍" }, 11 | ]; -------------------------------------------------------------------------------- /lib/delegate/sliver_appbar_delegate.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * SliverPersistentHeader 委托类 3 | */ 4 | import 'package:flutter/material.dart'; 5 | 6 | class SliverAppBarDelegate extends SliverPersistentHeaderDelegate { 7 | 8 | final TabBar _tabBar; 9 | SliverAppBarDelegate(this._tabBar); 10 | 11 | /** 12 | * minExtent 与 maxExtent 相同, Header不会有收缩效果,类似普通Header。 13 | */ 14 | @override 15 | double get minExtent => _tabBar.preferredSize.height; 16 | 17 | @override 18 | double get maxExtent => _tabBar.preferredSize.height; 19 | 20 | @override 21 | Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) { 22 | return Container( 23 | color: Colors.white, 24 | child: _tabBar 25 | ); 26 | } 27 | 28 | @override 29 | bool shouldRebuild(SliverAppBarDelegate oldDelegate) { 30 | return false; 31 | // return maxHeight != oldDelegate.maxHeight || 32 | // minHeight != oldDelegate.minHeight || 33 | // child != oldDelegate.child; 34 | } 35 | } -------------------------------------------------------------------------------- /lib/events/common_event.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 公用事件 3 | */ 4 | class Event { 5 | T event; 6 | Event(this.event); 7 | } -------------------------------------------------------------------------------- /lib/events/theme_event.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 主题更改事件 3 | * Create by Songlcy 4 | */ 5 | class ThemeChangeEvent { 6 | int themeIndex; 7 | ThemeChangeEvent(this.themeIndex); 8 | } -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluro/fluro.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:event_bus/event_bus.dart'; 4 | import 'package:fluttertoast/fluttertoast.dart'; 5 | import 'package:connectivity/connectivity.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import 'package:shared_preferences/shared_preferences.dart'; 8 | 9 | import './route/routes.dart'; 10 | import './constants/theme.dart'; 11 | import './utils/time_util.dart'; 12 | import './config/application.dart'; 13 | import './pages/home/home_page.dart'; 14 | import './models/state_model/main_state_model.dart'; 15 | 16 | void main() async { 17 | int themeIndex = await getTheme(); 18 | runApp(App(themeIndex)); 19 | } 20 | 21 | Future getTheme() async { 22 | SharedPreferences sp = await SharedPreferences.getInstance(); 23 | int themeIndex = sp.getInt("themeIndex"); 24 | if (themeIndex != null) { 25 | return themeIndex; 26 | } 27 | return 0; 28 | } 29 | 30 | class App extends StatefulWidget { 31 | final int themeIndex; 32 | 33 | App(this.themeIndex); 34 | 35 | @override 36 | _AppState createState() => _AppState(); 37 | } 38 | 39 | class _AppState extends State { 40 | dynamic subscription; 41 | MainStateModel mainStateModel; 42 | 43 | @override 44 | void initState() { 45 | super.initState(); 46 | mainStateModel = MainStateModel(); 47 | Application.eventBus = EventBus(); 48 | final Router router = Router(); 49 | Routes.configureRoutes(router); 50 | Application.router = router; 51 | TimeUtil.initLocaleLanguage(); 52 | initListener(); 53 | } 54 | 55 | initListener() { 56 | subscription = new Connectivity() 57 | .onConnectivityChanged 58 | .listen((ConnectivityResult result) { 59 | String networkResult = ""; 60 | switch (result) { 61 | case ConnectivityResult.mobile: 62 | networkResult = "当前处于移动网络"; 63 | break; 64 | case ConnectivityResult.wifi: 65 | networkResult = "当前处于wifi网络"; 66 | break; 67 | case ConnectivityResult.none: 68 | networkResult = "当前没有网络连接!"; 69 | break; 70 | default: 71 | break; 72 | } 73 | Fluttertoast.showToast( 74 | msg: networkResult, 75 | toastLength: Toast.LENGTH_SHORT, 76 | gravity: ToastGravity.TOP, 77 | timeInSecForIos: 1, 78 | backgroundColor: themeList[mainStateModel.themeIndex != null 79 | ? mainStateModel.themeIndex 80 | : widget.themeIndex], 81 | textColor: Colors.white, 82 | fontSize: 16.0 83 | ); 84 | }); 85 | } 86 | 87 | @override 88 | Widget build(BuildContext context) { 89 | return ScopedModel( 90 | model: mainStateModel, 91 | child: ScopedModelDescendant( 92 | builder: (context, child, model) { 93 | return MaterialApp( 94 | debugShowCheckedModeBanner: false, // 去除 DEBUG 标签 95 | theme: ThemeData( 96 | platform: TargetPlatform.iOS, 97 | primaryColor: themeList[model.themeIndex != null 98 | ? model.themeIndex 99 | : widget.themeIndex]), 100 | home: HomePage(), 101 | onGenerateRoute: Application.router.generator, 102 | ); 103 | }, 104 | )); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /lib/models/pood/Index_tab_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页Tab分类实体类 3 | * Create by Songlcy 4 | */ 5 | 6 | class IndexTabModel { 7 | 8 | String id; 9 | String name; 10 | 11 | IndexTabModel({ this.id, this.name }); 12 | 13 | factory IndexTabModel.fromJson(Map jsonObj) { 14 | return new IndexTabModel( 15 | id: jsonObj["_id"], 16 | name: jsonObj["name"] 17 | ); 18 | } 19 | } -------------------------------------------------------------------------------- /lib/models/pood/index_tab_page_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页Tab列表实体类 3 | * 对于嵌套结构,首先创建类和构造函数,然后从底层添加工厂方法。 4 | * Create by Songlcy 5 | */ 6 | class IndexTabPageModel { 7 | 8 | String message; 9 | String success; 10 | PayLoad payload; 11 | 12 | IndexTabPageModel({ this.message, this.success, this.payload }); 13 | 14 | factory IndexTabPageModel.fromJson(Map jsonObj) { 15 | return new IndexTabPageModel( 16 | message: jsonObj["_id"], 17 | success: jsonObj["name"], 18 | payload: PayLoad.fromJson(jsonObj["payload"]) 19 | ); 20 | } 21 | } 22 | 23 | class PayLoad { 24 | List ads; 25 | List banner; 26 | List hots; 27 | List latests; 28 | 29 | PayLoad({ this.ads, this.banner, this.hots, this.latests }); 30 | 31 | factory PayLoad.fromJson(Map jsonObj) { 32 | return PayLoad( 33 | ads: (jsonObj["ads"] as List).map((item) => Ads.fromJson(item)).toList(), 34 | banner: (jsonObj["banner"] as List).map((item) => Banner.fromJson(item)).toList(), 35 | hots: (jsonObj["hots"] as List).map((item) => Hot.fromJson(item)).toList(), 36 | latests: (jsonObj["latests"] as List).map((item) => Latest.fromJson(item)).toList(), 37 | ); 38 | } 39 | } 40 | 41 | class Action { 42 | /** 43 | * "data": "https://www.shuidichou.com/cf/contribute/caff17ed-905e-460b-a65a-8f0e943d47ae?channel=wx_charity_hy", 44 | * "type": "browser" 45 | */ 46 | String data; 47 | String type; 48 | 49 | Action({ this.data, this.type }); 50 | 51 | factory Action.fromJson(Map jsonObj) { 52 | return Action( 53 | data: jsonObj["data"], 54 | type: jsonObj["type"] 55 | ); 56 | } 57 | } 58 | 59 | class Ads { 60 | /** 61 | * "action": { 62 | "data": "Nl7FJ976sg", 63 | "type": "alipay_readpack" 64 | }, 65 | * "image": "https://dd.shmy.tech/static/ads/alipay/alipay_redpack.png", 66 | * "height": 0.6 67 | */ 68 | Action action; 69 | double height; 70 | String image; 71 | 72 | Ads({ this.action, this.height, this.image }); 73 | 74 | factory Ads.fromJson(Map jsonObj) { 75 | return Ads( 76 | action: Action.fromJson(jsonObj["action"]), 77 | height: jsonObj["height"], 78 | image: jsonObj["image"], 79 | ); 80 | } 81 | } 82 | 83 | class Banner { 84 | /** 85 | * "action": { 86 | "data": "Nl7FJ976sg", 87 | "type": "alipay_readpack" 88 | }, 89 | * "image": "https://dd.shmy.tech/static/ads/alipay/alipay_redpack.png", 90 | * "name": "你好,Flutter" 91 | */ 92 | Action action; 93 | String name; 94 | String image; 95 | 96 | Banner({ this.action, this.name, this.image }); 97 | 98 | factory Banner.fromJson(Map jsonObj) { 99 | return Banner( 100 | action: Action.fromJson(jsonObj["action"]), 101 | name: jsonObj['name'], 102 | image: jsonObj['image'], 103 | ); 104 | } 105 | 106 | } 107 | 108 | class Hot { 109 | /** 110 | * { 111 | "_id": "5bc93aad6e225858e54835c1", 112 | "generated_at": "2018-12-18T01:25:14Z", 113 | "latest": "更新到08集", 114 | "name": "十全八美第一季", 115 | "thumbnail": "http://tupian.tupianzy.com/pic/upload/vod/2018-10-18/201810181539876671.jpg" 116 | } 117 | */ 118 | String id; 119 | String generatedAt; 120 | String latest; 121 | String name; 122 | String thumbnail; 123 | 124 | Hot({ this.id, this.generatedAt, this.latest, this.name, this.thumbnail }); 125 | 126 | factory Hot.fromJson(Map jsonObj) { 127 | return Hot( 128 | id: jsonObj['_id'], 129 | generatedAt: jsonObj['generated_at'], 130 | latest: jsonObj['latest'], 131 | name: jsonObj['name'], 132 | thumbnail: jsonObj['thumbnail'] 133 | ); 134 | } 135 | 136 | } 137 | 138 | class Latest { 139 | /** 140 | * { 141 | "_id": "5bc6ec10e6fbb55fe2c62f87", 142 | "generated_at": "2019-01-01T00:52:02Z", 143 | "latest": "更新到11集", 144 | "name": "蔗糖女王第三季", 145 | "source": "zuidazy", 146 | "thumbnail": "http://tupian.tupianzy.com/pic/upload/vod/2018-10-17/201810171539757979.jpg" 147 | } 148 | */ 149 | String id; 150 | String generatedAt; 151 | String latest; 152 | String name; 153 | String source; 154 | String thumbnail; 155 | 156 | Latest({ this.id, this.generatedAt, this.latest, this.name, this.source, this.thumbnail }); 157 | 158 | factory Latest.fromJson(Map jsonObj) { 159 | return Latest( 160 | id: jsonObj['_id'], 161 | generatedAt: jsonObj['generated_at'], 162 | latest: jsonObj['latest'], 163 | name: jsonObj['name'], 164 | source: jsonObj['source'], 165 | thumbnail: jsonObj['thumbnail'] 166 | ); 167 | } 168 | 169 | } -------------------------------------------------------------------------------- /lib/models/pood/video_detail_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频详情 3 | * Create by Songlcy 4 | */ 5 | 6 | class VideoDetailModel { 7 | // { 8 | // "classify": { 9 | // "_id": "5b1fdbee30025ae5371ac363", 10 | // "name": "动漫" 11 | // }, 12 | // "director": ["濑藤健嗣"], 13 | // "favorited": false, 14 | // "favorited_count": 0, 15 | // "introduce": "本作是由东映动画、万代、小学馆共同发起的新企划,预定进行动画、漫画、玩具等多媒体展开。动画将于10月推出。", 16 | // "keyword": "爆钓BARHUNTER濑藤健嗣广桥凉内山夕实斋贺光希根本幸多baodiaoBARHUNTERlaitengjiansiguangqiaoliangneishanxishizhaiheguangxigenbenxingduobdBARHUNTERltjsgqlnsxszhgxgbxd", 17 | // "latest": "更新到16集", 18 | // "name": "爆钓BARHUNTER", 19 | // "number": 19, 20 | // "region": "日本", 21 | // "released_at": "2018", 22 | // "remote_url": [{ 23 | // "tag": "第01集", 24 | // "url": "https://youku163.zuida-bofang.com/20181002/16132_d52aa48b/index.m3u8" 25 | // }], 26 | // "running_time": 0, 27 | // "source": "zuidazy", 28 | // "starring": ["广桥凉", "内山夕实", "斋贺光希", "根本幸多"], 29 | // "thumbnail": "https://tupian.tupianzy.com/pic/upload/vod/2018-10-02/201810021538485416.jpg" 30 | // } 31 | 32 | Classify classify; 33 | List director; 34 | bool favorited; 35 | int favoritedCount; 36 | String introduce; 37 | String keyword; 38 | String name; 39 | String region; 40 | List remoteUrl; 41 | List starring; 42 | String releasedAt; 43 | String thumbnail; 44 | 45 | VideoDetailModel({ 46 | this.classify, 47 | this.director, 48 | this.favorited, 49 | this.favoritedCount, 50 | this.introduce, 51 | this.keyword, 52 | this.name, 53 | this.region, 54 | this.remoteUrl, 55 | this.starring, 56 | this.releasedAt, 57 | this.thumbnail 58 | }); 59 | 60 | factory VideoDetailModel.fromJson(Map jsonObj) { 61 | 62 | return VideoDetailModel( 63 | classify: Classify.fromJson(jsonObj["classify"]), 64 | director: jsonObj["director"], 65 | favorited: jsonObj["favorited"], 66 | favoritedCount: jsonObj["favoritedCount"], 67 | introduce: jsonObj["introduce"], 68 | keyword: jsonObj["keyword"], 69 | name: jsonObj["name"], 70 | region: jsonObj["region"], 71 | remoteUrl: (jsonObj["remote_url"] as List).map((item) => RemoteUrl.fromJson(item)).toList(), 72 | starring: jsonObj["starring"], 73 | releasedAt: jsonObj["released_at"], 74 | thumbnail: jsonObj["thumbnail"] 75 | ); 76 | } 77 | } 78 | class Classify { 79 | 80 | String id; 81 | String name; 82 | 83 | Classify({ this.id, this.name }); 84 | 85 | factory Classify.fromJson(Map jsonObj) { 86 | return Classify(id:jsonObj["_id"], name: jsonObj["name"]); 87 | } 88 | } 89 | 90 | class RemoteUrl { 91 | 92 | String tag; 93 | String url; 94 | 95 | RemoteUrl({ this.tag, this.url }); 96 | 97 | factory RemoteUrl.fromJson(Map jsonObj) { 98 | return RemoteUrl(tag: jsonObj["tag"], url: jsonObj["url"]); 99 | } 100 | } -------------------------------------------------------------------------------- /lib/models/pood/video_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频实体类 3 | * Create by Songlcy 4 | */ 5 | class VideoModel { 6 | // { 7 | // "_id": "5b6ac0c36384664afd73c1d0", 8 | // "generated_at": "2019-01-20T11:38:54Z", 9 | // "latest": "第40集", 10 | // "name": "咯咯咯鬼太郎6", 11 | // "source": "kuyunzy", 12 | // "thumbnail": "https://img.kuyun88.com/pic/uploadimg/2018-5/2018562284825623.jpg" 13 | // } 14 | String id; 15 | String generatedAt; 16 | String latest; 17 | String name; 18 | String source; 19 | String thumbnail; 20 | String timestamp; 21 | 22 | VideoModel({ this.id, this.generatedAt, this.latest, this.name, this.source, this.thumbnail, this.timestamp }); 23 | 24 | factory VideoModel.fromJson(Map jsonObj) { 25 | return VideoModel( 26 | id: jsonObj["_id"], 27 | generatedAt: jsonObj["generated_at"], 28 | latest: jsonObj["latest"], 29 | name: jsonObj["name"], 30 | source: jsonObj["source"], 31 | thumbnail: jsonObj["thumbnail"], 32 | timestamp: jsonObj["timestamp"] 33 | ); 34 | } 35 | } -------------------------------------------------------------------------------- /lib/models/state_model/base_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * Model基类 3 | * Create by Songlcy 4 | */ 5 | import 'package:scoped_model/scoped_model.dart'; 6 | 7 | class BaseStateModel extends Model { 8 | 9 | } -------------------------------------------------------------------------------- /lib/models/state_model/filter_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 过滤器组件状态Model 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | 8 | import './base_state_model.dart'; 9 | import './movie_state_model.dart'; 10 | import '../../constants/filter_menu.dart'; 11 | 12 | /** 13 | * item下标状态 14 | */ 15 | class FilterBarIndexState { 16 | final int yearIndex; // 年份 17 | final int areaIndex; // 地区 18 | final int sortIndex; // 最新收录 19 | final int sourceIndex; // 来源 20 | 21 | FilterBarIndexState({ 22 | this.yearIndex = 0, 23 | this.areaIndex = 0, 24 | this.sortIndex = 1, 25 | this.sourceIndex = 0, 26 | }); 27 | } 28 | 29 | class FilterStateModel extends BaseStateModel with MovieStateModel { 30 | 31 | bool _isOpen = false; 32 | List _itemList = []; 33 | FilterBarIndexState _filterBarIndexState; 34 | FilterStateModel(this._filterBarIndexState); 35 | 36 | bool get isOpen => _isOpen; 37 | List get itemList => _itemList; 38 | 39 | void init() { 40 | _itemList = [ 41 | {"index": _filterBarIndexState.yearIndex, "data": FILTER_ITEM[0]}, 42 | {"index": _filterBarIndexState.areaIndex, "data": FILTER_ITEM[1]}, 43 | {"index": _filterBarIndexState.sourceIndex, "data": FILTER_ITEM[2]}, 44 | {"index": _filterBarIndexState.sortIndex, "data": FILTER_ITEM[3]}, 45 | ]; 46 | } 47 | 48 | void setSelectIndex(int groupIndex, int index) { 49 | _itemList[groupIndex]["index"] = index; 50 | notifyListeners(); 51 | } 52 | 53 | void toggleOpenStatus() { 54 | _isOpen = !_isOpen; 55 | notifyListeners(); 56 | } 57 | 58 | static FilterStateModel of(BuildContext context) => ScopedModel.of(context, rebuildOnChange: true); 59 | } 60 | -------------------------------------------------------------------------------- /lib/models/state_model/home_state_model.dart: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 首页数据状态Model 4 | * Create by Songlcy 5 | */ 6 | import 'package:scoped_model/scoped_model.dart'; 7 | 8 | import './base_state_model.dart'; 9 | import '../../common/api.dart'; 10 | import '../../utils/http_util.dart'; 11 | import '../../common/status.dart'; 12 | import '../pood/Index_tab_model.dart'; 13 | import '../pood/index_tab_page_model.dart'; 14 | 15 | class HomeStateModel extends BaseStateModel { 16 | 17 | Status _status = Status.READY; 18 | Status get status => _status; 19 | 20 | List _tabList; 21 | List get tabList => _tabList; 22 | 23 | IndexTabPageModel _indexTabPageModel; 24 | IndexTabPageModel get indexTabPageModel => _indexTabPageModel; 25 | 26 | Map> hotMap = Map(); 27 | 28 | /** 29 | * 加载首页Tab分类列表 30 | */ 31 | fetchTabList() async { 32 | _status = Status.LOADING; 33 | await HttpUtil.get(INDEX_TAB_URL, null) 34 | .then((res) { 35 | _tabList = List(); 36 | if(res.statusCode == Response.OK) { 37 | _status = Status.SUCCESS; 38 | var responseList = res.data; 39 | if(responseList != null) { 40 | if(responseList.length == 0) { 41 | _status = Status.NO_RESULT; 42 | } else { 43 | for(int i = 0; i < responseList.length; i++) { 44 | IndexTabModel indexTabModel = IndexTabModel.fromJson(responseList[i]); 45 | _tabList.add(indexTabModel); 46 | } 47 | } 48 | } else { 49 | _status = Status.NO_RESULT; 50 | } 51 | return _tabList; 52 | } else { 53 | _status = Status.NO_RESULT; 54 | } 55 | }) 56 | .catchError((onError) { 57 | // _tabList = null 58 | print(onError.toString()); 59 | _status = Status.ERROR; 60 | }) 61 | .whenComplete(this.notifyListeners); 62 | } 63 | 64 | /** 65 | * 加载首页对应Tab分类 66 | */ 67 | fetchIndexVideoList(String categoryId) { 68 | _status = Status.LOADING; 69 | Map params = { "id": categoryId }; 70 | HttpUtil.get(INDEX_VIDEO_LIST, params) 71 | .then((res) { 72 | if(res.statusCode == Response.OK) { 73 | _status = Status.SUCCESS; 74 | var responseData = res.data; 75 | if(responseData != null) { 76 | _indexTabPageModel = IndexTabPageModel.fromJson(responseData); 77 | hotMap.addAll({ categoryId: _indexTabPageModel.payload.hots }); 78 | } else { 79 | _status = Status.NO_RESULT; 80 | } 81 | } else { 82 | _status = Status.NO_RESULT; 83 | } 84 | }) 85 | .catchError((onError) { 86 | _status = Status.ERROR; 87 | print(onError.toString()); 88 | }) 89 | .whenComplete(this.notifyListeners); 90 | } 91 | 92 | static HomeStateModel of(context) => 93 | ScopedModel.of(context, rebuildOnChange: true); 94 | } -------------------------------------------------------------------------------- /lib/models/state_model/main_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 主数据模型,需要全局使用的数据在这里添加模型 3 | * Create by Songlcy 4 | */ 5 | import 'package:scoped_model/scoped_model.dart'; 6 | import './theme_state_model.dart'; 7 | 8 | class MainStateModel extends Model with ThemeStateModel { 9 | 10 | static MainStateModel of(context) => ScopedModel.of(context, rebuildOnChange: true); 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /lib/models/state_model/movie_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 电影数据状态Model 3 | * Create by Songlcy 4 | */ 5 | import '../../common/api.dart'; 6 | import './base_state_model.dart'; 7 | import '../pood/video_model.dart'; 8 | import '../../common/status.dart'; 9 | import '../../utils/http_util.dart'; 10 | 11 | class MovieStateModel extends BaseStateModel{ 12 | 13 | List _movieList; 14 | Status status = Status.READY; 15 | Map paging = { "page": 1, "per_page": 20 }; 16 | 17 | List get movieList => _movieList; 18 | 19 | Future fetchMovieList(String categoryId, Map filterParams) async { 20 | status = Status.LOADING; 21 | this.notifyListeners(); 22 | await HttpUtil.get(VIDEO_LIST_URL + categoryId, {}..addAll(paging)..addAll(filterParams)) 23 | .then((res) { 24 | if(res.statusCode == Response.OK) { 25 | if(res.data["payload"]["result"].length == 0) { 26 | if(paging["page"] == 1) { 27 | status = Status.NO_RESULT; 28 | _movieList = []; 29 | } else { 30 | status = Status.NO_MORE; 31 | } 32 | } else { 33 | // 有数据 34 | var responseList = res.data["payload"]["result"]; 35 | if(paging["page"] == 1) { 36 | List tempList = []; 37 | for(int i = 0; i < responseList.length; i++) { 38 | VideoModel videoModel = VideoModel.fromJson(responseList[i]); 39 | tempList.add(videoModel); 40 | } 41 | _movieList = tempList; 42 | } else { 43 | for(int i = 0; i < responseList.length; i++) { 44 | VideoModel videoModel = VideoModel.fromJson(responseList[i]); 45 | _movieList.add(videoModel); 46 | } 47 | } 48 | status = Status.SUCCESS; 49 | } 50 | return true; 51 | } else { 52 | _movieList = []; 53 | status = Status.NO_RESULT; 54 | return false; 55 | } 56 | }) 57 | .catchError((onError){ 58 | _movieList = []; 59 | status = Status.ERROR; 60 | print(onError.toString()); 61 | return false; 62 | }) 63 | .whenComplete(this.notifyListeners); 64 | return true; 65 | } 66 | 67 | /** 68 | * 刷新 69 | */ 70 | Future refreshMovieList(String categoryId, Map filterParams) async { 71 | if(status == Status.LOADING) { 72 | return null; 73 | } 74 | int oldPage = paging["page"]; 75 | paging["page"] = 1; 76 | if(!await fetchMovieList(categoryId, filterParams)) { 77 | paging["page"] = oldPage; 78 | } 79 | } 80 | 81 | /** 82 | * 加载更多 83 | */ 84 | Future loadMoreMovieList(String categoryId, Map filterParams) async { 85 | if(status == Status.LOADING) { 86 | return null; 87 | } 88 | paging["page"]++; 89 | if(!await fetchMovieList(categoryId, filterParams)) { 90 | paging["page"]--; 91 | } 92 | } 93 | } -------------------------------------------------------------------------------- /lib/models/state_model/popular_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 精选模块Model 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | 8 | import '../pood/video_model.dart'; 9 | import './base_state_model.dart'; 10 | import '../../common/api.dart'; 11 | import '../../common/status.dart'; 12 | import '../../utils/http_util.dart'; 13 | 14 | class PopularStateModel extends BaseStateModel { 15 | 16 | List _listData; 17 | Status status = Status.READY; 18 | Map paging = { "page": 1, "per_page": 20 }; 19 | 20 | List get listData => _listData; 21 | 22 | Future fetchListData(String id) async { 23 | Map filterParams = { 24 | "year": "2018", 25 | "area": "", 26 | "sort": "2", 27 | "query": "2", 28 | "source": "", 29 | }; 30 | status = Status.LOADING; 31 | this.notifyListeners(); 32 | await HttpUtil.get(VIDEO_LIST_URL + id, {}..addAll(filterParams)..addAll(paging)) 33 | .then((res) { 34 | if(res.statusCode == Response.OK) { 35 | if(res.data["payload"]["result"].length == 0) { 36 | if(paging["page"] == 1) { 37 | status = Status.NO_RESULT; 38 | _listData = []; 39 | } else { 40 | status = Status.NO_MORE; 41 | } 42 | } else { 43 | // 有数据 44 | var responseList = res.data["payload"]["result"]; 45 | if(paging["page"] == 1) { 46 | List tempList = []; 47 | for(int i = 0; i < responseList.length; i++) { 48 | VideoModel videoModel = VideoModel.fromJson(responseList[i]); 49 | tempList.add(videoModel); 50 | } 51 | _listData = tempList; 52 | } else { 53 | for(int i = 0; i < responseList.length; i++) { 54 | VideoModel videoModel = VideoModel.fromJson(responseList[i]); 55 | _listData.add(videoModel); 56 | } 57 | } 58 | status = Status.SUCCESS; 59 | } 60 | return true; 61 | } else { 62 | _listData = []; 63 | return false; 64 | } 65 | }) 66 | .catchError((onError){ 67 | print(onError.toString()); 68 | status = Status.ERROR; 69 | _listData = []; 70 | return false; 71 | }) 72 | .whenComplete(this.notifyListeners); 73 | return true; 74 | } 75 | 76 | /** 77 | * 刷新 78 | */ 79 | Future refreshListData(String id) async { 80 | if(status == Status.LOADING) { 81 | return null; 82 | } 83 | int oldPage = paging["page"]; 84 | paging["page"] = 1; 85 | if(!await fetchListData(id)) { 86 | paging["page"] = oldPage; 87 | } 88 | } 89 | 90 | /** 91 | * 加载更多 92 | */ 93 | Future loadMoreListData(String id) async { 94 | if(status == Status.LOADING) { 95 | return null; 96 | } 97 | paging["page"]++; 98 | if(!await fetchListData(id)) { 99 | paging["page"]--; 100 | } 101 | } 102 | 103 | static PopularStateModel of(BuildContext context) => ScopedModel.of(context, rebuildOnChange: true); 104 | } -------------------------------------------------------------------------------- /lib/models/state_model/tab_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页Tab切换Model 3 | */ 4 | import './base_state_model.dart'; 5 | 6 | class TabBarStateModel extends BaseStateModel { 7 | 8 | int _tabBarCurrentIndex = 0; 9 | 10 | get tabBarCurrentIndex => _tabBarCurrentIndex; 11 | 12 | void changeTabBarCurrentIndex(int currentIndex) { 13 | _tabBarCurrentIndex = currentIndex; 14 | notifyListeners(); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /lib/models/state_model/theme_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 主题Model 3 | * Create by Songlcy 4 | */ 5 | import 'package:scoped_model/scoped_model.dart'; 6 | import 'package:shared_preferences/shared_preferences.dart'; 7 | 8 | abstract class ThemeStateModel extends Model { 9 | int _themeIndex; 10 | 11 | get themeIndex => _themeIndex; 12 | 13 | void changeTheme(int themeIndex) async { 14 | _themeIndex = themeIndex; 15 | notifyListeners(); 16 | SharedPreferences sp = await SharedPreferences.getInstance(); 17 | sp.setInt("themeIndex", themeIndex); 18 | } 19 | 20 | Future getTheme() async { 21 | SharedPreferences sp = await SharedPreferences.getInstance(); 22 | int themeIndex = sp.getInt("themeIndex"); 23 | if (themeIndex != null) { 24 | return themeIndex; 25 | } 26 | return 0; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/models/state_model/video_detail_state_model.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频详情Model 3 | * Create by Songlcy 4 | */ 5 | 6 | import '../../common/api.dart'; 7 | import './base_state_model.dart'; 8 | import '../../common/status.dart'; 9 | import '../../utils/http_util.dart'; 10 | import '../pood/video_detail_model.dart'; 11 | 12 | class VideoDetailStateModel extends BaseStateModel { 13 | 14 | Status _status = Status.READY; 15 | VideoDetailModel _videoDetailModel; 16 | 17 | Status get status => _status; 18 | VideoDetailModel get videoDetailModel => _videoDetailModel; 19 | 20 | fetchVideoDetail(String videoId) { 21 | 22 | _status = Status.LOADING; 23 | HttpUtil.get(VIDEO_URL + videoId, null) 24 | .then((res) { 25 | if(res.statusCode == Response.OK) { 26 | _status = Status.SUCCESS; 27 | _videoDetailModel = VideoDetailModel.fromJson(res.data["payload"]); 28 | } else { 29 | _status = Status.NO_RESULT; 30 | } 31 | }) 32 | .catchError((onError) { 33 | _status = Status.ERROR; 34 | print(onError.toString()); 35 | }) 36 | .whenComplete(this.notifyListeners); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /lib/pages/detail/video_desc_tab_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频详情 Tab 页面 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | 8 | import '../../common/status.dart'; 9 | import '../../utils/time_util.dart'; 10 | 11 | import '../../models/pood/video_model.dart'; 12 | import '../../models/pood/video_detail_model.dart'; 13 | import '../../models/state_model/video_detail_state_model.dart'; 14 | 15 | import '../../components/tag_component.dart'; 16 | import '../../components/loading_component.dart'; 17 | import '../../components/data_empty_component.dart'; 18 | import '../../components//video_detail_item_component.dart'; 19 | 20 | class VideoDescTabPage extends StatelessWidget { 21 | 22 | final VideoModel videoModel; 23 | const VideoDescTabPage(this.videoModel); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return ScopedModelDescendant( 28 | builder: (context, child, model) { 29 | VideoDetailModel videoDetailModel = model.videoDetailModel; 30 | return model.status == Status.LOADING ? 31 | LoadingComponent() 32 | : 33 | model.status == Status.SUCCESS ? 34 | ListView( 35 | children: [ 36 | VideoDetailItemComponent( 37 | icon: "assets/images/icon_videodetail_name.png", 38 | content: "${videoModel.name}", 39 | child: TagComponent( 40 | title: model.videoDetailModel != null 41 | ? model.videoDetailModel.classify.name 42 | : "" 43 | ), 44 | ), 45 | Container( 46 | margin: EdgeInsets.symmetric(vertical: 13.0), 47 | child: VideoDetailItemComponent( 48 | icon: "assets/images/icon_videodetail_director.png", 49 | content: "导演: ${model.videoDetailModel.director[0]}" 50 | ) 51 | ), 52 | VideoDetailItemComponent( 53 | icon: "assets/images/icon_videodetail_starring.png", 54 | content: "明星主演" 55 | ), 56 | Container( 57 | margin: EdgeInsets.fromLTRB(33.3, 8.0, 16.0, 0.0), 58 | child: Text("${videoDetailModel.starring.getRange(0, videoDetailModel.starring.length)}"), 59 | ), 60 | Container( 61 | margin: EdgeInsets.symmetric(vertical: 13.0), 62 | child: VideoDetailItemComponent( 63 | icon: "assets/images/icon_videodetail_num.png", 64 | content: "${videoModel.latest}" 65 | ) 66 | ), 67 | VideoDetailItemComponent( 68 | icon: "assets/images/icon_videodetail_jishu.png", 69 | content: "[ 更新时间 ] ${TimeUtil.getTimeago(DateTime.parse(videoModel.generatedAt))}" 70 | ), 71 | ], 72 | ) 73 | : 74 | DataEmptyComponent(status: model.status); 75 | }, 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/pages/detail/video_detail_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频详情 3 | * Create by Songlcy 4 | */ 5 | import 'dart:ui'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:shimmer/shimmer.dart'; 8 | import 'package:scoped_model/scoped_model.dart'; 9 | 10 | import './video_desc_tab_page.dart'; 11 | import './video_play_tab_page.dart'; 12 | import './video_plot_tab_page.dart'; 13 | import '../../utils/device_util.dart'; 14 | import '../../models/pood/video_model.dart'; 15 | import '../../constants/video_detail_tab.dart'; 16 | import '../../components/cached_image_component.dart'; 17 | import '../../components/hero_image_component.dart'; 18 | import '../../delegate/sliver_appbar_delegate.dart'; 19 | import '../../models/state_model/video_detail_state_model.dart'; 20 | 21 | class VideoDetailPage extends StatefulWidget { 22 | VideoModel videoItem; 23 | VideoDetailPage({@required this.videoItem}); 24 | 25 | @override 26 | State createState() => _VideoDetailPageState(); 27 | } 28 | 29 | class _VideoDetailPageState extends State { 30 | VideoDetailStateModel videoDetailStateModel; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | videoDetailStateModel = new VideoDetailStateModel(); 36 | videoDetailStateModel.fetchVideoDetail(widget.videoItem.id); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return ScopedModel( 42 | model: videoDetailStateModel, 43 | child: Scaffold( 44 | body: DefaultTabController( 45 | length: VIDEO_DETAIL_TAB.length, 46 | child: NestedScrollView( 47 | headerSliverBuilder: 48 | (BuildContext context, bool innerBoxIsScrolled) { 49 | return [ 50 | // 标题 51 | SliverAppBar( 52 | elevation: 0.0, 53 | floating: false, 54 | pinned: true, 55 | expandedHeight: 56 | DeviceUtil.getScreenSize(context).width * 1.05, 57 | flexibleSpace: FlexibleSpaceBar( 58 | title: Shimmer.fromColors( 59 | baseColor: Colors.white, 60 | highlightColor: Theme.of(context).primaryColor, 61 | period: Duration(milliseconds: 6000), 62 | child: Text( 63 | "${widget.videoItem.name}", 64 | style: TextStyle( 65 | fontSize: 16.0, 66 | ), 67 | ), 68 | ), 69 | centerTitle: true, 70 | background: HeaderBackGroundCover(widget.videoItem), 71 | ), 72 | actions: [ 73 | // 收藏按钮 74 | ], 75 | ), 76 | // Tab 77 | SliverPersistentHeader( 78 | pinned: true, 79 | delegate: SliverAppBarDelegate(TabBar( 80 | labelColor: Theme.of(context).primaryColor, 81 | labelStyle: TextStyle(fontSize: 16.5), 82 | unselectedLabelColor: Color.fromARGB(255, 192, 193, 195), 83 | indicatorColor: Theme.of(context).primaryColor, 84 | indicatorWeight: 2.0, 85 | tabs: VIDEO_DETAIL_TAB 86 | .map((item) => Tab( 87 | child: Row( 88 | mainAxisAlignment: MainAxisAlignment.center, 89 | children: [ 90 | item["icon"], 91 | SizedBox(width: 3.0), 92 | Text(item["name"], 93 | style: TextStyle(fontSize: 15.0)) 94 | ], 95 | ), 96 | )) 97 | .toList(), 98 | )), 99 | ) 100 | ]; 101 | }, 102 | body: VideoDetailContent(widget.videoItem), 103 | ), 104 | ), 105 | ) 106 | ); 107 | } 108 | } 109 | 110 | /** 111 | * 头部 112 | */ 113 | class HeaderBackGroundCover extends StatelessWidget { 114 | final VideoModel video; 115 | HeaderBackGroundCover(this.video); 116 | 117 | @override 118 | Widget build(BuildContext context) { 119 | return Container( 120 | child: Stack( 121 | children: [ 122 | // 底图 123 | Positioned.fill( 124 | child: CachedImageComponent( 125 | imageUrl: video.thumbnail, boxFit: BoxFit.fill), 126 | ), 127 | // 毛玻璃 128 | Positioned( 129 | child: BackdropFilter( 130 | filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), 131 | child: Container( 132 | decoration: BoxDecoration(color: Colors.black.withAlpha(60)), 133 | ), 134 | )), 135 | // 内容 136 | Positioned( 137 | left: 0.0, 138 | top: 60.0, 139 | right: 0.0, 140 | child: Column( 141 | mainAxisAlignment: MainAxisAlignment.center, 142 | crossAxisAlignment: CrossAxisAlignment.center, 143 | children: [ 144 | Container( 145 | width: 200.0, 146 | height: 290.0, 147 | margin: EdgeInsets.only(left: 10.0), 148 | child: HeroImageComponent( 149 | imageItem: video, 150 | imageWidth: 200.0, 151 | imageHeight: 300.0, 152 | ), 153 | decoration: BoxDecoration(boxShadow: [ 154 | BoxShadow( 155 | color: Colors.black.withAlpha(50), 156 | offset: Offset(0.0, 2.0), 157 | blurRadius: 6.0), 158 | BoxShadow( 159 | color: Colors.black.withAlpha(20), 160 | offset: Offset(0.0, 3.0), 161 | blurRadius: 8.0) 162 | ]), 163 | ) 164 | ], 165 | )) 166 | ], 167 | ), 168 | ); 169 | } 170 | } 171 | 172 | class VideoDetailContent extends StatelessWidget { 173 | final VideoModel video; 174 | VideoDetailContent(this.video); 175 | 176 | @override 177 | Widget build(BuildContext context) { 178 | return TabBarView( 179 | children: [ 180 | VideoDescTabPage(video), 181 | VideoPlayTabPage(), 182 | VideoPlotTabPage() 183 | ], 184 | ); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /lib/pages/detail/video_play_tab_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频播放列表 Tab 页面 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import 'package:video_player/video_player.dart'; 8 | 9 | import '../../common/status.dart'; 10 | import '../../components/loading_component.dart'; 11 | import '../../components/data_empty_component.dart'; 12 | import '../../components/video_detail_item_component.dart'; 13 | import '../../models/pood/video_detail_model.dart'; 14 | import '../../models/state_model/video_detail_state_model.dart'; 15 | 16 | class VideoPlayTabPage extends StatelessWidget { 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return ScopedModelDescendant( 21 | builder: (context, child, model) { 22 | return model.status == Status.LOADING 23 | ? LoadingComponent() 24 | : model.status == Status.SUCCESS 25 | ? 26 | ListView.builder( 27 | itemCount: model.videoDetailModel.remoteUrl.length, 28 | itemBuilder: (BuildContext context, int index) => 29 | _ListItem(model.videoDetailModel, model.videoDetailModel.remoteUrl[index]), 30 | ) 31 | : DataEmptyComponent(status: model.status); 32 | }, 33 | ); 34 | } 35 | } 36 | 37 | class _ListItem extends StatelessWidget { 38 | 39 | final RemoteUrl remoteUrl; 40 | final VideoDetailModel videoDetailModel; 41 | const _ListItem(this.videoDetailModel,this.remoteUrl); 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | return Container( 46 | margin: EdgeInsets.symmetric(horizontal: 8.0), 47 | child: Center( 48 | child: MaterialButton( 49 | height: 30.0, 50 | child: Text(remoteUrl.tag, style: TextStyle(color: Colors.white)), 51 | color: Theme.of(context).primaryColor, 52 | onPressed: () => goToVideoPlayerPage(videoDetailModel, remoteUrl) 53 | ) 54 | ), 55 | ); 56 | } 57 | 58 | /** 59 | * 跳转视频播放界面 60 | */ 61 | goToVideoPlayerPage(VideoDetailModel videoDetailModel, RemoteUrl remoteUrl) async { 62 | bool isHlS = remoteUrl.url.toLowerCase().endsWith(".m3u8"); 63 | // 点播 hls需要exo2内核 并且硬件解码 mp4 需要ijk内核 软件解码 64 | await VideoPlayer.play( 65 | videoDetailModel.name, 66 | remoteUrl.url, 67 | videoDetailModel.thumbnail, 68 | id: videoDetailModel.classify.id, 69 | tag: remoteUrl.tag, 70 | seek: 0, 71 | append: "【Vistor】", 72 | kernel: isHlS ? 2 : 0, 73 | ); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/pages/detail/video_plot_tab_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 视频剧情 Tab 页面 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | 8 | import '../../common/status.dart'; 9 | import '../../components/loading_component.dart'; 10 | import '../../components/data_empty_component.dart'; 11 | import '../../components/animation_text_component.dart'; 12 | import '../../components/video_detail_item_component.dart'; 13 | import '../../models/pood/video_detail_model.dart'; 14 | import '../../models/state_model/video_detail_state_model.dart'; 15 | 16 | 17 | class VideoPlotTabPage extends StatefulWidget { 18 | 19 | @override 20 | State createState()=>_VideoPlotTabPageState(); 21 | } 22 | class _VideoPlotTabPageState extends State { 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return ScopedModelDescendant( 27 | builder: (context, child, model) { 28 | VideoDetailModel videoDetailModel = model.videoDetailModel; 29 | return model.status == Status.LOADING ? 30 | LoadingComponent() 31 | : 32 | model.status == Status.SUCCESS ? 33 | ListView( 34 | children: [ 35 | VideoDetailItemComponent( 36 | icon: "assets/images/icon_videodetail_desc.png", 37 | content: "剧情" 38 | ), 39 | Container( 40 | margin: EdgeInsets.all(13.0), 41 | child: Center( 42 | child: AnimationTextComponent( 43 | delayTime: 1500, 44 | duration: 6000, 45 | text: "${videoDetailModel.introduce}", 46 | textStyle: TextStyle( 47 | color: Colors.black, 48 | // letterSpacing: 1.0 49 | ), 50 | ), 51 | ) 52 | ) 53 | ], 54 | ) 55 | : 56 | DataEmptyComponent(status: model.status); 57 | }, 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/pages/home/home_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页 3 | * Create by Songlcy 2018-12-25 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import 'package:fluttertoast/fluttertoast.dart'; 8 | 9 | import './tab_pages.dart'; 10 | import '../../constants/index_tab.dart'; 11 | import '../../models/state_model/tab_state_model.dart'; 12 | class HomePage extends StatefulWidget { 13 | @override 14 | _HomePageState createState() => _HomePageState(); 15 | } 16 | 17 | class _HomePageState extends State with AutomaticKeepAliveClientMixin { 18 | 19 | static int lastExitTime = 0; 20 | TabBarStateModel tabBarStateModel; 21 | 22 | @override 23 | bool get wantKeepAlive => true; 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | tabBarStateModel = TabBarStateModel(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return WillPopScope( 34 | onWillPop: _onBackPressed, 35 | child: ScopedModel( 36 | model: tabBarStateModel, 37 | child:ScopedModelDescendant( 38 | builder: (context, child, model) { 39 | return Scaffold( 40 | body: _renderTabContent(model), 41 | bottomNavigationBar: _renderBottomNavigationBar(model), 42 | ); 43 | }, 44 | ), 45 | ), 46 | ); 47 | 48 | 49 | } 50 | 51 | /** 52 | * 自定义返回键事件 53 | * 一定时间内点击两次退出,反之提示 54 | */ 55 | Future _onBackPressed() async { 56 | if(tabBarStateModel.tabBarCurrentIndex != 0) { 57 | tabBarStateModel.changeTabBarCurrentIndex(0); 58 | return await Future.value(false); 59 | } 60 | int nowExitTime = DateTime.now().millisecondsSinceEpoch; 61 | if(nowExitTime - lastExitTime > 2000) { 62 | lastExitTime = nowExitTime; 63 | Fluttertoast.showToast( 64 | msg: "再按一次退出程序", 65 | toastLength: Toast.LENGTH_SHORT, 66 | gravity: ToastGravity.BOTTOM, 67 | timeInSecForIos: 1, 68 | backgroundColor: Theme.of(context).primaryColor, 69 | textColor: Colors.white, 70 | fontSize: 16.0 71 | ); 72 | return await Future.value(false); 73 | } 74 | return await Future.value(true); 75 | } 76 | 77 | /** 78 | * Tab对应视图 79 | */ 80 | _renderTabContent(TabBarStateModel model) { 81 | return IndexedStack( 82 | index: model.tabBarCurrentIndex, 83 | children: [ 84 | IndexPage(), 85 | PopularPage(), 86 | MoviePage(), 87 | MinePage() 88 | ], 89 | ); 90 | } 91 | 92 | /** 93 | * TabBar 94 | */ 95 | _renderBottomNavigationBar(TabBarStateModel model) { 96 | return BottomNavigationBar( 97 | items: _renderTabBarItem(model.tabBarCurrentIndex), 98 | onTap: (index) => model.changeTabBarCurrentIndex(index), 99 | currentIndex: model.tabBarCurrentIndex, 100 | type: BottomNavigationBarType.fixed, 101 | ); 102 | } 103 | 104 | /** 105 | * TabBarItem 106 | */ 107 | List _renderTabBarItem(int currentIndex) { 108 | return [ 109 | BottomNavigationBarItem(icon: _getTabBarItemIcon(0, currentIndex),title: _getTabBarItemText(0, currentIndex)), 110 | BottomNavigationBarItem(icon: _getTabBarItemIcon(1, currentIndex),title: _getTabBarItemText(1, currentIndex)), 111 | BottomNavigationBarItem(icon: _getTabBarItemIcon(2, currentIndex),title: _getTabBarItemText(2, currentIndex)), 112 | BottomNavigationBarItem(icon: _getTabBarItemIcon(3, currentIndex),title: _getTabBarItemText(3, currentIndex)), 113 | ]; 114 | } 115 | 116 | /** 117 | * TabBar图标 118 | */ 119 | _getTabBarIcon(String path, Color color) { 120 | return Image.asset(path, width: 25.0, height: 25.0, color: color); 121 | } 122 | 123 | /** 124 | * TabBar图标 125 | */ 126 | Image _getTabBarItemIcon(index, currentIndex) { 127 | if(currentIndex == index) { 128 | return _getTabBarIcon(tabIcon[index][1], Theme.of(context).primaryColor); 129 | } 130 | return _getTabBarIcon(tabIcon[index][0], null); 131 | } 132 | 133 | /** 134 | * TabBar文字 135 | */ 136 | Text _getTabBarItemText(index, currentIndex) { 137 | return Text(tabTitle[index], style: TextStyle(color: index == currentIndex ? Theme.of(context).primaryColor : Color.fromARGB(255,192, 193, 195))); 138 | } 139 | 140 | @override 141 | void dispose() { 142 | // TODO: implement dispose 143 | super.dispose(); 144 | } 145 | } 146 | 147 | 148 | -------------------------------------------------------------------------------- /lib/pages/home/tab_pages.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * Tab界面 3 | */ 4 | export '../index/index_page.dart'; 5 | export '../popular/popular_page.dart'; 6 | export '../movie/movie_page.dart'; 7 | export '../mine/mine_page.dart'; -------------------------------------------------------------------------------- /lib/pages/index/index_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页 3 | * Create by Songlcy 2018-12-25 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import '../../models/state_model/home_state_model.dart'; 8 | 9 | import '../index/index_tab_page.dart'; 10 | import '../../common/status.dart'; 11 | import '../../components/loading_component.dart'; 12 | import '../../components/data_empty_component.dart'; 13 | import '../../components/tabbar_indictor_component.dart'; 14 | 15 | class IndexPage extends StatefulWidget { 16 | 17 | @override 18 | _IndexPageState createState() => _IndexPageState(); 19 | } 20 | 21 | class _IndexPageState extends State with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { 22 | 23 | TabController _tabController; 24 | HomeStateModel homeStateModel; 25 | 26 | _getIndexModel() { 27 | if(homeStateModel == null) { 28 | homeStateModel = HomeStateModel(); 29 | } 30 | return homeStateModel; 31 | } 32 | 33 | @override 34 | bool get wantKeepAlive => true; 35 | 36 | @override 37 | void initState() { 38 | super.initState(); 39 | _getIndexModel(); 40 | _initTabBarController(); 41 | } 42 | 43 | void _initTabBarController() async { 44 | await homeStateModel.fetchTabList(); 45 | _tabController = new TabController(vsync: this, length: homeStateModel.tabList.length); 46 | _tabController.animateTo(1); 47 | } 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | return ScopedModel( 52 | model: homeStateModel, 53 | child: ScopedModelDescendant( 54 | builder: (context, child, model) { 55 | return Scaffold( 56 | appBar: AppBar( 57 | centerTitle: true, 58 | title: Text("Vistor", style: TextStyle(fontFamily: 'Lobster')), 59 | ), 60 | body: _renderBody(model), 61 | ); 62 | }, 63 | ), 64 | ); 65 | } 66 | 67 | /** 68 | * 内容 69 | */ 70 | _renderBody(HomeStateModel model) { 71 | return model.status == Status.LOADING ? 72 | LoadingComponent() 73 | : 74 | model.status == Status.SUCCESS ? 75 | _renderTabView(model) 76 | : 77 | DataEmptyComponent(status: model.status); 78 | } 79 | 80 | /** 81 | * TabView 82 | */ 83 | _renderTabView(HomeStateModel model) { 84 | return Container( 85 | width: double.infinity, 86 | child: Column( 87 | children: [ 88 | _renderTabBar(model), 89 | _renderTabBarView(model) 90 | ], 91 | ), 92 | ); 93 | } 94 | 95 | /** 96 | * 顶部TabBar选项 97 | */ 98 | _renderTabBar(HomeStateModel model) { 99 | return Container( 100 | width: double.infinity, 101 | height: 60.0, 102 | padding: EdgeInsets.symmetric(horizontal: 8.0), 103 | child: Row( 104 | children: [ 105 | Expanded( 106 | child: TabBar( 107 | tabs: model.tabList.map((tab) => Tab(text: tab.name)).toList(), 108 | isScrollable: true, 109 | labelColor: Color.fromARGB(255, 51, 51, 51), 110 | unselectedLabelColor: Color.fromARGB(255,192, 193, 195), 111 | indicator: TabBarIndictorComponent(context: context,bgColor: Theme.of(context).primaryColor), 112 | controller: _tabController, 113 | ), 114 | ), 115 | ], 116 | ), 117 | ); 118 | } 119 | 120 | /** 121 | * TabBar视图 122 | */ 123 | _renderTabBarView(HomeStateModel model) { 124 | return Expanded( 125 | child: TabBarView( 126 | controller: _tabController, 127 | children: List.generate(model.tabList.length, (index) { 128 | return IndexTabPage(index: index, name: model.tabList[index].name , 129 | categoryId: model.tabList[index].id, stateModel: model); 130 | }).toList() 131 | // model.tabList.map((tab) => IndexTabPage(name: tab.name ,categoryId: tab.id, stateModel: model)).toList() 132 | ), 133 | ); 134 | } 135 | 136 | @override 137 | void dispose() { 138 | super.dispose(); 139 | _tabController.dispose(); 140 | } 141 | } 142 | 143 | 144 | -------------------------------------------------------------------------------- /lib/pages/index/index_tab_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 首页 Tab 界面 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 8 | 9 | 10 | import '../../route/routes.dart'; 11 | import '../../common/status.dart'; 12 | import '../../config/application.dart'; 13 | import '../../models/pood/video_model.dart'; 14 | import '../../components/empty_component.dart'; 15 | import '../../components/loading_component.dart'; 16 | import '../../components/data_empty_component.dart'; 17 | import '../../components/hero_image_component.dart'; 18 | import '../../models/pood/index_tab_page_model.dart'; 19 | import '../../models/state_model/home_state_model.dart'; 20 | 21 | class IndexTabPage extends StatefulWidget { 22 | 23 | final int index; 24 | final String name; 25 | final String categoryId; 26 | final HomeStateModel stateModel; 27 | 28 | const IndexTabPage({this.index, this.name, @required this.categoryId, @required this.stateModel}); 29 | 30 | @override 31 | _IndexTabPageState createState() => _IndexTabPageState(); 32 | } 33 | 34 | class _IndexTabPageState extends State { 35 | // with AutomaticKeepAliveClientMixin { 36 | 37 | @override 38 | void initState() { 39 | super.initState(); 40 | widget.stateModel.fetchIndexVideoList(widget.categoryId); 41 | } 42 | 43 | // @override 44 | // bool get wantKeepAlive => true; 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | return ScopedModelDescendant( 49 | builder: (context, child, model) { 50 | return _renderBody(model); 51 | }, 52 | ); 53 | } 54 | 55 | /** 56 | * 内容 57 | */ 58 | _renderBody(HomeStateModel model) { 59 | return model.status == Status.LOADING 60 | ? LoadingComponent() 61 | : model.status == Status.SUCCESS 62 | ? _renderListView(model.hotMap[widget.categoryId]) 63 | : DataEmptyComponent(status: model.status); 64 | } 65 | 66 | _renderListView(List list) { 67 | if(list != null) { 68 | return StaggeredGridView.countBuilder( 69 | crossAxisCount: 4, 70 | itemCount: list.length, 71 | itemBuilder: (BuildContext context, int index) => 72 | _ItemComponent(itemData: list[index]), 73 | staggeredTileBuilder: (int index) { 74 | return StaggeredTile.count(2, 2.6); 75 | }, // 列宽 和 高 76 | mainAxisSpacing: 4.0, 77 | crossAxisSpacing: 4.0, 78 | physics: BouncingScrollPhysics(), 79 | padding: EdgeInsets.only( 80 | top: 4.0, 81 | bottom: 4.0, 82 | ), 83 | ); 84 | } 85 | return EmptyComponent(); 86 | } 87 | } 88 | 89 | class _ItemComponent extends StatelessWidget { 90 | 91 | final Hot itemData; 92 | const _ItemComponent({this.itemData}); 93 | 94 | @override 95 | Widget build(BuildContext context) { 96 | 97 | return Stack( 98 | children: [ 99 | // fill 默认都为 0 100 | Positioned.fill( 101 | child: HeroImageComponent(imageItem: VideoModel( 102 | id:itemData.id, 103 | thumbnail: itemData.thumbnail, 104 | generatedAt: itemData.generatedAt, 105 | latest: itemData.latest 106 | ))), 107 | // 集数 108 | Positioned( 109 | top: 0.0, 110 | left: 0.0, 111 | child: Container( 112 | height: 20.0, 113 | padding: EdgeInsets.symmetric(horizontal: 5.0), 114 | color: Color.fromRGBO(0, 0, 0, 0.5), 115 | child: Center( 116 | child: Text( 117 | itemData.latest, 118 | style: TextStyle( 119 | color: Colors.white, 120 | fontSize: 10.0 121 | ), 122 | ), 123 | ), 124 | ), 125 | ), 126 | // 名称 127 | Positioned( 128 | left: 0.0, 129 | right: 0.0, 130 | bottom: 0.0, 131 | child: Container( 132 | height: 26.0, 133 | padding: EdgeInsets.symmetric(horizontal: 5.0), 134 | color: Color.fromRGBO(0, 0, 0, 0.5), 135 | child: Center( 136 | child: Text( 137 | itemData.name, 138 | overflow: TextOverflow.ellipsis, 139 | maxLines: 1, 140 | style: TextStyle( 141 | color: Colors.white, 142 | fontSize: 13.0 143 | ), 144 | ), 145 | ) 146 | ), 147 | ), 148 | Positioned.fill( 149 | child: MaterialButton( 150 | onPressed: () { 151 | // 跳转视频详情 152 | Hot video = itemData; 153 | Application.navigateTo( 154 | context: context, 155 | route: "${Routes.videoDetail}?name=${Uri.encodeComponent(video.name)}&thumbnail=${Uri.encodeComponent(video.thumbnail)}×tamp=${null}&id=${video.id}&latest=${Uri.encodeComponent(video.latest)}&generatedAt=${video.generatedAt}" 156 | ); 157 | }, 158 | ) 159 | ) 160 | ], 161 | ); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /lib/pages/mine/mine_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 我的界面 3 | * Create by Songlcy 4 | */ 5 | import 'dart:core'; 6 | import 'package:flutter/material.dart'; 7 | import '../../config/application.dart'; 8 | import '../../route/routes.dart'; 9 | import '../../common/api.dart'; 10 | 11 | class MinePage extends StatefulWidget { 12 | @override 13 | _MinePageState createState() => _MinePageState(); 14 | } 15 | 16 | class _MinePageState extends State with AutomaticKeepAliveClientMixin { 17 | 18 | @override 19 | bool get wantKeepAlive => true; 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Scaffold( 24 | appBar: AppBar( 25 | elevation: 0.0, 26 | centerTitle: true, 27 | title: Text("Mine", style: TextStyle(fontFamily: "Lobster")), 28 | ), 29 | body: ListView( 30 | children: [ 31 | const _HeaderComponent(), 32 | const _OptionListItemComponent(), 33 | Container( 34 | margin: EdgeInsets.fromLTRB(10, 20, 10, 10), 35 | child: MaterialButton( 36 | height: 50.0, 37 | color: Theme.of(context).primaryColor, 38 | minWidth: MediaQuery.of(context).size.width - 20.0, 39 | child: Text("退出登录", style: TextStyle(color: Colors.white)), 40 | onPressed: (){ 41 | 42 | }, 43 | ), 44 | ), 45 | ], 46 | ), 47 | ); 48 | } 49 | } 50 | 51 | class _HeaderComponent extends StatelessWidget { 52 | const _HeaderComponent(); 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | return Container( 57 | height: 160.0, 58 | color: Theme.of(context).primaryColor, 59 | child: Center( 60 | child: Column( 61 | mainAxisAlignment: MainAxisAlignment.center, 62 | children: [ 63 | CircleAvatar( 64 | radius: 40.0, 65 | child: Image.asset("assets/images/icon_default_avatar.png", 66 | width: 80.0, height: 80.0, fit: BoxFit.cover)), 67 | SizedBox( 68 | height: 10, 69 | ), 70 | InkWell( 71 | child: Text("请登录", style: TextStyle(color: Colors.white)), 72 | ) 73 | ], 74 | ), 75 | )); 76 | } 77 | } 78 | 79 | class _OptionListItemComponent extends StatelessWidget { 80 | 81 | const _OptionListItemComponent(); 82 | 83 | _navigate(BuildContext context, String route) { 84 | Application.navigateTo(context: context, route: route); 85 | } 86 | 87 | @override 88 | Widget build(BuildContext context) { 89 | Color themeColor = Theme.of(context).primaryColor; 90 | return Column( 91 | children: [ 92 | ListTile( 93 | title: Text("更换主题"), 94 | leading: Icon(Icons.sentiment_satisfied, color: themeColor), 95 | trailing: Icon(Icons.chevron_right, color: themeColor), 96 | onTap: () => _navigate(context, "${Routes.themeList}"), 97 | ), 98 | Divider(), 99 | ListTile( 100 | title: Text("我的博客"), 101 | leading: Icon(Icons.book, color: themeColor), 102 | trailing: Icon(Icons.chevron_right, color: themeColor), 103 | onTap: () => _navigate(context, "${Routes.webview}?title=${Uri.encodeComponent('我的博客')}&url=${Uri.encodeComponent(WEBSITE_URL)}"), 104 | ), 105 | Divider(), 106 | ListTile( 107 | title: Text("我的Github"), 108 | leading: Icon(Icons.web, color: themeColor), 109 | trailing: Icon(Icons.chevron_right, color: themeColor), 110 | onTap: () => _navigate(context, "${Routes.webview}?title=${Uri.encodeComponent('我的Github')}&url=${Uri.encodeComponent(GITHUB_URL)}"), 111 | ), 112 | ], 113 | ); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /lib/pages/movie/movie_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 电影 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 8 | 9 | import '../../route/routes.dart'; 10 | import '../../config/application.dart'; 11 | import '../../models/pood/video_model.dart'; 12 | import '../../components/empty_component.dart'; 13 | import '../../components/hero_image_component.dart'; 14 | import '../../components/filter_bar_component.dart'; 15 | import '../../components/list_bottom_indicator.dart'; 16 | import '../../models/state_model/filter_state_model.dart'; 17 | 18 | 19 | class MoviePage extends StatefulWidget { 20 | @override 21 | _MoviePageState createState() => _MoviePageState(); 22 | } 23 | 24 | class _MoviePageState extends State { 25 | FilterStateModel _filterBarStateModel; 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | FilterBarIndexState _filterBarIndexState = FilterBarIndexState(); 31 | _filterBarStateModel = FilterStateModel(_filterBarIndexState); 32 | _filterBarStateModel.init(); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return ScopedModel( 38 | model: _filterBarStateModel, 39 | child: Scaffold( 40 | appBar: AppBar( 41 | centerTitle: true, 42 | title: Text("Movie", style: TextStyle(fontFamily: 'Lobster')), 43 | actions: [ 44 | IconButton( 45 | tooltip: "过滤", 46 | icon: Icon(Icons.sort), 47 | onPressed: () { 48 | // 打开排序列表 49 | _filterBarStateModel.toggleOpenStatus(); 50 | }, 51 | ) 52 | ], 53 | ), 54 | body: _MovieListComponent(_filterBarStateModel), 55 | )); 56 | } 57 | } 58 | 59 | class _MovieListComponent extends StatefulWidget { 60 | FilterStateModel _filterBarStateModel; 61 | _MovieListComponent(this._filterBarStateModel); 62 | 63 | @override 64 | State createState() => _MovieListComponentState(); 65 | } 66 | 67 | class _MovieListComponentState extends State<_MovieListComponent> with AutomaticKeepAliveClientMixin { 68 | 69 | Map _filterParams; 70 | ScrollController _scrollController; 71 | final String MOVIE_ID = "5b1362ab30763a214430d036"; 72 | final GlobalKey _refreshIndicatorKey = 73 | GlobalKey(); 74 | 75 | @override 76 | bool get wantKeepAlive => true; 77 | 78 | @override 79 | void initState() { 80 | super.initState(); 81 | initData(); 82 | initListener(); 83 | widget._filterBarStateModel.fetchMovieList(MOVIE_ID, _filterParams); 84 | } 85 | 86 | /** 87 | * 初始化数据 88 | */ 89 | initData() { 90 | _filterParams = { 91 | "year": "", 92 | "area": "", 93 | "sort": "2", 94 | "query": "2", 95 | "source": "", 96 | }; 97 | } 98 | 99 | /** 100 | * 设置事件监听 101 | */ 102 | initListener() { 103 | _scrollController = ScrollController(); 104 | _scrollController.addListener(() { 105 | if (widget._filterBarStateModel.isOpen) { 106 | // 滑动状态中,关闭过滤菜单 107 | widget._filterBarStateModel.toggleOpenStatus(); 108 | } 109 | if (_scrollController.position.pixels == 110 | _scrollController.position.maxScrollExtent) { 111 | // 列表滑到最底部,加载更多 112 | _onListLoadMore(); 113 | } 114 | }); 115 | } 116 | 117 | /** 118 | * 过滤选择回调 119 | */ 120 | _onItemSelectCallback(params) { 121 | _filterParams[params["key"]] = params["value"]; 122 | _refreshIndicatorKey.currentState.show(); 123 | _scrollController.jumpTo(0.0); 124 | } 125 | 126 | /** 127 | * 刷新 128 | */ 129 | Future _onListRefresh() async { 130 | await FilterStateModel.of(context).refreshMovieList(MOVIE_ID, _filterParams); 131 | } 132 | 133 | /** 134 | * 加载更多 135 | */ 136 | _onListLoadMore() { 137 | FilterStateModel.of(context).loadMoreMovieList(MOVIE_ID, _filterParams); 138 | } 139 | 140 | @override 141 | Widget build(BuildContext context) { 142 | return RefreshIndicator( 143 | key: _refreshIndicatorKey, 144 | color: Theme.of(context).primaryColor, 145 | onRefresh: () => _onListRefresh(), 146 | child: Column( 147 | children: [ 148 | FilterBarComponent( 149 | itemNums: FilterStateModel.of(context).itemList.length, 150 | onItemSelectCallback: (params) => 151 | _onItemSelectCallback(params)), 152 | Expanded( 153 | child: ScopedModelDescendant( 154 | builder: (context, child, model) { 155 | return model.movieList != null ? 156 | StaggeredGridView.countBuilder( 157 | shrinkWrap: false, 158 | controller: _scrollController, 159 | crossAxisCount: 4, 160 | itemCount: model.movieList.length + 1, 161 | itemBuilder: (BuildContext context, int index) => 162 | _buildMovieListItem(model, index), 163 | staggeredTileBuilder: (int index) { 164 | if (index == model.movieList.length) { 165 | return StaggeredTile.count(4, 0.7); 166 | } 167 | return StaggeredTile.count(2, 2.6); 168 | }, 169 | mainAxisSpacing: 4.0, 170 | crossAxisSpacing: 4.0, 171 | physics: BouncingScrollPhysics(), 172 | padding: EdgeInsets.only( 173 | top: 4.0, 174 | bottom: 4.0, 175 | ), 176 | ): 177 | EmptyComponent(); 178 | } 179 | ) 180 | ) 181 | ], 182 | )); 183 | } 184 | 185 | /** 186 | * 列表项 187 | */ 188 | _buildMovieListItem(FilterStateModel model, int index) { 189 | if (model.movieList != null && index == model.movieList.length) { 190 | // 最后一项 191 | return ListBottomIndicator( 192 | status: model.status, 193 | onPressCallback: ()=> this.onPressCallback(model), 194 | ); 195 | } 196 | return Stack( 197 | children: [ 198 | // fill 默认都为 0 199 | Positioned.fill( 200 | child: HeroImageComponent(imageItem: model.movieList[index]) 201 | ), 202 | // 集数 203 | Positioned( 204 | top: 0.0, 205 | left: 0.0, 206 | child: Container( 207 | height: 20.0, 208 | padding: EdgeInsets.symmetric(horizontal: 5.0), 209 | color: Color.fromRGBO(0, 0, 0, 0.5), 210 | child: Center( 211 | child: Text( 212 | model.movieList[index].latest, 213 | style: TextStyle( 214 | color: Colors.white, 215 | fontSize: 10.0 216 | ), 217 | ), 218 | ), 219 | ), 220 | ), 221 | // 名称 222 | Positioned( 223 | left: 0.0, 224 | right: 0.0, 225 | bottom: 0.0, 226 | child: Container( 227 | height: 26.0, 228 | padding: EdgeInsets.symmetric(horizontal: 5.0), 229 | color: Color.fromRGBO(0, 0, 0, 0.5), 230 | child: Center( 231 | child: Text( 232 | model.movieList[index].name, 233 | overflow: TextOverflow.ellipsis, 234 | maxLines: 1, 235 | style: TextStyle( 236 | color: Colors.white, 237 | fontSize: 13.0 238 | ), 239 | ), 240 | ) 241 | ), 242 | ), 243 | Positioned.fill( 244 | child: MaterialButton( 245 | onPressed: () { 246 | // 跳转视频详情 247 | VideoModel video = model.movieList[index]; 248 | Application.navigateTo( 249 | context: context, 250 | route: "${Routes.videoDetail}?name=${Uri.encodeComponent(video.name)}&thumbnail=${Uri.encodeComponent(video.thumbnail)}×tamp=${video.timestamp}&id=${video.id}&latest=${Uri.encodeComponent(video.latest)}&generatedAt=${video.generatedAt}" 251 | ); 252 | }, 253 | ) 254 | ) 255 | ], 256 | ); 257 | } 258 | 259 | /** 260 | * 列表最后一项显示 261 | */ 262 | onPressCallback(FilterStateModel model) { 263 | if (model.movieList.length == 0) { 264 | // 刷新 265 | _onListRefresh(); 266 | } else { 267 | // 继续加载下一页 268 | _onListLoadMore(); 269 | } 270 | } 271 | } 272 | -------------------------------------------------------------------------------- /lib/pages/popular/popular_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 精选 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | 7 | import './popular_tab_page.dart'; 8 | import '../../components/tabbar_indictor_component.dart'; 9 | 10 | class PopularPage extends StatefulWidget { 11 | 12 | @override 13 | _PopularPageState createState() => _PopularPageState(); 14 | } 15 | 16 | class _PopularPageState extends State with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { 17 | 18 | TabController _tabController; 19 | final List _tabBarList = [ 20 | {"id": "5b1fdbee30025ae5371ac363", "name": "动漫"}, 21 | {"id": "5b1fd85730025ae5371abaed", "name": "综艺"} 22 | ]; 23 | 24 | @override 25 | bool get wantKeepAlive => true; 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | _tabController = TabController(vsync: this, length: 2); 31 | } 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return NestedScrollView( 36 | headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { 37 | return [ 38 | SliverAppBar( 39 | floating: true, 40 | pinned: true, 41 | // snap: true, 42 | centerTitle: true, 43 | title: Text("Popular", style: TextStyle(fontFamily: "Lobster")), 44 | backgroundColor: Theme.of(context).primaryColor, 45 | bottom: PreferredSize( 46 | preferredSize: Size(double.infinity, 36.0), 47 | child: Container( 48 | height: 36.0, 49 | child: TabBar( 50 | controller: _tabController, 51 | labelColor: Colors.white, 52 | unselectedLabelColor: Color.fromARGB(255,192, 193, 195), 53 | indicator: TabBarIndictorComponent(context: context), 54 | tabs: [ 55 | Tab(text: "动漫"), 56 | Tab(text: "综艺") 57 | ], 58 | ), 59 | ), 60 | ), 61 | ) 62 | ]; 63 | }, 64 | body: TabBarView( 65 | controller: _tabController, 66 | children:_tabBarList.map((item) => PopularTabPage(id: item["id"])).toList() 67 | ), 68 | ); 69 | } 70 | } -------------------------------------------------------------------------------- /lib/pages/popular/popular_tab_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 精选 Tab 详情页 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 8 | 9 | import '../../route/routes.dart'; 10 | import '../../config/application.dart'; 11 | import '../../models/pood/video_model.dart'; 12 | import '../../components/empty_component.dart'; 13 | import '../../components/hero_image_component.dart'; 14 | import '../../components/list_bottom_indicator.dart'; 15 | import '../../models/state_model/popular_state_model.dart'; 16 | 17 | class PopularTabPage extends StatefulWidget { 18 | 19 | String id; 20 | PopularTabPage({@required this.id}); 21 | 22 | @override 23 | State createState() => _PopularTabPageState(); 24 | } 25 | 26 | class _PopularTabPageState extends State with AutomaticKeepAliveClientMixin { 27 | 28 | PopularStateModel _popularStateModel; 29 | final GlobalKey _refreshIndicatorKey = 30 | GlobalKey(); 31 | 32 | // final NotificationListenerCallback onScrollNotification; 33 | 34 | @override 35 | bool get wantKeepAlive => true; 36 | 37 | @override 38 | void initState() { 39 | super.initState(); 40 | initData(); 41 | _popularStateModel.fetchListData(widget.id); 42 | } 43 | 44 | initData() { 45 | _popularStateModel = PopularStateModel(); 46 | } 47 | 48 | /** 49 | * 刷新 50 | */ 51 | Future _onListRefresh(BuildContext context) async { 52 | await _popularStateModel.fetchListData(widget.id); 53 | } 54 | 55 | /** 56 | * 加载更多 57 | */ 58 | Future _onListLoadMore() async { 59 | await _popularStateModel.loadMoreListData(widget.id); 60 | } 61 | 62 | @override 63 | Widget build(BuildContext context) { 64 | return ScopedModel( 65 | model: _popularStateModel, 66 | child: RefreshIndicator( 67 | key: _refreshIndicatorKey, 68 | color: Theme.of(context).primaryColor, 69 | onRefresh: () => _onListRefresh(context), 70 | child: ScopedModelDescendant( 71 | builder: (context, child, model) { 72 | return model.listData != null ? 73 | NotificationListener( 74 | onNotification: _handleScrollNotification, 75 | child: CustomScrollView( 76 | shrinkWrap: false, 77 | // controller: _scrollController, 78 | physics: BouncingScrollPhysics(), 79 | slivers: [ 80 | SliverStaggeredGrid.countBuilder( 81 | crossAxisCount: 4, 82 | itemCount: model.listData.length + 1, 83 | itemBuilder: (BuildContext context, int index) => 84 | _buildListItem(context, model, index), 85 | staggeredTileBuilder: (int index) { 86 | if (index == model.listData.length) { 87 | return StaggeredTile.count(4, 0.7); 88 | } 89 | return StaggeredTile.count(2, 2.6); 90 | }, 91 | mainAxisSpacing: 4.0, 92 | crossAxisSpacing: 4.0, 93 | ) 94 | ], 95 | ), 96 | ) 97 | : 98 | EmptyComponent(); 99 | }, 100 | ), 101 | ) 102 | ); 103 | } 104 | 105 | bool _handleScrollNotification(ScrollNotification notification) { 106 | // if (onScrollNotification != null) onScrollNotification(notification); 107 | 108 | if (notification.depth != 0) return false; 109 | 110 | // reach the pixels to loading more 111 | if (notification.metrics.axisDirection == AxisDirection.down && 112 | notification.metrics.pixels == notification.metrics.maxScrollExtent) { 113 | _onListLoadMore(); 114 | } 115 | return false; 116 | } 117 | 118 | /** 119 | * 列表项 120 | */ 121 | _buildListItem(BuildContext context, PopularStateModel model, int index) { 122 | if (model.listData != null && index == model.listData.length) { 123 | return ListBottomIndicator( 124 | status: model.status, 125 | onPressCallback: ()=> this.onPressCallback(model) 126 | ); 127 | } 128 | return Stack( 129 | children: [ 130 | // fill 默认都为 0 131 | Positioned.fill( 132 | child: HeroImageComponent(imageItem: model.listData[index]) 133 | ), 134 | // 集数 135 | Positioned( 136 | top: 0.0, 137 | left: 0.0, 138 | child: Container( 139 | height: 20.0, 140 | padding: EdgeInsets.symmetric(horizontal: 5.0), 141 | color: Color.fromRGBO(0, 0, 0, 0.5), 142 | child: Center( 143 | child: Text( 144 | model.listData[index].latest, 145 | style: TextStyle( 146 | color: Colors.white, 147 | fontSize: 10.0 148 | ), 149 | ), 150 | ), 151 | ), 152 | ), 153 | // 名称 154 | Positioned( 155 | left: 0.0, 156 | right: 0.0, 157 | bottom: 0.0, 158 | child: Container( 159 | height: 26.0, 160 | padding: EdgeInsets.symmetric(horizontal: 5.0), 161 | color: Color.fromRGBO(0, 0, 0, 0.5), 162 | child: Center( 163 | child: Text( 164 | model.listData[index].name, 165 | overflow: TextOverflow.ellipsis, 166 | maxLines: 1, 167 | style: TextStyle( 168 | color: Colors.white, 169 | fontSize: 13.0 170 | ), 171 | ), 172 | ) 173 | ), 174 | ), 175 | Positioned.fill( 176 | child: MaterialButton( 177 | onPressed: () { 178 | // 跳转视频详情 179 | VideoModel video = model.listData[index]; 180 | Application.navigateTo( 181 | context: context, 182 | route: "${Routes.videoDetail}?name=${Uri.encodeComponent(video.name)}&thumbnail=${Uri.encodeComponent(video.thumbnail)}×tamp=${video.timestamp}&id=${video.id}&latest=${Uri.encodeComponent(video.latest)}&generatedAt=${video.generatedAt}" 183 | ); 184 | }, 185 | ) 186 | ) 187 | ], 188 | ); 189 | } 190 | 191 | /** 192 | * 列表底部回调 193 | */ 194 | onPressCallback(PopularStateModel model) { 195 | if (model.listData.length == 0) { 196 | // 刷新 197 | _onListRefresh(context); 198 | } else { 199 | // 继续加载下一页 200 | _onListLoadMore(); 201 | } 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /lib/pages/theme/theme_list_page.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 主题列表 3 | * Create by Songlcy 4 | */ 5 | import 'package:flutter/material.dart'; 6 | import 'package:scoped_model/scoped_model.dart'; 7 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 8 | 9 | import '../../constants/theme.dart'; 10 | import '../../components/empty_component.dart'; 11 | import '../../models/state_model/main_state_model.dart'; 12 | 13 | class ThemeListPage extends StatefulWidget { 14 | @override 15 | State createState() => _ThemeListPageState(); 16 | } 17 | 18 | class _ThemeListPageState extends State { 19 | int themeIndex; 20 | _getDefaultTheme(BuildContext context) async { 21 | themeIndex = await ScopedModel.of(context).getTheme(); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | _getDefaultTheme(context); 27 | return Scaffold( 28 | appBar: AppBar( 29 | centerTitle: true, 30 | title: Text("更换主题"), 31 | ), 32 | body: _ThemeListBodyComponent(), 33 | ); 34 | } 35 | } 36 | 37 | class _ThemeListBodyComponent extends StatelessWidget { 38 | @override 39 | Widget build(BuildContext context) { 40 | return StaggeredGridView.countBuilder( 41 | crossAxisCount: 2, 42 | itemCount: themeList.length, 43 | itemBuilder: (BuildContext context, int index) => _renderThemeItem(index), 44 | staggeredTileBuilder: (int index) => new StaggeredTile.count(1, 0.5), 45 | mainAxisSpacing: 10.0, 46 | crossAxisSpacing: 10.0, 47 | padding: EdgeInsets.all(10.0), 48 | physics: BouncingScrollPhysics(), 49 | ); 50 | } 51 | 52 | _renderThemeItem(int index) { 53 | return ScopedModelDescendant( 54 | builder: (context, child, model) { 55 | return MaterialButton( 56 | color: themeList[index], 57 | elevation: 0, 58 | onPressed: () => model.changeTheme(index), 59 | child: _renderButtonBody(model, index), 60 | ); 61 | }); 62 | } 63 | 64 | _renderButtonBody(MainStateModel model, index) { 65 | return model.themeIndex == index 66 | ? Center( 67 | child: Icon(Icons.check, color: Colors.white, size: 30.0), 68 | ) 69 | : EmptyComponent(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/route/route_handlers.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 路由定义 3 | * Create by Songlcy 4 | */ 5 | import 'package:fluro/fluro.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; 8 | 9 | import '../pages/theme/theme_list_page.dart'; 10 | import '../pages/detail/video_detail_page.dart'; 11 | import '../models/pood/video_model.dart'; 12 | 13 | var themeListRouteHandler = Handler( 14 | handlerFunc: (BuildContext context, Map> params) { 15 | return ThemeListPage(); 16 | } 17 | ); 18 | 19 | var videoDetailRouteHandler = Handler( 20 | handlerFunc: (BuildContext context, Map> params) { 21 | String id = params["id"]?.first; 22 | String timestamp = params["timestamp"]?.first; 23 | String thumbnail = params["thumbnail"]?.first; 24 | String name = params["name"]?.first; 25 | String latest = params["latest"]?.first; 26 | String generatedAt = params["generatedAt"]?.first; 27 | return VideoDetailPage( 28 | videoItem: VideoModel( 29 | id: id, 30 | generatedAt: generatedAt, 31 | name: name, 32 | latest: latest, 33 | thumbnail: thumbnail, 34 | timestamp: timestamp, 35 | ) 36 | ); 37 | } 38 | ); 39 | 40 | 41 | var webviewRouteHandler = Handler( 42 | handlerFunc: (BuildContext context, Map> params) { 43 | String title = params["title"]?.first; 44 | String url = params["url"]?.first; 45 | return WebviewScaffold( 46 | appBar: AppBar( 47 | centerTitle: true, 48 | title: Text(title), 49 | ), 50 | url: url, 51 | ); 52 | } 53 | ); -------------------------------------------------------------------------------- /lib/route/routes.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 路由配置 3 | * Create by Songlcy 4 | */ 5 | import 'package:fluro/fluro.dart'; 6 | import 'package:flutter/material.dart'; 7 | import './route_handlers.dart'; 8 | 9 | class Routes { 10 | static String root = "/"; 11 | static String webview = "/webview"; 12 | static String themeList = "/themeList"; 13 | static String videoDetail = "/videoDetail"; 14 | 15 | static void configureRoutes(Router router) { 16 | 17 | router.define(themeList, handler: themeListRouteHandler); 18 | router.define(webview, handler: webviewRouteHandler); 19 | router.define(videoDetail, handler: videoDetailRouteHandler); 20 | 21 | router.notFoundHandler = Handler( 22 | handlerFunc: (BuildContext context, Map> params) { 23 | print("ROUTE WAS NOT FOUND !!!"); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/utils/device_util.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 屏幕工具类 3 | * Create by Songlcy 4 | */ 5 | import 'dart:ui'; 6 | import 'package:flutter/material.dart'; 7 | 8 | class DeviceUtil { 9 | 10 | /** 11 | * window, 单位px 12 | */ 13 | final double SCREEN_WIDTH = window.physicalSize.width; 14 | final double SCREEN_HEIGHT = window.physicalSize.height; 15 | final double SCREEN_PIXEL_RATIO = window.devicePixelRatio; 16 | final double TEXT_SCALE_FACTOR = window.textScaleFactor; 17 | 18 | 19 | // ====== 以下为MediaQuery属性,单位dp ====== 20 | 21 | /** 22 | * 屏幕尺寸, 单位为dp 23 | */ 24 | static Size getScreenSize(BuildContext context) { 25 | return MediaQuery.of(context).size; 26 | } 27 | 28 | /** 29 | * 屏幕像素密度 30 | */ 31 | static double getDevicePixelRatio(BuildContext context) { 32 | return MediaQuery.of(context).devicePixelRatio; 33 | } 34 | 35 | /** 36 | * 获取上边距和下边距的值。(主要用于刘海屏) 37 | */ 38 | static double topPadding(BuildContext context) { 39 | return MediaQuery.of(context).padding.top; 40 | } 41 | 42 | static double bottomPadding(BuildContext context) { 43 | return MediaQuery.of(context).padding.bottom; 44 | } 45 | 46 | /** 47 | * 每个逻辑像素的字体像素数。 默认为1.0 48 | */ 49 | static double getTextScaleFactor (BuildContext context) { 50 | return MediaQuery.of(context).textScaleFactor; 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /lib/utils/http_util.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 网络请求 3 | * Create by Songlcy 4 | */ 5 | import 'package:dio/dio.dart'; 6 | 7 | Options options = Options( 8 | // 连接服务器超时时间(毫秒) 9 | // connectTimeout: 10000, 10 | // receiveTimeout: 30000, 11 | headers: { 12 | "Content-Type": "application/json", 13 | "Accept": "application/json", 14 | // "Authorization": "Bearer " + access_token 15 | } 16 | ); 17 | 18 | class HttpUtil { 19 | 20 | // get 21 | static Future get(String url, Map params) async { 22 | Response response = await Dio(options).get(url, data: params); 23 | return response; 24 | } 25 | 26 | // post 27 | static Future post(String url, Map params) async { 28 | Response response = await Dio(options).post(url, data: params); 29 | return response; 30 | } 31 | } -------------------------------------------------------------------------------- /lib/utils/time_util.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * Time工具类 3 | * Create by Songlcy 4 | */ 5 | import 'package:timeago/timeago.dart' as timeago; 6 | import './time_zh_message.dart'; 7 | 8 | class TimeUtil { 9 | 10 | static initLocaleLanguage() { 11 | timeago.setLocaleMessages("zh-cn", TimeZhCnMessages()); 12 | } 13 | 14 | static String getTimeago(DateTime time) { 15 | return timeago.format(time, locale: 'zh-cn');; 16 | } 17 | } -------------------------------------------------------------------------------- /lib/utils/time_zh_message.dart: -------------------------------------------------------------------------------- 1 | /** 2 | * 国际化 3 | */ 4 | import 'package:timeago/src/messages/lookupmessages.dart'; 5 | 6 | class TimeZhCnMessages implements LookupMessages { 7 | String prefixAgo() => ''; 8 | String prefixFromNow() => '刚刚'; 9 | String suffixAgo() => '前'; 10 | String suffixFromNow() => '后'; 11 | String lessThanOneMinute(int seconds) => '少于一分钟'; 12 | String aboutAMinute(int minutes) => '约1分钟前'; 13 | String minutes(int minutes) => '${minutes}分'; 14 | String aboutAnHour(int minutes) => '约1小时'; 15 | String hours(int hours) => '约${hours}小时'; 16 | String aDay(int hours) => '约1天'; 17 | String days(int days) => '约${days}日'; 18 | String aboutAMonth(int days) => '约1个月'; 19 | String months(int months) => '约${months}月'; 20 | String aboutAYear(int year) => '约1年'; 21 | String years(int years) => '约${years}年'; 22 | wordSeparator() => ''; 23 | } -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: openeye_flutter 2 | description: A new Flutter project. 3 | 4 | # 以下定义应用程序的版本和内部版本号。 5 | # 版本号是由点分隔的三个数字,如1.2.43 6 | # 后跟一个用+分隔的可选内部版本号。 7 | # 可以在flutter中覆盖版本号和构建器号 8 | # build通过分别指定--build-name和--build-number。 9 | # 在semver.org上阅读有关版本控制的更多信息。 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | dio: ^1.0.13 19 | fluro: ^1.4.0 20 | timeago: ^2.0.10 21 | scoped_model: ^1.0.1 22 | event_bus: ^1.0.1 23 | shimmer: ^0.0.6 24 | connectivity: ^0.3.2 25 | fluttertoast: ^2.2.11 26 | shared_preferences: ^0.4.3 27 | cached_network_image: ^0.5.1 28 | flutter_swiper: ^1.1.4 29 | flutter_spinkit: ^3.0.0 30 | flutter_staggered_grid_view: ^0.2.6 31 | flutter_webview_plugin: ^0.3.0+2 32 | video_player: 33 | git: 34 | url: https://github.com/songxiaoliang/flutter_video_player.git 35 | 36 | # 以下将Cupertino Icons字体添加到您的应用程序中。与CupertinoIcons类一起使用,用于iOS样式图标。 37 | cupertino_icons: ^0.1.2 38 | 39 | dev_dependencies: 40 | flutter_test: 41 | sdk: flutter 42 | 43 | 44 | # For information on the generic Dart part of this file, see the 45 | # following page: https://www.dartlang.org/tools/pub/pubspec 46 | 47 | # The following section is specific to Flutter. 48 | flutter: 49 | 50 | uses-material-design: true 51 | 52 | assets: 53 | - assets/images/icon_home_tab.png 54 | - assets/images/icon_home_tab_pressed.png 55 | - assets/images/icon_popular_tab.png 56 | - assets/images/icon_popular_tab_pressed.png 57 | - assets/images/icon_movie_tab.png 58 | - assets/images/icon_movie_tab_pressed.png 59 | - assets/images/icon_mine_tab.png 60 | - assets/images/icon_mine_tab_pressed.png 61 | - assets/images/icon_empty.webp 62 | - assets/images/icon_load_error.png 63 | - assets/images/icon_placeholder.png 64 | - assets/images/icon_default_avatar.png 65 | - assets/images/icon_videodetail_num.png 66 | - assets/images/icon_videodetail_jishu.png 67 | - assets/images/icon_videodetail_name.png 68 | - assets/images/icon_videodetail_playlist.png 69 | - assets/images/icon_videodetail_director.png 70 | - assets/images/icon_videodetail_starring.png 71 | - assets/images/icon_videodetail_desc.png 72 | 73 | # 图像资源可以引用一个或多个特定于分辨率的“变体”,请参阅 https://flutter.io/assets-and-images/#resolution-aware。 74 | 75 | # 有关从包依赖项添加资产的详细信息,请参阅 https://flutter.io/assets-and-images/#from-packages 76 | 77 | # 要在应用程序中添加自定义字体,请在此处添加字体部分, 78 | # 在这个“flutter”部分。 此列表中的每个条目都应该有一个 79 | # “family”键带有字体系列名称,而“fonts”键带有 80 | # list给出字体的资产和其他描述符。 对于 81 | # example: 82 | fonts: 83 | - family: Lobster 84 | fonts: 85 | - asset: assets/fonts/Lobster-1.4.otf 86 | # style: italic 87 | - family: FZLanTing 88 | fonts: 89 | - asset: assets/fonts/FZLanTingHeiS-DB1-GB-Regular.TTF 90 | # weight: 700 91 | # 92 | # 有关包依赖关系中字体的详细信息,参见https://flutter.io/custom-fonts/#from-packages 93 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:openeye_flutter/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(App(0)); 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 | --------------------------------------------------------------------------------