├── linux ├── .gitignore ├── main.cc ├── flutter │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── my_application.h └── my_application.cc ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── 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-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── RunnerTests │ └── RunnerTests.swift └── .gitignore ├── macos ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_64.png │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_512.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Release.entitlements │ ├── DebugProfile.entitlements │ ├── MainFlutterWindow.swift │ └── Info.plist ├── .gitignore ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme └── RunnerTests │ └── RunnerTests.swift ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── assets └── images │ └── splash-bg.png ├── lib ├── core │ ├── usecase │ │ └── usecase.dart │ ├── configs │ │ ├── assets │ │ │ ├── app_vectors.dart │ │ │ └── app_images.dart │ │ └── theme │ │ │ ├── app_colors.dart │ │ │ └── app_theme.dart │ ├── entity │ │ ├── keyword.dart │ │ └── trailer.dart │ ├── models │ │ ├── keyword.dart │ │ └── trailer.dart │ ├── constants │ │ └── api_url.dart │ └── network │ │ ├── interceptors.dart │ │ └── dio_client.dart ├── presentation │ ├── splash │ │ ├── bloc │ │ │ ├── splash_state.dart │ │ │ └── splash_cubit.dart │ │ └── pages │ │ │ └── splash.dart │ ├── search │ │ ├── bloc │ │ │ ├── selectable_option_cubit.dart │ │ │ ├── search_state.dart │ │ │ └── search_cubit.dart │ │ ├── widgets │ │ │ ├── search_field.dart │ │ │ ├── selectable_option.dart │ │ │ ├── search_options.dart │ │ │ └── search_content.dart │ │ └── pages │ │ │ └── search.dart │ ├── watch │ │ ├── widgets │ │ │ ├── video_title.dart │ │ │ ├── video_vote_average.dart │ │ │ ├── video_release_date.dart │ │ │ ├── video_overview.dart │ │ │ ├── video_player.dart │ │ │ ├── tv_keywords.dart │ │ │ ├── similar_tvs.dart │ │ │ ├── recommendation_tvs.dart │ │ │ ├── similar_movies.dart │ │ │ └── recommendation_movies.dart │ │ ├── bloc │ │ │ ├── trailer_state.dart │ │ │ └── trailer_cubit.dart │ │ └── pages │ │ │ ├── tv_watch.dart │ │ │ └── movie_watch.dart │ ├── home │ │ ├── bloc │ │ │ ├── trendings_state.dart │ │ │ └── trendings_cubit.dart │ │ ├── widgets │ │ │ ├── category_text.dart │ │ │ ├── trending_movies.dart │ │ │ ├── popular_tv.dart │ │ │ └── now_playing_movies.dart │ │ └── pages │ │ │ └── home.dart │ └── auth │ │ └── pages │ │ ├── signup.dart │ │ └── signin.dart ├── domain │ ├── tv │ │ ├── repositories │ │ │ └── tv.dart │ │ ├── usecases │ │ │ ├── get_popular_tv.dart │ │ │ ├── search_tv.dart │ │ │ ├── get_keywords.dart │ │ │ ├── get_similar_tvs.dart │ │ │ └── get_recommendation_tvs.dart │ │ └── entities │ │ │ └── tv.dart │ ├── auth │ │ ├── repositories │ │ │ └── auth.dart │ │ └── usecases │ │ │ ├── is_logged_in.dart │ │ │ ├── signin.dart │ │ │ └── signup.dart │ └── movie │ │ ├── repositories │ │ └── movie.dart │ │ ├── usecases │ │ ├── search_movie.dart │ │ ├── get_movie_trailer.dart │ │ ├── get_trending_movies.dart │ │ ├── get_similar_movies.dart │ │ ├── get_now_playing_movies.dart │ │ └── get_recommendation_movies.dart │ │ └── entities │ │ └── movie.dart ├── common │ ├── helper │ │ ├── message │ │ │ └── display_message.dart │ │ ├── mapper │ │ │ ├── keyword.dart │ │ │ ├── trailer.dart │ │ │ ├── tv.dart │ │ │ └── movie.dart │ │ └── navigation │ │ │ └── app_navigation.dart │ ├── bloc │ │ ├── generic_data_state.dart │ │ └── generic_data_cubit.dart │ └── widgets │ │ ├── appbar │ │ └── app_bar.dart │ │ ├── tv │ │ └── tv_card.dart │ │ └── movie │ │ └── movie_card.dart ├── data │ ├── auth │ │ ├── models │ │ │ ├── signin_req_params.dart │ │ │ └── signup_req_params.dart │ │ ├── sources │ │ │ └── auth_api_service.dart │ │ └── repositories │ │ │ └── auth.dart │ ├── tv │ │ ├── models │ │ │ └── tv.dart │ │ ├── sources │ │ │ └── tv.dart │ │ └── repositories │ │ │ └── tv.dart │ └── movie │ │ ├── models │ │ └── movie.dart │ │ ├── sources │ │ └── movie.dart │ │ └── repositories │ │ └── movie.dart ├── main.dart └── service_locator.dart ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── utils.h │ ├── runner.exe.manifest │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ └── win32_window.h ├── flutter │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── .gitignore └── CMakeLists.txt ├── android ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── 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 │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── netflix │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── build.gradle └── settings.gradle ├── README.md ├── pubspec.yaml ├── .gitignore ├── test └── widget_test.dart ├── analysis_options.yaml └── .metadata /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /assets/images/splash-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/assets/images/splash-bg.png -------------------------------------------------------------------------------- /lib/core/usecase/usecase.dart: -------------------------------------------------------------------------------- 1 | abstract class UseCase { 2 | Future call({Params params}); 3 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/core/configs/assets/app_vectors.dart: -------------------------------------------------------------------------------- 1 | class AppVectors { 2 | 3 | static const basePath = 'assets/vectors/'; 4 | 5 | static const logo = '${basePath}logo.svg'; 6 | } -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/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/mahdinazmi/Flutter-Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/netflix/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.netflix 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mahdinazmi/Flutter-Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /lib/core/entity/keyword.dart: -------------------------------------------------------------------------------- 1 | class KeywordEntity { 2 | KeywordEntity({ 3 | required this.name, 4 | required this.id, 5 | }); 6 | 7 | final String ? name; 8 | final int ? id; 9 | 10 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | org.gradle.java.home=C\:\\Users\\Great Master\\.jdks\\corretto-17.0.12 5 | 6 | 7 | -------------------------------------------------------------------------------- /lib/presentation/splash/bloc/splash_state.dart: -------------------------------------------------------------------------------- 1 | abstract class SplashState {} 2 | 3 | class DisplaySplash extends SplashState {} 4 | 5 | class Authenticated extends SplashState {} 6 | 7 | class UnAuthenticated extends SplashState {} -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /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 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /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.6.3-all.zip 6 | -------------------------------------------------------------------------------- /lib/core/configs/theme/app_colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppColors { 4 | 5 | static const primary = Color(0xffE21221); 6 | static const background = Color(0xff1D1E22); 7 | static const secondBackground = Color(0xff181A20); 8 | } -------------------------------------------------------------------------------- /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/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/domain/tv/repositories/tv.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | 3 | abstract class TVRepository { 4 | Future getPopularTV(); 5 | Future getRecommendationTVs(int tvId); 6 | Future getSimilarTVs(int tvId); 7 | Future getKeywords(int tvId); 8 | Future searchTV(String query); 9 | } -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/common/helper/message/display_message.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DisplayMessage { 4 | 5 | static void errorMessage(String message,BuildContext context) { 6 | var snackbar = SnackBar(content: Text(message),behavior: SnackBarBehavior.floating,); 7 | ScaffoldMessenger.of(context).showSnackBar(snackbar); 8 | } 9 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/common/helper/mapper/keyword.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/core/entity/keyword.dart'; 2 | import 'package:netflix/core/models/keyword.dart'; 3 | 4 | class KeywordMapper { 5 | 6 | static KeywordEntity toEntity(KeywordModel keywordModel) { 7 | return KeywordEntity( 8 | name: keywordModel.name, 9 | id: keywordModel.id 10 | ); 11 | } 12 | } -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /lib/core/models/keyword.dart: -------------------------------------------------------------------------------- 1 | class KeywordModel { 2 | KeywordModel({ 3 | required this.name, 4 | required this.id, 5 | }); 6 | 7 | final String ? name; 8 | final int ? id; 9 | 10 | factory KeywordModel.fromJson(Map < String, dynamic > json) { 11 | return KeywordModel( 12 | name: json["name"], 13 | id: json["id"], 14 | ); 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /lib/presentation/search/bloc/selectable_option_cubit.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | 5 | enum SearchType {movie,tv} 6 | 7 | class SelectableOptionCubit extends Cubit { 8 | SelectableOptionCubit() : super(SearchType.movie); 9 | 10 | void selectMovie() => emit(SearchType.movie); 11 | void selectTV() => emit(SearchType.tv); 12 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/core/configs/assets/app_images.dart: -------------------------------------------------------------------------------- 1 | class AppImages { 2 | 3 | static const basePath = 'assets/images/'; 4 | 5 | static const movieImageBasePath = 'https://image.tmdb.org/t/p/w500'; 6 | 7 | static const splashBackground = '${basePath}splash-bg.png'; 8 | 9 | static const defaultImage = 'https://coffective.com/wp-content/uploads/2018/06/default-featured-image.png.jpg'; 10 | } -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /lib/common/bloc/generic_data_state.dart: -------------------------------------------------------------------------------- 1 | abstract class GenericDataState {} 2 | 3 | class DataLoading extends GenericDataState {} 4 | 5 | class DataLoaded extends GenericDataState { 6 | final T data; 7 | DataLoaded({required this.data}); 8 | } 9 | 10 | class FailureLoadData extends GenericDataState { 11 | final String errorMessage; 12 | FailureLoadData({required this.errorMessage}); 13 | } -------------------------------------------------------------------------------- /lib/domain/auth/repositories/auth.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/data/auth/models/signin_req_params.dart'; 3 | 4 | import '../../../data/auth/models/signup_req_params.dart'; 5 | 6 | abstract class AuthRepository { 7 | 8 | Future signup(SignupReqParams params); 9 | Future signin(SigninReqParams params); 10 | Future isLoggedIn(); 11 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/domain/auth/usecases/is_logged_in.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/core/usecase/usecase.dart'; 2 | import 'package:netflix/domain/auth/repositories/auth.dart'; 3 | import 'package:netflix/service_locator.dart'; 4 | 5 | class IsLoggedInUseCase extends UseCase { 6 | 7 | @override 8 | Future call({params}) async { 9 | return await sl().isLoggedIn(); 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /lib/domain/movie/repositories/movie.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | 3 | abstract class MovieRepository { 4 | 5 | Future getTrendingMovies(); 6 | Future getNowPlayingMovies(); 7 | Future getMovieTrailer(int movieId); 8 | Future getRecommendationMovies(int movieId); 9 | Future getSimilarMovies(int movieId); 10 | Future searchMovie(String query); 11 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/data/auth/models/signin_req_params.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | 3 | class SigninReqParams { 4 | final String email; 5 | final String password; 6 | SigninReqParams({ 7 | required this.email, 8 | required this.password 9 | }); 10 | 11 | Map toMap() { 12 | return { 13 | 'email': email, 14 | 'password': password, 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/domain/tv/usecases/get_popular_tv.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/tv/repositories/tv.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetPopularTVUseCase extends UseCase { 7 | 8 | @override 9 | Future call({params}) async { 10 | return await sl().getPopularTV(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/domain/tv/usecases/search_tv.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/tv/repositories/tv.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class SearchTVUseCase extends UseCase { 7 | 8 | @override 9 | Future call({String ? params}) async { 10 | return await sl().searchTV(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/data/auth/models/signup_req_params.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | 3 | class SignupReqParams { 4 | final String email; 5 | final String password; 6 | SignupReqParams({ 7 | required this.email, 8 | required this.password 9 | }); 10 | 11 | Map toMap() { 12 | return { 13 | 'email': email, 14 | 'password': password, 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/domain/tv/usecases/get_keywords.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/tv/repositories/tv.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetTVKeywordsUseCase extends UseCase { 7 | 8 | @override 9 | Future call({int ? params}) async { 10 | return await sl().getKeywords(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/video_title.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class VideoTitle extends StatelessWidget { 4 | final String title; 5 | const VideoTitle({required this.title,super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Text( 10 | title, 11 | style: const TextStyle( 12 | fontWeight: FontWeight.bold, 13 | fontSize: 20 14 | ), 15 | ); 16 | } 17 | } -------------------------------------------------------------------------------- /lib/domain/tv/usecases/get_similar_tvs.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/tv/repositories/tv.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetSimilarTvsUseCase extends UseCase { 7 | 8 | @override 9 | Future call({int ? params}) async { 10 | return await sl().getSimilarTVs(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/domain/movie/usecases/search_movie.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/movie/repositories/movie.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class SearchMovieUseCase extends UseCase { 7 | 8 | @override 9 | Future call({String ? params}) async { 10 | return await sl().searchMovie(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 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 | -------------------------------------------------------------------------------- /lib/domain/movie/usecases/get_movie_trailer.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/movie/repositories/movie.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetMovieTrailerUseCase extends UseCase { 7 | 8 | @override 9 | Future call({int ? params}) async { 10 | return await sl().getMovieTrailer(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/domain/movie/usecases/get_trending_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/movie/repositories/movie.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetTrendingMoviesUseCase extends UseCase { 7 | 8 | @override 9 | Future call({params}) async { 10 | return await sl().getTrendingMovies(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/domain/movie/usecases/get_similar_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/movie/repositories/movie.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetSimilarMoviesUseCase extends UseCase { 7 | 8 | @override 9 | Future call({int ? params}) async { 10 | return await sl().getSimilarMovies(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/domain/tv/usecases/get_recommendation_tvs.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/tv/repositories/tv.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetRecommendationTvsUseCase extends UseCase { 7 | 8 | @override 9 | Future call({int ? params}) async { 10 | return await sl().getRecommendationTVs(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /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/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 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 | -------------------------------------------------------------------------------- /lib/domain/movie/usecases/get_now_playing_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/movie/repositories/movie.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetNowPlayingMoviesUseCase extends UseCase { 7 | 8 | @override 9 | Future call({params}) async { 10 | return await sl().getNowPlayingMovies(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /lib/domain/movie/usecases/get_recommendation_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/domain/movie/repositories/movie.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class GetRecommendationMoviesUseCase extends UseCase { 7 | 8 | @override 9 | Future call({int ? params}) async { 10 | return await sl().getRecommendationMovies(params!); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import flutter_inappwebview_macos 9 | import shared_preferences_foundation 10 | 11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 12 | InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) 13 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 14 | } 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /lib/presentation/home/bloc/trendings_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/domain/movie/entities/movie.dart'; 2 | 3 | abstract class TrendingsState {} 4 | 5 | class TrendingMoviesLoading extends TrendingsState {} 6 | 7 | class TrendingMoviesLoaded extends TrendingsState { 8 | final List movies; 9 | TrendingMoviesLoaded({required this.movies}); 10 | } 11 | 12 | class FailureLoadTrendingMovies extends TrendingsState { 13 | final String errorMessage; 14 | FailureLoadTrendingMovies({required this.errorMessage}); 15 | } -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /lib/presentation/watch/bloc/trailer_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:youtube_player_flutter/youtube_player_flutter.dart'; 2 | 3 | abstract class TrailerState {} 4 | 5 | class TrailerLoading extends TrailerState {} 6 | 7 | class TrailerLoaded extends TrailerState { 8 | final YoutubePlayerController youtubePlayerController; 9 | TrailerLoaded({required this.youtubePlayerController}); 10 | } 11 | 12 | class FailuerLoadTrailer extends TrailerState { 13 | final String errorMessage; 14 | FailuerLoadTrailer({required this.errorMessage}); 15 | } -------------------------------------------------------------------------------- /lib/domain/auth/usecases/signin.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/data/auth/models/signin_req_params.dart'; 4 | import 'package:netflix/domain/auth/repositories/auth.dart'; 5 | import 'package:netflix/service_locator.dart'; 6 | 7 | class SigninUseCase extends UseCase { 8 | 9 | @override 10 | Future call({SigninReqParams? params}) async { 11 | return await sl().signin(params!); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /lib/domain/auth/usecases/signup.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'package:netflix/data/auth/models/signup_req_params.dart'; 4 | import 'package:netflix/domain/auth/repositories/auth.dart'; 5 | import 'package:netflix/service_locator.dart'; 6 | 7 | class SignupUseCase extends UseCase { 8 | 9 | @override 10 | Future call({SignupReqParams? params}) async { 11 | return await sl().signup(params!); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/video_vote_average.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class VideoVoteAverage extends StatelessWidget { 4 | final double voteAverage; 5 | const VideoVoteAverage({required this.voteAverage,super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Row( 10 | children: [ 11 | const Icon( 12 | Icons.star, 13 | color: Colors.amber, 14 | size: 20, 15 | ), 16 | Text( 17 | ' ${voteAverage.toStringAsFixed(1)}' 18 | ), 19 | ], 20 | ); 21 | } 22 | } -------------------------------------------------------------------------------- /lib/presentation/home/widgets/category_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CategoryText extends StatelessWidget { 4 | final String title; 5 | const CategoryText({required this.title,super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Padding( 10 | padding: const EdgeInsets.only( 11 | top: 12, 12 | left: 16 13 | ), 14 | child: Text( 15 | title, 16 | style: const TextStyle( 17 | fontWeight: FontWeight.bold, 18 | fontSize: 24 19 | ), 20 | ), 21 | ); 22 | } 23 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # netflix 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /lib/core/constants/api_url.dart: -------------------------------------------------------------------------------- 1 | class ApiUrl { 2 | 3 | static const baseURL = 'https://netflix-backend-production-8413.up.railway.app/'; 4 | static const apiV = 'api/v1/'; 5 | 6 | static const signup = '${apiV}auth/signup'; 7 | static const signin = '${apiV}auth/signin'; 8 | static const trendingMovies = '${apiV}movie/trending'; 9 | static const nowPlayingMovies = '${apiV}movie/nowplaying'; 10 | static const popularTV = '${apiV}tv/popular'; 11 | static const movie = '${apiV}movie/'; 12 | static const tv = '${apiV}tv/'; 13 | static const search = '${apiV}search/'; 14 | 15 | static const trailerBase = 'https://www.youtube.com/watch?v='; 16 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/core/entity/trailer.dart: -------------------------------------------------------------------------------- 1 | class TrailerEntity { 2 | TrailerEntity({ 3 | required this.iso6391, 4 | required this.iso31661, 5 | required this.name, 6 | required this.key, 7 | required this.site, 8 | required this.size, 9 | required this.type, 10 | required this.official, 11 | required this.publishedAt, 12 | required this.id, 13 | }); 14 | 15 | final String ? iso6391; 16 | final String ? iso31661; 17 | final String ? name; 18 | final String ? key; 19 | final String ? site; 20 | final int ? size; 21 | final String ? type; 22 | final bool ? official; 23 | final DateTime ? publishedAt; 24 | final String ? id; 25 | 26 | } -------------------------------------------------------------------------------- /lib/common/helper/mapper/trailer.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/core/entity/trailer.dart'; 2 | import 'package:netflix/core/models/trailer.dart'; 3 | 4 | class TrailerMapper { 5 | 6 | static TrailerEntity toEntity(TrailerModel trailerModel) { 7 | return TrailerEntity( 8 | iso6391: trailerModel.iso6391, 9 | iso31661: trailerModel.iso31661, 10 | name: trailerModel.name, 11 | key: trailerModel.key, 12 | site: trailerModel.site, 13 | size: trailerModel.size, 14 | type: trailerModel.type, 15 | official: trailerModel.official, 16 | publishedAt: trailerModel.publishedAt, 17 | id: trailerModel.id 18 | ); 19 | } 20 | } -------------------------------------------------------------------------------- /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 = netflix 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.netflix 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /lib/common/bloc/generic_data_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | import 'package:netflix/core/usecase/usecase.dart'; 3 | import 'generic_data_state.dart'; 4 | 5 | 6 | class GenericDataCubit extends Cubit { 7 | GenericDataCubit() : super(DataLoading()); 8 | 9 | 10 | void getData(UseCase usecase,{dynamic params}) async { 11 | var returnedData = await usecase.call(params: params); 12 | returnedData.fold( 13 | (error){ 14 | emit( 15 | FailureLoadData(errorMessage: error) 16 | ); 17 | }, 18 | (data){ 19 | emit( 20 | DataLoaded(data: data) 21 | ); 22 | } 23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /lib/presentation/search/bloc/search_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/domain/movie/entities/movie.dart'; 2 | import 'package:netflix/domain/tv/entities/tv.dart'; 3 | 4 | abstract class SearchState {} 5 | 6 | class SearchInitial extends SearchState {} 7 | 8 | class SearchLoading extends SearchState {} 9 | 10 | class MoviesLoaded extends SearchState { 11 | final List movies; 12 | MoviesLoaded({required this.movies}); 13 | } 14 | 15 | class TVsLoaded extends SearchState { 16 | final List tvs; 17 | TVsLoaded({required this.tvs}); 18 | } 19 | 20 | class SearchFailure extends SearchState { 21 | final String errorMessage; 22 | SearchFailure({required this.errorMessage}); 23 | } 24 | -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/video_release_date.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class VideoReleaseDate extends StatelessWidget { 4 | final DateTime releaseDate; 5 | const VideoReleaseDate({required this.releaseDate,super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Row( 10 | children: [ 11 | const Icon( 12 | Icons.calendar_month, 13 | size: 20, 14 | color: Colors.grey, 15 | ), 16 | 17 | Text( 18 | ' ${releaseDate.toString().split(' ')[0]}', 19 | style: const TextStyle( 20 | color: Colors.grey, 21 | ), 22 | ) 23 | ], 24 | ); 25 | } 26 | } -------------------------------------------------------------------------------- /lib/presentation/splash/bloc/splash_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | import 'package:netflix/domain/auth/usecases/is_logged_in.dart'; 3 | import 'package:netflix/presentation/splash/bloc/splash_state.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class SplashCubit extends Cubit { 7 | 8 | SplashCubit() : super(DisplaySplash()); 9 | 10 | void appStarted() async { 11 | await Future.delayed(const Duration(seconds: 2)); 12 | var isLoggedIn = await sl < IsLoggedInUseCase > ().call(); 13 | if (isLoggedIn) { 14 | emit(Authenticated()); 15 | } else { 16 | emit( 17 | UnAuthenticated() 18 | ); 19 | } 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: netflix 2 | description: "A new Flutter project." 3 | 4 | publish_to: 'none' 5 | 6 | version: 1.0.0+1 7 | 8 | environment: 9 | sdk: '>=3.4.3 <4.0.0' 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | 16 | cupertino_icons: ^1.0.6 17 | flutter_bloc: 18 | reactive_button: 0.0.9 19 | dartz: 20 | dio: 21 | logger: 22 | get_it: 23 | shared_preferences: 24 | flutter_svg: 25 | fan_carousel_image_slider: 26 | youtube_player_flutter: 9.0.0 27 | 28 | dev_dependencies: 29 | flutter_test: 30 | sdk: flutter 31 | 32 | flutter_lints: ^3.0.0 33 | 34 | flutter: 35 | 36 | uses-material-design: true 37 | 38 | assets: 39 | - assets/images/ 40 | - assets/vectors/ 41 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/common/helper/navigation/app_navigation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppNavigator { 4 | 5 | static void pushReplacement(BuildContext context,Widget widget) { 6 | Navigator.pushReplacement( 7 | context, 8 | MaterialPageRoute(builder: (context) => widget) 9 | ); 10 | } 11 | 12 | static void push(BuildContext context,Widget widget) { 13 | Navigator.push( 14 | context, 15 | MaterialPageRoute(builder: (context) => widget) 16 | ); 17 | } 18 | 19 | static void pushAndRemove(BuildContext context,Widget widget) { 20 | Navigator.pushAndRemoveUntil( 21 | context, 22 | MaterialPageRoute(builder: (context) => widget), 23 | (Route route) => false 24 | ); 25 | } 26 | } -------------------------------------------------------------------------------- /lib/presentation/home/bloc/trendings_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | import 'package:netflix/domain/movie/usecases/get_trending_movies.dart'; 3 | import 'package:netflix/presentation/home/bloc/trendings_state.dart'; 4 | import 'package:netflix/service_locator.dart'; 5 | 6 | class TrendingsCubit extends Cubit { 7 | TrendingsCubit() : super(TrendingMoviesLoading()); 8 | 9 | 10 | void getTrendingMovies() async { 11 | var returnedData = await sl().call(); 12 | returnedData.fold( 13 | (error){ 14 | emit( 15 | FailureLoadTrendingMovies(errorMessage: error) 16 | ); 17 | }, 18 | (data){ 19 | emit( 20 | TrendingMoviesLoaded(movies: data) 21 | ); 22 | } 23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/video_overview.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class VideoOverview extends StatelessWidget { 4 | final String overview; 5 | const VideoOverview({required this.overview,super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Column( 10 | crossAxisAlignment: CrossAxisAlignment.start, 11 | children: [ 12 | const Text( 13 | 'Overview', 14 | style: TextStyle( 15 | fontWeight: FontWeight.bold, 16 | fontSize: 20 17 | ), 18 | ), 19 | const SizedBox(height: 10, ), 20 | Text( 21 | overview, 22 | style: Theme.of(context).primaryTextTheme.bodyMedium 23 | ) 24 | ], 25 | ); 26 | } 27 | } -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "7.3.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /lib/common/helper/mapper/tv.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/data/tv/models/tv.dart'; 2 | import 'package:netflix/domain/tv/entities/tv.dart'; 3 | 4 | class TvMapper { 5 | 6 | static TVEntity toEntity(TVModel tvmodel) { 7 | return TVEntity( 8 | adult: tvmodel.adult, 9 | backdropPath: tvmodel.backdropPath, 10 | genreIds: tvmodel.genreIds, 11 | id: tvmodel.id, 12 | originCountry: tvmodel.originCountry, 13 | originalLanguage: tvmodel.originalLanguage, 14 | originalName: tvmodel.originalName, 15 | overview: tvmodel.overview, 16 | popularity: tvmodel.popularity, 17 | posterPath: tvmodel.posterPath, 18 | firstAirDate: tvmodel.firstAirDate, 19 | name: tvmodel.name, 20 | voteAverage: tvmodel.voteAverage, 21 | voteCount: tvmodel.voteCount 22 | ); 23 | } 24 | } -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /lib/common/helper/mapper/movie.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/data/movie/models/movie.dart'; 2 | import 'package:netflix/domain/movie/entities/movie.dart'; 3 | 4 | class MovieMapper { 5 | 6 | static MovieEntity toEntity(MovieModel movie) { 7 | return MovieEntity( 8 | backdropPath: movie.backdropPath, 9 | id: movie.id, 10 | title: movie.title, 11 | originalTitle: movie.originalTitle, 12 | overview: movie.overview, 13 | posterPath: movie.posterPath, 14 | mediaType: movie.mediaType, 15 | adult: movie.adult, 16 | originalLanguage: movie.originalLanguage, 17 | genreIds: movie.genreIds, 18 | popularity: movie.popularity, 19 | releaseDate: movie.releaseDate, 20 | video: movie.video, 21 | voteAverage: movie.voteAverage, 22 | voteCount: movie.voteCount 23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /lib/presentation/search/widgets/search_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/presentation/search/bloc/search_cubit.dart'; 4 | import 'package:netflix/presentation/search/bloc/selectable_option_cubit.dart'; 5 | 6 | class SearchField extends StatelessWidget { 7 | const SearchField({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return TextField( 12 | controller: context.read < SearchCubit > ().textEditingController , 13 | onChanged: (value) { 14 | context.read < SearchCubit > ().search( 15 | value, 16 | context.read < SelectableOptionCubit > ().state 17 | ); 18 | }, 19 | decoration: const InputDecoration( 20 | hintText: 'Search...' 21 | ), 22 | ); 23 | } 24 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/presentation/search/widgets/selectable_option.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/core/configs/theme/app_colors.dart'; 3 | 4 | class SelectableOption extends StatelessWidget { 5 | final String title; 6 | final bool isSelected; 7 | final VoidCallback onTap; 8 | const SelectableOption({ 9 | super.key, 10 | required this.title, 11 | required this.isSelected, 12 | required this.onTap 13 | }); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return GestureDetector( 18 | onTap: onTap, 19 | child: Container( 20 | width: 90, 21 | height: 40, 22 | decoration: BoxDecoration( 23 | borderRadius: BorderRadius.circular(10), 24 | color: isSelected ? AppColors.primary : AppColors.secondBackground 25 | ), 26 | child: Center( 27 | child: Text( 28 | title, 29 | ), 30 | ), 31 | ), 32 | ); 33 | } 34 | } -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netflix", 3 | "short_name": "netflix", 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/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 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:netflix/core/configs/theme/app_theme.dart'; 5 | import 'package:netflix/presentation/splash/bloc/splash_cubit.dart'; 6 | import 'package:netflix/service_locator.dart'; 7 | 8 | import 'presentation/splash/pages/splash.dart'; 9 | 10 | void main() { 11 | WidgetsFlutterBinding.ensureInitialized(); 12 | setupServiceLocator(); 13 | runApp(const MyApp()); 14 | } 15 | 16 | class MyApp extends StatelessWidget { 17 | const MyApp({super.key}); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | SystemChrome.setSystemUIOverlayStyle( 22 | const SystemUiOverlayStyle( 23 | statusBarColor: Colors.transparent 24 | ) 25 | ); 26 | return BlocProvider( 27 | create: (context) => SplashCubit()..appStarted(), 28 | child: MaterialApp( 29 | debugShowCheckedModeBanner: false, 30 | theme: AppTheme.appTheme, 31 | home: const SplashPage() 32 | ), 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/core/models/trailer.dart: -------------------------------------------------------------------------------- 1 | class TrailerModel { 2 | TrailerModel({ 3 | required this.iso6391, 4 | required this.iso31661, 5 | required this.name, 6 | required this.key, 7 | required this.site, 8 | required this.size, 9 | required this.type, 10 | required this.official, 11 | required this.publishedAt, 12 | required this.id, 13 | }); 14 | 15 | final String ? iso6391; 16 | final String ? iso31661; 17 | final String ? name; 18 | final String ? key; 19 | final String ? site; 20 | final int ? size; 21 | final String ? type; 22 | final bool ? official; 23 | final DateTime ? publishedAt; 24 | final String ? id; 25 | 26 | factory TrailerModel.fromJson(Map < String, dynamic > json) { 27 | return TrailerModel( 28 | iso6391: json["iso_639_1"], 29 | iso31661: json["iso_3166_1"], 30 | name: json["name"], 31 | key: json["key"], 32 | site: json["site"], 33 | size: json["size"], 34 | type: json["type"], 35 | official: json["official"], 36 | publishedAt: DateTime.tryParse(json["published_at"] ?? ""), 37 | id: json["id"], 38 | ); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:netflix/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/presentation/watch/bloc/trailer_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | import 'package:netflix/core/entity/trailer.dart'; 3 | import 'package:netflix/domain/movie/usecases/get_movie_trailer.dart'; 4 | import 'package:netflix/presentation/watch/bloc/trailer_state.dart'; 5 | import 'package:netflix/service_locator.dart'; 6 | import 'package:youtube_player_flutter/youtube_player_flutter.dart'; 7 | 8 | class TrailerCubit extends Cubit { 9 | TrailerCubit() : super (TrailerLoading()); 10 | 11 | 12 | void getMovieTrailer(int movieId) async { 13 | 14 | var returnedData = await sl().call( 15 | params:movieId 16 | ); 17 | 18 | returnedData.fold( 19 | (error) { 20 | emit(FailuerLoadTrailer(errorMessage: error )); 21 | }, 22 | (data) async{ 23 | TrailerEntity trailerEntity = data; 24 | YoutubePlayerController controller = YoutubePlayerController( 25 | initialVideoId: trailerEntity.key!, 26 | flags: const YoutubePlayerFlags( 27 | autoPlay: false, 28 | ), 29 | ); 30 | 31 | emit(TrailerLoaded(youtubePlayerController: controller )); 32 | } 33 | ); 34 | } 35 | } -------------------------------------------------------------------------------- /lib/domain/tv/entities/tv.dart: -------------------------------------------------------------------------------- 1 | import '../../../core/configs/assets/app_images.dart'; 2 | 3 | class TVEntity { 4 | TVEntity({ 5 | required this.adult, 6 | required this.backdropPath, 7 | required this.genreIds, 8 | required this.id, 9 | required this.originCountry, 10 | required this.originalLanguage, 11 | required this.originalName, 12 | required this.overview, 13 | required this.popularity, 14 | required this.posterPath, 15 | required this.firstAirDate, 16 | required this.name, 17 | required this.voteAverage, 18 | required this.voteCount, 19 | }); 20 | 21 | final bool ? adult; 22 | final String ? backdropPath; 23 | final List < int > genreIds; 24 | final int ? id; 25 | final List < String > originCountry; 26 | final String ? originalLanguage; 27 | final String ? originalName; 28 | final String ? overview; 29 | final double ? popularity; 30 | final String ? posterPath; 31 | final DateTime ? firstAirDate; 32 | final String ? name; 33 | final double ? voteAverage; 34 | final int ? voteCount; 35 | 36 | String providePosterPath() { 37 | return posterPath != null ? AppImages.movieImageBasePath + posterPath! : 38 | AppImages.defaultImage; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/video_player.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/presentation/watch/bloc/trailer_cubit.dart'; 4 | import 'package:youtube_player_flutter/youtube_player_flutter.dart'; 5 | 6 | import '../bloc/trailer_state.dart'; 7 | 8 | class VideoPlayer extends StatelessWidget { 9 | final int id; 10 | const VideoPlayer({required this.id,super.key}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return BlocProvider( 15 | create: (context) => TrailerCubit()..getMovieTrailer(id), 16 | child: BlocBuilder( 17 | builder: (context, state) { 18 | if (state is TrailerLoading){ 19 | return const Center(child: CircularProgressIndicator()); 20 | } 21 | if (state is TrailerLoaded) { 22 | return YoutubePlayer( 23 | controller: state.youtubePlayerController, 24 | showVideoProgressIndicator: true, 25 | ); 26 | } 27 | if (state is FailuerLoadTrailer) { 28 | return Center(child: Text(state.errorMessage)); 29 | } 30 | return Container(); 31 | }, 32 | ) 33 | ); 34 | } 35 | } -------------------------------------------------------------------------------- /lib/domain/movie/entities/movie.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/core/configs/assets/app_images.dart'; 2 | 3 | class MovieEntity { 4 | MovieEntity({ 5 | required this.backdropPath, 6 | required this.id, 7 | required this.title, 8 | required this.originalTitle, 9 | required this.overview, 10 | required this.posterPath, 11 | required this.mediaType, 12 | required this.adult, 13 | required this.originalLanguage, 14 | required this.genreIds, 15 | required this.popularity, 16 | required this.releaseDate, 17 | required this.video, 18 | required this.voteAverage, 19 | required this.voteCount, 20 | }); 21 | 22 | final String ? backdropPath; 23 | final int ? id; 24 | final String ? title; 25 | final String ? originalTitle; 26 | final String ? overview; 27 | final String ? posterPath; 28 | final String ? mediaType; 29 | final bool ? adult; 30 | final String ? originalLanguage; 31 | final List < int > genreIds; 32 | final double ? popularity; 33 | final DateTime ? releaseDate; 34 | final bool ? video; 35 | final double ? voteAverage; 36 | final int ? voteCount; 37 | 38 | String providePosterPath() { 39 | return posterPath != null ? AppImages.movieImageBasePath + posterPath! : 40 | AppImages.defaultImage; 41 | } 42 | } -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | netflix 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /lib/data/auth/sources/auth_api_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:netflix/core/constants/api_url.dart'; 4 | import 'package:netflix/core/network/dio_client.dart'; 5 | import 'package:netflix/data/auth/models/signin_req_params.dart'; 6 | import 'package:netflix/data/auth/models/signup_req_params.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | 9 | abstract class AuthService { 10 | 11 | Future signup(SignupReqParams params); 12 | Future signin(SigninReqParams params); 13 | } 14 | 15 | 16 | class AuthApiServiceImpl extends AuthService { 17 | 18 | 19 | @override 20 | Future signup(SignupReqParams params) async { 21 | try { 22 | 23 | var response = await sl().post( 24 | ApiUrl.signup, 25 | data: params.toMap() 26 | ); 27 | return Right(response.data); 28 | 29 | } on DioException catch(e) { 30 | return Left(e.response!.data['message']); 31 | } 32 | } 33 | 34 | @override 35 | Future signin(SigninReqParams params) async { 36 | try { 37 | 38 | var response = await sl().post( 39 | ApiUrl.signin, 40 | data: params.toMap() 41 | ); 42 | return Right(response.data); 43 | 44 | } on DioException catch(e) { 45 | return Left(e.response!.data['message']); 46 | } 47 | } 48 | 49 | 50 | } -------------------------------------------------------------------------------- /lib/presentation/search/pages/search.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/widgets/appbar/app_bar.dart'; 4 | import 'package:netflix/presentation/search/bloc/search_cubit.dart'; 5 | import 'package:netflix/presentation/search/bloc/selectable_option_cubit.dart'; 6 | import 'package:netflix/presentation/search/widgets/search_options.dart'; 7 | import '../widgets/search_content.dart'; 8 | import '../widgets/search_field.dart'; 9 | 10 | class SearchPage extends StatelessWidget { 11 | const SearchPage({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: const BasicAppbar( 17 | title: Text('Search'), 18 | ), 19 | body: MultiBlocProvider( 20 | providers: [ 21 | BlocProvider(create: (context) => SelectableOptionCubit()), 22 | BlocProvider(create: (context) => SearchCubit()) 23 | ], 24 | child: const Padding( 25 | padding: EdgeInsets.symmetric(horizontal: 16), 26 | child: Column( 27 | children: [ 28 | SearchField(), 29 | SizedBox(height: 16,), 30 | SearchOptions(), 31 | SizedBox(height: 16,), 32 | Expanded(child: SearchContent()) 33 | ], 34 | ), 35 | ), 36 | ), 37 | ); 38 | } 39 | } -------------------------------------------------------------------------------- /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"netflix", 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 | -------------------------------------------------------------------------------- /lib/core/configs/theme/app_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'app_colors.dart'; 4 | 5 | class AppTheme { 6 | 7 | static final appTheme = ThemeData( 8 | primaryColor: AppColors.primary, 9 | scaffoldBackgroundColor: AppColors.background, 10 | brightness: Brightness.dark, 11 | snackBarTheme: const SnackBarThemeData( 12 | backgroundColor: AppColors.background, 13 | contentTextStyle: TextStyle(color: Colors.white), 14 | ), 15 | inputDecorationTheme: InputDecorationTheme( 16 | filled: true, 17 | fillColor: const Color(0xff2C2B2B) , 18 | hintStyle: const TextStyle( 19 | color: Color(0xffA7A7A7), 20 | fontWeight: FontWeight.w400, 21 | ), 22 | contentPadding: const EdgeInsets.all(16), 23 | border: OutlineInputBorder( 24 | borderRadius: BorderRadius.circular(4), 25 | borderSide: BorderSide.none 26 | ), 27 | enabledBorder: OutlineInputBorder( 28 | borderRadius: BorderRadius.circular(4), 29 | borderSide: BorderSide.none 30 | ) 31 | ), 32 | elevatedButtonTheme: ElevatedButtonThemeData( 33 | style: ElevatedButton.styleFrom( 34 | backgroundColor: AppColors.primary, 35 | elevation: 0, 36 | textStyle: const TextStyle(fontSize: 16,fontWeight: FontWeight.w400), 37 | shape: RoundedRectangleBorder( 38 | borderRadius: BorderRadius.circular(100) 39 | ) 40 | ) 41 | ) 42 | ); 43 | } -------------------------------------------------------------------------------- /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 https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/tv_keywords.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/core/entity/keyword.dart'; 4 | import 'package:netflix/domain/tv/usecases/get_keywords.dart'; 5 | 6 | import '../../../common/bloc/generic_data_cubit.dart'; 7 | import '../../../common/bloc/generic_data_state.dart'; 8 | import '../../../service_locator.dart'; 9 | 10 | class TVKeywords extends StatelessWidget { 11 | final int tvId; 12 | const TVKeywords({required this.tvId,super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return BlocProvider( 17 | create: (context) => GenericDataCubit()..getData>(sl(),params: tvId), 18 | child: BlocBuilder( 19 | builder: (context, state) { 20 | if (state is DataLoading){ 21 | return const Center( 22 | child: CircularProgressIndicator() 23 | ); 24 | } 25 | 26 | if (state is DataLoaded ){ 27 | List keywords = state.data; 28 | return Wrap( 29 | spacing: 5, 30 | children: keywords.map((item) => Chip( 31 | label: Text( 32 | item.name! 33 | ), 34 | )).toList(), 35 | ); 36 | } 37 | 38 | if (state is FailureLoadData) { 39 | return Text(state.errorMessage); 40 | } 41 | 42 | return Container(); 43 | }, 44 | ) 45 | ); 46 | } 47 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/trending_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:fan_carousel_image_slider/fan_carousel_image_slider.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:netflix/core/configs/assets/app_images.dart'; 5 | import 'package:netflix/presentation/home/bloc/trendings_cubit.dart'; 6 | 7 | import '../bloc/trendings_state.dart'; 8 | 9 | class TrendingMovies extends StatelessWidget { 10 | const TrendingMovies({super.key}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return BlocProvider( 15 | create: (context) => TrendingsCubit()..getTrendingMovies(), 16 | child: BlocBuilder( 17 | builder: (context, state) { 18 | if (state is TrendingMoviesLoading){ 19 | return const Center( 20 | child: CircularProgressIndicator() 21 | ); 22 | } 23 | 24 | if (state is TrendingMoviesLoaded ){ 25 | return FanCarouselImageSlider.sliderType1( 26 | imagesLink: state.movies.map( 27 | (item) => AppImages.movieImageBasePath + item.posterPath.toString() 28 | ).toList(), 29 | isAssets: false, 30 | autoPlay: false, 31 | sliderHeight: 400, 32 | showIndicator: true, 33 | ); 34 | } 35 | 36 | if (state is FailureLoadTrendingMovies) { 37 | return Center(child: Text(state.errorMessage)); 38 | } 39 | 40 | return Container(); 41 | }, 42 | ) 43 | ); 44 | } 45 | } -------------------------------------------------------------------------------- /lib/presentation/search/bloc/search_cubit.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/domain/movie/usecases/search_movie.dart'; 4 | import 'package:netflix/domain/tv/usecases/search_tv.dart'; 5 | import 'package:netflix/presentation/search/bloc/search_state.dart'; 6 | import 'package:netflix/presentation/search/bloc/selectable_option_cubit.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | 9 | class SearchCubit extends Cubit { 10 | SearchCubit() : super(SearchInitial()); 11 | 12 | TextEditingController textEditingController = TextEditingController(); 13 | 14 | void search(String query, SearchType searchType) { 15 | if (query.isNotEmpty ) { 16 | emit(SearchLoading()); 17 | switch (searchType) { 18 | case SearchType.movie : 19 | searchMovie(query); 20 | break; 21 | case SearchType.tv : 22 | searchTV(query); 23 | break; 24 | } 25 | } 26 | } 27 | 28 | void searchMovie(String query) async { 29 | var returnedData = await sl().call(params: query); 30 | returnedData.fold( 31 | (errorMessage){ 32 | emit(SearchFailure(errorMessage: errorMessage)); 33 | }, 34 | (data) { 35 | emit(MoviesLoaded(movies: data)); 36 | } 37 | ); 38 | } 39 | 40 | void searchTV(String query) async { 41 | var returnedData = await sl().call(params: query); 42 | returnedData.fold( 43 | (errorMessage){ 44 | emit(SearchFailure(errorMessage: errorMessage)); 45 | }, 46 | (data) { 47 | emit(TVsLoaded(tvs: data)); 48 | } 49 | ); 50 | } 51 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/common/widgets/appbar/app_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../../core/configs/theme/app_colors.dart'; 4 | 5 | class BasicAppbar extends StatelessWidget implements PreferredSizeWidget { 6 | final Widget ? title; 7 | final Widget ? action; 8 | final Widget ? leading; 9 | final Color ? backgroundColor; 10 | final bool hideBack; 11 | final double ? height; 12 | const BasicAppbar({ 13 | this.title, 14 | this.hideBack = false, 15 | this.action, 16 | this.backgroundColor , 17 | this.height, 18 | this.leading, 19 | super.key 20 | }); 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return AppBar( 25 | backgroundColor: backgroundColor ?? Colors.transparent, 26 | elevation: 0, 27 | centerTitle: true, 28 | automaticallyImplyLeading: false, 29 | toolbarHeight: height ?? 80 , 30 | title: title ?? const Text(''), 31 | titleSpacing: 0, 32 | leadingWidth: leading != null ? 150 : null, 33 | actions: [ 34 | action ?? Container() 35 | ], 36 | leading: leading ?? (hideBack ? null : IconButton( 37 | onPressed: (){ 38 | Navigator.pop(context); 39 | }, 40 | icon: Container( 41 | height: 50, 42 | width: 50, 43 | decoration: const BoxDecoration( 44 | color: AppColors.secondBackground, 45 | shape: BoxShape.circle 46 | ), 47 | child: const Icon( 48 | Icons.arrow_back_ios_new, 49 | size: 15, 50 | color: Colors.white 51 | ), 52 | ), 53 | )), 54 | ); 55 | } 56 | 57 | @override 58 | Size get preferredSize => Size.fromHeight(height ?? 80); 59 | } -------------------------------------------------------------------------------- /lib/presentation/watch/pages/tv_watch.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/common/widgets/appbar/app_bar.dart'; 3 | import 'package:netflix/domain/tv/entities/tv.dart'; 4 | import 'package:netflix/presentation/watch/widgets/video_player.dart'; 5 | import '../widgets/recommendation_tvs.dart'; 6 | import '../widgets/similar_tvs.dart'; 7 | import '../widgets/tv_keywords.dart'; 8 | import '../widgets/video_overview.dart'; 9 | import '../widgets/video_title.dart'; 10 | import '../widgets/video_vote_average.dart'; 11 | 12 | class TVWatchPage extends StatelessWidget { 13 | final TVEntity tvEntity; 14 | const TVWatchPage({required this.tvEntity,super.key}); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: const BasicAppbar( 20 | hideBack: false, 21 | ), 22 | body: SingleChildScrollView( 23 | padding: const EdgeInsets.symmetric(horizontal: 16), 24 | child: Column( 25 | crossAxisAlignment: CrossAxisAlignment.start, 26 | children: [ 27 | VideoPlayer(id: tvEntity.id!), 28 | const SizedBox(height: 16,), 29 | VideoTitle(title: tvEntity.name!,), 30 | const SizedBox(height: 16,), 31 | TVKeywords(tvId: tvEntity.id!,), 32 | const SizedBox(height: 16,), 33 | VideoVoteAverage(voteAverage: tvEntity.voteAverage!,), 34 | const SizedBox(height: 16,), 35 | VideoOverview(overview: tvEntity.overview!,), 36 | const SizedBox(height: 16,), 37 | RecommendationTVs(tvId: tvEntity.id!,), 38 | const SizedBox(height: 16,), 39 | SimilarTVs(tvId: tvEntity.id!,) 40 | ], 41 | ), 42 | ), 43 | ); 44 | } 45 | } -------------------------------------------------------------------------------- /lib/data/auth/repositories/auth.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/data/auth/models/signin_req_params.dart'; 3 | 4 | import 'package:netflix/data/auth/models/signup_req_params.dart'; 5 | import 'package:netflix/data/auth/sources/auth_api_service.dart'; 6 | import 'package:netflix/domain/auth/repositories/auth.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | 10 | class AuthRepositoryImpl extends AuthRepository { 11 | 12 | 13 | @override 14 | Future signup(SignupReqParams params) async { 15 | var data = await sl().signup(params); 16 | return data.fold( 17 | (error) { 18 | return Left(error); 19 | }, 20 | (data) async { 21 | final SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 22 | sharedPreferences.setString('token',data['user']['token']); 23 | return Right(data); 24 | } 25 | ); 26 | } 27 | 28 | @override 29 | Future signin(SigninReqParams params) async { 30 | var data = await sl().signin(params); 31 | return data.fold( 32 | (error) { 33 | return Left(error); 34 | }, 35 | (data) async { 36 | final SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 37 | sharedPreferences.setString('token',data['user']['token']); 38 | return Right(data); 39 | } 40 | ); 41 | } 42 | 43 | @override 44 | Future isLoggedIn() async { 45 | final SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 46 | var token = sharedPreferences.getString('token'); 47 | if (token == null) { 48 | return false; 49 | } else { 50 | return true; 51 | } 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Netflix 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | netflix 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /lib/presentation/search/widgets/search_options.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | 4 | import '../bloc/search_cubit.dart'; 5 | import '../bloc/selectable_option_cubit.dart'; 6 | import 'selectable_option.dart'; 7 | 8 | class SearchOptions extends StatelessWidget { 9 | const SearchOptions({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return BlocBuilder < SelectableOptionCubit, SearchType > ( 14 | builder: (context, state) { 15 | return Row( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | children: [ 18 | SelectableOption( 19 | isSelected: context.read < SelectableOptionCubit > ().state == SearchType.movie, 20 | title: 'Movie', 21 | onTap: (){ 22 | context.read < SelectableOptionCubit > ().selectMovie(); 23 | context.read < SearchCubit > ().search( 24 | context.read < SearchCubit > ().textEditingController.text, 25 | context.read < SelectableOptionCubit > ().state 26 | ); 27 | }, 28 | ), 29 | const SizedBox(width: 16, ), 30 | SelectableOption( 31 | isSelected: context.read < SelectableOptionCubit > ().state == SearchType.tv, 32 | title: 'TV', 33 | onTap: (){ 34 | context.read < SelectableOptionCubit > ().selectTV(); 35 | context.read < SearchCubit > ().search( 36 | context.read < SearchCubit > ().textEditingController.text, 37 | context.read < SelectableOptionCubit > ().state 38 | ); 39 | }, 40 | ) 41 | ], 42 | ); 43 | }, 44 | ); 45 | } 46 | } -------------------------------------------------------------------------------- /.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: "761747bfc538b5af34aa0d3fac380f1bc331ec49" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 17 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 18 | - platform: android 19 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 20 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 21 | - platform: ios 22 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 23 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 24 | - platform: linux 25 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 26 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 27 | - platform: macos 28 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 29 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 30 | - platform: web 31 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 32 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 33 | - platform: windows 34 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 35 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /lib/presentation/home/pages/home.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/flutter_svg.dart'; 3 | import 'package:netflix/common/helper/navigation/app_navigation.dart'; 4 | import 'package:netflix/common/widgets/appbar/app_bar.dart'; 5 | import 'package:netflix/core/configs/assets/app_vectors.dart'; 6 | import 'package:netflix/presentation/home/widgets/category_text.dart'; 7 | import 'package:netflix/presentation/home/widgets/now_playing_movies.dart'; 8 | import 'package:netflix/presentation/home/widgets/popular_tv.dart'; 9 | import 'package:netflix/presentation/home/widgets/trending_movies.dart'; 10 | 11 | import '../../search/pages/search.dart'; 12 | 13 | class HomePage extends StatelessWidget { 14 | const HomePage({super.key}); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: BasicAppbar( 20 | hideBack: true, 21 | action: IconButton( 22 | icon: const Icon(Icons.search), 23 | onPressed: (){ 24 | AppNavigator.push(context, const SearchPage()); 25 | }, 26 | ), 27 | title: SvgPicture.asset( 28 | AppVectors.logo 29 | ), 30 | ), 31 | body: const SingleChildScrollView( 32 | child: Column( 33 | crossAxisAlignment: CrossAxisAlignment.start, 34 | children: [ 35 | CategoryText(title: 'Trendings 🔥'), 36 | TrendingMovies(), 37 | SizedBox(height: 16,), 38 | CategoryText(title: 'Now Playing'), 39 | SizedBox(height: 16,), 40 | NowPlayingMovies(), 41 | SizedBox(height: 16,), 42 | CategoryText(title: 'Popular TV'), 43 | SizedBox(height: 16,), 44 | PopularTv(), 45 | SizedBox(height: 16,), 46 | ], 47 | ), 48 | ), 49 | ); 50 | } 51 | } -------------------------------------------------------------------------------- /lib/data/tv/models/tv.dart: -------------------------------------------------------------------------------- 1 | class TVModel { 2 | TVModel({ 3 | required this.adult, 4 | required this.backdropPath, 5 | required this.genreIds, 6 | required this.id, 7 | required this.originCountry, 8 | required this.originalLanguage, 9 | required this.originalName, 10 | required this.overview, 11 | required this.popularity, 12 | required this.posterPath, 13 | required this.firstAirDate, 14 | required this.name, 15 | required this.voteAverage, 16 | required this.voteCount, 17 | }); 18 | 19 | final bool ? adult; 20 | final String ? backdropPath; 21 | final List < int > genreIds; 22 | final int ? id; 23 | final List < String > originCountry; 24 | final String ? originalLanguage; 25 | final String ? originalName; 26 | final String ? overview; 27 | final double ? popularity; 28 | final String ? posterPath; 29 | final DateTime ? firstAirDate; 30 | final String ? name; 31 | final double ? voteAverage; 32 | final int ? voteCount; 33 | 34 | factory TVModel.fromJson(Map < String, dynamic > json) { 35 | return TVModel( 36 | adult: json["adult"], 37 | backdropPath: json["backdrop_path"], 38 | genreIds: json["genre_ids"] == null ? [] : List < int > .from(json["genre_ids"] !.map((x) => x)), 39 | id: json["id"], 40 | originCountry: json["origin_country"] == null ? [] : List < String > .from(json["origin_country"] !.map((x) => x)), 41 | originalLanguage: json["original_language"], 42 | originalName: json["original_name"], 43 | overview: json["overview"], 44 | popularity: json["popularity"], 45 | posterPath: json["poster_path"], 46 | firstAirDate: DateTime.tryParse(json["first_air_date"] ?? ""), 47 | name: json["name"], 48 | voteAverage: double.tryParse(json["vote_average"].toString()), 49 | voteCount: json["vote_count"], 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/data/movie/models/movie.dart: -------------------------------------------------------------------------------- 1 | class MovieModel { 2 | MovieModel({ 3 | required this.backdropPath, 4 | required this.id, 5 | required this.title, 6 | required this.originalTitle, 7 | required this.overview, 8 | required this.posterPath, 9 | required this.mediaType, 10 | required this.adult, 11 | required this.originalLanguage, 12 | required this.genreIds, 13 | required this.popularity, 14 | required this.releaseDate, 15 | required this.video, 16 | required this.voteAverage, 17 | required this.voteCount, 18 | }); 19 | 20 | final String ? backdropPath; 21 | final int ? id; 22 | final String ? title; 23 | final String ? originalTitle; 24 | final String ? overview; 25 | final String ? posterPath; 26 | final String ? mediaType; 27 | final bool ? adult; 28 | final String ? originalLanguage; 29 | final List < int > genreIds; 30 | final double ? popularity; 31 | final DateTime ? releaseDate; 32 | final bool ? video; 33 | final double ? voteAverage; 34 | final int ? voteCount; 35 | 36 | factory MovieModel.fromJson(Map < String, dynamic > json) { 37 | return MovieModel( 38 | backdropPath: json["backdrop_path"], 39 | id: json["id"], 40 | title: json["title"], 41 | originalTitle: json["original_title"], 42 | overview: json["overview"], 43 | posterPath: json["poster_path"], 44 | mediaType: json["media_type"], 45 | adult: json["adult"], 46 | originalLanguage: json["original_language"], 47 | genreIds: json["genre_ids"] == null ? [] : List < int > .from(json["genre_ids"] !.map((x) => x)), 48 | popularity: json["popularity"], 49 | releaseDate: DateTime.tryParse(json["release_date"] ?? ""), 50 | video: json["video"], 51 | voteAverage: double.tryParse(json["vote_average"].toString()), 52 | voteCount: json["vote_count"], 53 | ); 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /lib/presentation/splash/pages/splash.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/helper/navigation/app_navigation.dart'; 4 | import 'package:netflix/core/configs/assets/app_images.dart'; 5 | import 'package:netflix/presentation/auth/pages/signin.dart'; 6 | import 'package:netflix/presentation/home/pages/home.dart'; 7 | import 'package:netflix/presentation/splash/bloc/splash_cubit.dart'; 8 | 9 | import '../bloc/splash_state.dart'; 10 | 11 | class SplashPage extends StatelessWidget { 12 | const SplashPage({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Scaffold( 17 | body: BlocListener( 18 | listener: (context, state) { 19 | if (state is UnAuthenticated) { 20 | AppNavigator.pushReplacement(context, SigninPage()); 21 | } 22 | 23 | if (state is Authenticated) { 24 | AppNavigator.pushReplacement(context, const HomePage()); 25 | } 26 | }, 27 | child: Stack( 28 | children: [ 29 | Container( 30 | decoration: const BoxDecoration( 31 | image: DecorationImage( 32 | image: AssetImage( 33 | AppImages.splashBackground 34 | ) 35 | ) 36 | ), 37 | ), 38 | Container( 39 | decoration: BoxDecoration( 40 | gradient: LinearGradient( 41 | begin: Alignment.center, 42 | end: Alignment.bottomCenter, 43 | colors: [ 44 | const Color(0xff1A1B20).withOpacity(0), 45 | const Color(0xff1A1B20) 46 | ] 47 | ) 48 | ), 49 | ) 50 | ], 51 | ), 52 | ), 53 | ); 54 | } 55 | } -------------------------------------------------------------------------------- /lib/presentation/home/widgets/popular_tv.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/bloc/generic_data_cubit.dart'; 4 | import 'package:netflix/common/bloc/generic_data_state.dart'; 5 | import 'package:netflix/common/widgets/tv/tv_card.dart'; 6 | import 'package:netflix/domain/tv/entities/tv.dart'; 7 | import 'package:netflix/domain/tv/usecases/get_popular_tv.dart'; 8 | import 'package:netflix/service_locator.dart'; 9 | 10 | class PopularTv extends StatelessWidget { 11 | const PopularTv({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return BlocProvider( 16 | create: (context) => GenericDataCubit()..getData>(sl()), 17 | child: BlocBuilder( 18 | builder: (context, state) { 19 | if (state is DataLoading){ 20 | return const Center( 21 | child: CircularProgressIndicator() 22 | ); 23 | } 24 | 25 | if (state is DataLoaded ){ 26 | return SizedBox( 27 | height: 300, 28 | child: ListView.separated( 29 | scrollDirection: Axis.horizontal, 30 | padding: const EdgeInsets.symmetric(horizontal: 16), 31 | itemBuilder: (context, index) { 32 | return TVCard( 33 | tvEntity: state.data[index], 34 | ); 35 | }, 36 | separatorBuilder: (context, index) => const SizedBox(width: 10,), 37 | itemCount: state.data.length 38 | ), 39 | ); 40 | } 41 | 42 | if (state is FailureLoadData) { 43 | return Center(child: Text(state.errorMessage)); 44 | } 45 | 46 | return Container(); 47 | }, 48 | ) 49 | ); 50 | } 51 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/core/network/interceptors.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:logger/logger.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | 5 | /// This interceptor is used to show request and response logs 6 | class LoggerInterceptor extends Interceptor { 7 | Logger logger = Logger(printer: PrettyPrinter(methodCount: 0, colors: true,printEmojis: true)); 8 | 9 | @override 10 | void onError( DioException err, ErrorInterceptorHandler handler) { 11 | final options = err.requestOptions; 12 | final requestPath = '${options.baseUrl}${options.path}'; 13 | logger.e('${options.method} request ==> $requestPath'); //Error log 14 | logger.d('Error type: ${err.error} \n ' 15 | 'Error message: ${err.message}'); //Debug log 16 | handler.next(err); //Continue with the Error 17 | } 18 | 19 | @override 20 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 21 | final requestPath = '${options.baseUrl}${options.path}'; 22 | logger.i('${options.method} request ==> $requestPath'); //Info log 23 | handler.next(options); // continue with the Request 24 | } 25 | 26 | @override 27 | void onResponse(Response response, ResponseInterceptorHandler handler) { 28 | logger.d('STATUSCODE: ${response.statusCode} \n ' 29 | 'STATUSMESSAGE: ${response.statusMessage} \n' 30 | 'HEADERS: ${response.headers} \n' 31 | 'Data: ${response.data}'); // Debug log 32 | handler.next(response); // continue with the Response 33 | } 34 | } 35 | 36 | 37 | class AuthorizationInterceptor extends Interceptor { 38 | 39 | @override 40 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) async { 41 | final SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); 42 | final token = sharedPreferences.getString('token'); 43 | options.headers['Authorization'] = "Bearer $token"; 44 | handler.next(options); // continue with the Request 45 | } 46 | } -------------------------------------------------------------------------------- /lib/presentation/home/widgets/now_playing_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/bloc/generic_data_cubit.dart'; 4 | import 'package:netflix/common/bloc/generic_data_state.dart'; 5 | import 'package:netflix/domain/movie/entities/movie.dart'; 6 | import 'package:netflix/domain/movie/usecases/get_now_playing_movies.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | import '../../../common/widgets/movie/movie_card.dart'; 9 | 10 | class NowPlayingMovies extends StatelessWidget { 11 | const NowPlayingMovies({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return BlocProvider( 16 | create: (context) => GenericDataCubit()..getData>(sl()), 17 | child: BlocBuilder( 18 | builder: (context, state) { 19 | if (state is DataLoading){ 20 | return const Center( 21 | child: CircularProgressIndicator() 22 | ); 23 | } 24 | 25 | if (state is DataLoaded ){ 26 | return SizedBox( 27 | height: 300, 28 | child: ListView.separated( 29 | scrollDirection: Axis.horizontal, 30 | padding: const EdgeInsets.symmetric(horizontal: 16), 31 | itemBuilder: (context, index) { 32 | return MovieCard( 33 | movieEntity: state.data[index], 34 | ); 35 | }, 36 | separatorBuilder: (context, index) => const SizedBox(width: 10,), 37 | itemCount: state.data.length 38 | ), 39 | ); 40 | } 41 | 42 | if (state is FailureLoadData) { 43 | return Center(child: Text(state.errorMessage)); 44 | } 45 | 46 | return Container(); 47 | }, 48 | ) 49 | ); 50 | } 51 | } -------------------------------------------------------------------------------- /lib/presentation/watch/pages/movie_watch.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/common/widgets/appbar/app_bar.dart'; 3 | import 'package:netflix/domain/movie/entities/movie.dart'; 4 | import 'package:netflix/presentation/watch/widgets/video_player.dart'; 5 | 6 | import '../widgets/recommendation_movies.dart'; 7 | import '../widgets/similar_movies.dart'; 8 | import '../widgets/video_overview.dart'; 9 | import '../widgets/video_release_date.dart'; 10 | import '../widgets/video_title.dart'; 11 | import '../widgets/video_vote_average.dart'; 12 | 13 | class MovieWatchPage extends StatelessWidget { 14 | final MovieEntity movieEntity; 15 | const MovieWatchPage({required this.movieEntity,super.key}); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | appBar: const BasicAppbar( 21 | hideBack: false, 22 | ), 23 | body: SingleChildScrollView( 24 | padding: const EdgeInsets.symmetric(horizontal: 16), 25 | child: Column( 26 | crossAxisAlignment: CrossAxisAlignment.start, 27 | children: [ 28 | VideoPlayer(id: movieEntity.id!), 29 | const SizedBox(height: 16,), 30 | VideoTitle(title: movieEntity.title!,), 31 | const SizedBox(height: 16,), 32 | Row( 33 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 34 | children: [ 35 | VideoReleaseDate(releaseDate: movieEntity.releaseDate!,), 36 | VideoVoteAverage(voteAverage: movieEntity.voteAverage!,) 37 | ], 38 | ), 39 | const SizedBox(height: 16,), 40 | VideoOverview(overview: movieEntity.overview!,), 41 | const SizedBox(height: 16,), 42 | RecommendationMovies(movieId: movieEntity.id!,), 43 | const SizedBox(height: 16,), 44 | SimilarMovies(movieId: movieEntity.id!,) 45 | ], 46 | ), 47 | ), 48 | ); 49 | } 50 | } -------------------------------------------------------------------------------- /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 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | def localProperties = new Properties() 9 | def localPropertiesFile = rootProject.file("local.properties") 10 | if (localPropertiesFile.exists()) { 11 | localPropertiesFile.withReader("UTF-8") { reader -> 12 | localProperties.load(reader) 13 | } 14 | } 15 | 16 | def flutterVersionCode = localProperties.getProperty("flutter.versionCode") 17 | if (flutterVersionCode == null) { 18 | flutterVersionCode = "1" 19 | } 20 | 21 | def flutterVersionName = localProperties.getProperty("flutter.versionName") 22 | if (flutterVersionName == null) { 23 | flutterVersionName = "1.0" 24 | } 25 | 26 | android { 27 | namespace = "com.example.netflix" 28 | compileSdk = flutter.compileSdkVersion 29 | ndkVersion = flutter.ndkVersion 30 | 31 | compileOptions { 32 | sourceCompatibility = JavaVersion.VERSION_1_8 33 | targetCompatibility = JavaVersion.VERSION_1_8 34 | } 35 | 36 | 37 | defaultConfig { 38 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 39 | applicationId = "com.example.netflix" 40 | // You can update the following values to match your application needs. 41 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 42 | minSdk = flutter.minSdkVersion 43 | targetSdk = flutter.targetSdkVersion 44 | versionCode = flutterVersionCode.toInteger() 45 | versionName = flutterVersionName 46 | } 47 | 48 | buildTypes { 49 | release { 50 | // TODO: Add your own signing config for the release build. 51 | // Signing with the debug keys for now, so `flutter run --release` works. 52 | signingConfig = signingConfigs.debug 53 | } 54 | } 55 | } 56 | 57 | flutter { 58 | source = "../.." 59 | } 60 | -------------------------------------------------------------------------------- /lib/presentation/search/widgets/search_content.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/widgets/movie/movie_card.dart'; 4 | import 'package:netflix/common/widgets/tv/tv_card.dart'; 5 | import 'package:netflix/presentation/search/bloc/search_cubit.dart'; 6 | import 'package:netflix/presentation/search/bloc/search_state.dart'; 7 | 8 | class SearchContent extends StatelessWidget { 9 | const SearchContent({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return BlocBuilder ( 14 | builder: (context, state) { 15 | if (state is SearchLoading){ 16 | return const Center(child: CircularProgressIndicator()); 17 | } 18 | if (state is MoviesLoaded) { 19 | return GridView.builder( 20 | itemCount: state.movies.length, 21 | shrinkWrap: true, 22 | gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( 23 | crossAxisCount: 2, 24 | crossAxisSpacing: 10, 25 | mainAxisSpacing: 10, 26 | childAspectRatio: 0.6 27 | ), 28 | itemBuilder: (context, index) { 29 | return MovieCard(movieEntity: state.movies[index]); 30 | }, 31 | ); 32 | } 33 | if (state is TVsLoaded) { 34 | return GridView.builder( 35 | shrinkWrap: true, 36 | itemCount: state.tvs.length, 37 | gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( 38 | crossAxisCount: 2, 39 | crossAxisSpacing: 10, 40 | mainAxisSpacing: 10, 41 | childAspectRatio: 0.6 42 | ), 43 | itemBuilder: (context, index) { 44 | return TVCard(tvEntity: state.tvs[index]); 45 | }, 46 | ); 47 | } 48 | if (state is SearchFailure) { 49 | return Center(child: Text(state.errorMessage)); 50 | } 51 | 52 | return Container(); 53 | }, 54 | ); 55 | } 56 | } -------------------------------------------------------------------------------- /lib/data/tv/sources/tv.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:dio/dio.dart'; 3 | 4 | import '../../../core/constants/api_url.dart'; 5 | import '../../../core/network/dio_client.dart'; 6 | import '../../../service_locator.dart'; 7 | 8 | abstract class TVService { 9 | 10 | Future getPopularTv(); 11 | Future getRecommendationTVs(int tvId); 12 | Future getSimilarTVs(int tvId); 13 | Future getKeywords(int tvId); 14 | Future searchTV(String query); 15 | } 16 | 17 | 18 | class TVApiServiceImpl extends TVService { 19 | 20 | 21 | @override 22 | Future getPopularTv() async { 23 | try { 24 | var response = await sl().get( 25 | ApiUrl.popularTV, 26 | ); 27 | return Right(response.data); 28 | } on DioException catch(e) { 29 | return Left(e.response!.data['message']); 30 | } 31 | } 32 | 33 | @override 34 | Future getRecommendationTVs(int tvId) async { 35 | try { 36 | 37 | var response = await sl().get( 38 | '${ApiUrl.tv}$tvId/recommendations', 39 | ); 40 | return Right(response.data); 41 | 42 | } on DioException catch(e) { 43 | return Left(e.response!.data['message']); 44 | } 45 | } 46 | 47 | @override 48 | Future getSimilarTVs(int tvId) async { 49 | try { 50 | 51 | var response = await sl().get( 52 | '${ApiUrl.tv}$tvId/similar', 53 | ); 54 | return Right(response.data); 55 | 56 | } on DioException catch(e) { 57 | return Left(e.response!.data['message']); 58 | } 59 | } 60 | 61 | @override 62 | Future getKeywords(int tvId) async { 63 | try { 64 | 65 | var response = await sl().get( 66 | '${ApiUrl.tv}$tvId/keywords', 67 | ); 68 | return Right(response.data); 69 | 70 | } on DioException catch(e) { 71 | return Left(e.response!.data['message']); 72 | } 73 | } 74 | 75 | @override 76 | Future searchTV(String query) async { 77 | try { 78 | 79 | var response = await sl().get( 80 | '${ApiUrl.search}tv/$query', 81 | ); 82 | return Right(response.data); 83 | 84 | } on DioException catch(e) { 85 | return Left(e.response!.data['message']); 86 | } 87 | } 88 | 89 | 90 | } -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/similar_tvs.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/bloc/generic_data_cubit.dart'; 4 | import 'package:netflix/common/bloc/generic_data_state.dart'; 5 | import 'package:netflix/domain/tv/entities/tv.dart'; 6 | import 'package:netflix/domain/tv/usecases/get_similar_tvs.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | import '../../../common/widgets/tv/tv_card.dart'; 9 | 10 | class SimilarTVs extends StatelessWidget { 11 | final int tvId; 12 | const SimilarTVs({required this.tvId,super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return BlocProvider( 17 | create: (context) => GenericDataCubit()..getData>(sl(),params: tvId), 18 | child: BlocBuilder( 19 | builder: (context, state) { 20 | if (state is DataLoading){ 21 | return const Center( 22 | child: CircularProgressIndicator() 23 | ); 24 | } 25 | 26 | if (state is DataLoaded ){ 27 | return Column( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | const Text( 31 | 'Similar', 32 | style: TextStyle( 33 | fontWeight: FontWeight.bold, 34 | fontSize: 20 35 | ), 36 | ), 37 | const SizedBox(height: 16,), 38 | SizedBox( 39 | height: 300, 40 | child: ListView.separated( 41 | scrollDirection: Axis.horizontal, 42 | itemBuilder: (context, index) { 43 | return TVCard( 44 | tvEntity: state.data[index], 45 | ); 46 | }, 47 | separatorBuilder: (context, index) => const SizedBox(width: 10,), 48 | itemCount: state.data.length 49 | ), 50 | ), 51 | ], 52 | ); 53 | } 54 | 55 | if (state is FailureLoadData) { 56 | return Text(state.errorMessage); 57 | } 58 | 59 | return Container(); 60 | }, 61 | ) 62 | ); 63 | } 64 | } -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/recommendation_tvs.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/bloc/generic_data_cubit.dart'; 4 | import 'package:netflix/common/bloc/generic_data_state.dart'; 5 | import 'package:netflix/common/widgets/tv/tv_card.dart'; 6 | import 'package:netflix/domain/tv/entities/tv.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | import '../../../domain/tv/usecases/get_recommendation_tvs.dart'; 9 | 10 | class RecommendationTVs extends StatelessWidget { 11 | final int tvId; 12 | const RecommendationTVs({required this.tvId,super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return BlocProvider( 17 | create: (context) => GenericDataCubit()..getData>(sl(),params: tvId), 18 | child: BlocBuilder( 19 | builder: (context, state) { 20 | if (state is DataLoading){ 21 | return const Center( 22 | child: CircularProgressIndicator() 23 | ); 24 | } 25 | 26 | if (state is DataLoaded ){ 27 | return Column( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | const Text( 31 | 'Recommendation', 32 | style: TextStyle( 33 | fontWeight: FontWeight.bold, 34 | fontSize: 20 35 | ), 36 | ), 37 | const SizedBox(height: 16,), 38 | SizedBox( 39 | height: 300, 40 | child: ListView.separated( 41 | scrollDirection: Axis.horizontal, 42 | itemBuilder: (context, index) { 43 | return TVCard( 44 | tvEntity: state.data[index], 45 | ); 46 | }, 47 | separatorBuilder: (context, index) => const SizedBox(width: 10,), 48 | itemCount: state.data.length 49 | ), 50 | ), 51 | ], 52 | ); 53 | } 54 | 55 | if (state is FailureLoadData) { 56 | return Text(state.errorMessage); 57 | } 58 | 59 | return Container(); 60 | }, 61 | ) 62 | ); 63 | } 64 | } -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/similar_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/bloc/generic_data_cubit.dart'; 4 | import 'package:netflix/common/bloc/generic_data_state.dart'; 5 | import 'package:netflix/domain/movie/entities/movie.dart'; 6 | import 'package:netflix/domain/movie/usecases/get_similar_movies.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | import '../../../common/widgets/movie/movie_card.dart'; 9 | 10 | class SimilarMovies extends StatelessWidget { 11 | final int movieId; 12 | const SimilarMovies({required this.movieId,super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return BlocProvider( 17 | create: (context) => GenericDataCubit()..getData>(sl(),params: movieId), 18 | child: BlocBuilder( 19 | builder: (context, state) { 20 | if (state is DataLoading){ 21 | return const Center( 22 | child: CircularProgressIndicator() 23 | ); 24 | } 25 | 26 | if (state is DataLoaded ){ 27 | return Column( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | const Text( 31 | 'Similar', 32 | style: TextStyle( 33 | fontWeight: FontWeight.bold, 34 | fontSize: 20 35 | ), 36 | ), 37 | const SizedBox(height: 16,), 38 | SizedBox( 39 | height: 300, 40 | child: ListView.separated( 41 | scrollDirection: Axis.horizontal, 42 | itemBuilder: (context, index) { 43 | return MovieCard( 44 | movieEntity: state.data[index], 45 | ); 46 | }, 47 | separatorBuilder: (context, index) => const SizedBox(width: 10,), 48 | itemCount: state.data.length 49 | ), 50 | ), 51 | ], 52 | ); 53 | } 54 | 55 | if (state is FailureLoadData) { 56 | return Text(state.errorMessage); 57 | } 58 | 59 | return Container(); 60 | }, 61 | ) 62 | ); 63 | } 64 | } -------------------------------------------------------------------------------- /lib/presentation/watch/widgets/recommendation_movies.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/common/bloc/generic_data_cubit.dart'; 4 | import 'package:netflix/common/bloc/generic_data_state.dart'; 5 | import 'package:netflix/domain/movie/entities/movie.dart'; 6 | import 'package:netflix/domain/movie/usecases/get_recommendation_movies.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | import '../../../common/widgets/movie/movie_card.dart'; 9 | 10 | class RecommendationMovies extends StatelessWidget { 11 | final int movieId; 12 | const RecommendationMovies({required this.movieId,super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return BlocProvider( 17 | create: (context) => GenericDataCubit()..getData>(sl(),params: movieId), 18 | child: BlocBuilder( 19 | builder: (context, state) { 20 | if (state is DataLoading){ 21 | return const Center( 22 | child: CircularProgressIndicator() 23 | ); 24 | } 25 | 26 | if (state is DataLoaded ){ 27 | return Column( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | const Text( 31 | 'Recommendation', 32 | style: TextStyle( 33 | fontWeight: FontWeight.bold, 34 | fontSize: 20 35 | ), 36 | ), 37 | const SizedBox(height: 16,), 38 | SizedBox( 39 | height: 300, 40 | child: ListView.separated( 41 | scrollDirection: Axis.horizontal, 42 | itemBuilder: (context, index) { 43 | return MovieCard( 44 | movieEntity: state.data[index], 45 | ); 46 | }, 47 | separatorBuilder: (context, index) => const SizedBox(width: 10,), 48 | itemCount: state.data.length 49 | ), 50 | ), 51 | ], 52 | ); 53 | } 54 | 55 | if (state is FailureLoadData) { 56 | return Text(state.errorMessage); 57 | } 58 | 59 | return Container(); 60 | }, 61 | ) 62 | ); 63 | } 64 | } -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/data/tv/repositories/tv.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/common/helper/mapper/keyword.dart'; 3 | import 'package:netflix/common/helper/mapper/tv.dart'; 4 | import 'package:netflix/core/models/keyword.dart'; 5 | import 'package:netflix/data/tv/models/tv.dart'; 6 | import 'package:netflix/data/tv/sources/tv.dart'; 7 | import 'package:netflix/domain/tv/repositories/tv.dart'; 8 | 9 | import '../../../service_locator.dart'; 10 | 11 | class TVRepositoryImpl extends TVRepository { 12 | 13 | 14 | @override 15 | Future getPopularTV() async { 16 | var returnedData = await sl().getPopularTv(); 17 | 18 | return returnedData.fold( 19 | (error) { 20 | return Left(error); 21 | } , 22 | (data) { 23 | var movies = List.from(data['content']).map((item) => TvMapper.toEntity(TVModel.fromJson(item))).toList(); 24 | return Right(movies); 25 | } 26 | ); 27 | } 28 | 29 | @override 30 | Future getRecommendationTVs(int tvId) async { 31 | var returnedData = await sl < TVService > ().getRecommendationTVs(tvId); 32 | return returnedData.fold( 33 | (error) { 34 | return Left(error); 35 | }, 36 | (data) { 37 | var movies = List.from(data['content']).map((item) => TvMapper.toEntity(TVModel.fromJson(item))).toList(); 38 | return Right(movies); 39 | } 40 | ); 41 | } 42 | 43 | @override 44 | Future getSimilarTVs(int tvId) async { 45 | var returnedData = await sl < TVService > ().getSimilarTVs(tvId); 46 | return returnedData.fold( 47 | (error) { 48 | return Left(error); 49 | }, 50 | (data) { 51 | var movies = List.from(data['content']).map((item) => TvMapper.toEntity(TVModel.fromJson(item))).toList(); 52 | return Right(movies); 53 | } 54 | ); 55 | } 56 | 57 | @override 58 | Future getKeywords(int tvId) async { 59 | var returnedData = await sl < TVService > ().getKeywords(tvId); 60 | return returnedData.fold( 61 | (error) { 62 | return Left(error); 63 | }, 64 | (data) { 65 | var movies = List.from(data['content']).map((item) => KeywordMapper.toEntity(KeywordModel.fromJson(item))).toList(); 66 | return Right(movies); 67 | } 68 | ); 69 | } 70 | 71 | @override 72 | Future searchTV(String query) async { 73 | var returnedData = await sl < TVService > ().searchTV(query); 74 | return returnedData.fold( 75 | (error) { 76 | return Left(error); 77 | }, 78 | (data) { 79 | var movies = List.from(data['content']).map((item) => TvMapper.toEntity(TVModel.fromJson(item))).toList(); 80 | return Right(movies); 81 | } 82 | ); 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /lib/data/movie/sources/movie.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:dio/dio.dart'; 3 | 4 | import '../../../core/constants/api_url.dart'; 5 | import '../../../core/network/dio_client.dart'; 6 | import '../../../service_locator.dart'; 7 | 8 | abstract class MovieService { 9 | 10 | Future getTrendingMovies(); 11 | Future getNowPlayingMovies(); 12 | Future getMovieTrailer(int movieId); 13 | Future getRecommendationMovies(int movieId); 14 | Future getSimilarMovies(int movieId); 15 | Future searchMovie(String query); 16 | } 17 | 18 | class MovieApiServiceImpl extends MovieService { 19 | 20 | 21 | @override 22 | Future getTrendingMovies() async { 23 | try { 24 | 25 | var response = await sl().get( 26 | ApiUrl.trendingMovies, 27 | ); 28 | return Right(response.data); 29 | 30 | } on DioException catch(e) { 31 | return Left(e.response!.data['message']); 32 | } 33 | } 34 | 35 | @override 36 | Future getNowPlayingMovies() async { 37 | try { 38 | 39 | var response = await sl().get( 40 | ApiUrl.nowPlayingMovies, 41 | ); 42 | return Right(response.data); 43 | 44 | } on DioException catch(e) { 45 | return Left(e.response!.data['message']); 46 | } 47 | } 48 | 49 | @override 50 | Future getMovieTrailer(int movieId) async { 51 | try { 52 | 53 | var response = await sl().get( 54 | '${ApiUrl.movie}$movieId/trailer', 55 | ); 56 | return Right(response.data); 57 | 58 | } on DioException catch(e) { 59 | return Left(e.response!.data['message']); 60 | } 61 | } 62 | 63 | @override 64 | Future getRecommendationMovies(int movieId) async { 65 | try { 66 | 67 | var response = await sl().get( 68 | '${ApiUrl.movie}$movieId/recommendations', 69 | ); 70 | return Right(response.data); 71 | 72 | } on DioException catch(e) { 73 | return Left(e.response!.data['message']); 74 | } 75 | } 76 | 77 | @override 78 | Future getSimilarMovies(int movieId) async { 79 | try { 80 | 81 | var response = await sl().get( 82 | '${ApiUrl.movie}$movieId/similar', 83 | ); 84 | return Right(response.data); 85 | 86 | } on DioException catch(e) { 87 | return Left(e.response!.data['message']); 88 | } 89 | } 90 | 91 | @override 92 | Future searchMovie(String query) async { 93 | try { 94 | 95 | var response = await sl().get( 96 | '${ApiUrl.search}movie/$query', 97 | ); 98 | return Right(response.data); 99 | 100 | } on DioException catch(e) { 101 | return Left(e.response!.data['message']); 102 | } 103 | } 104 | 105 | } -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/common/widgets/tv/tv_card.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:netflix/common/helper/navigation/app_navigation.dart'; 4 | import 'package:netflix/domain/tv/entities/tv.dart'; 5 | 6 | import '../../../core/configs/theme/app_colors.dart'; 7 | import '../../../presentation/watch/pages/tv_watch.dart'; 8 | 9 | class TVCard extends StatelessWidget { 10 | final TVEntity tvEntity; 11 | const TVCard({ 12 | required this.tvEntity, 13 | super.key 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return GestureDetector( 19 | onTap: (){ 20 | AppNavigator.push(context, TVWatchPage(tvEntity: tvEntity,)); 21 | }, 22 | child: Container( 23 | width: 180, 24 | decoration: BoxDecoration( 25 | color: AppColors.background, 26 | borderRadius: BorderRadius.circular(8) 27 | ), 28 | child: Column( 29 | crossAxisAlignment: CrossAxisAlignment.start, 30 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 31 | children: [ 32 | Expanded( 33 | flex: 4, 34 | child: Container( 35 | decoration: BoxDecoration( 36 | color: Colors.white, 37 | image: DecorationImage( 38 | fit: BoxFit.fill, 39 | image: NetworkImage( 40 | tvEntity.providePosterPath(), 41 | ) 42 | ), 43 | borderRadius: const BorderRadius.only( 44 | topLeft: Radius.circular(8), 45 | topRight: Radius.circular(8) 46 | ) 47 | ), 48 | ), 49 | ), 50 | Expanded( 51 | flex: 1, 52 | child: Padding( 53 | padding: const EdgeInsets.all(8.0), 54 | child: Column( 55 | crossAxisAlignment: CrossAxisAlignment.start, 56 | children: [ 57 | Text( 58 | tvEntity.name!, 59 | style: const TextStyle( 60 | fontSize: 16, 61 | overflow: TextOverflow.ellipsis, 62 | fontWeight: FontWeight.bold 63 | ), 64 | ), 65 | Row( 66 | mainAxisAlignment: MainAxisAlignment.end, 67 | children: [ 68 | const Icon( 69 | Icons.star, 70 | size: 16, 71 | color: Colors.amber, 72 | ), 73 | Text( 74 | ' ${tvEntity.voteAverage!.toStringAsFixed(1)}', 75 | style: const TextStyle( 76 | fontSize: 10 77 | ), 78 | ) 79 | ], 80 | ) 81 | ], 82 | ), 83 | ), 84 | ), 85 | 86 | ], 87 | ), 88 | ), 89 | ); 90 | } 91 | } -------------------------------------------------------------------------------- /lib/common/widgets/movie/movie_card.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:netflix/common/helper/navigation/app_navigation.dart'; 4 | import 'package:netflix/domain/movie/entities/movie.dart'; 5 | import 'package:netflix/presentation/watch/pages/movie_watch.dart'; 6 | 7 | import '../../../core/configs/theme/app_colors.dart'; 8 | 9 | class MovieCard extends StatelessWidget { 10 | final MovieEntity movieEntity; 11 | const MovieCard({ 12 | required this.movieEntity, 13 | super.key 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return GestureDetector( 19 | onTap: (){ 20 | AppNavigator.push(context, MovieWatchPage(movieEntity: movieEntity,)); 21 | }, 22 | child: Container( 23 | width: 180, 24 | decoration: BoxDecoration( 25 | color: AppColors.background, 26 | borderRadius: BorderRadius.circular(8) 27 | ), 28 | child: Column( 29 | crossAxisAlignment: CrossAxisAlignment.start, 30 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 31 | children: [ 32 | Expanded( 33 | flex: 4, 34 | child: Container( 35 | decoration: BoxDecoration( 36 | color: Colors.white, 37 | image: DecorationImage( 38 | fit: BoxFit.fill, 39 | image: NetworkImage( 40 | movieEntity.providePosterPath() 41 | ) 42 | ), 43 | borderRadius: const BorderRadius.only( 44 | topLeft: Radius.circular(8), 45 | topRight: Radius.circular(8) 46 | ) 47 | ), 48 | ), 49 | ), 50 | Expanded( 51 | flex: 1, 52 | child: Padding( 53 | padding: const EdgeInsets.all(8.0), 54 | child: Column( 55 | crossAxisAlignment: CrossAxisAlignment.start, 56 | children: [ 57 | Text( 58 | movieEntity.title!, 59 | style: const TextStyle( 60 | fontSize: 16, 61 | overflow: TextOverflow.ellipsis, 62 | fontWeight: FontWeight.bold 63 | ), 64 | ), 65 | Row( 66 | mainAxisAlignment: MainAxisAlignment.end, 67 | children: [ 68 | const Icon( 69 | Icons.star, 70 | size: 16, 71 | color: Colors.amber, 72 | ), 73 | Text( 74 | ' ${movieEntity.voteAverage!.toStringAsFixed(1)}', 75 | style: const TextStyle( 76 | fontSize: 10 77 | ), 78 | ) 79 | ], 80 | ) 81 | ], 82 | ), 83 | ), 84 | ), 85 | 86 | ], 87 | ), 88 | ), 89 | ); 90 | } 91 | } -------------------------------------------------------------------------------- /lib/service_locator.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:get_it/get_it.dart'; 3 | import 'package:netflix/core/network/dio_client.dart'; 4 | import 'package:netflix/data/auth/repositories/auth.dart'; 5 | import 'package:netflix/data/auth/sources/auth_api_service.dart'; 6 | import 'package:netflix/data/movie/repositories/movie.dart'; 7 | import 'package:netflix/data/movie/sources/movie.dart'; 8 | import 'package:netflix/data/tv/repositories/tv.dart'; 9 | import 'package:netflix/data/tv/sources/tv.dart'; 10 | import 'package:netflix/domain/auth/repositories/auth.dart'; 11 | import 'package:netflix/domain/auth/usecases/is_logged_in.dart'; 12 | import 'package:netflix/domain/auth/usecases/signin.dart'; 13 | import 'package:netflix/domain/auth/usecases/signup.dart'; 14 | import 'package:netflix/domain/movie/repositories/movie.dart'; 15 | import 'package:netflix/domain/movie/usecases/get_movie_trailer.dart'; 16 | import 'package:netflix/domain/movie/usecases/get_now_playing_movies.dart'; 17 | import 'package:netflix/domain/movie/usecases/get_recommendation_movies.dart'; 18 | import 'package:netflix/domain/movie/usecases/get_similar_movies.dart'; 19 | import 'package:netflix/domain/movie/usecases/get_trending_movies.dart'; 20 | import 'package:netflix/domain/movie/usecases/search_movie.dart'; 21 | import 'package:netflix/domain/tv/repositories/tv.dart'; 22 | import 'package:netflix/domain/tv/usecases/get_keywords.dart'; 23 | import 'package:netflix/domain/tv/usecases/get_popular_tv.dart'; 24 | import 'package:netflix/domain/tv/usecases/get_recommendation_tvs.dart'; 25 | import 'package:netflix/domain/tv/usecases/get_similar_tvs.dart'; 26 | import 'package:netflix/domain/tv/usecases/search_tv.dart'; 27 | 28 | final sl = GetIt.instance; 29 | 30 | void setupServiceLocator() { 31 | 32 | sl.registerSingleton(DioClient()); 33 | 34 | 35 | // Services 36 | sl.registerSingleton(AuthApiServiceImpl()); 37 | sl.registerSingleton(MovieApiServiceImpl()); 38 | sl.registerSingleton(TVApiServiceImpl()); 39 | 40 | // Repostories 41 | sl.registerSingleton(AuthRepositoryImpl()); 42 | sl.registerSingleton(MovieRepositoryImpl()); 43 | sl.registerSingleton(TVRepositoryImpl()); 44 | 45 | // Usecases 46 | sl.registerSingleton(SignupUseCase()); 47 | sl.registerSingleton(SigninUseCase()); 48 | sl.registerSingleton(IsLoggedInUseCase()); 49 | sl.registerSingleton(GetTrendingMoviesUseCase()); 50 | sl.registerSingleton(GetNowPlayingMoviesUseCase()); 51 | sl.registerSingleton(GetPopularTVUseCase()); 52 | sl.registerSingleton(GetMovieTrailerUseCase()); 53 | sl.registerSingleton(GetRecommendationMoviesUseCase()); 54 | sl.registerSingleton(GetSimilarMoviesUseCase()); 55 | sl.registerSingleton(GetSimilarTvsUseCase()); 56 | sl.registerSingleton(GetRecommendationTvsUseCase()); 57 | sl.registerSingleton(GetTVKeywordsUseCase()); 58 | sl.registerSingleton(SearchMovieUseCase()); 59 | sl.registerSingleton(SearchTVUseCase()); 60 | } -------------------------------------------------------------------------------- /lib/core/network/dio_client.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:netflix/core/constants/api_url.dart'; 3 | 4 | import 'interceptors.dart'; 5 | 6 | class DioClient { 7 | 8 | late final Dio _dio; 9 | DioClient(): _dio = Dio( 10 | BaseOptions( 11 | baseUrl: ApiUrl.baseURL , 12 | headers: { 13 | 'Content-Type': 'application/json; charset=UTF-8' 14 | }, 15 | responseType: ResponseType.json, 16 | sendTimeout: const Duration(seconds: 10), 17 | receiveTimeout: const Duration(seconds: 10) 18 | ), 19 | )..interceptors.addAll([AuthorizationInterceptor(),LoggerInterceptor()]); 20 | 21 | // GET METHOD 22 | Future < Response > get( 23 | String url, { 24 | Map < String, 25 | dynamic > ? queryParameters, 26 | Options ? options, 27 | CancelToken ? cancelToken, 28 | ProgressCallback ? onReceiveProgress, 29 | }) async { 30 | try { 31 | final Response response = await _dio.get( 32 | url, 33 | queryParameters: queryParameters, 34 | options: options, 35 | cancelToken: cancelToken, 36 | onReceiveProgress: onReceiveProgress, 37 | ); 38 | return response; 39 | } 40 | on DioException { 41 | rethrow; 42 | } 43 | } 44 | 45 | // POST METHOD 46 | Future < Response > post( 47 | String url, { 48 | data, 49 | Map < String, 50 | dynamic > ? queryParameters, 51 | Options ? options, 52 | ProgressCallback ? onSendProgress, 53 | ProgressCallback ? onReceiveProgress, 54 | }) async { 55 | try { 56 | final Response response = await _dio.post( 57 | url, 58 | data: data, 59 | options: options, 60 | onSendProgress: onSendProgress, 61 | onReceiveProgress: onReceiveProgress, 62 | ); 63 | return response; 64 | } catch (e) { 65 | rethrow; 66 | } 67 | } 68 | 69 | // PUT METHOD 70 | Future < Response > put( 71 | String url, { 72 | dynamic data, 73 | Map < String, 74 | dynamic > ? queryParameters, 75 | Options ? options, 76 | CancelToken ? cancelToken, 77 | ProgressCallback ? onSendProgress, 78 | ProgressCallback ? onReceiveProgress, 79 | }) async { 80 | try { 81 | final Response response = await _dio.put( 82 | url, 83 | data: data, 84 | queryParameters: queryParameters, 85 | options: options, 86 | cancelToken: cancelToken, 87 | onSendProgress: onSendProgress, 88 | onReceiveProgress: onReceiveProgress, 89 | ); 90 | return response; 91 | } catch (e) { 92 | rethrow; 93 | } 94 | } 95 | 96 | // DELETE METHOD 97 | Future < dynamic > delete( 98 | String url, { 99 | data, 100 | Map < String, 101 | dynamic > ? queryParameters, 102 | Options ? options, 103 | CancelToken ? cancelToken, 104 | }) async { 105 | try { 106 | final Response response = await _dio.delete( 107 | url, 108 | data: data, 109 | queryParameters: queryParameters, 110 | options: options, 111 | cancelToken: cancelToken, 112 | ); 113 | return response.data; 114 | } catch (e) { 115 | rethrow; 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /lib/data/movie/repositories/movie.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/common/helper/mapper/movie.dart'; 3 | import 'package:netflix/common/helper/mapper/trailer.dart'; 4 | import 'package:netflix/core/models/trailer.dart'; 5 | import 'package:netflix/data/movie/sources/movie.dart'; 6 | import 'package:netflix/domain/movie/repositories/movie.dart'; 7 | import 'package:netflix/service_locator.dart'; 8 | 9 | import '../models/movie.dart'; 10 | 11 | class MovieRepositoryImpl extends MovieRepository { 12 | 13 | @override 14 | Future getTrendingMovies() async { 15 | var returnedData = await sl().getTrendingMovies(); 16 | 17 | return returnedData.fold( 18 | (error) { 19 | return Left(error); 20 | } , 21 | (data) { 22 | var movies = List.from(data['content']).map((item) => MovieMapper.toEntity(MovieModel.fromJson(item))).toList(); 23 | return Right(movies); 24 | } 25 | ); 26 | 27 | } 28 | 29 | @override 30 | Future < Either > getNowPlayingMovies() async { 31 | var returnedData = await sl < MovieService > ().getNowPlayingMovies(); 32 | 33 | return returnedData.fold( 34 | (error) { 35 | return Left(error); 36 | }, 37 | (data) { 38 | var movies = List.from(data['content']).map((item) => MovieMapper.toEntity(MovieModel.fromJson(item))).toList(); 39 | return Right(movies); 40 | } 41 | ); 42 | } 43 | 44 | @override 45 | Future getMovieTrailer(int movieId) async { 46 | var returnedData = await sl < MovieService > ().getMovieTrailer(movieId); 47 | return returnedData.fold( 48 | (error) { 49 | return Left(error); 50 | }, 51 | (data) { 52 | var movies = TrailerMapper.toEntity(TrailerModel.fromJson(data['trailer'])); 53 | return Right(movies); 54 | } 55 | ); 56 | } 57 | 58 | @override 59 | Future getRecommendationMovies(int movieId) async { 60 | var returnedData = await sl < MovieService > ().getRecommendationMovies(movieId); 61 | return returnedData.fold( 62 | (error) { 63 | return Left(error); 64 | }, 65 | (data) { 66 | var movies = List.from(data['content']).map((item) => MovieMapper.toEntity(MovieModel.fromJson(item))).toList(); 67 | return Right(movies); 68 | } 69 | ); 70 | } 71 | 72 | @override 73 | Future getSimilarMovies(int movieId) async { 74 | var returnedData = await sl < MovieService > ().getSimilarMovies(movieId); 75 | return returnedData.fold( 76 | (error) { 77 | return Left(error); 78 | }, 79 | (data) { 80 | var movies = List.from(data['content']).map((item) => MovieMapper.toEntity(MovieModel.fromJson(item))).toList(); 81 | return Right(movies); 82 | } 83 | ); 84 | } 85 | 86 | @override 87 | Future searchMovie(String query) async { 88 | var returnedData = await sl < MovieService > ().searchMovie(query); 89 | return returnedData.fold( 90 | (error) { 91 | return Left(error); 92 | }, 93 | (data) { 94 | var movies = List.from(data['content']).map((item) => MovieMapper.toEntity(MovieModel.fromJson(item))).toList(); 95 | return Right(movies); 96 | } 97 | ); 98 | } 99 | 100 | } -------------------------------------------------------------------------------- /lib/presentation/auth/pages/signup.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:netflix/common/helper/navigation/app_navigation.dart'; 4 | import 'package:netflix/core/configs/theme/app_colors.dart'; 5 | import 'package:netflix/data/auth/models/signup_req_params.dart'; 6 | import 'package:netflix/domain/auth/usecases/signup.dart'; 7 | import 'package:netflix/presentation/auth/pages/signin.dart'; 8 | import 'package:netflix/service_locator.dart'; 9 | import 'package:reactive_button/reactive_button.dart'; 10 | 11 | import '../../../common/helper/message/display_message.dart'; 12 | import '../../home/pages/home.dart'; 13 | 14 | class SignupPage extends StatelessWidget { 15 | SignupPage({super.key}); 16 | 17 | final TextEditingController _emailCon = TextEditingController(); 18 | final TextEditingController _passwordCon = TextEditingController(); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return Scaffold( 23 | body: SafeArea( 24 | minimum: const EdgeInsets.only(top: 100,right:16,left:16), 25 | child: Column( 26 | mainAxisAlignment: MainAxisAlignment.start, 27 | crossAxisAlignment: CrossAxisAlignment.center, 28 | children: [ 29 | _signupText(), 30 | const SizedBox(height: 30,), 31 | _emailField(), 32 | const SizedBox(height: 20,), 33 | _passwordField(), 34 | const SizedBox(height: 60,), 35 | _signupButton(context), 36 | const SizedBox(height: 20,), 37 | _signinText(context) 38 | ], 39 | ), 40 | ), 41 | ); 42 | } 43 | 44 | Widget _signupText() { 45 | return const Text( 46 | 'Sign Up', 47 | style: TextStyle( 48 | fontWeight: FontWeight.bold, 49 | fontSize: 24 50 | ), 51 | ); 52 | } 53 | 54 | Widget _emailField() { 55 | return TextField( 56 | controller: _emailCon, 57 | decoration: const InputDecoration( 58 | hintText: 'Email' 59 | ), 60 | ); 61 | } 62 | 63 | Widget _passwordField() { 64 | return TextField( 65 | controller: _passwordCon, 66 | decoration: const InputDecoration( 67 | hintText: 'Password' 68 | ), 69 | ); 70 | } 71 | 72 | Widget _signupButton(BuildContext context) { 73 | return ReactiveButton( 74 | title: 'Sign Up', 75 | activeColor: AppColors.primary, 76 | onPressed: () async => sl < SignupUseCase > ().call( 77 | params: SignupReqParams( 78 | email: _emailCon.text, 79 | password: _passwordCon.text 80 | ), 81 | ), 82 | onSuccess: () { 83 | AppNavigator.pushAndRemove(context, const HomePage()); 84 | }, 85 | onFailure: (error) { 86 | DisplayMessage.errorMessage(error, context); 87 | } 88 | ); 89 | } 90 | 91 | Widget _signinText(BuildContext context) { 92 | return Text.rich( 93 | TextSpan( 94 | children: [ 95 | const TextSpan( 96 | text: "Do you have account?" 97 | ), 98 | TextSpan( 99 | text: ' Sign In', 100 | style: const TextStyle( 101 | color: Colors.blue 102 | ), 103 | recognizer: TapGestureRecognizer()..onTap=(){ 104 | AppNavigator.push(context, SigninPage()); 105 | } 106 | ) 107 | ] 108 | ) 109 | ); 110 | } 111 | } -------------------------------------------------------------------------------- /lib/presentation/auth/pages/signin.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:netflix/common/helper/message/display_message.dart'; 4 | import 'package:netflix/common/helper/navigation/app_navigation.dart'; 5 | import 'package:netflix/core/configs/theme/app_colors.dart'; 6 | import 'package:netflix/data/auth/models/signin_req_params.dart'; 7 | import 'package:netflix/domain/auth/usecases/signin.dart'; 8 | import 'package:netflix/presentation/auth/pages/signup.dart'; 9 | import 'package:netflix/presentation/home/pages/home.dart'; 10 | import 'package:netflix/service_locator.dart'; 11 | import 'package:reactive_button/reactive_button.dart'; 12 | 13 | class SigninPage extends StatelessWidget { 14 | SigninPage({super.key}); 15 | 16 | final TextEditingController _emailCon = TextEditingController(); 17 | final TextEditingController _passwordCon = TextEditingController(); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return Scaffold( 22 | body: SafeArea( 23 | minimum: const EdgeInsets.only(top: 100,right:16,left:16), 24 | child: Column( 25 | mainAxisAlignment: MainAxisAlignment.start, 26 | crossAxisAlignment: CrossAxisAlignment.center, 27 | children: [ 28 | _signinText(), 29 | const SizedBox(height: 30,), 30 | _emailField(), 31 | const SizedBox(height: 20,), 32 | _passwordField(), 33 | const SizedBox(height: 60,), 34 | _signinButton(context), 35 | const SizedBox(height: 20,), 36 | _signupText(context) 37 | ], 38 | ), 39 | ), 40 | ); 41 | } 42 | 43 | Widget _signinText() { 44 | return const Text( 45 | 'Sign In', 46 | style: TextStyle( 47 | fontWeight: FontWeight.bold, 48 | fontSize: 24 49 | ), 50 | ); 51 | } 52 | 53 | Widget _emailField() { 54 | return TextField( 55 | controller: _emailCon , 56 | decoration: const InputDecoration( 57 | hintText: 'Email' 58 | ), 59 | ); 60 | } 61 | 62 | Widget _passwordField() { 63 | return TextField( 64 | controller: _passwordCon, 65 | decoration: const InputDecoration( 66 | hintText: 'Password' 67 | ), 68 | ); 69 | } 70 | 71 | Widget _signinButton(BuildContext context) { 72 | return ReactiveButton( 73 | title: 'Sign In', 74 | activeColor: AppColors.primary, 75 | onPressed: () async => sl().call( 76 | params: SigninReqParams( 77 | email: _emailCon.text, 78 | password: _passwordCon.text 79 | ) 80 | ), 81 | onSuccess: () { 82 | AppNavigator.pushAndRemove(context, const HomePage()); 83 | }, 84 | onFailure: (error) { 85 | DisplayMessage.errorMessage(error, context); 86 | }, 87 | ); 88 | } 89 | 90 | Widget _signupText(BuildContext context) { 91 | return Text.rich( 92 | TextSpan( 93 | children: [ 94 | const TextSpan( 95 | text: "Don't you have account?" 96 | ), 97 | TextSpan( 98 | text: ' Sign Up', 99 | style: const TextStyle( 100 | color: Colors.blue 101 | ), 102 | recognizer: TapGestureRecognizer()..onTap=(){ 103 | AppNavigator.push(context, SignupPage()); 104 | } 105 | ) 106 | ] 107 | ) 108 | ); 109 | } 110 | } -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "netflix" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "netflix" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "netflix.exe" "\0" 98 | VALUE "ProductName", "netflix" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(netflix LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "netflix") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "netflix"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "netflix"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GApplication::startup. 85 | static void my_application_startup(GApplication* application) { 86 | //MyApplication* self = MY_APPLICATION(object); 87 | 88 | // Perform any actions required at application startup. 89 | 90 | G_APPLICATION_CLASS(my_application_parent_class)->startup(application); 91 | } 92 | 93 | // Implements GApplication::shutdown. 94 | static void my_application_shutdown(GApplication* application) { 95 | //MyApplication* self = MY_APPLICATION(object); 96 | 97 | // Perform any actions required at application shutdown. 98 | 99 | G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); 100 | } 101 | 102 | // Implements GObject::dispose. 103 | static void my_application_dispose(GObject* object) { 104 | MyApplication* self = MY_APPLICATION(object); 105 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 106 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 107 | } 108 | 109 | static void my_application_class_init(MyApplicationClass* klass) { 110 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 111 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 112 | G_APPLICATION_CLASS(klass)->startup = my_application_startup; 113 | G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; 114 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 115 | } 116 | 117 | static void my_application_init(MyApplication* self) {} 118 | 119 | MyApplication* my_application_new() { 120 | return MY_APPLICATION(g_object_new(my_application_get_type(), 121 | "application-id", APPLICATION_ID, 122 | "flags", G_APPLICATION_NON_UNIQUE, 123 | nullptr)); 124 | } 125 | --------------------------------------------------------------------------------