├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── .idea │ ├── .gitignore │ ├── compiler.xml │ ├── gradle.xml │ ├── jarRepositories.xml │ ├── misc.xml │ └── vcs.xml ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── moive1 │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── fonts │ ├── Urbanist-Bold.ttf │ ├── Urbanist-Light.ttf │ ├── Urbanist-Medium.ttf │ └── Urbanist-Regular.ttf └── images │ ├── bc-videologo.png │ ├── home-unselected.svg │ ├── home.svg │ ├── ic-search.svg │ ├── ic-star.svg │ ├── ic-time.svg │ ├── ic_launcher.png │ ├── logo.svg │ ├── on-boarding.png │ ├── play-selected.svg │ ├── play-unselected.svg │ ├── play.svg │ └── user.svg ├── git.sh ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── l10n.yaml ├── lib ├── app │ ├── app.dart │ ├── app_bloc_observer.dart │ ├── auth_bloc │ │ ├── authentication_bloc.dart │ │ ├── authentication_event.dart │ │ └── authentication_state.dart │ └── config_bloc │ │ ├── config_bloc.dart │ │ ├── config_event.dart │ │ └── config_state.dart ├── bootstrap.dart ├── common │ ├── StringUtils.dart │ ├── colours.dart │ ├── global.dart │ ├── public.dart │ ├── screen.dart │ └── styles.dart ├── http │ ├── api │ │ └── apis.dart │ ├── api_response.dart │ ├── error_interceptor.dart │ ├── http.dart │ ├── http_exceptions.dart │ └── http_utils.dart ├── l10n │ ├── app_en.arb │ ├── app_ja.arb │ ├── app_ru.arb │ ├── app_zh.arb │ ├── l10n.dart │ ├── messages_all.dart │ ├── messages_all_locales.dart │ ├── messages_en.dart │ ├── messages_ja.dart │ ├── messages_ru.dart │ └── messages_zh.dart ├── main.dart ├── models │ ├── LaunchadsJson.dart │ ├── MainJson.dart │ ├── RecommendJson.dart │ ├── token.dart │ └── user.dart ├── pages │ ├── components │ │ ├── avatar.dart │ │ ├── cast_card.dart │ │ ├── movie_card_details.dart │ │ ├── review_card.dart │ │ ├── review_content.dart │ │ └── section_listview.dart │ ├── detail │ │ ├── bloc │ │ │ ├── detail_movie_bloc.dart │ │ │ ├── detail_movie_event.dart │ │ │ └── detail_movie_state.dart │ │ ├── components │ │ │ ├── circle_dot.dart │ │ │ ├── details_card.dart │ │ │ ├── image_with_shimmer.dart │ │ │ ├── movie_card_details.dart │ │ │ └── slider_card_image.dart │ │ ├── detail_page.dart │ │ └── widgets │ │ │ ├── similar_movies_list.dart │ │ │ └── videos_list.dart │ ├── explore │ │ ├── bloc │ │ │ ├── explore_bloc.dart │ │ │ ├── explore_event.dart │ │ │ └── explore_state.dart │ │ ├── explore_page.dart │ │ ├── filter │ │ │ ├── filter_dialog.dart │ │ │ └── filter_view_model.dart │ │ └── widgets │ │ │ └── app_search_bar.dart │ ├── home │ │ ├── bloc │ │ │ ├── home_bloc.dart │ │ │ ├── home_event.dart │ │ │ └── home_state.dart │ │ ├── home_data.dart │ │ ├── home_page.dart │ │ ├── movies_see_all.dart │ │ ├── movies_see_category.dart │ │ ├── tabs │ │ │ ├── home_tab_newest.dart │ │ │ ├── home_tab_others.dart │ │ │ └── home_tab_recommend.dart │ │ └── widgets │ │ │ ├── avtor_movices.dart │ │ │ ├── banner_movices.dart │ │ │ ├── custom_slider.dart │ │ │ ├── link_movices.dart │ │ │ ├── muti_movices.dart │ │ │ ├── now_playing_movies.dart │ │ │ ├── popular_movies.dart │ │ │ ├── slider_card.dart │ │ │ ├── slider_card_image.dart │ │ │ ├── summary_movices.dart │ │ │ ├── top_rated_movies.dart │ │ │ └── upcoming_movies.dart │ ├── initialpages │ │ ├── bloc │ │ │ ├── register_bloc.dart │ │ │ ├── register_event.dart │ │ │ └── register_state.dart │ │ └── page │ │ │ ├── genres_selection_page.dart │ │ │ ├── onboardingpage.dart │ │ │ └── onboardingpage_controller.dart │ ├── login │ │ ├── logic.dart │ │ ├── state.dart │ │ └── view.dart │ ├── main │ │ └── main_page.dart │ ├── movies │ │ ├── bloc │ │ │ ├── movies_bloc.dart │ │ │ ├── movies_event.dart │ │ │ └── movies_state.dart │ │ ├── movies_page.dart │ │ └── widgets │ │ │ └── movies_grid_list.dart │ ├── mylist │ │ ├── bloc │ │ │ ├── my_list_bloc.dart │ │ │ ├── my_list_event.dart │ │ │ └── my_list_state.dart │ │ └── my_list_page.dart │ ├── profile │ │ └── profile_screen.dart │ ├── skeletonlib │ │ ├── shimmer.dart │ │ ├── skeleton.dart │ │ ├── stylings.dart │ │ ├── theme.dart │ │ └── widgets.dart │ ├── splash │ │ └── splash_screen.dart │ ├── user │ │ ├── logic.dart │ │ ├── state.dart │ │ └── view.dart │ ├── videoplayer │ │ ├── bloc │ │ │ ├── player_bloc.dart │ │ │ ├── player_event.dart │ │ │ └── player_state.dart │ │ └── player_page.dart │ └── widgets │ │ ├── empty_view.dart │ │ ├── error_view.dart │ │ ├── genre_item_widget.dart │ │ ├── movie_item_card.dart │ │ ├── no_connection_view.dart │ │ ├── progress_view.dart │ │ ├── skeletonLoading.dart │ │ └── video_item_card.dart ├── resources │ ├── app_colors.dart │ ├── app_constants.dart │ ├── app_router.dart │ ├── app_routes.dart │ ├── app_shape.dart │ ├── app_strings.dart │ ├── app_theme.dart │ ├── app_typography.dart │ └── app_values.dart └── utils │ ├── .gitkeep │ ├── encrypt_util.dart │ ├── message_util.dart │ ├── sliver_grid_delegate.dart │ ├── sp_util.dart │ ├── status.dart │ ├── strings.dart │ ├── typedef │ ├── enums.dart │ ├── function.dart │ └── functions.dart │ └── ui │ └── auto_ui.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon_1024.png │ │ ├── app_icon_128.png │ │ ├── app_icon_16.png │ │ ├── app_icon_256.png │ │ ├── app_icon_32.png │ │ ├── app_icon_512.png │ │ └── app_icon_64.png │ ├── Base.lproj │ └── MainMenu.xib │ ├── Configs │ ├── AppInfo.xcconfig │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── packages ├── movies_api │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── lib │ │ ├── movies_api.dart │ │ └── src │ │ │ ├── auth │ │ │ └── secret.dart │ │ │ ├── models │ │ │ ├── cast │ │ │ │ ├── cast.dart │ │ │ │ ├── cast_response.dart │ │ │ │ └── crew.dart │ │ │ ├── category │ │ │ │ └── category.dart │ │ │ ├── genre │ │ │ │ ├── genre.dart │ │ │ │ └── genres.dart │ │ │ ├── models.dart │ │ │ ├── movie_detail │ │ │ │ ├── belongs_to_collection.dart │ │ │ │ ├── genres_of_movie.dart │ │ │ │ ├── movie_detail_response.dart │ │ │ │ ├── production_companies.dart │ │ │ │ ├── production_countries.dart │ │ │ │ └── spoken_languages.dart │ │ │ ├── movies │ │ │ │ ├── dates.dart │ │ │ │ ├── movies_data.dart │ │ │ │ └── movies_response.dart │ │ │ ├── navi │ │ │ │ ├── navi_avtor.dart │ │ │ │ ├── navi_banner.dart │ │ │ │ ├── navi_link.dart │ │ │ │ ├── navi_mutisummary.dart │ │ │ │ ├── navi_newest.dart │ │ │ │ ├── navi_summary.dart │ │ │ │ └── navilist.dart │ │ │ └── videos │ │ │ │ ├── video_data.dart │ │ │ │ └── video_response.dart │ │ │ └── movies_api_interface │ │ │ └── movie_api.dart │ ├── pubspec.yaml │ └── test │ │ └── moies_api_test.dart ├── movies_data │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── lib │ │ ├── movies_data.dart │ │ └── src │ │ │ ├── api │ │ │ ├── favorites_storage_api_impl.dart │ │ │ ├── genres_storage_api_impl.dart │ │ │ ├── language_preferences.dart │ │ │ ├── movie_api_impl.dart │ │ │ └── theme_preferences.dart │ │ │ ├── log.dart │ │ │ ├── models │ │ │ ├── cast │ │ │ │ └── cast_item.dart │ │ │ ├── genre │ │ │ │ └── genre_item.dart │ │ │ ├── models.dart │ │ │ ├── movie_data │ │ │ │ └── movie_detail.dart │ │ │ ├── movie_item │ │ │ │ ├── movie_item.dart │ │ │ │ └── movies_list.dart │ │ │ ├── response_state.dart │ │ │ └── videos │ │ │ │ └── videos_item.dart │ │ │ └── repositories │ │ │ ├── auth_repository.dart │ │ │ ├── base_repository.dart │ │ │ ├── config_repository.dart │ │ │ ├── movies_repository.dart │ │ │ └── storage_repository.dart │ ├── pubspec.yaml │ └── test │ │ └── movies_data_test.dart └── storage_api │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── lib │ ├── src │ │ ├── favorites_storage_api.dart │ │ ├── genres_storage_api.dart │ │ └── models │ │ │ ├── genre_entity.dart │ │ │ └── movie_item_entity.dart │ └── storage_api.dart │ ├── pubspec.yaml │ └── test │ └── storage_api_test.dart ├── previewimsages ├── Snipaste_2023-04-07_14-10-52.png ├── Snipaste_2023-04-07_14-11-15.png ├── Snipaste_2023-04-08_08-43-21.png ├── Snipaste_2023-04-08_08-47-20.png ├── Snipaste_2023-04-08_08-49-25.png ├── Snipaste_2023-04-08_08-52-02.png ├── Snipaste_2023-04-08_09-04-57.png ├── Snipaste_2023-04-08_09-16-56.png ├── Snipaste_2023-04-08_09-17-39.png ├── Snipaste_2023-04-08_09-30-31.png ├── Snipaste_2023-04-08_09-41-37.png ├── android.png └── ios.png ├── pubspec.lock ├── pubspec.yaml ├── timefile ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /android/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /android/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /android/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/moive1/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.moive1 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/fonts/Urbanist-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/assets/fonts/Urbanist-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/Urbanist-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/assets/fonts/Urbanist-Light.ttf -------------------------------------------------------------------------------- /assets/fonts/Urbanist-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/assets/fonts/Urbanist-Medium.ttf -------------------------------------------------------------------------------- /assets/fonts/Urbanist-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/assets/fonts/Urbanist-Regular.ttf -------------------------------------------------------------------------------- /assets/images/bc-videologo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/assets/images/bc-videologo.png -------------------------------------------------------------------------------- /assets/images/ic-search.svg: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /assets/images/ic-star.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /assets/images/ic-time.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /assets/images/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/assets/images/ic_launcher.png -------------------------------------------------------------------------------- /assets/images/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /assets/images/on-boarding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/assets/images/on-boarding.png -------------------------------------------------------------------------------- /git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git add . 4 | date +%F > timefile 5 | currentTime=$( 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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/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/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 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | Moive1 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | moive1 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | LSRequiresIPhoneOS 28 | 29 | NSBonjourServices 30 | 31 | _dartobservatory._tcp 32 | 33 | UIApplicationSupportsIndirectInputEvents 34 | 35 | UILaunchStoryboardName 36 | LaunchScreen 37 | UIMainStoryboardFile 38 | Main 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeLeft 43 | UIInterfaceOrientationLandscapeRight 44 | 45 | UISupportedInterfaceOrientations~ipad 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationPortraitUpsideDown 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /l10n.yaml: -------------------------------------------------------------------------------- 1 | arb-dir: lib/l10n 2 | template-arb-file: app_en.arb 3 | output-localization-file: app_localizations.dart -------------------------------------------------------------------------------- /lib/app/app_bloc_observer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | import 'package:bloc/bloc.dart'; 3 | 4 | class AppBlocObserver extends BlocObserver { 5 | 6 | @override 7 | void onChange(BlocBase bloc, Change change) { 8 | super.onChange(bloc, change); 9 | log('onChange(${bloc.runtimeType}, $change)'); 10 | } 11 | 12 | @override 13 | void onError(BlocBase bloc, Object error, StackTrace stackTrace) { 14 | log('onError(${bloc.runtimeType}, $error, $stackTrace)'); 15 | super.onError(bloc, error, stackTrace); 16 | } 17 | } -------------------------------------------------------------------------------- /lib/app/auth_bloc/authentication_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:movies_data/movies_data.dart'; 5 | import 'package:equatable/equatable.dart'; 6 | 7 | 8 | part 'authentication_state.dart'; 9 | part 'authentication_event.dart'; 10 | 11 | class AuthenticationBloc 12 | extends Bloc { 13 | final AuthRepository _auThRepository; 14 | 15 | late StreamSubscription 16 | _authenticationStatusSubscription; 17 | 18 | AuthenticationBloc(AuthRepository authRepository) 19 | : _auThRepository = authRepository, 20 | super(const AuthenticationState.unknown()) { 21 | on<_AuthenticationStatusChanged>(_onAuthenticationStateChanged); 22 | on(_onAuthenticationLogoutRequested); 23 | 24 | _authenticationStatusSubscription = _auThRepository.status.listen( 25 | (status) => add(_AuthenticationStatusChanged(status)), 26 | ); 27 | } 28 | 29 | Future _onAuthenticationStateChanged( 30 | _AuthenticationStatusChanged event, 31 | Emitter emit, 32 | ) async { 33 | switch (event.status) { 34 | case AuthenticationStatus.unknown: 35 | return emit(const AuthenticationState.unknown()); 36 | case AuthenticationStatus.unauthenticated: 37 | return emit(const AuthenticationState.unauthenticated()); 38 | case AuthenticationStatus.authenticated: 39 | return emit(const AuthenticationState.authenticated()); 40 | } 41 | } 42 | 43 | void _onAuthenticationLogoutRequested( 44 | AuthenticationLogoutRequested event, 45 | Emitter emit, 46 | ) { 47 | _auThRepository.logout(); 48 | } 49 | 50 | @override 51 | Future close() { 52 | _authenticationStatusSubscription.cancel(); 53 | return super.close(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/app/auth_bloc/authentication_event.dart: -------------------------------------------------------------------------------- 1 | part of 'authentication_bloc.dart'; 2 | 3 | abstract class AuthenticationEvent { 4 | const AuthenticationEvent(); 5 | } 6 | 7 | class _AuthenticationStatusChanged extends AuthenticationEvent { 8 | final AuthenticationStatus status; 9 | const _AuthenticationStatusChanged(this.status); 10 | } 11 | 12 | class AuthenticationLogoutRequested extends AuthenticationEvent {} 13 | 14 | -------------------------------------------------------------------------------- /lib/app/auth_bloc/authentication_state.dart: -------------------------------------------------------------------------------- 1 | part of 'authentication_bloc.dart'; 2 | 3 | class AuthenticationState extends Equatable { 4 | 5 | const AuthenticationState._({ 6 | this.status = AuthenticationStatus.unknown 7 | }); 8 | 9 | final AuthenticationStatus status; 10 | 11 | const AuthenticationState.unknown() : this._(); 12 | 13 | const AuthenticationState.authenticated() 14 | : this._(status: AuthenticationStatus.authenticated); 15 | 16 | const AuthenticationState.unauthenticated() 17 | : this._(status: AuthenticationStatus.unauthenticated); 18 | 19 | @override 20 | List get props => [status]; 21 | } 22 | -------------------------------------------------------------------------------- /lib/app/config_bloc/config_bloc.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:bloc/bloc.dart'; 3 | import 'package:equatable/equatable.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:movies_data/movies_data.dart'; 6 | 7 | part 'config_event.dart'; 8 | 9 | part 'config_state.dart'; 10 | 11 | class ConfigBloc extends Bloc { 12 | final ConfigRepository configRepository; 13 | 14 | ConfigBloc(this.configRepository) : super(const ConfigState.initial()) { 15 | 16 | on((event, emit) { 17 | emit(state.copyWith( 18 | langCode: configRepository.appLang, 19 | darkTheme: configRepository.darkTheme)); 20 | }); 21 | 22 | on((event, emit) { 23 | if (event.langCode == null) return; 24 | configRepository.appLang = event.langCode!; 25 | emit(state.copyWith(langCode: event.langCode)); 26 | }); 27 | 28 | on((event, emit) { 29 | if (event.darkTheme == null) return; 30 | configRepository.darkTheme = event.darkTheme!; 31 | emit(state.copyWith(darkTheme: event.darkTheme)); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/app/config_bloc/config_event.dart: -------------------------------------------------------------------------------- 1 | part of 'config_bloc.dart'; 2 | 3 | @immutable 4 | abstract class ConfigEvent {} 5 | 6 | class GetInitialAppState extends ConfigEvent {} 7 | 8 | class ChangeLanguageEvent extends ConfigEvent { 9 | final String? langCode; 10 | 11 | ChangeLanguageEvent(this.langCode); 12 | } 13 | 14 | class ChangeThemeModeEvent extends ConfigEvent { 15 | final bool? darkTheme; 16 | 17 | ChangeThemeModeEvent(this.darkTheme); 18 | } 19 | -------------------------------------------------------------------------------- /lib/app/config_bloc/config_state.dart: -------------------------------------------------------------------------------- 1 | part of 'config_bloc.dart'; 2 | 3 | class ConfigState extends Equatable { 4 | final String langCode; 5 | final bool darkTheme; 6 | 7 | const ConfigState({required this.langCode, required this.darkTheme}); 8 | 9 | const ConfigState.initial({langCode = LANG_EN, darkTheme = true}) 10 | : this(langCode: langCode, darkTheme: darkTheme); 11 | 12 | ConfigState copyWith({String? langCode, bool? darkTheme}) { 13 | return ConfigState( 14 | langCode: langCode ?? this.langCode, 15 | darkTheme: darkTheme ?? this.darkTheme); 16 | } 17 | 18 | Map get languages => { 19 | 'English': langCode == LANG_EN, 20 | 'Russian': langCode == LANG_RU, 21 | '中文': langCode == LANG_ZH, 22 | }; 23 | 24 | String getLangCode(String lang) { 25 | switch (lang) { 26 | case 'English': 27 | return LANG_EN; 28 | case 'Russian': 29 | return LANG_RU; 30 | case '中文': 31 | return LANG_ZH; 32 | } 33 | return LANG_EN; 34 | } 35 | 36 | @override 37 | List get props => [langCode, darkTheme]; 38 | } 39 | -------------------------------------------------------------------------------- /lib/bootstrap.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_localizations/flutter_localizations.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:get/get_navigation/src/root/get_material_app.dart'; 5 | import 'package:hive/hive.dart'; 6 | import 'package:movie_app/app/app.dart'; 7 | import 'package:movie_app/common/global.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | 10 | void bootstrap({ 11 | required SharedPreferences sharedPref, 12 | required BoxCollection boxCollection, 13 | }) { 14 | // FlutterError.onError = (details) { 15 | // log(details.exceptionAsString(), stackTrace: details.stack); 16 | // }; 17 | // Bloc.observer = AppBlocObserver(); 18 | runApp(App(sharedPref: sharedPref, boxCollection: boxCollection)); 19 | // runApp( 20 | // const MyApp(), 21 | // ); 22 | // runZonedGuarded( 23 | // () => , 24 | // (error, stackTrace) => log(error.toString(), stackTrace: stackTrace), 25 | // ); 26 | } 27 | -------------------------------------------------------------------------------- /lib/common/StringUtils.dart: -------------------------------------------------------------------------------- 1 | class StringUtils { 2 | static bool isNullOrEmpty(String? str) { 3 | return str == null || str.isEmpty; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /lib/common/colours.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Colours { 4 | static const Color text_dark = Color(0xFF333333); 5 | static const Color text_normal = Color(0xFF666666); 6 | static const Color text_gray = Color(0xFF888888); 7 | 8 | static const Color gray_33 = Color(0xFF333333); 9 | static const Color gray_66 = Color(0xFF666666); 10 | static const Color gray_88 = Color(0xFF888888); 11 | static const Color gray_99 = Color(0xFF999999); 12 | static const Color gray_5A = Color(0xFF5A5A5A); 13 | 14 | static const Color blue_main = Color(0xFF1890FF); 15 | static const Color indexlabel_main = Color(0xFF757575); 16 | 17 | static const Color divider = Color(0xFFF6F6F6); 18 | static const Color divider2 = Color(0xFFD1D1D1); 19 | } 20 | -------------------------------------------------------------------------------- /lib/common/global.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class Global { 5 | static const baseUrl = 'https://api.dcgvc.com/'; 6 | 7 | static GlobalKey navigatorState = GlobalKey(); 8 | } 9 | -------------------------------------------------------------------------------- /lib/common/public.dart: -------------------------------------------------------------------------------- 1 | export 'dart:async'; 2 | export 'dart:convert'; 3 | export 'dart:io'; 4 | 5 | export '../utils/message_util.dart'; 6 | export 'package:flutter_screenutil/flutter_screenutil.dart'; 7 | export '../utils/sp_util.dart'; 8 | export '../http/api/apis.dart'; 9 | export '../http/http_utils.dart'; 10 | export './colours.dart'; 11 | export './styles.dart'; 12 | export 'global.dart'; 13 | export 'StringUtils.dart'; 14 | -------------------------------------------------------------------------------- /lib/common/screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'dart:ui' as ui show window; 4 | 5 | class Screen { 6 | static double get width { 7 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 8 | return mediaQuery.size.width; 9 | } 10 | 11 | static double get height { 12 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 13 | return mediaQuery.size.height; 14 | } 15 | 16 | static double get scale { 17 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 18 | return mediaQuery.devicePixelRatio; 19 | } 20 | 21 | static double get textScaleFactor { 22 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 23 | return mediaQuery.textScaleFactor; 24 | } 25 | 26 | static double get navigationBarHeight { 27 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 28 | return mediaQuery.padding.top + kToolbarHeight; 29 | } 30 | 31 | static double get topSafeHeight { 32 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 33 | if (mediaQuery.padding.top <= 0) { 34 | return 24.0; 35 | } 36 | return mediaQuery.padding.top; 37 | } 38 | 39 | static double get bottomSafeHeight { 40 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 41 | return mediaQuery.padding.bottom; 42 | } 43 | 44 | static bool get isHorizontal { 45 | MediaQueryData mediaQuery = MediaQueryData.fromWindow(ui.window); 46 | return mediaQuery.size.width > mediaQuery.size.height; 47 | } 48 | 49 | static updateStatusBarStyle(SystemUiOverlayStyle style) { 50 | SystemChrome.setSystemUIOverlayStyle(style); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/http/api/apis.dart: -------------------------------------------------------------------------------- 1 | /*后台接口api*/ 2 | import 'package:movie_app/common/public.dart'; 3 | 4 | class Apis { 5 | static String appid = "IPOSih2134KHJKLDIO"; 6 | static String token = 7 | "${Global.baseUrl}flutter/gettoken.php/?s=App.JYApp_Main.GetToken"; 8 | static String getLaunchAds = 9 | "${Global.baseUrl}flutter/gettoken.php/?s=App.JYApp_Main.GetLaunchAds"; 10 | static String getRecommandList = "${Global.baseUrl}flutter/recommand.php"; 11 | } 12 | -------------------------------------------------------------------------------- /lib/http/api_response.dart: -------------------------------------------------------------------------------- 1 | import 'http_exceptions.dart'; 2 | 3 | class ApiResponse implements Exception { 4 | Status status; 5 | T? data; 6 | DioHttpException? exception; 7 | 8 | /** 9 | * 成功 网络请求 10 | */ 11 | ApiResponse.completed(this.data) : status = Status.COMPLETED; 12 | 13 | /** 14 | * 错误 网络请求 15 | */ 16 | ApiResponse.error(this.exception) : status = Status.ERROR; 17 | 18 | @override 19 | String toString() { 20 | return "Status : $status \n Message : $exception \n Data : $data"; 21 | } 22 | } 23 | 24 | enum Status { COMPLETED, ERROR } 25 | -------------------------------------------------------------------------------- /lib/http/error_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'http_exceptions.dart'; 5 | 6 | /// 错误处理拦截器 7 | class ErrorInterceptor extends Interceptor { 8 | Duration durationTime = Duration(seconds: 2); 9 | 10 | @override 11 | onError(DioError err, ErrorInterceptorHandler handler) { 12 | // error统一处理 13 | DioHttpException appException = DioHttpException.create(err); 14 | // 错误提示 15 | print('DioError===: ${appException.toString()}'); 16 | err.error = appException; 17 | super.onError(err, handler); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/l10n/app_en.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale": "en", 3 | "welcomeText": "Welcome to Movina", 4 | "welcomeContent": "The best movie streaming app of the century to make your days great!", 5 | "getStarted": "Get Started", 6 | "topMovies": "Top Movies", 7 | "choseFavoriteGenre": "Choose your interests and get the best movie recommendations. Don\\'t worry, you can always change it later.", 8 | "skip": "Skip", 9 | "continui": "Continue", 10 | "seeAll": "See all", 11 | "popular": "Popular", 12 | "topRated": "Top rated movies", 13 | "home": "Home", 14 | "explore": "Explore", 15 | "myList": "My List", 16 | "profile": "Profile", 17 | "movies": "Movies", 18 | "tryAgain": "Try again", 19 | "errorMessage": "Something went wrong!", 20 | "emptyList": "Your List is Empty", 21 | "play": "Play", 22 | "releaseDate": "Release date: {date}", 23 | "nowPlaying": "Now Playing", 24 | "minutes": "{time} minutes", 25 | "imdb": "{rating} (IMDb)", 26 | "genre": "Genre", 27 | "videos": "Videos", 28 | "similarMovies": "Similar Movies", 29 | "search": "Search", 30 | "darkMode": "Dark Mode", 31 | "language": "Language", 32 | "changeLanguage": "Change language", 33 | "noConnection": "No Connection", 34 | "clickenter":"Enter", 35 | "retry":"retry", 36 | "testing":"testing", 37 | "tessssting":"测试", 38 | "daojishi": "Enter " 39 | 40 | 41 | } -------------------------------------------------------------------------------- /lib/l10n/app_ja.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale": "ja", 3 | "welcomeText": "欢迎来到 Movina", 4 | "welcomeContent": "本世纪最好的电影流媒体应用程序,让您的日子变得美好!", 5 | "getStarted": "开始", 6 | "topMovies": "热门电影", 7 | "choseFavoriteGenre": "选择您的兴趣并获得最佳电影推荐。别担心,您以后可以随时更改。", 8 | "skip": "跳过", 9 | "continui": "继续", 10 | "seeAll": "查看全部", 11 | "popular": "流行", 12 | "topRated": "评分最高的电影", 13 | "home": "主页", 14 | "explore": "探索", 15 | "myList": "关注列表", 16 | "profile": "个人资料", 17 | "movies": "发现电影", 18 | "tryAgain": "再试一次", 19 | "errorMessage": "出了点问题!", 20 | "emptyList": "你的列表是空的", 21 | "play": "播放", 22 | "releaseDate": "发布日期:{date}", 23 | "nowPlaying": "正在播放", 24 | "minutes": "{time} 分钟", 25 | "imdb": "{rating} (IMDb)", 26 | "genre": "流派", 27 | "videos": "视频", 28 | "similarMovies": "类似电影", 29 | "search": "搜索", 30 | "darkMode": "深色模式", 31 | "language": "语言", 32 | "changeLanguage": "更改语言", 33 | "noConnection": "无连接", 34 | "clickenter":"进入", 35 | "retry":"retry", 36 | "testing":"testing", 37 | "tessssting":"测试", 38 | "daojishi": "倒计时" 39 | } -------------------------------------------------------------------------------- /lib/l10n/app_ru.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale": "ru", 3 | "welcomeText": "Добро пожаловать в Movina", 4 | "welcomeContent": "Лучшее приложение века для потоковой передачи фильмов, которое сделает ваши дни прекрасными!", 5 | "getStarted": "Начать", 6 | "topMovies": "Лучшие фильмы", 7 | "choseFavoriteGenre": "Выберите свои интересы и получите лучшие рекомендации фильмов. Не волнуйтесь, вы всегда можете изменить его позже.", 8 | "skip": "Пропустить", 9 | "continui": "Продолжить", 10 | "seeAll": "Посмотреть", 11 | "popular": "Популярный", 12 | "topRated": "Самый топовые", 13 | "home": "Главный", 14 | "explore": "Исследовать", 15 | "myList": "Мой список", 16 | "profile": "Профиль", 17 | "movies": "Кино", 18 | "tryAgain": "Попробуйте еще раз", 19 | "errorMessage": "Что то пошло не так!", 20 | "emptyList": "Ваш список пуст", 21 | "play": "Играть", 22 | "releaseDate": "Дата выпуска: {date}", 23 | "nowPlaying": "Сейчас играет", 24 | "minutes": "{time} минуты", 25 | "imdb": "{rating} (IMDb)", 26 | "genre": "Жанр", 27 | "videos": "Видео", 28 | "similarMovies": "Похожие фильмы", 29 | "search": "Поиск", 30 | "darkMode": "Темный режим", 31 | "language": "Язык", 32 | "changeLanguage": "Изменить язык", 33 | "noConnection": "Нет соединения", 34 | "clickenter":"进入", 35 | "retry":"retry", 36 | "testing":"testing", 37 | "tessssting":"测试", 38 | "daojishi": "Time" 39 | } -------------------------------------------------------------------------------- /lib/l10n/app_zh.arb: -------------------------------------------------------------------------------- 1 | { 2 | "@@locale": "zh", 3 | "welcomeText": "欢迎来到 Movina", 4 | "welcomeContent": "本世纪最好的电影流媒体应用程序,让您的日子变得美好!", 5 | "getStarted": "开始", 6 | "topMovies": "热门电影", 7 | "choseFavoriteGenre": "选择您的兴趣并获得最佳电影推荐。别担心,您以后可以随时更改。", 8 | "skip": "跳过", 9 | "continui": "继续", 10 | "seeAll": "查看全部", 11 | "popular": "流行", 12 | "topRated": "评分最高的电影", 13 | "home": "主页", 14 | "explore": "探索", 15 | "myList": "关注列表", 16 | "profile": "个人资料", 17 | "movies": "电影", 18 | "tryAgain": "再试一次", 19 | "errorMessage": "出了点问题!", 20 | "emptyList": "你的列表是空的", 21 | "play": "播放", 22 | "releaseDate": "发布日期:{date}", 23 | "nowPlaying": "正在播放", 24 | "minutes": "{time} 分钟", 25 | "imdb": "{rating} (IMDb)", 26 | "genre": "流派", 27 | "videos": "视频", 28 | "similarMovies": "类似电影", 29 | "search": "搜索", 30 | "darkMode": "深色模式", 31 | "language": "语言", 32 | "changeLanguage": "更改语言", 33 | "noConnection": "无连接", 34 | "clickenter":"进入", 35 | "retry":"retry", 36 | "testing":"测试", 37 | "tessssting":"测试", 38 | "daojishi": "倒计时" 39 | } -------------------------------------------------------------------------------- /lib/l10n/l10n.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:flutter_gen/gen_l10n/app_localizations.dart'; 3 | 4 | export 'package:flutter_gen/gen_l10n/app_localizations.dart'; 5 | 6 | extension AppLocalizationsX on BuildContext { 7 | AppLocalizations get l10n => AppLocalizations.of(this)!; 8 | } -------------------------------------------------------------------------------- /lib/l10n/messages_all.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart 2 | // This is a library that looks up messages for specific locales by 3 | // delegating to the appropriate library. 4 | 5 | export 'messages_all_locales.dart' 6 | show initializeMessages; 7 | 8 | -------------------------------------------------------------------------------- /lib/l10n/messages_en.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart 2 | // This is a library that provides messages for a en locale. All the 3 | // messages from the main program should be duplicated here with the same 4 | // function name. 5 | 6 | // Ignore issues from commonly used lints in this file. 7 | // ignore_for_file:unnecessary_brace_in_string_interps 8 | // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering 9 | // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases 10 | // ignore_for_file:unused_import, file_names 11 | 12 | import 'package:intl/intl.dart'; 13 | import 'package:intl/message_lookup_by_library.dart'; 14 | 15 | final messages = MessageLookup(); 16 | 17 | typedef String? MessageIfAbsent( 18 | String? messageStr, List? args); 19 | 20 | class MessageLookup extends MessageLookupByLibrary { 21 | @override 22 | String get localeName => 'en'; 23 | 24 | @override 25 | final Map messages = _notInlinedMessages(_notInlinedMessages); 26 | 27 | static Map _notInlinedMessages(_) => { 28 | 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /lib/l10n/messages_ja.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart 2 | // This is a library that provides messages for a ja locale. All the 3 | // messages from the main program should be duplicated here with the same 4 | // function name. 5 | 6 | // Ignore issues from commonly used lints in this file. 7 | // ignore_for_file:unnecessary_brace_in_string_interps 8 | // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering 9 | // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases 10 | // ignore_for_file:unused_import, file_names 11 | 12 | import 'package:intl/intl.dart'; 13 | import 'package:intl/message_lookup_by_library.dart'; 14 | 15 | final messages = MessageLookup(); 16 | 17 | typedef String? MessageIfAbsent( 18 | String? messageStr, List? args); 19 | 20 | class MessageLookup extends MessageLookupByLibrary { 21 | @override 22 | String get localeName => 'ja'; 23 | 24 | @override 25 | final Map messages = _notInlinedMessages(_notInlinedMessages); 26 | 27 | static Map _notInlinedMessages(_) => { 28 | 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /lib/l10n/messages_ru.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart 2 | // This is a library that provides messages for a ru locale. All the 3 | // messages from the main program should be duplicated here with the same 4 | // function name. 5 | 6 | // Ignore issues from commonly used lints in this file. 7 | // ignore_for_file:unnecessary_brace_in_string_interps 8 | // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering 9 | // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases 10 | // ignore_for_file:unused_import, file_names 11 | 12 | import 'package:intl/intl.dart'; 13 | import 'package:intl/message_lookup_by_library.dart'; 14 | 15 | final messages = MessageLookup(); 16 | 17 | typedef String? MessageIfAbsent( 18 | String? messageStr, List? args); 19 | 20 | class MessageLookup extends MessageLookupByLibrary { 21 | @override 22 | String get localeName => 'ru'; 23 | 24 | @override 25 | final Map messages = _notInlinedMessages(_notInlinedMessages); 26 | 27 | static Map _notInlinedMessages(_) => { 28 | 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /lib/l10n/messages_zh.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart 2 | // This is a library that provides messages for a zh locale. All the 3 | // messages from the main program should be duplicated here with the same 4 | // function name. 5 | 6 | // Ignore issues from commonly used lints in this file. 7 | // ignore_for_file:unnecessary_brace_in_string_interps 8 | // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering 9 | // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases 10 | // ignore_for_file:unused_import, file_names 11 | 12 | import 'package:intl/intl.dart'; 13 | import 'package:intl/message_lookup_by_library.dart'; 14 | 15 | final messages = MessageLookup(); 16 | 17 | typedef String? MessageIfAbsent( 18 | String? messageStr, List? args); 19 | 20 | class MessageLookup extends MessageLookupByLibrary { 21 | @override 22 | String get localeName => 'zh'; 23 | 24 | @override 25 | final Map messages = _notInlinedMessages(_notInlinedMessages); 26 | 27 | static Map _notInlinedMessages(_) => { 28 | 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:hive/hive.dart'; 7 | import 'package:movie_app/bootstrap.dart'; 8 | import 'package:movie_app/common/global.dart'; 9 | import 'package:movie_app/http/http_utils.dart'; 10 | import 'package:path_provider/path_provider.dart'; 11 | import 'package:shared_preferences/shared_preferences.dart'; 12 | import 'package:flutter/foundation.dart' show kIsWeb; 13 | 14 | const databaseName = 'movies.db'; 15 | const collectionFavorites = 'favorites.box'; 16 | const collectionGenres = 'genres.box'; 17 | 18 | Future main() async { 19 | //Init Main URL 20 | HttpUtils.init( 21 | baseUrl: Global.baseUrl, 22 | ); 23 | 24 | WidgetsFlutterBinding.ensureInitialized(); 25 | 26 | final sharedPrefs = await SharedPreferences.getInstance(); 27 | Directory directory = Directory("/assets/db"); 28 | if (kIsWeb) { 29 | } else { 30 | final path = await getApplicationDocumentsDirectory(); 31 | directory = path; 32 | } 33 | 34 | final boxCollection = await BoxCollection.open( 35 | databaseName, 36 | {collectionFavorites, collectionGenres}, 37 | path: directory.path, 38 | ); 39 | 40 | bootstrap(sharedPref: sharedPrefs, boxCollection: boxCollection); 41 | } 42 | -------------------------------------------------------------------------------- /lib/models/LaunchadsJson.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | class LaunchadsJson { 4 | LaunchadsJson({ 5 | this.adimageurl, 6 | this.adimageclickurl, 7 | this.adtimes, 8 | this.show, 9 | }); 10 | 11 | String? adimageurl; 12 | String? adimageclickurl; 13 | int? adtimes; 14 | int? show; 15 | 16 | factory LaunchadsJson.fromJson(Map json) => LaunchadsJson( 17 | adimageurl: json["adimageurl"], 18 | adimageclickurl: json["adimageclickurl"], 19 | adtimes: json["adtimes"], 20 | show: json["show"], 21 | ); 22 | 23 | Map toJson() => { 24 | "adimageurl": adimageurl, 25 | "adimageclickurl": adimageclickurl, 26 | "adtimes": adtimes, 27 | "show": show, 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /lib/models/MainJson.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | class MainJson { 4 | MainJson({ 5 | this.code, 6 | this.message, 7 | this.stat, 8 | }); 9 | 10 | int? code; 11 | String? message; 12 | bool? stat; 13 | 14 | factory MainJson.fromJson(Map json) => MainJson( 15 | code: json["code"], 16 | message: json["message"], 17 | stat: json["stat"], 18 | ); 19 | 20 | Map toJson() => { 21 | "code": code, 22 | "message": message, 23 | "stat": stat, 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /lib/models/token.dart: -------------------------------------------------------------------------------- 1 | class Token { 2 | String? accessToken; 3 | String? tokenType; 4 | String? refreshToken; 5 | int? expiresIn; 6 | String? scope; 7 | String? company; 8 | String? jti; 9 | 10 | Token( 11 | {this.accessToken, 12 | this.tokenType, 13 | this.refreshToken, 14 | this.expiresIn, 15 | this.scope, 16 | this.company, 17 | this.jti}); 18 | 19 | Token.fromJson(Map json) { 20 | accessToken = json['access_token']; 21 | tokenType = json['token_type']; 22 | refreshToken = json['refresh_token']; 23 | expiresIn = json['expires_in']; 24 | scope = json['scope']; 25 | company = json['company']; 26 | jti = json['jti']; 27 | } 28 | 29 | Map toJson() { 30 | final Map data = new Map(); 31 | data['access_token'] = this.accessToken; 32 | data['token_type'] = this.tokenType; 33 | data['refresh_token'] = this.refreshToken; 34 | data['expires_in'] = this.expiresIn; 35 | data['scope'] = this.scope; 36 | data['company'] = this.company; 37 | data['jti'] = this.jti; 38 | return data; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/models/user.dart: -------------------------------------------------------------------------------- 1 | // To parse this JSON data, do 2 | // 3 | // final user = userFromJson(jsonString); 4 | 5 | import 'dart:convert'; 6 | 7 | class User { 8 | User({ 9 | this.userName, 10 | this.userId, 11 | this.userAccount, 12 | this.userAgender, 13 | this.userpassword, 14 | }); 15 | 16 | String? userName; 17 | String? userId; 18 | String? userAccount; 19 | int? userAgender; 20 | String? userpassword; 21 | 22 | factory User.fromRawJson(String str) => User.fromJson(json.decode(str)); 23 | 24 | String toRawJson() => json.encode(toJson()); 25 | 26 | factory User.fromJson(Map json) => User( 27 | userName: json["userName"], 28 | userId: json["userId"], 29 | userAccount: json["userAccount"], 30 | userAgender: json["userAgender"], 31 | userpassword: json["userpassword"], 32 | ); 33 | 34 | Map toJson() => { 35 | "userName": userName, 36 | "userId": userId, 37 | "userAccount": userAccount, 38 | "userAgender": userAgender, 39 | "userpassword": userpassword, 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /lib/pages/components/avatar.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:movie_app/resources/app_colors.dart'; 4 | import 'package:movie_app/resources/app_values.dart'; 5 | import 'package:shimmer/shimmer.dart'; 6 | 7 | class Avatar extends StatelessWidget { 8 | const Avatar({ 9 | super.key, 10 | required this.avatarUrl, 11 | }); 12 | 13 | final String avatarUrl; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return CachedNetworkImage( 18 | imageUrl: avatarUrl, 19 | imageBuilder: (context, imageProvider) => CircleAvatar( 20 | radius: AppSize.s20, 21 | backgroundColor: AppColors.transparent, 22 | backgroundImage: imageProvider, 23 | ), 24 | placeholder: (context, _) => Shimmer.fromColors( 25 | baseColor: Colors.grey[850]!, 26 | highlightColor: Colors.grey[800]!, 27 | child: const CircleAvatar( 28 | radius: AppSize.s20, 29 | ), 30 | ), 31 | errorWidget: (_, __, ___) => const Icon( 32 | Icons.error, 33 | color: AppColors.error, 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/pages/components/cast_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:movie_app/pages/detail/components/image_with_shimmer.dart'; 4 | import 'package:movie_app/resources/app_values.dart'; 5 | import 'package:movies_data/movies_data.dart'; 6 | 7 | class CastCard extends StatelessWidget { 8 | final CastItem cast; 9 | const CastCard({ 10 | required this.cast, 11 | super.key, 12 | }); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | final textTheme = Theme.of(context).textTheme; 17 | return SizedBox( 18 | width: AppSize.s100, 19 | child: Column( 20 | children: [ 21 | ClipRRect( 22 | borderRadius: BorderRadius.circular(AppSize.s8), 23 | child: ImageWithShimmer( 24 | imageUrl: cast.profilePath ?? "", 25 | width: double.infinity, 26 | height: AppSize.s130, 27 | ), 28 | ), 29 | Text( 30 | cast.originalName ?? "", 31 | style: textTheme.bodyLarge, 32 | maxLines: 2, 33 | textAlign: TextAlign.center, 34 | ) 35 | ], 36 | ), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/pages/components/movie_card_details.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:movies_data/movies_data.dart'; 3 | 4 | class MovieCardDetails extends StatelessWidget { 5 | const MovieCardDetails({ 6 | super.key, 7 | required this.movieDetails, 8 | }); 9 | 10 | final MovieItem movieDetails; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | final textTheme = Theme.of(context).textTheme; 15 | return Text(""); 16 | // if (movieDetails.releaseDate.isNotEmpty && 17 | // movieDetails.genres.isNotEmpty && 18 | // movieDetails.runtime!.isNotEmpty) { 19 | // return Row( 20 | // children: [ 21 | // if (movieDetails.releaseDate.isNotEmpty) ...[ 22 | // Text( 23 | // movieDetails.releaseDate.split(',')[1], 24 | // style: textTheme.bodyLarge, 25 | // ), 26 | // const CircleDot(), 27 | // ], 28 | // if (movieDetails.genres.isNotEmpty) ...[ 29 | // Text( 30 | // movieDetails.genres, 31 | // style: textTheme.bodyLarge, 32 | // ), 33 | // const CircleDot(), 34 | // ] else ...[ 35 | // if (movieDetails.runtime!.isNotEmpty) ...[ 36 | // const CircleDot(), 37 | // ] 38 | // ], 39 | // Text( 40 | // movieDetails.runtime!, 41 | // style: textTheme.bodyLarge, 42 | // ), 43 | // ], 44 | // ); 45 | // } else { 46 | // return const SizedBox(); 47 | // } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/pages/components/review_content.dart: -------------------------------------------------------------------------------- 1 | // import 'package:flutter/material.dart'; 2 | // import 'package:movies_app/core/resources/app_values.dart'; 3 | // import 'package:movies_app/movies/domain/entities/review.dart'; 4 | // import 'package:movies_app/movies/presentation/components/avatar.dart'; 5 | 6 | // class ReviewContent extends StatelessWidget { 7 | // const ReviewContent({ 8 | // super.key, 9 | // required this.review, 10 | // }); 11 | 12 | // final Review review; 13 | 14 | // @override 15 | // Widget build(BuildContext context) { 16 | // final textTheme = Theme.of(context).textTheme; 17 | // return SingleChildScrollView( 18 | // physics: const BouncingScrollPhysics(), 19 | // child: Padding( 20 | // padding: const EdgeInsets.all(AppPadding.p16), 21 | // child: Column( 22 | // children: [ 23 | // Row( 24 | // children: [ 25 | // Padding( 26 | // padding: const EdgeInsets.only(right: AppPadding.p6), 27 | // child: Avatar(avatarUrl: review.avatarUrl), 28 | // ), 29 | // Column( 30 | // crossAxisAlignment: CrossAxisAlignment.start, 31 | // children: [ 32 | // Text( 33 | // review.authorName, 34 | // style: textTheme.bodyMedium, 35 | // ), 36 | // Text( 37 | // review.authorUserName, 38 | // style: textTheme.bodyLarge, 39 | // ), 40 | // ], 41 | // ) 42 | // ], 43 | // ), 44 | // Padding( 45 | // padding: const EdgeInsets.only(top: AppPadding.p10), 46 | // child: Text( 47 | // review.content, 48 | // style: textTheme.bodyLarge, 49 | // ), 50 | // ), 51 | // ], 52 | // ), 53 | // ), 54 | // ); 55 | // } 56 | // } 57 | -------------------------------------------------------------------------------- /lib/pages/components/section_listview.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:movie_app/resources/app_values.dart'; 3 | 4 | class SectionListView extends StatelessWidget { 5 | final int itemCount; 6 | final double height; 7 | final Widget Function(BuildContext context, int index) itemBuilder; 8 | 9 | const SectionListView({ 10 | required this.height, 11 | required this.itemCount, 12 | required this.itemBuilder, 13 | super.key, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return SizedBox( 19 | height: height, 20 | child: ListView.separated( 21 | padding: const EdgeInsets.symmetric(horizontal: AppPadding.p16), 22 | itemCount: itemCount, 23 | scrollDirection: Axis.horizontal, 24 | itemBuilder: itemBuilder, 25 | separatorBuilder: (context, index) => 26 | const SizedBox(width: AppSize.s10), 27 | ), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/pages/detail/bloc/detail_movie_event.dart: -------------------------------------------------------------------------------- 1 | part of 'detail_movie_bloc.dart'; 2 | 3 | @immutable 4 | abstract class DetailMovieEvent { 5 | const DetailMovieEvent(); 6 | } 7 | 8 | class FetchedMovieEvent extends DetailMovieEvent { 9 | final String movieId; 10 | 11 | const FetchedMovieEvent({required this.movieId}); 12 | } 13 | 14 | class BookmarkEvent extends DetailMovieEvent { 15 | final MovieItem item; 16 | 17 | const BookmarkEvent({required this.item}); 18 | } 19 | -------------------------------------------------------------------------------- /lib/pages/detail/bloc/detail_movie_state.dart: -------------------------------------------------------------------------------- 1 | part of 'detail_movie_bloc.dart'; 2 | 3 | class DetailMovieState extends Equatable { 4 | final MovieDetail? movie; 5 | final bool isMarked; 6 | final List movies; 7 | final List videos; 8 | final List casts; 9 | final Status status; 10 | final Object? error; 11 | 12 | const DetailMovieState({ 13 | required this.status, 14 | required this.isMarked, 15 | required this.videos, 16 | required this.movies, 17 | required this.casts, 18 | this.error, 19 | this.movie, 20 | }); 21 | 22 | DetailMovieState.initialState() 23 | : this( 24 | status: Status.empty, 25 | movies: [], 26 | videos: [], 27 | casts: [], 28 | isMarked: false); 29 | 30 | DetailMovieState.empty() 31 | : this( 32 | status: Status.empty, 33 | movies: [], 34 | videos: [], 35 | casts: [], 36 | isMarked: false); 37 | 38 | DetailMovieState copyWith({ 39 | Status? status, 40 | List? movies, 41 | List? videos, 42 | List? casts, 43 | bool? isMarked, 44 | Object? error, 45 | MovieDetail? movie, 46 | }) { 47 | return DetailMovieState( 48 | movie: movie ?? this.movie, 49 | videos: videos ?? this.videos, 50 | movies: movies ?? this.movies, 51 | casts: casts ?? this.casts, 52 | isMarked: isMarked ?? this.isMarked, 53 | status: status ?? this.status, 54 | error: error ?? this.error, 55 | ); 56 | } 57 | 58 | @override 59 | List get props => 60 | [movie, movies, isMarked, videos, casts, status, error]; 61 | } 62 | -------------------------------------------------------------------------------- /lib/pages/detail/components/circle_dot.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:movie_app/resources/app_colors.dart'; 3 | import 'package:movie_app/resources/app_values.dart'; 4 | 5 | class CircleDot extends StatelessWidget { 6 | const CircleDot({ 7 | super.key, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Padding( 13 | padding: const EdgeInsets.symmetric(horizontal: AppPadding.p6), 14 | child: Container( 15 | width: AppSize.s6, 16 | height: AppSize.s6, 17 | decoration: const BoxDecoration( 18 | shape: BoxShape.circle, 19 | color: AppColors.circleDotColor, 20 | ), 21 | ), 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/pages/detail/components/image_with_shimmer.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:movie_app/resources/app_colors.dart'; 4 | import 'package:shimmer/shimmer.dart'; 5 | 6 | class ImageWithShimmer extends StatelessWidget { 7 | const ImageWithShimmer({ 8 | super.key, 9 | required this.imageUrl, 10 | required this.width, 11 | required this.height, 12 | }); 13 | 14 | final String imageUrl; 15 | final double height; 16 | final double width; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return CachedNetworkImage( 21 | imageUrl: imageUrl, 22 | height: height, 23 | width: width, 24 | fit: BoxFit.cover, 25 | placeholder: (_, __) => Shimmer.fromColors( 26 | baseColor: Colors.grey[850]!, 27 | highlightColor: Colors.grey[800]!, 28 | child: Container( 29 | height: height, 30 | color: AppColors.secondaryText, 31 | ), 32 | ), 33 | errorWidget: (_, __, ___) => const Icon( 34 | Icons.error, 35 | color: AppColors.error, 36 | ), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/pages/detail/components/movie_card_details.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:movie_app/pages/detail/components/circle_dot.dart'; 3 | import 'package:movies_data/movies_data.dart'; 4 | 5 | class MovieCardDetails extends StatelessWidget { 6 | const MovieCardDetails({ 7 | super.key, 8 | required this.movieDetails, 9 | }); 10 | 11 | final MovieDetail movieDetails; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | final textTheme = Theme.of(context).textTheme; 16 | if (movieDetails.releaseData.isNotEmpty && 17 | movieDetails.genres.isNotEmpty && 18 | movieDetails.overview.isNotEmpty) { 19 | return Row( 20 | children: [ 21 | if (movieDetails.releaseData.isNotEmpty) ...[ 22 | Text( 23 | movieDetails.releaseData, //.split(',')[1], 24 | style: textTheme.bodyLarge, 25 | ), 26 | const CircleDot(), 27 | ], 28 | if (movieDetails.genres.isNotEmpty) ...[ 29 | Text( 30 | movieDetails.genres.first, 31 | style: textTheme.bodyLarge, 32 | ), 33 | const CircleDot(), 34 | ] else ...[ 35 | if (movieDetails.overview.isNotEmpty) ...[ 36 | const CircleDot(), 37 | ] 38 | ], 39 | Text( 40 | movieDetails.language, 41 | style: textTheme.bodyLarge, 42 | ), 43 | ], 44 | ); 45 | } else { 46 | return const SizedBox(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/pages/detail/components/slider_card_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:movie_app/pages/detail/components/image_with_shimmer.dart'; 3 | import 'package:movie_app/resources/app_colors.dart'; 4 | 5 | class SliderCardImage extends StatelessWidget { 6 | const SliderCardImage({ 7 | super.key, 8 | required this.imageUrl, 9 | }); 10 | 11 | final String imageUrl; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | final size = MediaQuery.of(context).size; 16 | return ImageWithShimmer( 17 | height: size.height * 0.3, 18 | width: double.infinity, 19 | imageUrl: imageUrl, 20 | ); 21 | } 22 | 23 | /* 24 | ///加入渐变颜色MASK效果 25 | @override 26 | Widget build(BuildContext context) { 27 | final size = MediaQuery.of(context).size; 28 | return ShaderMask( 29 | blendMode: BlendMode.dstIn, 30 | shaderCallback: (rect) { 31 | return const LinearGradient( 32 | begin: Alignment.topCenter, 33 | end: Alignment.bottomCenter, 34 | colors: [ 35 | AppColors.black, 36 | AppColors.black, 37 | AppColors.transparent, 38 | ], 39 | stops: [0.3, 0.5, 1], 40 | ).createShader( 41 | Rect.fromLTRB(0, 0, rect.width, rect.height), 42 | ); 43 | }, 44 | child: ImageWithShimmer( 45 | height: size.height * 0.6, 46 | width: double.infinity, 47 | imageUrl: imageUrl, 48 | ), 49 | ); 50 | } 51 | */ 52 | } 53 | -------------------------------------------------------------------------------- /lib/pages/detail/widgets/similar_movies_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:movie_app/pages/detail/bloc/detail_movie_bloc.dart'; 4 | import 'package:movie_app/pages/widgets/empty_view.dart'; 5 | import 'package:movie_app/pages/widgets/movie_item_card.dart'; 6 | import 'package:movie_app/utils/sliver_grid_delegate.dart'; 7 | 8 | class SimilarMoviesList extends StatelessWidget { 9 | const SimilarMoviesList({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return BlocBuilder( 14 | buildWhen: (prev, current) => prev.movies != current.movies, 15 | builder: (context, state) { 16 | final movies = state.movies; 17 | if (movies.isEmpty) { 18 | return const SliverToBoxAdapter(child: EmptyView()); 19 | } 20 | return SliverGrid( 21 | gridDelegate: gridDelegate(context), 22 | delegate: SliverChildBuilderDelegate( 23 | (context, index) => MovieItemCard(movie: movies[index]), 24 | childCount: state.movies.length, 25 | ), 26 | ); 27 | }, 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/pages/detail/widgets/videos_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:movie_app/pages/detail/bloc/detail_movie_bloc.dart'; 4 | import 'package:movie_app/pages/videoplayer/player_page.dart'; 5 | import 'package:movie_app/pages/widgets/empty_view.dart'; 6 | import 'package:movie_app/pages/widgets/video_item_card.dart'; 7 | 8 | class VideosList extends StatelessWidget { 9 | const VideosList({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return BlocBuilder( 14 | builder: (context, state) { 15 | if (state.videos.isEmpty) { 16 | return const SliverToBoxAdapter(child: EmptyView()); 17 | } 18 | return SliverList( 19 | delegate: SliverChildBuilderDelegate( 20 | (context, index) => VideoItemCard( 21 | video: state.videos[index], 22 | onPressed: () { 23 | Navigator.of(context).push(PlayerPage.route( 24 | movieId: state.movie!.id, 25 | videoKey: state.videos[index].key, 26 | )); 27 | }, 28 | ), 29 | childCount: state.videos.length, 30 | ), 31 | ); 32 | }, 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/pages/explore/bloc/explore_event.dart: -------------------------------------------------------------------------------- 1 | part of 'explore_bloc.dart'; 2 | 3 | @immutable 4 | abstract class ExploreEvent {} 5 | 6 | @immutable 7 | class FetchMoviesEvent extends ExploreEvent {} 8 | 9 | @immutable 10 | class FilterEvent extends ExploreEvent { 11 | FilterEvent(this.filter); 12 | 13 | final Filter filter; 14 | } 15 | 16 | @immutable 17 | class SearchMoviesEvent extends ExploreEvent { 18 | SearchMoviesEvent(this.query); 19 | 20 | final String query; 21 | } 22 | 23 | @immutable 24 | class ClearStateEvent extends ExploreEvent {} 25 | 26 | /// Internal event from network 27 | @immutable 28 | class _EmitResponseEvent extends ExploreEvent { 29 | _EmitResponseEvent(this.responseState); 30 | final ResponseState responseState; 31 | } 32 | 33 | /// Internal event from network 34 | @immutable 35 | class _EmitErrorEvent extends ExploreEvent { 36 | _EmitErrorEvent({this.error}); 37 | 38 | final Object? error; 39 | } 40 | -------------------------------------------------------------------------------- /lib/pages/explore/filter/filter_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:equatable/equatable.dart'; 4 | import 'package:movie_app/utils/status.dart'; 5 | import 'package:movies_data/movies_data.dart'; 6 | import 'package:rxdart/rxdart.dart'; 7 | 8 | class FilterState extends Equatable { 9 | final List genres; 10 | final Status status; 11 | 12 | const FilterState(this.genres, this.status); 13 | 14 | FilterState.loading() : this([], Status.pending); 15 | 16 | const FilterState.success(List genres) 17 | : this(genres, Status.success); 18 | 19 | FilterState.fail() : this([], Status.error); 20 | 21 | FilterState.noConnection() : this([], Status.noConnection); 22 | 23 | @override 24 | List get props => [genres, status]; 25 | } 26 | 27 | class FilterViewModel { 28 | final MoviesRepository repository; 29 | 30 | FilterViewModel(MoviesRepository? moviesRepository) 31 | : repository = moviesRepository ?? MoviesRepository(); 32 | 33 | StreamSubscription? _streamSubscription; 34 | 35 | final _genresStreamController = 36 | BehaviorSubject.seeded(FilterState.loading()); 37 | 38 | Stream get getGenresStream => _genresStreamController; 39 | 40 | Future loadGenres() async { 41 | _streamSubscription?.cancel(); 42 | _streamSubscription = 43 | repository.getGenres().asStream().listen((responseState) { 44 | if (responseState is Success) { 45 | _genresStreamController.sink 46 | .add(FilterState.success(responseState.successValue)); 47 | } else if (responseState is Fail) { 48 | _genresStreamController.sink.add(FilterState.fail()); 49 | } else if (responseState is NoConnection) { 50 | _genresStreamController.sink.add(FilterState.noConnection()); 51 | } else { 52 | _genresStreamController.sink.add(FilterState.fail()); 53 | } 54 | }); 55 | } 56 | 57 | void close() { 58 | _streamSubscription?.cancel(); 59 | _genresStreamController.close(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/pages/home/bloc/home_event.dart: -------------------------------------------------------------------------------- 1 | part of 'home_bloc.dart'; 2 | 3 | @immutable 4 | abstract class HomeEvent {} 5 | 6 | ///获取将来 + 根据Navi ID获取数据 7 | class FetchUpcomingMoviesEvent extends HomeEvent {} 8 | 9 | //根据类别来获取所有tab单项的数据 10 | class FetchTabDataByCategoryEvent extends HomeEvent { 11 | final Categroy_Home categroy; 12 | 13 | FetchTabDataByCategoryEvent({required this.categroy}); 14 | // const FetchTabDataByCategoryEvent({required this.categroyname}); 15 | } 16 | 17 | ///获取正在播放 18 | class FetchNowPlayingMoviesEvent extends HomeEvent {} 19 | 20 | ///获取最流行 21 | class FetchPopularMoviesEvent extends HomeEvent {} 22 | 23 | ///获取顶部评分 24 | class FetchTopRatedMoviesEvent extends HomeEvent {} 25 | 26 | ///获取所有类别 27 | class FetchAllCategorysEvent extends HomeEvent {} 28 | -------------------------------------------------------------------------------- /lib/pages/home/widgets/banner_movices.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:iconly/iconly.dart'; 4 | import 'package:movie_app/l10n/l10n.dart'; 5 | import 'package:movie_app/pages/detail/components/slider_card_image.dart'; 6 | import 'package:movie_app/pages/home/bloc/home_bloc.dart'; 7 | import 'package:movie_app/pages/home/movies_see_all.dart'; 8 | import 'package:movie_app/pages/widgets/empty_view.dart'; 9 | import 'package:movie_app/pages/widgets/error_view.dart'; 10 | import 'package:movie_app/pages/widgets/movie_item_card.dart'; 11 | import 'package:movie_app/pages/widgets/no_connection_view.dart'; 12 | import 'package:movie_app/pages/widgets/progress_view.dart'; 13 | import 'package:movie_app/resources/app_values.dart'; 14 | import 'package:movie_app/utils/status.dart'; 15 | import 'package:movies_data/movies_data.dart'; 16 | import 'package:movies_api/src/models/navi/navi_avtor.dart'; 17 | 18 | import 'package:movies_api/src/models/navi/navi_link.dart'; 19 | 20 | class BannerMovies extends StatelessWidget { 21 | @override 22 | Widget build(BuildContext context) { 23 | // TODO: implement build 24 | return Text("s"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/pages/home/widgets/custom_slider.dart: -------------------------------------------------------------------------------- 1 | import 'package:carousel_slider/carousel_slider.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CustomSlider extends StatelessWidget { 5 | final Widget Function(BuildContext context, int itemIndex, int) itemBuilder; 6 | const CustomSlider({ 7 | required this.itemBuilder, 8 | super.key, 9 | }); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | final size = MediaQuery.of(context).size; 14 | const int carouselSliderItemsCount = 4; 15 | return CarouselSlider.builder( 16 | itemCount: carouselSliderItemsCount, 17 | options: CarouselOptions( 18 | viewportFraction: 1, 19 | height: size.height * 0.55, 20 | autoPlay: true, 21 | ), 22 | itemBuilder: itemBuilder, 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/pages/home/widgets/slider_card_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:movie_app/pages/detail/components/image_with_shimmer.dart'; 4 | import 'package:movie_app/resources/app_colors.dart'; 5 | 6 | class SliderCardImage extends StatelessWidget { 7 | const SliderCardImage({ 8 | super.key, 9 | required this.imageUrl, 10 | }); 11 | 12 | final String imageUrl; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | final size = MediaQuery.of(context).size; 17 | return ShaderMask( 18 | blendMode: BlendMode.dstIn, 19 | shaderCallback: (rect) { 20 | return const LinearGradient( 21 | begin: Alignment.topCenter, 22 | end: Alignment.bottomCenter, 23 | colors: [ 24 | AppColors.black, 25 | AppColors.black, 26 | AppColors.transparent, 27 | ], 28 | stops: [0.3, 0.5, 1], 29 | ).createShader( 30 | Rect.fromLTRB(0, 0, rect.width, rect.height), 31 | ); 32 | }, 33 | child: ImageWithShimmer( 34 | height: 175, // size.height * 0.6, 35 | width: double.infinity, 36 | imageUrl: imageUrl, 37 | ), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/pages/initialpages/bloc/register_event.dart: -------------------------------------------------------------------------------- 1 | part of 'register_bloc.dart'; 2 | 3 | @immutable 4 | abstract class RegisterEvent extends Equatable { 5 | const RegisterEvent(); 6 | } 7 | 8 | class FinishRegisterEvent extends RegisterEvent { 9 | @override 10 | List get props => []; 11 | } 12 | 13 | class ChangeFlagEvent extends RegisterEvent { 14 | final GenreItem genre; 15 | 16 | const ChangeFlagEvent(this.genre); 17 | 18 | @override 19 | List get props => [genre]; 20 | } 21 | 22 | class FetchGenresEvent extends RegisterEvent { 23 | const FetchGenresEvent(); 24 | 25 | @override 26 | List get props => []; 27 | } 28 | 29 | class _RefreshEvent extends RegisterEvent { 30 | const _RefreshEvent(this.genres); 31 | 32 | final List genres; 33 | 34 | @override 35 | List get props => []; 36 | } 37 | -------------------------------------------------------------------------------- /lib/pages/initialpages/bloc/register_state.dart: -------------------------------------------------------------------------------- 1 | part of 'register_bloc.dart'; 2 | 3 | class RegisterState extends Equatable { 4 | final Status status; 5 | final Object? error; 6 | final List genres; 7 | 8 | const RegisterState( 9 | {required this.status, this.error, required this.genres}); 10 | 11 | RegisterState.initial() : this(status: Status.empty, genres: [], error: null); 12 | 13 | RegisterState copyWith({ 14 | Status? status, 15 | Object? error, 16 | List? genres, 17 | }) { 18 | return RegisterState( 19 | status: status ?? this.status, 20 | genres: genres ?? this.genres, 21 | error: error ?? this.error, 22 | ); 23 | } 24 | 25 | @override 26 | List get props => [status, genres, error]; 27 | } 28 | -------------------------------------------------------------------------------- /lib/pages/login/logic.dart: -------------------------------------------------------------------------------- 1 | import 'package:movie_app/pages/login/state.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | class LoginLogic extends GetxController { 5 | final state = LoginState(); 6 | } 7 | -------------------------------------------------------------------------------- /lib/pages/login/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:movie_app/models/user.dart'; 2 | 3 | class LoginState { 4 | // 用户信息 5 | // late User userInfo; 6 | 7 | LoginState() {} 8 | } 9 | -------------------------------------------------------------------------------- /lib/pages/login/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class LoginPage extends StatefulWidget { 5 | @override 6 | _LoginPageState createState() => _LoginPageState(); 7 | } 8 | 9 | class _LoginPageState extends State { 10 | @override 11 | void initState() { 12 | super.initState(); 13 | } 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | backgroundColor: Colors.white, 19 | body: ListView( 20 | children: [ 21 | Container( 22 | alignment: Alignment.centerLeft, 23 | padding: EdgeInsets.only(left: 35, top: 30), 24 | height: 200, 25 | child: Text( 26 | "用户登录", 27 | style: TextStyle( 28 | fontSize: 30, 29 | color: Colors.black, 30 | fontWeight: FontWeight.bold, 31 | ), 32 | )), 33 | ], 34 | )); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/pages/movies/bloc/movies_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:movies_data/movies_data.dart'; 5 | 6 | part 'movies_event.dart'; 7 | 8 | part 'movies_state.dart'; 9 | 10 | class MoviesBloc extends Bloc { 11 | final StorageRepository _repository; 12 | 13 | MoviesBloc({required StorageRepository repository}) 14 | : _repository = repository, 15 | super(MoviesState.initial()) { 16 | on((event, emit) async { 17 | final activeGenres = _repository.getSavedGenres(); 18 | // emit(MoviesState()); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/pages/movies/bloc/movies_event.dart: -------------------------------------------------------------------------------- 1 | part of 'movies_bloc.dart'; 2 | 3 | @immutable 4 | abstract class MoviesEvent {} 5 | 6 | class GetActiveGenres extends MoviesEvent {} 7 | -------------------------------------------------------------------------------- /lib/pages/movies/bloc/movies_state.dart: -------------------------------------------------------------------------------- 1 | part of 'movies_bloc.dart'; 2 | 3 | class MoviesState extends Equatable { 4 | final List genres; 5 | 6 | const MoviesState(this.genres); 7 | 8 | MoviesState.initial() : this([]); 9 | 10 | @override 11 | List get props => [genres]; 12 | } 13 | -------------------------------------------------------------------------------- /lib/pages/mylist/bloc/my_list_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:equatable/equatable.dart'; 5 | import 'package:flutter/foundation.dart'; 6 | import 'package:movie_app/utils/status.dart'; 7 | import 'package:movies_data/movies_data.dart'; 8 | 9 | part 'my_list_event.dart'; 10 | 11 | part 'my_list_state.dart'; 12 | 13 | class MyListBloc extends Bloc { 14 | final StorageRepository repository; 15 | 16 | late StreamSubscription> _moviesStatusSubscription; 17 | 18 | MyListBloc({required this.repository}) : super(MyListState.initial()) { 19 | on((event, emit) async { 20 | final hasMarked = 21 | await repository.checkWhetherIsMarkedOrNot(event.movie.id); 22 | if (hasMarked) { 23 | repository.deleteMovie(event.movie.id); 24 | } else { 25 | repository.saveMovies(event.movie); 26 | } 27 | }); 28 | 29 | _moviesStatusSubscription = repository.getSavedMovies().listen((list) { 30 | if (list.isEmpty) { 31 | emit(state.copyWith(movies: [], status: Status.empty)); 32 | } else { 33 | emit(state.copyWith(movies: list, status: Status.success)); 34 | } 35 | }); 36 | } 37 | 38 | @override 39 | Future close() { 40 | _moviesStatusSubscription.cancel(); 41 | return super.close(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/pages/mylist/bloc/my_list_event.dart: -------------------------------------------------------------------------------- 1 | part of 'my_list_bloc.dart'; 2 | 3 | @immutable 4 | abstract class MyListEvent { 5 | const MyListEvent(); 6 | } 7 | 8 | class AddAndRemoveEvent extends MyListEvent { 9 | final MovieItem movie; 10 | 11 | const AddAndRemoveEvent({required this.movie}); 12 | } 13 | 14 | class GetMovieItems extends MyListEvent {} 15 | -------------------------------------------------------------------------------- /lib/pages/mylist/bloc/my_list_state.dart: -------------------------------------------------------------------------------- 1 | part of 'my_list_bloc.dart'; 2 | 3 | class MyListState extends Equatable { 4 | final List movies; 5 | final Status status; 6 | final MovieItem? temporary; 7 | 8 | const MyListState( 9 | {required this.movies, required this.status, this.temporary}); 10 | 11 | MyListState.initial() 12 | : this(movies: [], status: Status.empty, temporary: null); 13 | 14 | MyListState copyWith({ 15 | Status? status, 16 | List? movies, 17 | MovieItem? temporary, 18 | }) { 19 | return MyListState( 20 | status: status ?? this.status, 21 | movies: movies ?? this.movies, 22 | temporary: temporary ?? this.temporary, 23 | ); 24 | } 25 | 26 | @override 27 | List get props => [movies, temporary, status]; 28 | } 29 | -------------------------------------------------------------------------------- /lib/pages/skeletonlib/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SkeletonTheme extends InheritedWidget { 4 | final LinearGradient? shimmerGradient; 5 | final LinearGradient? darkShimmerGradient; 6 | final ThemeMode? themeMode; 7 | 8 | const SkeletonTheme({ 9 | Key? key, 10 | required Widget child, 11 | this.shimmerGradient, 12 | this.darkShimmerGradient, 13 | this.themeMode, 14 | }) : super(key: key, child: child); 15 | 16 | static SkeletonTheme? of(BuildContext context) => 17 | context.dependOnInheritedWidgetOfExactType(); 18 | 19 | @override 20 | bool updateShouldNotify(SkeletonTheme oldWidget) => 21 | oldWidget.themeMode != themeMode || 22 | oldWidget.shimmerGradient != shimmerGradient || 23 | oldWidget.darkShimmerGradient != darkShimmerGradient; 24 | } 25 | -------------------------------------------------------------------------------- /lib/pages/splash/splash_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/flutter_svg.dart'; 3 | 4 | class SplashPage extends StatelessWidget { 5 | const SplashPage({super.key}); 6 | 7 | static Route route() { 8 | return MaterialPageRoute(builder: (_) => const SplashPage()); 9 | } 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Scaffold( 14 | body: Center( 15 | child: SizedBox( 16 | height: 100, 17 | width: 100, 18 | child: Image.asset('assets/images/ic_launcher.png'), 19 | ), 20 | ), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/pages/user/logic.dart: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/pages/user/state.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/lib/pages/user/state.dart -------------------------------------------------------------------------------- /lib/pages/videoplayer/bloc/player_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:movie_app/utils/status.dart'; 5 | import 'package:movies_data/movies_data.dart'; 6 | 7 | part 'player_event.dart'; 8 | 9 | part 'player_state.dart'; 10 | 11 | class PlayerBloc extends Bloc { 12 | final MoviesRepository repository; 13 | 14 | PlayerBloc({required this.repository}) : super(PlayerState.initial()) { 15 | on(_onFetchVideosEvent); 16 | on(_onChangeVideoEvent); 17 | } 18 | 19 | Future _onChangeVideoEvent( 20 | ChangeVideoEvent event, 21 | Emitter emit, 22 | ) async { 23 | emit(state.copyWith(currentVideoKey: event.videoKey)); 24 | } 25 | 26 | Future _onFetchVideosEvent( 27 | FetchVideosEvent event, 28 | Emitter emit, 29 | ) async { 30 | emit(state.copyWith(status: Status.pending)); 31 | final responseState = 32 | await repository.getVideosByMovieId(movieId: event.movieId!); 33 | 34 | if (responseState is Success) { 35 | final data = responseState.successValue; 36 | emit(state.copyWith(status: Status.success, videos: data.videos)); 37 | } else if (responseState is Fail) { 38 | emit(state.copyWith(status: Status.error)); 39 | } else if (responseState is NoConnection) { 40 | emit(state.copyWith(status: Status.noConnection)); 41 | } else { 42 | emit(state); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/pages/videoplayer/bloc/player_event.dart: -------------------------------------------------------------------------------- 1 | part of 'player_bloc.dart'; 2 | 3 | @immutable 4 | abstract class PlayerEvent { 5 | const PlayerEvent(); 6 | } 7 | 8 | class FetchVideosEvent extends PlayerEvent { 9 | const FetchVideosEvent(this.movieId); 10 | 11 | final String? movieId; 12 | } 13 | 14 | class CopyVideosEvent extends PlayerEvent { 15 | const CopyVideosEvent(this.movieId); 16 | 17 | final String movieId; 18 | } 19 | 20 | class ChangeVideoEvent extends PlayerEvent { 21 | const ChangeVideoEvent(this.videoKey); 22 | 23 | final String? videoKey; 24 | } 25 | -------------------------------------------------------------------------------- /lib/pages/videoplayer/bloc/player_state.dart: -------------------------------------------------------------------------------- 1 | part of 'player_bloc.dart'; 2 | 3 | class PlayerState extends Equatable { 4 | const PlayerState( 5 | {this.movieId, 6 | required this.videos, 7 | this.currentVideoKey, 8 | required this.status}); 9 | 10 | final String? movieId; 11 | final String? currentVideoKey; 12 | final List videos; 13 | final Status status; 14 | 15 | PlayerState.initial() : this(status: Status.empty, videos: []); 16 | 17 | PlayerState copyWith({ 18 | String? movieId, 19 | List? videos, 20 | String? currentVideoKey, 21 | Status? status, 22 | }) { 23 | return PlayerState( 24 | videos: videos ?? this.videos, 25 | movieId: movieId ?? this.movieId, 26 | status: status ?? this.status, 27 | currentVideoKey: currentVideoKey ?? this.currentVideoKey); 28 | } 29 | 30 | @override 31 | List get props => [movieId, status, currentVideoKey, videos]; 32 | } 33 | -------------------------------------------------------------------------------- /lib/pages/widgets/empty_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:iconly/iconly.dart'; 3 | import 'package:movie_app/resources/app_typography.dart'; 4 | import 'package:movie_app/utils/strings.dart' show emptyMessage; 5 | 6 | class EmptyView extends StatelessWidget { 7 | const EmptyView({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Center( 12 | child: Column( 13 | crossAxisAlignment: CrossAxisAlignment.center, 14 | mainAxisSize: MainAxisSize.min, 15 | children: [ 16 | Icon(IconlyBold.document, 17 | size: 65, color: Theme.of(context).colorScheme.onSurface), 18 | const SizedBox(height: 20), 19 | const Text(emptyMessage, style: AppTypography.titleLarge), 20 | ], 21 | ), 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/pages/widgets/error_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:iconly/iconly.dart'; 3 | import 'package:movie_app/resources/app_typography.dart'; 4 | import 'package:movie_app/utils/strings.dart'; 5 | 6 | typedef OnRetry = void Function(); 7 | 8 | class ErrorView extends StatelessWidget { 9 | const ErrorView({Key? key, this.message, this.onRetry}) : super(key: key); 10 | 11 | final String? message; 12 | final OnRetry? onRetry; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Center( 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.center, 19 | mainAxisSize: MainAxisSize.min, 20 | children: [ 21 | Icon(IconlyBold.paper_negative, 22 | size: 65, color: Theme.of(context).colorScheme.onSurface), 23 | Text(message ?? errorMessage, style: AppTypography.bodyLarge), 24 | const SizedBox(height: 8.0), 25 | ElevatedButton(onPressed: onRetry, child: const Text(tryAgain)) 26 | ], 27 | ), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/pages/widgets/genre_item_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:movie_app/resources/app_colors.dart'; 3 | 4 | import 'package:movie_app/resources/app_typography.dart'; 5 | 6 | class GenreItemWidget extends StatelessWidget { 7 | final String genre; 8 | final bool selected; 9 | final void Function() onSelected; 10 | 11 | const GenreItemWidget({ 12 | Key? key, 13 | required this.selected, 14 | required this.genre, 15 | required this.onSelected, 16 | }) : super(key: key); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return GestureDetector( 21 | onTap: onSelected, 22 | child: Container( 23 | margin: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 8.0), 24 | padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0), 25 | decoration: BoxDecoration( 26 | color: selected 27 | ? Theme.of(context).colorScheme.secondary 28 | : Colors.transparent, 29 | border: Border.all( 30 | width: 2, 31 | color: AppColors.secondaryColor, 32 | ), 33 | borderRadius: BorderRadius.circular(30)), 34 | child: Text( 35 | genre, 36 | style: AppTypography.bodyMedium.copyWith( 37 | fontWeight: FontWeight.w500, 38 | color: selected 39 | ? Colors.white 40 | : Theme.of(context).colorScheme.secondary, 41 | ), 42 | ), 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/pages/widgets/no_connection_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:movie_app/l10n/l10n.dart'; 3 | 4 | class NoConnectionView extends StatelessWidget { 5 | const NoConnectionView({Key? key, this.callback}) : super(key: key); 6 | 7 | final VoidCallback? callback; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Center( 12 | child: Column( 13 | crossAxisAlignment: CrossAxisAlignment.center, 14 | mainAxisAlignment: MainAxisAlignment.center, 15 | mainAxisSize: MainAxisSize.min, 16 | children: [ 17 | Icon( 18 | Icons.signal_wifi_connected_no_internet_4_rounded, 19 | color: Theme.of(context).colorScheme.secondary, 20 | size: 100, 21 | ), 22 | Text(context.l10n.noConnection), 23 | ElevatedButton.icon( 24 | icon: const Icon(Icons.refresh), 25 | onPressed: callback, 26 | label: Text(context.l10n.tryAgain), 27 | ) 28 | ], 29 | ), 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/pages/widgets/progress_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ProgressView extends StatelessWidget { 4 | const ProgressView({Key? key}) : super(key: key); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return Center( 9 | child: Padding( 10 | padding: const EdgeInsets.all(8.0), 11 | child: CircularProgressIndicator( 12 | color: Theme.of(context).colorScheme.secondary, 13 | ), 14 | ), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/resources/app_constants.dart: -------------------------------------------------------------------------------- 1 | class AppConstants { 2 | static const int carouselSliderItemsCount = 4; 3 | } 4 | -------------------------------------------------------------------------------- /lib/resources/app_routes.dart: -------------------------------------------------------------------------------- 1 | class AppRoutes { 2 | static const String moviesRoute = 'movies'; 3 | static const String movieDetailsRoute = 'movieDetails'; 4 | static const String popularMoviesRoute = 'popularMovies'; 5 | static const String topRatedMoviesRoute = 'topRatedMovies'; 6 | 7 | static const String tvShowsRoute = 'tvShows'; 8 | static const String tvShowDetailsRoute = 'tvShowDetails'; 9 | static const String popularTvShowsRoute = 'popularTvShowsRoute'; 10 | static const String topRatedTvShowsRoute = 'topRatedTvShowsRoute'; 11 | 12 | static const String searchRoute = 'search'; 13 | static const String watchlistRoute = 'watchlist'; 14 | } 15 | -------------------------------------------------------------------------------- /lib/resources/app_shape.dart: -------------------------------------------------------------------------------- 1 | class AppShape { 2 | static const largeShape = 25.0; 3 | static const normalShaper = 20.0; 4 | static const smallShape = 10.0; 5 | } 6 | -------------------------------------------------------------------------------- /lib/resources/app_strings.dart: -------------------------------------------------------------------------------- 1 | class AppStrings { 2 | static const String appTitle = 'Movies App'; 3 | static const String seeAll = 'see all'; 4 | static const String popularMovies = 'Popular movies'; 5 | static const String topRatedMovies = 'Top rated movies'; 6 | static const String story = 'Story'; 7 | static const String videos = 'Videos'; 8 | static const String cast = 'Cast'; 9 | static const String reviews = 'Reviews'; 10 | static const String similar = 'Similar'; 11 | static const String showLess = 'Show less'; 12 | static const String showMore = 'Show more'; 13 | static const String movies = 'Movies'; 14 | static const String shows = 'Shows'; 15 | static const String search = 'Search'; 16 | static const String watchlist = 'Watchlist'; 17 | static const String popularShows = 'Popular shows'; 18 | static const String topRatedShows = 'Top rated shows'; 19 | static const String lastEpisodeOnAir = 'Last Episode on Air'; 20 | static const String seasons = 'Seasons'; 21 | static const String season = 'Season'; 22 | static const String episodes = 'Episodes'; 23 | static const String episode = 'Episode'; 24 | static const String airDate = 'Air date:'; 25 | static const String lastEpisode = 'Last Episode'; 26 | static const String searchText = 27 | 'By typing in search bar, Movia search in movies and series and then show you the best results.'; 28 | static const String searchHint = 'Search for Movies, Series...'; 29 | static const String watchlistIsEmpty = 'Watchlist is empty'; 30 | static const String watchlistText = 31 | 'After adding movies and series to watchlist, they will appear here.'; 32 | static const String oops = 'Ooops'; 33 | static const String tryAgainLater = 'Please try again later'; 34 | static const String errorMessage = 'Something went wrong'; 35 | static const String tryAgain = 'try again'; 36 | static const String noResults = 'No results'; 37 | } 38 | -------------------------------------------------------------------------------- /lib/resources/app_typography.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppTypography { 4 | static const titleLarge = TextStyle( 5 | fontSize: 20.0, 6 | fontWeight: FontWeight.w500, 7 | ); 8 | static const titleMedium = TextStyle( 9 | fontSize: 20.0, 10 | fontWeight: FontWeight.w600, 11 | ); 12 | static const titleSmall = TextStyle( 13 | fontSize: 16.0, 14 | fontWeight: FontWeight.normal, 15 | ); 16 | static const labelLarge = TextStyle( 17 | fontSize: 20.0, 18 | fontWeight: FontWeight.bold, 19 | ); 20 | static const labelMedium = TextStyle( 21 | fontSize: 16.0, 22 | fontWeight: FontWeight.normal, 23 | ); 24 | static const labelSmall = TextStyle( 25 | fontSize: 14.0, 26 | fontWeight: FontWeight.normal, 27 | ); 28 | static const bodyLarge = TextStyle( 29 | fontSize: 16.0, 30 | fontWeight: FontWeight.w500, 31 | ); 32 | static const bodyMedium = TextStyle( 33 | fontSize: 14.0, 34 | fontWeight: FontWeight.w500, 35 | ); 36 | static const bodySmall = TextStyle( 37 | fontSize: 12.0, 38 | fontWeight: FontWeight.normal, 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /lib/utils/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/lib/utils/.gitkeep -------------------------------------------------------------------------------- /lib/utils/encrypt_util.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:crypto/crypto.dart'; 4 | import 'package:convert/convert.dart'; 5 | 6 | /// Encrypt Util. 7 | class EncryptUtil { 8 | /// md5 加密 9 | static String encodeMd5(String data) { 10 | var content = Utf8Encoder().convert(data); 11 | var digest = md5.convert(content); 12 | return hex.encode(digest.bytes); 13 | } 14 | 15 | /// 异或对称加密 16 | static String xorCode(String res, String key) { 17 | List keyList = key.split(','); 18 | List codeUnits = res.codeUnits; 19 | List codes = []; 20 | for (int i = 0, length = codeUnits.length; i < length; i++) { 21 | int code = codeUnits[i] ^ int.parse(keyList[i % keyList.length]); 22 | codes.add(code); 23 | } 24 | return String.fromCharCodes(codes); 25 | } 26 | 27 | /// 异或对称 Base64 加密 28 | static String xorBase64Encode(String res, String key) { 29 | String encode = xorCode(res, key); 30 | encode = encodeBase64(encode); 31 | return encode; 32 | } 33 | 34 | /// 异或对称 Base64 解密 35 | static String xorBase64Decode(String res, String key) { 36 | String encode = decodeBase64(res); 37 | encode = xorCode(encode, key); 38 | return encode; 39 | } 40 | 41 | /// Base64加密 42 | static String encodeBase64(String data) { 43 | var content = utf8.encode(data); 44 | var digest = base64Encode(content); 45 | return digest; 46 | } 47 | 48 | /// Base64解密 49 | static String decodeBase64(String data) { 50 | List bytes = base64Decode(data); 51 | String result = utf8.decode(bytes); 52 | return result; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/utils/message_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:fluttertoast/fluttertoast.dart'; 4 | 5 | class MessageUtil { 6 | static toast(String msg) { 7 | Fluttertoast.showToast( 8 | msg: msg, 9 | toastLength: Toast.LENGTH_SHORT, 10 | gravity: ToastGravity.CENTER, 11 | timeInSecForIosWeb: 1, 12 | backgroundColor: Colors.black, 13 | textColor: Colors.white, 14 | fontSize: 16.0); 15 | } 16 | 17 | static alert(String msg, BuildContext context, {Function? callback}) { 18 | showCupertinoDialog( 19 | context: context, 20 | builder: (context) { 21 | return Material( 22 | color: Colors.transparent, 23 | child: CupertinoAlertDialog( 24 | title: Text("提示"), 25 | content: Text(msg), 26 | actions: [ 27 | CupertinoButton( 28 | child: Text("确定"), 29 | onPressed: () { 30 | Navigator.pop(context); 31 | callback!(); 32 | }), 33 | ]), 34 | ); 35 | }, 36 | ); 37 | } 38 | 39 | static snack(String msg, BuildContext context) { 40 | ScaffoldMessenger.of(context).hideCurrentSnackBar(); 41 | ScaffoldMessenger.of(context).showSnackBar(SnackBar( 42 | content: Text(msg), 43 | action: SnackBarAction( 44 | label: "关闭", 45 | onPressed: () => ScaffoldMessenger.of(context).hideCurrentSnackBar(), 46 | ), 47 | )); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/utils/sliver_grid_delegate.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | SliverGridDelegate gridDelegate(BuildContext context) { 4 | return SliverGridDelegateWithFixedCrossAxisCount( 5 | crossAxisCount: MediaQuery.of(context).size.width > 500.0 ? 4 : 2, 6 | mainAxisSpacing: 10, 7 | crossAxisSpacing: 10, 8 | childAspectRatio: 100 / 150, 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /lib/utils/status.dart: -------------------------------------------------------------------------------- 1 | 2 | enum Status { success, pending, empty, error, noConnection } 3 | -------------------------------------------------------------------------------- /lib/utils/strings.dart: -------------------------------------------------------------------------------- 1 | const welcomeText = 'Welcome'; 2 | const welcomeContent = ''; 3 | const getStarted = 'Get Started'; 4 | const topMovies = 'Top Movies'; 5 | const entering = 'entering'; 6 | const choseFavoriteGenre = 7 | 'Choose your interests and get the best movie recommendations. Don\'t worry, you can always change it later.'; 8 | 9 | const skip = 'Skip'; 10 | const continui = 'Continue'; 11 | const seeAll = 'See all'; 12 | const populars = 'Popular'; 13 | const topRated = 'Top rated movies'; 14 | const home = 'Home'; 15 | const explore = 'Explore'; 16 | const myList = 'My List'; 17 | const profile = 'Profile'; 18 | const movies = 'Movies'; 19 | const tryAgain = 'Try again'; 20 | const errorMessage = 'Something went wrong!'; 21 | const emptyMessage = 'Your List is Empty'; 22 | const play = 'Play'; 23 | const releaseDate = 'Release date: '; 24 | -------------------------------------------------------------------------------- /lib/utils/typedef/enums.dart: -------------------------------------------------------------------------------- 1 | enum RequestStatus { loading, loaded, error } 2 | 3 | enum GetAllRequestStatus { loading, loaded, error, fetchMoreError } 4 | -------------------------------------------------------------------------------- /lib/utils/typedef/function.dart: -------------------------------------------------------------------------------- 1 | ///无参数请求回调 2 | typedef ParamVoidCallback = dynamic Function(); 3 | 4 | ///回调一个参数 5 | typedef ParamSingleCallback = dynamic Function(D data); 6 | 7 | ///回到俩个参数 8 | typedef ParamTwiceCallback = dynamic Function(O dataOne, T dataTwo); 9 | 10 | ///回调三个参数 11 | typedef ParamThreeCallback = dynamic Function( 12 | O dataOne, T dataTwo, K threeData); -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import path_provider_foundation 9 | import share_plus 10 | import shared_preferences_foundation 11 | import sqflite 12 | import url_launcher_macos 13 | import wakelock_macos 14 | 15 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 16 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 17 | SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) 18 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 19 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 20 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 21 | WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) 22 | } 23 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = moive1 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.moive1 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/movies_api/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | 32 | #lib/src/auth/secret.dart 贱人忽略了 33 | -------------------------------------------------------------------------------- /packages/movies_api/.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: b06b8b2710955028a6b562f5aa6fe62941d6febf 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/movies_api/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /packages/movies_api/LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /packages/movies_api/README.md: -------------------------------------------------------------------------------- 1 | 13 | 14 | TODO: Put a short description of the package here that helps potential users 15 | know whether this package might be useful for them. 16 | 17 | ## Features 18 | 19 | TODO: List what your package can do. Maybe include images, gifs, or videos. 20 | 21 | ## Getting started 22 | 23 | TODO: List prerequisites and provide or point to information on how to 24 | start using the package. 25 | 26 | ## Usage 27 | 28 | TODO: Include short and useful examples for package users. Add longer examples 29 | to `/example` folder. 30 | 31 | ```dart 32 | const like = 'sample'; 33 | ``` 34 | 35 | ## Additional information 36 | 37 | TODO: Tell users more about the package: where to find more information, how to 38 | contribute to the package, how to file issues, what response they can expect 39 | from the package authors, and more. 40 | -------------------------------------------------------------------------------- /packages/movies_api/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/movies_api/lib/movies_api.dart: -------------------------------------------------------------------------------- 1 | library moies_api; 2 | 3 | export 'package:movies_api/src/models/models.dart'; 4 | export 'package:movies_api/src/movies_api_interface/movie_api.dart'; 5 | export 'package:movies_api/src/auth/secret.dart'; 6 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/auth/secret.dart: -------------------------------------------------------------------------------- 1 | // TODO Implement this library. 2 | // TODO Implement this library. 3 | const String apiKey = '0aff95d84a8fd707d12059bc0f81de49'; 4 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/cast/cast.dart: -------------------------------------------------------------------------------- 1 | class Cast { 2 | Cast({ 3 | this.adult, 4 | this.gender, 5 | this.id, 6 | this.knownForDepartment, 7 | this.originalName, 8 | this.popularity, 9 | this.profilePath, 10 | this.castId, 11 | this.character, 12 | this.creditId, 13 | this.order, 14 | }); 15 | 16 | Cast.fromJson(dynamic json) 17 | : adult = json['adult'], 18 | gender = json['gender'], 19 | id = json['id'], 20 | knownForDepartment = json['known_for_department'], 21 | originalName = json['original_name'], 22 | popularity = json['popularity'], 23 | profilePath = json['profile_path'], 24 | castId = json['cast_id'], 25 | character = json['character'], 26 | creditId = json['credit_id'], 27 | order = json['order']; 28 | 29 | final bool? adult; 30 | final int? gender; 31 | final int? id; 32 | final String? knownForDepartment; 33 | final String? originalName; 34 | final double? popularity; 35 | final String? profilePath; 36 | final int? castId; 37 | final String? character; 38 | final String? creditId; 39 | final int? order; 40 | 41 | Map toJson() { 42 | final map = {}; 43 | map['adult'] = adult; 44 | map['gender'] = gender; 45 | map['id'] = id; 46 | map['known_for_department'] = knownForDepartment; 47 | map['original_name'] = originalName; 48 | map['popularity'] = popularity; 49 | map['profile_path'] = profilePath; 50 | map['cast_id'] = castId; 51 | map['character'] = character; 52 | map['credit_id'] = creditId; 53 | map['order'] = order; 54 | return map; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/cast/cast_response.dart: -------------------------------------------------------------------------------- 1 | import 'cast.dart'; 2 | import 'crew.dart'; 3 | 4 | class CastResponse { 5 | CastResponse({ 6 | this.id, 7 | this.cast, 8 | this.crew, 9 | }); 10 | 11 | late final int? id; 12 | late final List? cast; 13 | late final List? crew; 14 | 15 | CastResponse.fromJson(dynamic json) { 16 | id = json['id']; 17 | if (json['cast'] != null) { 18 | cast = []; 19 | json['cast'].forEach((v) { 20 | cast?.add(Cast.fromJson(v)); 21 | }); 22 | } 23 | if (json['crew'] != null) { 24 | crew = []; 25 | json['crew'].forEach((v) { 26 | crew?.add(Crew.fromJson(v)); 27 | }); 28 | } 29 | } 30 | 31 | Map toJson() { 32 | final map = {}; 33 | map['id'] = id; 34 | if (cast != null) { 35 | map['cast'] = cast?.map((v) => v.toJson()).toList(); 36 | } 37 | if (crew != null) { 38 | map['crew'] = crew?.map((v) => v.toJson()).toList(); 39 | } 40 | return map; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/cast/crew.dart: -------------------------------------------------------------------------------- 1 | class Crew { 2 | Crew({ 3 | this.adult, 4 | this.gender, 5 | this.id, 6 | this.knownForDepartment, 7 | this.originalName, 8 | this.popularity, 9 | this.profilePath, 10 | this.creditId, 11 | this.department, 12 | this.job, 13 | }); 14 | 15 | Crew.fromJson(dynamic json) 16 | : adult = json['adult'], 17 | gender = json['gender'], 18 | id = json['id'], 19 | knownForDepartment = json['known_for_department'], 20 | originalName = json['original_name'], 21 | popularity = json['popularity'], 22 | profilePath = json['profile_path'], 23 | creditId = json['credit_id'], 24 | department = json['department'], 25 | job = json['job']; 26 | 27 | final bool? adult; 28 | final int? gender; 29 | final int? id; 30 | final String? knownForDepartment; 31 | final String? originalName; 32 | final double? popularity; 33 | final String? profilePath; 34 | final String? creditId; 35 | final String? department; 36 | final String? job; 37 | 38 | Map toJson() { 39 | final map = {}; 40 | map['adult'] = adult; 41 | map['gender'] = gender; 42 | map['id'] = id; 43 | map['known_for_department'] = knownForDepartment; 44 | map['original_name'] = originalName; 45 | map['popularity'] = popularity; 46 | map['profile_path'] = profilePath; 47 | map['credit_id'] = creditId; 48 | map['department'] = department; 49 | map['job'] = job; 50 | return map; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/category/category.dart: -------------------------------------------------------------------------------- 1 | // import 'package:equatable/equatable.dart'; 2 | 3 | class Categroy_Home { 4 | Categroy_Home({ 5 | this.navbarId, 6 | this.navbarName, 7 | this.navbarType, 8 | this.searchTags, 9 | this.searchWords, 10 | }); 11 | 12 | String? navbarId; 13 | String? navbarName; 14 | String? navbarType; 15 | List? searchTags; 16 | String? searchWords; 17 | 18 | factory Categroy_Home.fromJson(Map json) => Categroy_Home( 19 | navbarId: json["navbar_id"], 20 | navbarName: json["navbar_name"], 21 | navbarType: json["navbar_type"], 22 | searchTags: json["search_tags"] == null 23 | ? [] 24 | : List.from( 25 | json["search_tags"]!.map((x) => SearchTag.fromJson(x))), 26 | searchWords: json["search_words"], 27 | ); 28 | 29 | Map toJson() => { 30 | "navbar_id": navbarId, 31 | "navbar_name": navbarName, 32 | "navbar_type": navbarType, 33 | "search_tags": searchTags == null 34 | ? [] 35 | : List.from(searchTags!.map((x) => x.toJson())), 36 | "search_words": searchWords, 37 | }; 38 | } 39 | 40 | class SearchTag { 41 | SearchTag({ 42 | this.tagId, 43 | this.tagName, 44 | }); 45 | 46 | String? tagId; 47 | String? tagName; 48 | 49 | factory SearchTag.fromJson(Map json) => SearchTag( 50 | tagId: json["tag_id"], 51 | tagName: json["tag_name"], 52 | ); 53 | 54 | Map toJson() => { 55 | "tag_id": tagId, 56 | "tag_name": tagName, 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/genre/genre.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class Genre extends Equatable { 4 | final String id; 5 | final String name; 6 | 7 | const Genre({ 8 | required this.id, 9 | required this.name, 10 | }); 11 | 12 | Genre.fromJson(dynamic json) 13 | : id = json['id'].toString(), 14 | name = json['name'].toString(); 15 | 16 | Map toJson() { 17 | final map = {}; 18 | map['id'] = id; 19 | map['name'] = name; 20 | return map; 21 | } 22 | 23 | @override 24 | List get props => [id, name]; 25 | } 26 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/genre/genres.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | import 'genre.dart'; 4 | 5 | class Genres extends Equatable { 6 | late List? genres; 7 | 8 | Genres({required this.genres}); 9 | 10 | Genres.fromJson(dynamic json) { 11 | if (json['genres'] != null) { 12 | genres = []; 13 | json['genres'].forEach((v) { 14 | genres!.add(Genre.fromJson(v)); 15 | }); 16 | } 17 | } 18 | 19 | Map toJson() { 20 | final map = {}; 21 | if (genres != null) { 22 | map['genres'] = genres!.map((v) => v.toJson()).toList(); 23 | } 24 | return map; 25 | } 26 | 27 | @override 28 | List get props => [genres]; 29 | } 30 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/models.dart: -------------------------------------------------------------------------------- 1 | export 'movies/movies_response.dart'; 2 | export 'movie_detail/movie_detail_response.dart'; 3 | export 'genre/genre.dart'; 4 | export 'videos/video_response.dart'; 5 | export 'category/category.dart'; 6 | export 'navi/navilist.dart'; 7 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movie_detail/belongs_to_collection.dart: -------------------------------------------------------------------------------- 1 | part of 'movie_detail_response.dart'; 2 | 3 | class BelongsToCollection extends Equatable { 4 | final int? id; 5 | final String? name; 6 | final String? posterPath; 7 | final String? backdropPath; 8 | 9 | const BelongsToCollection({ 10 | this.id, 11 | this.name, 12 | this.posterPath, 13 | this.backdropPath, 14 | }); 15 | 16 | BelongsToCollection.fromJson(Map json) 17 | : id = json['id'], 18 | name = json['name'], 19 | posterPath = json['poster_path'], 20 | backdropPath = json['backdrop_path']; 21 | 22 | Map toJson() { 23 | final Map data = {}; 24 | data['id'] = id; 25 | data['name'] = name; 26 | data['poster_path'] = posterPath; 27 | data['backdrop_path'] = backdropPath; 28 | return data; 29 | } 30 | 31 | @override 32 | List get props => [id, name, posterPath, backdropPath]; 33 | } 34 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movie_detail/genres_of_movie.dart: -------------------------------------------------------------------------------- 1 | part of 'movie_detail_response.dart'; 2 | 3 | class GenreOfMovie extends Equatable { 4 | final int? id; 5 | final String? name; 6 | 7 | const GenreOfMovie({ 8 | this.id, 9 | this.name, 10 | }); 11 | 12 | GenreOfMovie.fromJson(Map json) 13 | : id = json['id'], 14 | name = json['name']; 15 | 16 | Map toJson() { 17 | final Map data = {}; 18 | data['id'] = id; 19 | data['name'] = name; 20 | return data; 21 | } 22 | 23 | @override 24 | List get props => [id, name]; 25 | } 26 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movie_detail/production_companies.dart: -------------------------------------------------------------------------------- 1 | part of 'movie_detail_response.dart'; 2 | 3 | class ProductionCompanies extends Equatable { 4 | final int? id; 5 | final String? logoPath; 6 | final String? name; 7 | final String? originCountry; 8 | 9 | const ProductionCompanies({ 10 | this.id, 11 | this.logoPath, 12 | this.name, 13 | this.originCountry, 14 | }); 15 | 16 | ProductionCompanies.fromJson(Map json) 17 | : id = json['id'], 18 | logoPath = json['logo_path'], 19 | name = json['name'], 20 | originCountry = json['origin_country']; 21 | 22 | Map toJson() { 23 | final Map data = {}; 24 | data['id'] = id; 25 | data['logo_path'] = logoPath; 26 | data['name'] = name; 27 | data['origin_country'] = originCountry; 28 | return data; 29 | } 30 | 31 | @override 32 | List get props => [id, logoPath, name, originCountry]; 33 | } 34 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movie_detail/production_countries.dart: -------------------------------------------------------------------------------- 1 | part of 'movie_detail_response.dart'; 2 | 3 | class ProductionCountries extends Equatable { 4 | final String? iso31661, name; 5 | 6 | const ProductionCountries({this.iso31661, this.name}); 7 | 8 | ProductionCountries.fromJson(Map json) 9 | : iso31661 = json['iso_3166_1'], 10 | name = json['name']; 11 | 12 | Map toJson() { 13 | final Map data = {}; 14 | data['iso_3166_1'] = iso31661; 15 | data['name'] = name; 16 | return data; 17 | } 18 | 19 | @override 20 | List get props => [iso31661, name]; 21 | } 22 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movie_detail/spoken_languages.dart: -------------------------------------------------------------------------------- 1 | part of 'movie_detail_response.dart'; 2 | 3 | class SpokenLanguages extends Equatable { 4 | final String? englishName, iso6391, name; 5 | 6 | const SpokenLanguages({ 7 | this.englishName, 8 | this.iso6391, 9 | this.name, 10 | }); 11 | 12 | SpokenLanguages.fromJson(Map json) 13 | : englishName = json['english_name'], 14 | iso6391 = json['iso_639_1'], 15 | name = json['name']; 16 | 17 | Map toJson() { 18 | final Map data = {}; 19 | data['english_name'] = englishName; 20 | data['iso_639_1'] = iso6391; 21 | data['name'] = name; 22 | return data; 23 | } 24 | 25 | @override 26 | List get props => [englishName, iso6391, name]; 27 | } 28 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movies/dates.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class Dates extends Equatable { 4 | final String? maximum, minimum; 5 | 6 | const Dates({this.maximum, this.minimum}); 7 | 8 | Dates.fromJson(Map json) 9 | : maximum = json['maximum'], 10 | minimum = json['minimum']; 11 | 12 | Map toJson() { 13 | final Map data = {}; 14 | data['maximum'] = maximum; 15 | data['minimum'] = minimum; 16 | return data; 17 | } 18 | 19 | @override 20 | List get props => [maximum, minimum]; 21 | } 22 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movies/movies_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class MovieData extends Equatable { 4 | final String? id; 5 | final String? backdropPath; 6 | final String? originalLanguage; 7 | final String? overview; 8 | final String? posterPath; 9 | final String? title; 10 | final String? voteAverage; 11 | 12 | const MovieData({ 13 | this.backdropPath, 14 | this.id, 15 | this.originalLanguage, 16 | this.overview, 17 | this.posterPath, 18 | this.title, 19 | this.voteAverage, 20 | }); 21 | 22 | MovieData.fromJson(Map json) 23 | : backdropPath = json['backdrop_path'], 24 | id = json['id'].toString(), 25 | originalLanguage = json['original_language'], 26 | overview = json['overview'], 27 | posterPath = json['poster_path'], 28 | title = json['title'], 29 | voteAverage = json['vote_average'].toString(); 30 | 31 | Map toJson() { 32 | final Map data = {}; 33 | data['backdrop_path'] = backdropPath; 34 | data['id'] = id; 35 | data['original_language'] = originalLanguage; 36 | data['overview'] = overview; 37 | data['poster_path'] = posterPath; 38 | data['title'] = title; 39 | data['vote_average'] = voteAverage; 40 | return data; 41 | } 42 | 43 | @override 44 | List get props => [ 45 | backdropPath, 46 | id, 47 | originalLanguage, 48 | overview, 49 | posterPath, 50 | title, 51 | voteAverage 52 | ]; 53 | } 54 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/movies/movies_response.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:movies_api/src/models/movies/dates.dart'; 3 | 4 | import 'movies_data.dart'; 5 | 6 | class MoviesResponse extends Equatable { 7 | final Dates? dates; 8 | final int? page; 9 | final List? results; 10 | final int? totalPages; 11 | final int? totalResults; 12 | 13 | const MoviesResponse({ 14 | this.dates, 15 | this.page, 16 | this.results, 17 | this.totalPages, 18 | this.totalResults, 19 | }); 20 | 21 | Map toJson() { 22 | final Map data = {}; 23 | if (dates != null) { 24 | data['dates'] = dates!.toJson(); 25 | } 26 | data['page'] = page; 27 | if (results != null) { 28 | data['results'] = results!.map((v) => v.toJson()).toList(); 29 | } 30 | data['total_pages'] = totalPages; 31 | data['total_results'] = totalResults; 32 | return data; 33 | } 34 | 35 | MoviesResponse.fromJson(Map json) 36 | : dates = json['dates'] != null ? Dates.fromJson(json['dates']) : null, 37 | page = json['page'], 38 | results = (json['results'] as List) 39 | .map((e) => MovieData.fromJson(e)) 40 | .toList(), 41 | totalPages = json['total_pages'], 42 | totalResults = json['total_results']; 43 | 44 | @override 45 | List get props => [ 46 | dates, 47 | page, 48 | results, 49 | totalPages, 50 | totalResults, 51 | ]; 52 | } 53 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/navi/navi_banner.dart: -------------------------------------------------------------------------------- 1 | class Navi_Banner { 2 | Navi_Banner({ 3 | this.bannerId, 4 | this.title, 5 | this.coverUri, 6 | this.clickParam, 7 | }); 8 | 9 | String? bannerId; 10 | String? title; 11 | String? coverUri; 12 | ClickParam? clickParam; 13 | 14 | factory Navi_Banner.fromJson(Map json) => Navi_Banner( 15 | bannerId: json["banner_id"], 16 | title: json["title"], 17 | coverUri: json["cover_uri"], 18 | clickParam: json["click_param"] == null 19 | ? null 20 | : ClickParam.fromJson(json["click_param"]), 21 | ); 22 | 23 | Map toJson() => { 24 | "banner_id": bannerId, 25 | "title": title, 26 | "cover_uri": coverUri, 27 | "click_param": clickParam?.toJson(), 28 | }; 29 | } 30 | 31 | class ClickParam { 32 | ClickParam({ 33 | this.path, 34 | this.type, 35 | this.value, 36 | }); 37 | 38 | String? path; 39 | int? type; 40 | int? value; 41 | 42 | factory ClickParam.fromJson(Map json) => ClickParam( 43 | path: json["path"], 44 | type: json["type"], 45 | value: json["value"], 46 | ); 47 | 48 | Map toJson() => { 49 | "path": path, 50 | "type": type, 51 | "value": value, 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/videos/video_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class Results extends Equatable { 4 | final String? iso6391; 5 | final String? iso31661; 6 | final String? name; 7 | final String? key; 8 | final String? site; 9 | final int? size; 10 | final String? type; 11 | final bool? official; 12 | final String? publishedAt; 13 | final String? id; 14 | 15 | const Results({ 16 | required this.iso6391, 17 | required this.iso31661, 18 | required this.name, 19 | required this.key, 20 | required this.site, 21 | required this.size, 22 | required this.type, 23 | required this.official, 24 | required this.publishedAt, 25 | required this.id, 26 | }); 27 | 28 | Results.fromJson(dynamic json) 29 | : iso6391 = json['iso_639_1'], 30 | iso31661 = json['iso_3166_1'], 31 | name = json['name'], 32 | key = json['key'], 33 | site = json['site'], 34 | size = json['size'], 35 | type = json['type'], 36 | official = json['official'], 37 | publishedAt = json['published_at'], 38 | id = json['id']; 39 | 40 | Map toJson() { 41 | final map = {}; 42 | map['iso_639_1'] = iso6391; 43 | map['iso_3166_1'] = iso31661; 44 | map['name'] = name; 45 | map['key'] = key; 46 | map['site'] = site; 47 | map['size'] = size; 48 | map['type'] = type; 49 | map['official'] = official; 50 | map['published_at'] = publishedAt; 51 | map['id'] = id; 52 | return map; 53 | } 54 | 55 | @override 56 | List get props => [ 57 | iso6391, 58 | iso31661, 59 | name, 60 | key, 61 | site, 62 | size, 63 | type, 64 | official, 65 | publishedAt, 66 | id, 67 | ]; 68 | } 69 | -------------------------------------------------------------------------------- /packages/movies_api/lib/src/models/videos/video_response.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | import 'video_data.dart'; 4 | 5 | class VideosResponse extends Equatable { 6 | late final int? id; 7 | late final List? results; 8 | 9 | VideosResponse({ 10 | required this.id, 11 | required this.results, 12 | }); 13 | 14 | VideosResponse.fromJson(dynamic json) { 15 | id = json['id']; 16 | if (json['results'] != null) { 17 | results = []; 18 | json['results'].forEach((v) { 19 | results!.add(Results.fromJson(v)); 20 | }); 21 | } 22 | } 23 | 24 | Map toJson() { 25 | final map = {}; 26 | map['id'] = id; 27 | if (results != null) { 28 | map['results'] = results!.map((v) => v.toJson()).toList(); 29 | } 30 | return map; 31 | } 32 | 33 | @override 34 | List get props => [id, results]; 35 | } 36 | -------------------------------------------------------------------------------- /packages/movies_api/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: movies_api 2 | description: A new Flutter package project. 3 | version: 0.0.1 4 | publish_to: none 5 | homepage: 6 | 7 | environment: 8 | sdk: '>=2.19.0 <3.0.0' 9 | flutter: ">=1.17.0" 10 | 11 | dependencies: 12 | equatable: ^2.0.5 13 | flutter: 14 | sdk: flutter 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^2.0.0 20 | 21 | # For information on the generic Dart part of this file, see the 22 | # following page: https://dart.dev/tools/pub/pubspec 23 | 24 | # The following section is specific to Flutter packages. 25 | flutter: 26 | 27 | # To add assets to your package, add an assets section, like this: 28 | # assets: 29 | # - images/a_dot_burr.jpeg 30 | # - images/a_dot_ham.jpeg 31 | # 32 | # For details regarding assets in packages, see 33 | # https://flutter.dev/assets-and-images/#from-packages 34 | # 35 | # An image asset can refer to one or more resolution-specific "variants", see 36 | # https://flutter.dev/assets-and-images/#resolution-aware 37 | 38 | # To add custom fonts to your package, add a fonts section here, 39 | # in this "flutter" section. Each entry in this list should have a 40 | # "family" key with the font family name, and a "fonts" key with a 41 | # list giving the asset and other descriptors for the font. For 42 | # example: 43 | # fonts: 44 | # - family: Schyler 45 | # fonts: 46 | # - asset: fonts/Schyler-Regular.ttf 47 | # - asset: fonts/Schyler-Italic.ttf 48 | # style: italic 49 | # - family: Trajan Pro 50 | # fonts: 51 | # - asset: fonts/TrajanPro.ttf 52 | # - asset: fonts/TrajanPro_Bold.ttf 53 | # weight: 700 54 | # 55 | # For details regarding fonts in packages, see 56 | # https://flutter.dev/custom-fonts/#from-packages 57 | -------------------------------------------------------------------------------- /packages/movies_api/test/moies_api_test.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/packages/movies_api/test/moies_api_test.dart -------------------------------------------------------------------------------- /packages/movies_data/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | -------------------------------------------------------------------------------- /packages/movies_data/.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: b06b8b2710955028a6b562f5aa6fe62941d6febf 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/movies_data/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /packages/movies_data/LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /packages/movies_data/README.md: -------------------------------------------------------------------------------- 1 | 13 | 14 | TODO: Put a short description of the package here that helps potential users 15 | know whether this package might be useful for them. 16 | 17 | ## Features 18 | 19 | TODO: List what your package can do. Maybe include images, gifs, or videos. 20 | 21 | ## Getting started 22 | 23 | TODO: List prerequisites and provide or point to information on how to 24 | start using the package. 25 | 26 | ## Usage 27 | 28 | TODO: Include short and useful examples for package users. Add longer examples 29 | to `/example` folder. 30 | 31 | ```dart 32 | const like = 'sample'; 33 | ``` 34 | 35 | ## Additional information 36 | 37 | TODO: Tell users more about the package: where to find more information, how to 38 | contribute to the package, how to file issues, what response they can expect 39 | from the package authors, and more. 40 | -------------------------------------------------------------------------------- /packages/movies_data/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/movies_data/lib/movies_data.dart: -------------------------------------------------------------------------------- 1 | library movies_data; 2 | 3 | export 'package:movies_data/src/models/models.dart'; 4 | export 'package:movies_data/src/repositories/movies_repository.dart'; 5 | export 'package:movies_data/src/repositories/auth_repository.dart'; 6 | export 'package:movies_data/src/repositories/storage_repository.dart'; 7 | export 'package:movies_data/src/repositories/config_repository.dart'; 8 | import 'package:movies_api/src/models/category/category.dart'; 9 | import 'package:movies_api/src/models/navi/navilist.dart'; 10 | // export 'package:movies_data/src/log.dart'; 11 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/api/language_preferences.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | const LANG_EN = 'en'; 4 | const LANG_RU = 'ru'; 5 | const LANG_ZH = 'zh'; 6 | 7 | class LanguagePreferences { 8 | static const APP_LANGUAGE = "app_language"; 9 | late SharedPreferences preferences; 10 | 11 | LanguagePreferences(SharedPreferences sharedPreferences) 12 | : preferences = sharedPreferences; 13 | 14 | setLanguage(String langCode) async { 15 | preferences.setString(APP_LANGUAGE, langCode); 16 | } 17 | 18 | Future getLanguage() async { 19 | return preferences.getString(APP_LANGUAGE) ?? LANG_EN; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/api/theme_preferences.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | class ThemePreference { 4 | static const APP_THEME = "app_theme"; 5 | late SharedPreferences preferences; 6 | 7 | ThemePreference(SharedPreferences sharedPreferences) 8 | : preferences = sharedPreferences; 9 | 10 | setDarkTheme(bool value) async { 11 | preferences.setBool(APP_THEME, value); 12 | } 13 | 14 | Future getTheme() async { 15 | return preferences.getBool(APP_THEME) ?? false; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/log.dart: -------------------------------------------------------------------------------- 1 | // TODO Implement this library. 2 | 3 | void logger(String string) {} 4 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/cast/cast_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class CastItem extends Equatable { 4 | final int? gender; 5 | final int? id; 6 | final String? originalName; 7 | final double? popularity; 8 | final String? profilePath; 9 | final int? castId; 10 | final String? character; 11 | final String? creditId; 12 | final int? order; 13 | 14 | final String? bwh; 15 | final String? age; 16 | final String? body; 17 | final String? res_tid_name; 18 | 19 | CastItem( 20 | {this.gender, 21 | this.id, 22 | this.originalName, 23 | this.popularity, 24 | this.profilePath, 25 | this.castId, 26 | this.character, 27 | this.creditId, 28 | this.body, 29 | this.bwh, 30 | this.age, 31 | this.res_tid_name, 32 | this.order}); 33 | 34 | @override 35 | List get props => [ 36 | gender, 37 | id, 38 | originalName, 39 | popularity, 40 | profilePath, 41 | castId, 42 | character, 43 | creditId, 44 | order, 45 | body, 46 | bwh, 47 | age, 48 | res_tid_name, 49 | ]; 50 | } 51 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/genre/genre_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class GenreItem extends Equatable { 4 | final String id; 5 | final String name; 6 | final bool isActive; 7 | 8 | GenreItem({ 9 | required this.id, 10 | required this.name, 11 | this.isActive = false, 12 | }); 13 | 14 | @override 15 | List get props => [id, name, isActive]; 16 | } 17 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/models.dart: -------------------------------------------------------------------------------- 1 | export 'package:movies_data/src/models/genre/genre_item.dart'; 2 | export 'package:movies_data/src/models/movie_data/movie_detail.dart'; 3 | export 'package:movies_data/src/models/movie_item/movie_item.dart'; 4 | export 'package:movies_data/src/models/movie_item/movies_list.dart'; 5 | export 'package:movies_data/src/models/videos/videos_item.dart'; 6 | export 'package:movies_data/src/models/cast/cast_item.dart'; 7 | export 'package:movies_data/src/models/response_state.dart'; 8 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/movie_data/movie_detail.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class MovieDetail extends Equatable { 4 | final String id; 5 | final String title; 6 | final String poserPath; 7 | final String backdropPath; 8 | final String duration; 9 | final String rating; 10 | final String releaseData; 11 | final List genres; 12 | final String overview; 13 | final String language; 14 | 15 | MovieDetail({ 16 | required this.id, 17 | required this.title, 18 | required this.poserPath, 19 | required this.backdropPath, 20 | required this.duration, 21 | required this.rating, 22 | required this.releaseData, 23 | required this.genres, 24 | required this.overview, 25 | required this.language, 26 | }); 27 | 28 | @override 29 | List get props => [ 30 | id, 31 | title, 32 | poserPath, 33 | backdropPath, 34 | duration, 35 | rating, 36 | releaseData, 37 | genres, 38 | overview, 39 | language, 40 | ]; 41 | } 42 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/movie_item/movie_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:storage_api/storage_api.dart'; 3 | 4 | class MovieItem extends Equatable { 5 | final String id; 6 | final String title; 7 | final String rate; 8 | final String posterPath; 9 | final String backdropPath; 10 | 11 | final String? uploadUserNickname; 12 | final String? uploadUserUri; 13 | final String? playTimes; 14 | final String? createdTick; 15 | 16 | MovieItem({ 17 | required this.id, 18 | required this.title, 19 | required this.rate, 20 | required this.posterPath, 21 | required this.backdropPath, 22 | this.uploadUserNickname, 23 | this.uploadUserUri, 24 | this.playTimes, 25 | this.createdTick, 26 | }); 27 | 28 | MovieItem.fromStorage(MovieItemEntity entity) 29 | : this.id = entity.id, 30 | this.title = entity.title, 31 | this.posterPath = entity.posterPath, 32 | this.rate = entity.rating, 33 | this.uploadUserNickname = "", 34 | this.uploadUserUri = "", 35 | this.playTimes = "", 36 | this.createdTick = "", 37 | this.backdropPath = entity.backdropPath ?? ''; 38 | 39 | @override 40 | List get props => [id, title, rate, posterPath, backdropPath]; 41 | } 42 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/movie_item/movies_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | import 'movie_item.dart'; 4 | 5 | class MoviesList extends Equatable { 6 | final List? movies; 7 | final int? page; 8 | 9 | MoviesList({ 10 | this.movies, 11 | this.page, 12 | }); 13 | 14 | @override 15 | String toString() => { 16 | 'movies': movies, 17 | 'page': page, 18 | }.toString(); 19 | 20 | @override 21 | List get props => [movies, page]; 22 | } 23 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/response_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | 3 | @immutable 4 | abstract class ResponseState { 5 | const ResponseState(); 6 | 7 | T? getValueOrNull() { 8 | if (this is Success) return (this as Success).data; 9 | return null; 10 | } 11 | 12 | // Call this fun only in success cases 13 | T get successValue => (this as Success).data; 14 | 15 | Object? get errorValue => (this as Fail).error; 16 | 17 | } 18 | 19 | class Success extends ResponseState { 20 | final T data; 21 | 22 | const Success({required this.data}); 23 | } 24 | 25 | class Fail extends ResponseState { 26 | final Object? error; 27 | 28 | const Fail({required this.error}); 29 | } 30 | 31 | class NoConnection extends ResponseState {} 32 | 33 | class Empty extends ResponseState {} 34 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/models/videos/videos_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class Videos extends Equatable { 4 | final String id; 5 | final List videos; 6 | 7 | Videos({ 8 | required this.id, 9 | required this.videos, 10 | }); 11 | 12 | @override 13 | List get props => [id, videos]; 14 | } 15 | 16 | class VideoItem extends Equatable { 17 | final String id; 18 | final String size; 19 | final String key; 20 | final String name; 21 | 22 | VideoItem({ 23 | required this.name, 24 | required this.id, 25 | required this.size, 26 | required this.key, 27 | }); 28 | 29 | bool compareKey(String? key) { 30 | return key == this.key; 31 | } 32 | 33 | @override 34 | List get props => [id, key, size, name]; 35 | } 36 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/repositories/auth_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | 5 | const userStatus = 'user_status'; 6 | 7 | enum AuthenticationStatus { unknown, unauthenticated, authenticated } 8 | 9 | class AuthRepository { 10 | final SharedPreferences sharedPreferences; 11 | 12 | AuthRepository(this.sharedPreferences); 13 | 14 | final _controller = StreamController(); 15 | 16 | Stream get status async* { 17 | final status = sharedPreferences.getBool(userStatus) ?? false; 18 | print(status); 19 | if (status) { 20 | yield AuthenticationStatus.authenticated; 21 | } else { 22 | yield AuthenticationStatus.unauthenticated; 23 | } 24 | yield* _controller.stream; 25 | } 26 | 27 | Future logout() async { 28 | final state = await sharedPreferences.setBool(userStatus, false); 29 | _controller.sink.add(AuthenticationStatus.unauthenticated); 30 | return state; 31 | } 32 | 33 | Future login() async { 34 | final state = await sharedPreferences.setBool(userStatus, true); 35 | _controller.sink.add(AuthenticationStatus.authenticated); 36 | return state; 37 | } 38 | 39 | void dispose() => _controller.close(); 40 | } 41 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/repositories/base_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:movies_data/movies_data.dart'; 4 | 5 | typedef ResultCallback = Future Function(); 6 | 7 | class BaseRepository { 8 | Future> launchWithCatchError( 9 | ResultCallback callback) async { 10 | try { 11 | return Success(data: await callback()); 12 | } on IOException { 13 | return NoConnection(); 14 | } catch (error) { 15 | return Fail(error: error); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/movies_data/lib/src/repositories/config_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:movies_data/src/api/language_preferences.dart'; 2 | import 'package:movies_data/src/api/theme_preferences.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | 5 | export 'package:movies_data/src/api/language_preferences.dart'; 6 | 7 | class ConfigRepository { 8 | final ThemePreference _themePreference; 9 | final LanguagePreferences _languagePreferences; 10 | 11 | ConfigRepository(SharedPreferences sharedPreferences) 12 | : _themePreference = ThemePreference(sharedPreferences), 13 | _languagePreferences = LanguagePreferences(sharedPreferences) { 14 | init(); 15 | } 16 | 17 | init() async { 18 | _darkTheme = await _themePreference.getTheme(); 19 | _appLocale = await _languagePreferences.getLanguage(); 20 | } 21 | 22 | bool _darkTheme = false; 23 | 24 | bool get darkTheme => _darkTheme; 25 | 26 | String _appLocale = LANG_EN; 27 | 28 | String get appLang => _appLocale; 29 | 30 | set appLang(String langCode) { 31 | _appLocale = langCode; 32 | _languagePreferences.setLanguage(langCode); 33 | } 34 | 35 | set darkTheme(bool value) { 36 | _darkTheme = value; 37 | _themePreference.setDarkTheme(value); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/movies_data/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: movies_data 2 | description: A new Flutter package project. 3 | version: 0.0.1 4 | publish_to: none 5 | homepage: 6 | 7 | environment: 8 | sdk: '>=2.19.0 <3.0.0' 9 | flutter: ">=1.17.0" 10 | 11 | dependencies: 12 | dio: ^4.0.6 13 | equatable: ^2.0.5 14 | http: ^0.13.5 15 | movies_api: 16 | path: ../movies_api 17 | storage_api: 18 | path: ../storage_api 19 | shared_preferences: ^2.0.17 20 | sqflite: ^2.2.4+1 21 | hive: ^2.2.3 22 | rxdart: ^0.27.7 23 | path_provider: ^2.0.12 24 | 25 | 26 | dev_dependencies: 27 | 28 | # For information on the generic Dart part of this file, see the 29 | # following page: https://dart.dev/tools/pub/pubspec 30 | 31 | # The following section is specific to Flutter packages. 32 | flutter: 33 | 34 | # To add assets to your package, add an assets section, like this: 35 | # assets: 36 | # - images/a_dot_burr.jpeg 37 | # - images/a_dot_ham.jpeg 38 | # 39 | # For details regarding assets in packages, see 40 | # https://flutter.dev/assets-and-images/#from-packages 41 | # 42 | # An image asset can refer to one or more resolution-specific "variants", see 43 | # https://flutter.dev/assets-and-images/#resolution-aware 44 | 45 | # To add custom fonts to your package, add a fonts section here, 46 | # in this "flutter" section. Each entry in this list should have a 47 | # "family" key with the font family name, and a "fonts" key with a 48 | # list giving the asset and other descriptors for the font. For 49 | # example: 50 | # fonts: 51 | # - family: Schyler 52 | # fonts: 53 | # - asset: fonts/Schyler-Regular.ttf 54 | # - asset: fonts/Schyler-Italic.ttf 55 | # style: italic 56 | # - family: Trajan Pro 57 | # fonts: 58 | # - asset: fonts/TrajanPro.ttf 59 | # - asset: fonts/TrajanPro_Bold.ttf 60 | # weight: 700 61 | # 62 | # For details regarding fonts in packages, see 63 | # https://flutter.dev/custom-fonts/#from-packages 64 | -------------------------------------------------------------------------------- /packages/movies_data/test/movies_data_test.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/packages/movies_data/test/movies_data_test.dart -------------------------------------------------------------------------------- /packages/storage_api/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | -------------------------------------------------------------------------------- /packages/storage_api/.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: b06b8b2710955028a6b562f5aa6fe62941d6febf 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/storage_api/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /packages/storage_api/LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /packages/storage_api/README.md: -------------------------------------------------------------------------------- 1 | 13 | 14 | TODO: Put a short description of the package here that helps potential users 15 | know whether this package might be useful for them. 16 | 17 | ## Features 18 | 19 | TODO: List what your package can do. Maybe include images, gifs, or videos. 20 | 21 | ## Getting started 22 | 23 | TODO: List prerequisites and provide or point to information on how to 24 | start using the package. 25 | 26 | ## Usage 27 | 28 | TODO: Include short and useful examples for package users. Add longer examples 29 | to `/example` folder. 30 | 31 | ```dart 32 | const like = 'sample'; 33 | ``` 34 | 35 | ## Additional information 36 | 37 | TODO: Tell users more about the package: where to find more information, how to 38 | contribute to the package, how to file issues, what response they can expect 39 | from the package authors, and more. 40 | -------------------------------------------------------------------------------- /packages/storage_api/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/storage_api/lib/src/favorites_storage_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:storage_api/src/models/movie_item_entity.dart'; 2 | 3 | abstract class FavoritesStorageApi { 4 | /// {@macro storage_api} 5 | const FavoritesStorageApi(); 6 | 7 | /// Provides a [Stream] of all movies. 8 | Stream> getMovies(); 9 | 10 | /// Saves a [movie]. 11 | /// 12 | /// If a [movie] with the same id already exists, it will be replaced. 13 | Future saveMovie(MovieItemEntity movie); 14 | 15 | /// Deletes the movie with the given id. 16 | /// 17 | /// If no movie with the given id exists, a [MovieNotFoundException] error is 18 | /// thrown. 19 | Future deleteMovie(String id); 20 | 21 | /// Deletes all movies. 22 | /// 23 | /// Returns nothing. 24 | Future clearAll(); 25 | 26 | /// check movie by id 27 | /// 28 | Future checkWhetherIsMarkedOrNot(String id); 29 | 30 | void close(); 31 | } 32 | 33 | class MovieNotFoundException implements Exception {} 34 | -------------------------------------------------------------------------------- /packages/storage_api/lib/src/genres_storage_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:storage_api/src/models/genre_entity.dart'; 2 | 3 | abstract class GenresStorageApi { 4 | const GenresStorageApi(); 5 | 6 | /// Provides a [Stream] of all genres. 7 | Stream> getGenres(); 8 | 9 | /// Saves All genres from from user selection 10 | /// Receives [Set] of genres 11 | Future saveListOfGenres(Set genres); 12 | 13 | /// Removes genre by id 14 | Future deleteGenre(String id); 15 | 16 | /// change genre selection 17 | Future changeFlag(GenreEntity genre); 18 | 19 | /// Removes all saved genres 20 | Future clearGenre(); 21 | 22 | void close(); 23 | } 24 | 25 | class GenreNotFoundException implements Exception {} 26 | 27 | -------------------------------------------------------------------------------- /packages/storage_api/lib/src/models/genre_entity.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class GenreEntity extends Equatable { 4 | final String name; 5 | final String id; 6 | final bool isActive; 7 | 8 | const GenreEntity({ 9 | required this.name, 10 | required this.id, 11 | this.isActive = false, 12 | }); 13 | 14 | GenreEntity changeFlag() { 15 | return GenreEntity( 16 | name: name, 17 | id: id, 18 | isActive: !isActive, 19 | ); 20 | } 21 | 22 | Map toJson() { 23 | final map = {}; 24 | map['id'] = id; 25 | map['name'] = name; 26 | map['is_active'] = isActive; 27 | return map; 28 | } 29 | 30 | @override 31 | List get props => [id, name, isActive]; 32 | } 33 | -------------------------------------------------------------------------------- /packages/storage_api/lib/src/models/movie_item_entity.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | const keyId = 'id'; 4 | const keyTitle = 'title'; 5 | const keyPosterPath = 'poster_path'; 6 | const keyRating = 'rating'; 7 | const keyBackdropPath = 'backdrop_path'; 8 | 9 | class MovieItemEntity extends Equatable { 10 | final String id; 11 | final String posterPath; 12 | final String? backdropPath; 13 | final String title; 14 | final String rating; 15 | 16 | const MovieItemEntity( 17 | {required this.id, 18 | required this.posterPath, 19 | required this.title, 20 | required this.rating, this.backdropPath}); 21 | 22 | MovieItemEntity.fromJson(Map json) 23 | : id = json[keyId], 24 | posterPath = json[keyPosterPath], 25 | title = json[keyTitle], 26 | rating = json[keyRating], 27 | backdropPath = json[keyRating]; 28 | 29 | Map toJson() { 30 | final map = {}; 31 | map[keyId] = id; 32 | map[keyPosterPath] = posterPath; 33 | map[keyBackdropPath] = backdropPath; 34 | map[keyTitle] = title; 35 | map[keyRating] = rating; 36 | return map; 37 | } 38 | 39 | @override 40 | List get props => [id, posterPath, title, rating, backdropPath]; 41 | } 42 | -------------------------------------------------------------------------------- /packages/storage_api/lib/storage_api.dart: -------------------------------------------------------------------------------- 1 | library storage_api; 2 | 3 | export 'package:storage_api/src/favorites_storage_api.dart'; 4 | export 'package:storage_api/src/genres_storage_api.dart'; 5 | export 'package:storage_api/src/models/movie_item_entity.dart'; 6 | export 'package:storage_api/src/models/genre_entity.dart'; -------------------------------------------------------------------------------- /packages/storage_api/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: storage_api 2 | description: A new Flutter package project. 3 | version: 0.0.1 4 | homepage: 5 | 6 | environment: 7 | sdk: '>=2.19.0 <3.0.0' 8 | flutter: ">=1.17.0" 9 | 10 | dependencies: 11 | equatable: ^2.0.5 12 | flutter: 13 | sdk: flutter 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | flutter_lints: ^2.0.0 19 | 20 | # For information on the generic Dart part of this file, see the 21 | # following page: https://dart.dev/tools/pub/pubspec 22 | 23 | # The following section is specific to Flutter packages. 24 | flutter: 25 | 26 | # To add assets to your package, add an assets section, like this: 27 | # assets: 28 | # - images/a_dot_burr.jpeg 29 | # - images/a_dot_ham.jpeg 30 | # 31 | # For details regarding assets in packages, see 32 | # https://flutter.dev/assets-and-images/#from-packages 33 | # 34 | # An image asset can refer to one or more resolution-specific "variants", see 35 | # https://flutter.dev/assets-and-images/#resolution-aware 36 | 37 | # To add custom fonts to your package, add a fonts section here, 38 | # in this "flutter" section. Each entry in this list should have a 39 | # "family" key with the font family name, and a "fonts" key with a 40 | # list giving the asset and other descriptors for the font. For 41 | # example: 42 | # fonts: 43 | # - family: Schyler 44 | # fonts: 45 | # - asset: fonts/Schyler-Regular.ttf 46 | # - asset: fonts/Schyler-Italic.ttf 47 | # style: italic 48 | # - family: Trajan Pro 49 | # fonts: 50 | # - asset: fonts/TrajanPro.ttf 51 | # - asset: fonts/TrajanPro_Bold.ttf 52 | # weight: 700 53 | # 54 | # For details regarding fonts in packages, see 55 | # https://flutter.dev/custom-fonts/#from-packages 56 | -------------------------------------------------------------------------------- /packages/storage_api/test/storage_api_test.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/packages/storage_api/test/storage_api_test.dart -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-07_14-10-52.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-07_14-10-52.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-07_14-11-15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-07_14-11-15.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_08-43-21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_08-43-21.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_08-47-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_08-47-20.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_08-49-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_08-49-25.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_08-52-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_08-52-02.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_09-04-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_09-04-57.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_09-16-56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_09-16-56.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_09-17-39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_09-17-39.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_09-30-31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_09-30-31.png -------------------------------------------------------------------------------- /previewimsages/Snipaste_2023-04-08_09-41-37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/Snipaste_2023-04-08_09-41-37.png -------------------------------------------------------------------------------- /previewimsages/android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/android.png -------------------------------------------------------------------------------- /previewimsages/ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/previewimsages/ios.png -------------------------------------------------------------------------------- /timefile: -------------------------------------------------------------------------------- 1 | 2023-06-01 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moive1", 3 | "short_name": "moive1", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | void RegisterPlugins(flutter::PluginRegistry* registry) { 14 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 15 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 16 | SharePlusWindowsPluginCApiRegisterWithRegistrar( 17 | registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); 18 | UrlLauncherWindowsRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 20 | } 21 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | permission_handler_windows 7 | share_plus 8 | url_launcher_windows 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"moive1", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicolastinkl/NVPlayer/d39d9c489743e787f44cf4ecd2c1055fa24223d5/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | --------------------------------------------------------------------------------