├── 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 └── .gitignore ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── android ├── gradle.properties ├── 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 │ │ │ │ ├── xml │ │ │ │ │ └── network_security_config.xml │ │ │ │ ├── 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 │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── assets └── img │ └── NetFlixOriginal.jpg ├── lib ├── core │ ├── strings.dart │ └── colors │ │ ├── common.dart │ │ └── colors.dart ├── presentation │ ├── home │ │ ├── test.dart │ │ ├── category_model │ │ │ └── categories │ │ │ │ ├── genre.dart │ │ │ │ ├── categories.dart │ │ │ │ ├── genre.g.dart │ │ │ │ └── categories.g.dart │ │ ├── widgets │ │ │ ├── custom_button_widget.dart │ │ │ ├── background_card.dart │ │ │ ├── categories.dart │ │ │ └── main_card1.dart │ │ └── discover_tv │ │ │ └── discover_model.dart │ ├── search │ │ ├── widgets │ │ │ ├── search_text_widget.dart │ │ │ ├── search_result.dart │ │ │ └── search_idle.dart │ │ └── screen_search.dart │ ├── widgets │ │ ├── main_card.dart │ │ ├── app_bar_widget.dart │ │ ├── number_main_card.dart │ │ └── main_title_cad.dart │ ├── new_and_hot │ │ ├── widgets │ │ │ ├── nh_button_widget.dart │ │ │ └── everones_watch_widget.dart │ │ └── screen_new_and_hot.dart │ ├── main_page │ │ ├── screen_main_page.dart │ │ └── widgets │ │ │ └── bottom_navigation.dart │ └── downloads │ │ └── screen_downloads.dart ├── application │ ├── home │ │ ├── homebloc_event.dart │ │ ├── homebloc_state.dart │ │ └── homebloc_bloc.dart │ ├── downloads │ │ ├── downloads_event.dart │ │ ├── downloads_state.dart │ │ └── downloads_bloc.dart │ ├── search │ │ └── bloc │ │ │ ├── search_event.dart │ │ │ ├── search_state.dart │ │ │ └── search_bloc.dart │ ├── hot_and_new │ │ ├── hotandnew_event.dart │ │ ├── hotandnew_state.dart │ │ └── hotandnew_bloc.dart │ └── fastLaugh │ │ ├── fastlaugh_event.dart │ │ ├── fastlaugh_state.dart │ │ └── fastlaugh_bloc.dart ├── domain │ ├── i_downloads _repo.dart │ ├── core │ │ ├── main_failure.dart │ │ ├── debounce.dart │ │ └── di │ │ │ ├── injectable.dart │ │ │ └── injectable.config.dart │ ├── home │ │ ├── home_screen_service.dart │ │ └── model │ │ │ └── main_screen │ │ │ ├── main_screen.dart │ │ │ └── main_screen.g.dart │ ├── search │ │ ├── search_services.dart │ │ └── models │ │ │ └── search_resp │ │ │ ├── search_resp.dart │ │ │ └── search_resp.g.dart │ ├── new_and_hot │ │ ├── hot_and_new_service.dart │ │ └── models │ │ │ └── hot_and_new_resp │ │ │ ├── hot_and_new_resp.dart │ │ │ └── hot_and_new_resp.g.dart │ └── downloads │ │ ├── core │ │ └── api_end_points.dart │ │ └── models │ │ ├── downloads.dart │ │ ├── downloads.g.dart │ │ └── downloads.freezed.dart ├── test_widget.dart ├── infrastructure │ ├── apis.dart │ ├── home │ │ └── main_screen_implementation.dart │ ├── search │ │ └── search_implementation.dart │ ├── downloads │ │ └── downloads_repository.dart │ └── hot_and_new │ │ └── hot_and_new_implementation.dart ├── main.dart └── media │ └── media_json.dart ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── CMakeLists.txt │ ├── utils.h │ ├── runner.exe.manifest │ ├── flutter_window.h │ ├── main.cpp │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ ├── win32_window.h │ └── win32_window.cpp ├── .gitignore ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt └── CMakeLists.txt ├── .metadata ├── README.md ├── .gitignore ├── test └── widget_test.dart ├── analysis_options.yaml └── pubspec.yaml /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 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /assets/img/NetFlixOriginal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/assets/img/NetFlixOriginal.jpg -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /lib/core/strings.dart: -------------------------------------------------------------------------------- 1 | const baseUrl = "https://api.themoviedb.org/3"; 2 | const imageBase = "https://image.tmdb.org/t/p/w500"; 3 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/presentation/home/test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:netflix/core/colors/colors.dart'; 4 | 5 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/viswajithka97/Netflix-Clone/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/viswajithka97/Netflix-Clone/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.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 | } 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 | -------------------------------------------------------------------------------- /lib/application/home/homebloc_event.dart: -------------------------------------------------------------------------------- 1 | part of 'homebloc_bloc.dart'; 2 | 3 | @freezed 4 | class HomeblocEvent with _$HomeblocEvent { 5 | const factory HomeblocEvent.loadTrendingMovies() = LoadTrendingMovies; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /lib/application/downloads/downloads_event.dart: -------------------------------------------------------------------------------- 1 | part of 'downloads_bloc.dart'; 2 | 3 | @freezed 4 | class DownloadsEvent with _$DownloadsEvent { 5 | const factory DownloadsEvent.getDownloadsImage() = _GetDownloadsImage; 6 | } 7 | -------------------------------------------------------------------------------- /lib/application/search/bloc/search_event.dart: -------------------------------------------------------------------------------- 1 | part of 'search_bloc.dart'; 2 | 3 | @freezed 4 | class SearchEvent with _$SearchEvent { 5 | const factory SearchEvent.intialize() = Intialize; 6 | const factory SearchEvent.searchMovie({required String query}) = SearchMovie; 7 | } 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/xml/network_security_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | api.example.com(to be adjusted) 5 | 6 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/domain/i_downloads _repo.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/domain/core/main_failure.dart'; 3 | import 'package:netflix/domain/downloads/models/downloads.dart'; 4 | 5 | abstract class IDownloadsRepo { 6 | Future>> getDownloadsImages(); 7 | } 8 | -------------------------------------------------------------------------------- /lib/test_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class TestWidg extends StatelessWidget { 4 | const TestWidg({Key? key}) : super(key: key); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return Container( 9 | child: Text("HAi"), 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/domain/core/main_failure.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | part 'main_failure.freezed.dart'; 3 | 4 | @freezed 5 | class MainFailure with _$MainFailure { 6 | const factory MainFailure.clientFailure() = _ClientFailure; 7 | const factory MainFailure.serverFailure() = _ServerFailure; 8 | } 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/domain/home/home_screen_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/domain/core/main_failure.dart'; 3 | import 'package:netflix/domain/home/model/main_screen/main_screen.dart'; 4 | 5 | abstract class HomeScreenService { 6 | Future> getAllTrendingVideos(); 7 | } 8 | -------------------------------------------------------------------------------- /lib/domain/search/search_services.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/domain/core/main_failure.dart'; 3 | import 'package:netflix/domain/search/models/search_resp/search_resp.dart'; 4 | 5 | abstract class SearchService { 6 | Future> searchMovies({required query}); 7 | } 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/application/hot_and_new/hotandnew_event.dart: -------------------------------------------------------------------------------- 1 | part of 'hotandnew_bloc.dart'; 2 | 3 | @freezed 4 | class HotandnewEvent with _$HotandnewEvent { 5 | const factory HotandnewEvent.loadDataInComingSoon() = LoadDataInComingSoon; 6 | const factory HotandnewEvent.loadDataInEveryOnesWatching() = 7 | LoadDataInEveryOnesWatching; 8 | } 9 | -------------------------------------------------------------------------------- /.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: 5464c5bac742001448fe4fc0597be939379f88ea 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /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/application/fastLaugh/fastlaugh_event.dart: -------------------------------------------------------------------------------- 1 | part of 'fastlaugh_bloc.dart'; 2 | 3 | @freezed 4 | class FastlaughEvent with _$FastlaughEvent { 5 | const factory FastlaughEvent.initialize() = Initialize; 6 | const factory FastlaughEvent.likeVideo({required int id}) = LikeVideo; 7 | const factory FastlaughEvent.unLikeVideo({required int id}) = UnLikeVideo; 8 | } 9 | -------------------------------------------------------------------------------- /lib/domain/core/debounce.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'dart:async'; 3 | 4 | class Debouncer { 5 | final int milliseconds; 6 | Timer? _timer; 7 | 8 | Debouncer({required this.milliseconds}); 9 | 10 | run(VoidCallback action) { 11 | _timer?.cancel(); 12 | _timer = Timer(Duration(milliseconds: milliseconds), action); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/colors/common.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Gap extends StatelessWidget { 4 | final W; 5 | final H; 6 | const Gap({Key? key, double this.H = 0, double this.W = 0}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return SizedBox( 11 | height: H, 12 | width: W, 13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /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/domain/core/di/injectable.dart: -------------------------------------------------------------------------------- 1 | import 'package:injectable/injectable.dart'; 2 | import 'package:get_it/get_it.dart'; 3 | import 'package:netflix/domain/core/di/injectable.config.dart'; 4 | import 'injectable.config.dart'; 5 | 6 | final getIt = GetIt.instance; 7 | 8 | @InjectableInit() 9 | Future configureInjection() async { 10 | await $initGetIt(getIt, environment: Environment.prod); 11 | } 12 | -------------------------------------------------------------------------------- /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/new_and_hot/hot_and_new_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix/domain/core/main_failure.dart'; 3 | import 'package:netflix/domain/new_and_hot/models/hot_and_new_resp/hot_and_new_resp.dart'; 4 | 5 | abstract class HotAndNewService { 6 | Future> getHotAndNewMovieData(); 7 | Future> getHotAndNewTveData(); 8 | } 9 | -------------------------------------------------------------------------------- /lib/presentation/home/category_model/categories/genre.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'genre.g.dart'; 4 | 5 | @JsonSerializable() 6 | class Genre { 7 | int? id; 8 | String? name; 9 | 10 | Genre({this.id, this.name}); 11 | 12 | factory Genre.fromJson(Map json) => _$GenreFromJson(json); 13 | 14 | Map toJson() => _$GenreToJson(this); 15 | } 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | UrlLauncherWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /lib/application/home/homebloc_state.dart: -------------------------------------------------------------------------------- 1 | part of 'homebloc_bloc.dart'; 2 | 3 | @freezed 4 | class HomeblocState with _$HomeblocState { 5 | const factory HomeblocState( 6 | { List? moviesList, 7 | 8 | 9 | required bool isLoading, 10 | required bool isError}) = _Initial; 11 | 12 | factory HomeblocState.initial() => 13 | const HomeblocState(moviesList: [],isLoading: false, isError: false); 14 | } 15 | -------------------------------------------------------------------------------- /lib/core/colors/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | const backgroundColor = Colors.black; 4 | const whiteColor = Colors.white; 5 | const buttonColor = Colors.blueAccent; 6 | const buttonColorWhie = Colors.white; 7 | const blackColor = Colors.black; 8 | const greyColor = Color.fromARGB(255, 54, 54, 54); 9 | const greyTextColor = Color.fromARGB(255, 133, 133, 133); 10 | const lightGrey = Color.fromARGB(255, 192, 192, 192); 11 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/application/fastLaugh/fastlaugh_state.dart: -------------------------------------------------------------------------------- 1 | part of 'fastlaugh_bloc.dart'; 2 | 3 | @freezed 4 | class FastlaughState with _$FastlaughState { 5 | const factory FastlaughState({ 6 | required List videosList, 7 | required bool isLoading, 8 | required bool isError, 9 | }) = _Initial; 10 | 11 | factory FastlaughState.initialize() => FastlaughState( 12 | videosList: [], 13 | isLoading: true, 14 | isError: false, 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /lib/presentation/home/category_model/categories/categories.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | import 'genre.dart'; 4 | 5 | part 'categories.g.dart'; 6 | 7 | @JsonSerializable() 8 | class Category { 9 | List? genres; 10 | 11 | Category({this.genres}); 12 | 13 | factory Category.fromJson(Map json) { 14 | return _$CategoryFromJson(json); 15 | } 16 | 17 | Map toJson() => _$CategoryToJson(this); 18 | } 19 | -------------------------------------------------------------------------------- /lib/application/search/bloc/search_state.dart: -------------------------------------------------------------------------------- 1 | part of 'search_bloc.dart'; 2 | 3 | @freezed 4 | class SearchState with _$SearchState { 5 | const factory SearchState({ 6 | required List searchResultData, 7 | required List IdleList, 8 | required bool isLoading, 9 | required bool isError, 10 | }) = _SearchState; 11 | 12 | factory SearchState.initial() => const SearchState( 13 | searchResultData: [], IdleList: [], isLoading: false, isError: false); 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/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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/domain/downloads/core/api_end_points.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix/core/strings.dart'; 2 | import 'package:netflix/infrastructure/api_key.dart'; 3 | 4 | class ApiEndPoits { 5 | static const downloads = "${baseUrl}/trending/movie/week?api_key=${API_KEY}"; 6 | static const search = "${baseUrl}/search/movie?api_key=${API_KEY}&query="; 7 | static const hotAndNewMovie = "${baseUrl}/discover/movie?api_key=${API_KEY}"; 8 | static const hotAndNewTv = "${baseUrl}/discover/tv?api_key=${API_KEY}"; 9 | static const home = "${baseUrl}/search/movie?api_key=${API_KEY}"; 10 | } 11 | -------------------------------------------------------------------------------- /lib/application/hot_and_new/hotandnew_state.dart: -------------------------------------------------------------------------------- 1 | part of 'hotandnew_bloc.dart'; 2 | 3 | @freezed 4 | class HotandnewState with _$HotandnewState { 5 | const factory HotandnewState({ 6 | required List? comingSoonList, 7 | required List everyOnesWatchingList, 8 | required bool isLoading, 9 | required bool isError, 10 | }) = _Initial; 11 | 12 | factory HotandnewState.initial() => const HotandnewState( 13 | comingSoonList: [], 14 | everyOnesWatchingList: [], 15 | isError: false, 16 | isLoading: false); 17 | } 18 | -------------------------------------------------------------------------------- /lib/domain/downloads/models/downloads.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | part 'downloads.freezed.dart'; 3 | part 'downloads.g.dart'; 4 | 5 | @freezed 6 | class Downloads with _$Downloads { 7 | const factory Downloads({ 8 | @JsonKey(name: "poster_path") required String posterPath, 9 | @JsonKey(name: "title") required String title, 10 | @JsonKey(name: "backdrop_path") required String verticalImage, 11 | }) = _Downloads; 12 | 13 | factory Downloads.fromJson(Map json) => 14 | _$DownloadsFromJson(json); 15 | } 16 | -------------------------------------------------------------------------------- /lib/presentation/search/widgets/search_text_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/core/colors/colors.dart'; 3 | 4 | class SearchTextWidget extends StatelessWidget { 5 | final String title; 6 | const SearchTextWidget({Key? key, required this.title}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Text( 11 | title, 12 | style: const TextStyle( 13 | color: whiteColor, 14 | fontSize: 20, 15 | fontWeight: FontWeight.bold, 16 | ), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/application/downloads/downloads_state.dart: -------------------------------------------------------------------------------- 1 | part of 'downloads_bloc.dart'; 2 | 3 | @freezed 4 | class DownloadsState with _$DownloadsState { 5 | const factory DownloadsState({ 6 | required bool isLoading, 7 | required Option>> 8 | downloadsFalureOrSuccess, 9 | required List downloads, 10 | }) = _DownloadsState; 11 | 12 | factory DownloadsState.initial() { 13 | return const DownloadsState( 14 | isLoading: false, 15 | downloadsFalureOrSuccess: None(), 16 | downloads: [], 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /lib/presentation/home/category_model/categories/genre.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'genre.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Genre _$GenreFromJson(Map json) => Genre( 10 | id: json['id'] as int?, 11 | name: json['name'] as String?, 12 | ); 13 | 14 | Map _$GenreToJson(Genre instance) => { 15 | 'id': instance.id, 16 | 'name': instance.name, 17 | }; 18 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /lib/presentation/home/category_model/categories/categories.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'categories.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Category _$CategoryFromJson(Map json) => Category( 10 | genres: (json['genres'] as List?) 11 | ?.map((e) => Genre.fromJson(e as Map)) 12 | .toList(), 13 | ); 14 | 15 | Map _$CategoryToJson(Category instance) => { 16 | 'genres': instance.genres, 17 | }; 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /lib/presentation/widgets/main_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/presentation/search/widgets/search_result.dart'; 3 | 4 | class MainCard extends StatelessWidget { 5 | const MainCard({ 6 | Key? key, 7 | }) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Column( 12 | children: [ 13 | Container( 14 | width: 110, 15 | height: 160, 16 | decoration: BoxDecoration( 17 | borderRadius: BorderRadius.circular(5), 18 | image: DecorationImage( 19 | fit: BoxFit.fill, image: NetworkImage(samplePosters[1]))), 20 | ), 21 | ], 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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/presentation/home/widgets/custom_button_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class HomeCustomButtonWidget extends StatelessWidget { 4 | const HomeCustomButtonWidget({ 5 | Key? key, 6 | required this.title, 7 | required this.icon, 8 | }) : super(key: key); 9 | 10 | final String title; 11 | final IconData icon; 12 | @override 13 | Widget build(BuildContext context) { 14 | return Column( 15 | children: [ 16 | Icon( 17 | icon, 18 | size: 28, 19 | color: Color.fromARGB(255, 187, 187, 187), 20 | ), 21 | Text( 22 | title, 23 | style: TextStyle(color: Color.fromARGB(255, 187, 187, 187)), 24 | ) 25 | ], 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/domain/downloads/models/downloads.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'downloads.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_Downloads _$$_DownloadsFromJson(Map json) => _$_Downloads( 10 | posterPath: json['poster_path'] as String, 11 | title: json['title'] as String, 12 | verticalImage: json['backdrop_path'] as String, 13 | ); 14 | 15 | Map _$$_DownloadsToJson(_$_Downloads instance) => 16 | { 17 | 'poster_path': instance.posterPath, 18 | 'title': instance.title, 19 | 'backdrop_path': instance.verticalImage, 20 | }; 21 | -------------------------------------------------------------------------------- /lib/presentation/new_and_hot/widgets/nh_button_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/core/colors/colors.dart'; 3 | import 'package:netflix/core/colors/common.dart'; 4 | 5 | class NhButtonWidget extends StatelessWidget { 6 | const NhButtonWidget({Key? key, required this.icon, required this.title}) 7 | : super(key: key); 8 | final icon; 9 | final title; 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Column( 14 | children: [ 15 | Icon( 16 | icon, 17 | size: 25, 18 | color: whiteColor, 19 | ), 20 | Gap( 21 | H: 5, 22 | ), 23 | Text( 24 | title, 25 | style: TextStyle( 26 | color: greyTextColor, 27 | fontSize: 12, 28 | ), 29 | ) 30 | ], 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | 48 | #ignoring ( Api Key ) 49 | lib/infrastructure/api_key.dart 50 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package: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 | -------------------------------------------------------------------------------- /lib/infrastructure/apis.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:netflix/presentation/home/category_model/categories/categories.dart'; 4 | import 'package:netflix/presentation/home/category_model/categories/genre.dart'; 5 | import 'package:http/http.dart' as http; 6 | import 'package:netflix/presentation/home/discover_tv/discover_model.dart'; 7 | 8 | abstract class ApiCalls { 9 | Future category(); 10 | Future discoverTV(); 11 | } 12 | 13 | class MovieDB extends ApiCalls { 14 | @override 15 | Future> category() async { 16 | final result = await http.get(Uri.parse( 17 | 'https://api.themoviedb.org/3/genre/movie/list?api_key=9431fb06c74cd222c8e46d576d2b4dfe&language=en-US')); 18 | Map map = json.decode(result.body); 19 | final data = Category.fromJson(map); 20 | return data.genres!; 21 | } 22 | 23 | @override 24 | Future> discoverTV() async { 25 | final result = await http.get(Uri.parse( 26 | "https://api.themoviedb.org/3/trending/all/day?api_key=9431fb06c74cd222c8e46d576d2b4dfe")); 27 | Map map = json.decode(result.body); 28 | final data = Discover.fromJson(map); 29 | print(data.results); 30 | return data.results!; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/presentation/main_page/screen_main_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/presentation/FastLuagh/screen_fast_laugh.dart'; 3 | import 'package:netflix/presentation/downloads/screen_downloads.dart'; 4 | import 'package:netflix/presentation/home/screen_home.dart'; 5 | import 'package:netflix/presentation/main_page/widgets/bottom_navigation.dart'; 6 | import 'package:netflix/presentation/new_and_hot/screen_new_and_hot.dart'; 7 | import 'package:netflix/presentation/search/screen_search.dart'; 8 | 9 | class ScreenMainPage extends StatelessWidget { 10 | ScreenMainPage({Key? key}) : super(key: key); 11 | 12 | final _pages = [ 13 | const ScreenHome(), 14 | const ScreenNewAndHot(), 15 | const ScreenFastLaugh(), 16 | ScreenSearch(), 17 | ScreenDownloads() 18 | ]; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return Scaffold( 23 | body: SafeArea( 24 | child: ValueListenableBuilder( 25 | valueListenable: indexChangedNotifier, 26 | builder: (BuildContext context, int index, _) { 27 | return _pages[index]; 28 | }, 29 | ), 30 | ), 31 | bottomNavigationBar: const BottomNavigationWidget(), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/infrastructure/home/main_screen_implementation.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix/domain/core/main_failure.dart'; 6 | import 'package:dartz/dartz.dart'; 7 | import 'package:netflix/domain/downloads/core/api_end_points.dart'; 8 | import 'package:netflix/domain/home/home_screen_service.dart'; 9 | import 'package:netflix/domain/home/model/main_screen/main_screen.dart'; 10 | 11 | @LazySingleton(as: HomeScreenService) 12 | class HomeScreenImplementation implements HomeScreenService { 13 | @override 14 | Future> getAllTrendingVideos() async { 15 | try { 16 | final Response response = await Dio(BaseOptions()).get( 17 | ApiEndPoits.downloads, 18 | ); 19 | 20 | 21 | 22 | if (response.statusCode == 200 || response.statusCode == 201) { 23 | final result = MainScreenResp.fromJson(response.data); 24 | 25 | // log("${response.data}"); 26 | 27 | return Right(result); 28 | } else { 29 | return const Left(MainFailure.serverFailure()); 30 | } 31 | } catch (e) { 32 | log(e.toString()); 33 | return const Left(MainFailure.clientFailure()); 34 | } 35 | 36 | 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /lib/infrastructure/search/search_implementation.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix/domain/core/main_failure.dart'; 6 | import 'package:dartz/dartz.dart'; 7 | import 'package:netflix/domain/downloads/core/api_end_points.dart'; 8 | import 'package:netflix/domain/search/models/search_resp/search_resp.dart'; 9 | import 'package:netflix/domain/search/search_services.dart'; 10 | 11 | @LazySingleton(as: SearchService) 12 | class SearchImpl implements SearchService { 13 | @override 14 | Future> searchMovies({required query}) async { 15 | try { 16 | final Response response = await Dio(BaseOptions()).get( 17 | ApiEndPoits.search, 18 | queryParameters: {'query': query}, 19 | ); 20 | 21 | // print(ApiEndPoits.search); 22 | log("${response.data}"); 23 | 24 | if (response.statusCode == 200 || response.statusCode == 201) { 25 | final result = SearchResp.fromJson(response.data); 26 | 27 | return Right(result); 28 | } else { 29 | return const Left(MainFailure.serverFailure()); 30 | } 31 | } catch (e) { 32 | log(e.toString()); 33 | return const Left(MainFailure.clientFailure()); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/application/downloads/downloads_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:dartz/dartz.dart'; 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix/domain/core/main_failure.dart'; 6 | import 'package:netflix/domain/downloads/models/downloads.dart'; 7 | import 'package:netflix/domain/i_downloads%20_repo.dart'; 8 | part 'downloads_bloc.freezed.dart'; 9 | part 'downloads_event.dart'; 10 | part 'downloads_state.dart'; 11 | 12 | @Injectable() 13 | class DownloadsBloc extends Bloc { 14 | final IDownloadsRepo _downloadsRepo; 15 | 16 | DownloadsBloc(this._downloadsRepo) : super(DownloadsState.initial()) { 17 | on<_GetDownloadsImage>((event, emit) async { 18 | final Either> downloadsOption = 19 | await _downloadsRepo.getDownloadsImages(); 20 | 21 | emit(downloadsOption.fold( 22 | (failure) => state.copyWith( 23 | isLoading: true, 24 | downloadsFalureOrSuccess: Some( 25 | Left(failure), 26 | ), 27 | ), 28 | (success) => state.copyWith( 29 | isLoading: false, 30 | downloads: success, 31 | downloadsFalureOrSuccess: Some( 32 | Right(success), 33 | ), 34 | ), 35 | )); 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/presentation/widgets/app_bar_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:netflix/core/colors/common.dart'; 4 | 5 | class AppBarWidget extends StatelessWidget { 6 | final String title; 7 | const AppBarWidget({Key? key, required this.title}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Padding( 12 | padding: const EdgeInsets.symmetric(horizontal: 15), 13 | child: Row( 14 | children: [ 15 | Text( 16 | title, 17 | style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), 18 | ), 19 | const Spacer(), 20 | IconButton( 21 | onPressed: () {}, 22 | icon: const Icon( 23 | Icons.cast_rounded, 24 | color: Colors.white, 25 | size: 25, 26 | )), 27 | const Gap( 28 | W: 10, 29 | ), 30 | Container( 31 | decoration: const BoxDecoration( 32 | gradient: LinearGradient( 33 | begin: Alignment.topCenter, 34 | end: Alignment.bottomCenter, 35 | colors: [Colors.red, Colors.yellow])), 36 | width: 25, 37 | height: 25, 38 | ), 39 | // const Gap( 40 | // W: 10, 41 | // ), 42 | ], 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"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/infrastructure/downloads/downloads_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:netflix/domain/downloads/core/api_end_points.dart'; 4 | import 'package:netflix/domain/downloads/models/downloads.dart'; 5 | import 'package:netflix/domain/core/main_failure.dart'; 6 | import 'package:dartz/dartz.dart'; 7 | import 'package:netflix/domain/i_downloads%20_repo.dart'; 8 | 9 | @LazySingleton(as: IDownloadsRepo) 10 | class DownloadRepository implements IDownloadsRepo { 11 | @override 12 | Future>> getDownloadsImages() async { 13 | try { 14 | final Response response = 15 | await Dio(BaseOptions()).get(ApiEndPoits.downloads); 16 | 17 | print(ApiEndPoits.downloads); 18 | 19 | if (response.statusCode == 200 || response.statusCode == 201) { 20 | final downloadList = (response.data["results"] as List).map((e) { 21 | return Downloads.fromJson(e); 22 | }).toList(); 23 | 24 | // for (final raw in response.data) { 25 | // downloadList.add(Downloads.fromJson(raw as Map)); 26 | // } 27 | 28 | print(downloadList.toString()); 29 | 30 | return Right(downloadList); 31 | } else { 32 | return const Left(MainFailure.serverFailure()); 33 | } 34 | } catch (e) { 35 | return const Left(MainFailure.clientFailure()); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /lib/application/home/homebloc_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix/domain/home/home_screen_service.dart'; 6 | import 'package:netflix/domain/home/model/main_screen/main_screen.dart'; 7 | 8 | part 'homebloc_event.dart'; 9 | part 'homebloc_state.dart'; 10 | part 'homebloc_bloc.freezed.dart'; 11 | 12 | @Injectable() 13 | class HomeblocBloc extends Bloc { 14 | final HomeScreenService _homeScreenService; 15 | HomeblocBloc(this._homeScreenService) : super(HomeblocState.initial()) { 16 | on((event, emit) async { 17 | emit( 18 | const HomeblocState( 19 | moviesList: [], 20 | isLoading: true, 21 | isError: false, 22 | ), 23 | ); 24 | final _result = await _homeScreenService.getAllTrendingVideos(); 25 | 26 | final newState = _result.fold((failure) { 27 | return const HomeblocState( 28 | moviesList: [], 29 | isLoading: false, 30 | isError: true, 31 | ); 32 | }, (succes) { 33 | var newlist = succes.results!; 34 | List movieList = []; 35 | // var newlist = state.moviesList!; 36 | 37 | movieList.addAll(newlist); 38 | 39 | movieList.shuffle(); 40 | 41 | return HomeblocState( 42 | moviesList: movieList, 43 | isLoading: false, 44 | isError: false, 45 | ); 46 | }); 47 | 48 | emit(newState); 49 | }); 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/application/hot_and_new/hotandnew_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:freezed_annotation/freezed_annotation.dart'; 3 | import 'package:injectable/injectable.dart'; 4 | import 'package:netflix/domain/new_and_hot/hot_and_new_service.dart'; 5 | import 'package:netflix/domain/new_and_hot/models/hot_and_new_resp/hot_and_new_resp.dart'; 6 | 7 | part 'hotandnew_event.dart'; 8 | part 'hotandnew_state.dart'; 9 | part 'hotandnew_bloc.freezed.dart'; 10 | 11 | @Injectable() 12 | class HotandnewBloc extends Bloc { 13 | final HotAndNewService _hotAndNewService; 14 | 15 | HotandnewBloc(this._hotAndNewService) : super(HotandnewState.initial()) { 16 | // get hot and new movie data 17 | 18 | on((event, emit) async { 19 | // sending loading 20 | emit(const HotandnewState( 21 | comingSoonList: [], 22 | everyOnesWatchingList: [], 23 | isLoading: true, 24 | isError: false)); 25 | final _result = await _hotAndNewService.getHotAndNewMovieData(); 26 | 27 | final newState = _result.fold((failure) { 28 | return const HotandnewState( 29 | comingSoonList: [], 30 | everyOnesWatchingList: [], 31 | isLoading: false, 32 | isError: true); 33 | }, (success) { 34 | return HotandnewState( 35 | comingSoonList: success.results, 36 | everyOnesWatchingList: state.everyOnesWatchingList, 37 | isLoading: false, 38 | isError: false); 39 | }); 40 | 41 | emit(newState); 42 | }); 43 | on((event, emit) async {}); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | 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 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /lib/domain/new_and_hot/models/hot_and_new_resp/hot_and_new_resp.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'hot_and_new_resp.g.dart'; 4 | 5 | @JsonSerializable() 6 | class HotAndNewResp { 7 | int? page; 8 | List? results; 9 | 10 | HotAndNewResp({this.page, this.results = const []}); 11 | 12 | factory HotAndNewResp.fromJson(Map json) { 13 | return _$HotAndNewRespFromJson(json); 14 | } 15 | 16 | Map toJson() => _$HotAndNewRespToJson(this); 17 | } 18 | 19 | @JsonSerializable() 20 | class HotAndNewData { 21 | bool? adult; 22 | @JsonKey(name: 'backdrop_path') 23 | String? backdropPath; 24 | @JsonKey(name: 'genre_ids') 25 | List? genreIds; 26 | int? id; 27 | @JsonKey(name: 'original_language') 28 | String? originalLanguage; 29 | @JsonKey(name: 'original_title') 30 | String? originalTitle; 31 | String? overview; 32 | double? popularity; 33 | @JsonKey(name: 'poster_path') 34 | String? posterPath; 35 | @JsonKey(name: 'release_date') 36 | String? releaseDate; 37 | String? title; 38 | bool? video; 39 | @JsonKey(name: 'vote_average') 40 | double? voteAverage; 41 | @JsonKey(name: 'vote_count') 42 | int? voteCount; 43 | 44 | HotAndNewData({ 45 | this.adult, 46 | this.backdropPath, 47 | this.genreIds, 48 | this.id, 49 | this.originalLanguage, 50 | this.originalTitle, 51 | this.overview, 52 | this.popularity, 53 | this.posterPath, 54 | this.releaseDate, 55 | this.title, 56 | this.video, 57 | this.voteAverage, 58 | this.voteCount, 59 | }); 60 | 61 | factory HotAndNewData.fromJson(Map json) { 62 | return _$HotAndNewDataFromJson(json); 63 | } 64 | 65 | Map toJson() => _$HotAndNewDataToJson(this); 66 | } 67 | -------------------------------------------------------------------------------- /lib/domain/search/models/search_resp/search_resp.dart: -------------------------------------------------------------------------------- 1 | import 'package:injectable/injectable.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | part 'search_resp.g.dart'; 4 | 5 | @JsonSerializable() 6 | class SearchResp { 7 | List? results; 8 | 9 | SearchResp({this.results = const []}); 10 | 11 | factory SearchResp.fromJson(Map json) { 12 | return _$SearchRespFromJson(json); 13 | } 14 | 15 | Map toJson() => _$SearchRespToJson(this); 16 | } 17 | 18 | @JsonSerializable() 19 | class SearchResultData { 20 | bool? adult; 21 | @JsonKey(name: 'backdrop_path') 22 | String? backdropPath; 23 | @JsonKey(name: 'genre_ids') 24 | List? genreIds; 25 | int? id; 26 | @JsonKey(name: 'original_language') 27 | String? originalLanguage; 28 | @JsonKey(name: 'original_title') 29 | String? originalTitle; 30 | String? overview; 31 | double? popularity; 32 | @JsonKey(name: 'poster_path') 33 | String? posterPath; 34 | @JsonKey(name: 'release_date') 35 | String? releaseDate; 36 | String? title; 37 | bool? video; 38 | @JsonKey(name: 'vote_average') 39 | double? voteAverage; 40 | @JsonKey(name: 'vote_count') 41 | int? voteCount; 42 | 43 | SearchResultData({ 44 | this.adult, 45 | this.backdropPath, 46 | this.genreIds, 47 | this.id, 48 | this.originalLanguage, 49 | this.originalTitle, 50 | this.overview, 51 | this.popularity, 52 | this.posterPath, 53 | this.releaseDate, 54 | this.title, 55 | this.video, 56 | this.voteAverage, 57 | this.voteCount, 58 | }); 59 | 60 | factory SearchResultData.fromJson(Map json) { 61 | return _$SearchResultDataFromJson(json); 62 | } 63 | 64 | Map toJson() => _$SearchResultDataToJson(this); 65 | } 66 | -------------------------------------------------------------------------------- /lib/domain/home/model/main_screen/main_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | part 'main_screen.g.dart'; 3 | 4 | @JsonSerializable() 5 | class MainScreenResp { 6 | int? page; 7 | List? results; 8 | 9 | MainScreenResp({this.page, this.results}); 10 | 11 | factory MainScreenResp.fromJson(Map json) { 12 | return _$MainScreenRespFromJson(json); 13 | } 14 | 15 | Map toJson() => _$MainScreenRespToJson(this); 16 | } 17 | 18 | @JsonSerializable() 19 | class MainScreenData { 20 | bool? video; 21 | @JsonKey(name: 'vote_average') 22 | double? voteAverage; 23 | String? overview; 24 | @JsonKey(name: 'release_date') 25 | String? releaseDate; 26 | bool? adult; 27 | @JsonKey(name: 'backdrop_path') 28 | String? backdropPath; 29 | @JsonKey(name: 'vote_count') 30 | int? voteCount; 31 | @JsonKey(name: 'genre_ids') 32 | List? genreIds; 33 | String? title; 34 | @JsonKey(name: 'original_language') 35 | String? originalLanguage; 36 | @JsonKey(name: 'original_title') 37 | String? originalTitle; 38 | @JsonKey(name: 'poster_path') 39 | String? posterPath; 40 | int? id; 41 | double? popularity; 42 | @JsonKey(name: 'media_type') 43 | String? mediaType; 44 | 45 | MainScreenData({ 46 | this.video, 47 | this.voteAverage, 48 | this.overview, 49 | this.releaseDate, 50 | this.adult, 51 | this.backdropPath, 52 | this.voteCount, 53 | this.genreIds, 54 | this.title, 55 | this.originalLanguage, 56 | this.originalTitle, 57 | this.posterPath, 58 | this.id, 59 | this.popularity, 60 | this.mediaType, 61 | }); 62 | 63 | factory MainScreenData.fromJson(Map json) { 64 | return _$MainScreenDataFromJson(json); 65 | } 66 | 67 | Map toJson() => _$MainScreenDataToJson(this); 68 | } 69 | -------------------------------------------------------------------------------- /lib/infrastructure/hot_and_new/hot_and_new_implementation.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix/domain/core/main_failure.dart'; 6 | import 'package:dartz/dartz.dart'; 7 | import 'package:netflix/domain/downloads/core/api_end_points.dart'; 8 | import 'package:netflix/domain/new_and_hot/hot_and_new_service.dart'; 9 | import 'package:netflix/domain/new_and_hot/models/hot_and_new_resp/hot_and_new_resp.dart'; 10 | 11 | @LazySingleton(as: HotAndNewService) 12 | class HotAndNewImplementation implements HotAndNewService { 13 | @override 14 | Future> getHotAndNewMovieData() async { 15 | try { 16 | final Response response = await Dio(BaseOptions()).get( 17 | ApiEndPoits.hotAndNewMovie, 18 | ); 19 | 20 | if (response.statusCode == 200 || response.statusCode == 201) { 21 | final result = HotAndNewResp.fromJson(response.data); 22 | 23 | return Right(result); 24 | } else { 25 | return const Left(MainFailure.serverFailure()); 26 | } 27 | } catch (e) { 28 | log(e.toString()); 29 | return const Left(MainFailure.clientFailure()); 30 | } 31 | } 32 | 33 | @override 34 | Future> getHotAndNewTveData() async { 35 | try { 36 | final Response response = await Dio(BaseOptions()).get( 37 | ApiEndPoits.hotAndNewTv, 38 | ); 39 | 40 | if (response.statusCode == 200 || response.statusCode == 201) { 41 | final result = HotAndNewResp.fromJson(response.data); 42 | 43 | return Right(result); 44 | } else { 45 | return const Left(MainFailure.serverFailure()); 46 | } 47 | } catch (e) { 48 | log(e.toString()); 49 | return const Left(MainFailure.clientFailure()); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 17 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/background_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/application/home/homebloc_bloc.dart'; 3 | import 'package:netflix/core/colors/colors.dart'; 4 | import 'package:netflix/core/strings.dart'; 5 | import 'package:netflix/presentation/home/widgets/custom_button_widget.dart'; 6 | 7 | class BackGroundCard extends StatelessWidget { 8 | const BackGroundCard({Key? key, required this.state}) : super(key: key); 9 | 10 | final HomeblocState state; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | final moviePoster = imageBase + state.moviesList![0].posterPath.toString(); 15 | 16 | return Stack( 17 | alignment: Alignment.bottomCenter, 18 | children: [ 19 | Container( 20 | width: double.infinity, 21 | height: 600, 22 | decoration: BoxDecoration( 23 | image: DecorationImage(image: NetworkImage(moviePoster))), 24 | ), 25 | Padding( 26 | padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 0), 27 | child: Row( 28 | mainAxisAlignment: MainAxisAlignment.spaceAround, 29 | children: [ 30 | const HomeCustomButtonWidget( 31 | icon: Icons.add, 32 | title: "My List", 33 | ), 34 | _PlayButton(), 35 | const HomeCustomButtonWidget( 36 | icon: Icons.info_outline, 37 | title: "Info", 38 | ), 39 | ], 40 | ), 41 | ) 42 | ], 43 | ); 44 | } 45 | } 46 | 47 | TextButton _PlayButton() { 48 | return TextButton.icon( 49 | style: ButtonStyle( 50 | backgroundColor: MaterialStateProperty.all(whiteColor), 51 | foregroundColor: MaterialStateProperty.all(blackColor), 52 | ), 53 | onPressed: () {}, 54 | icon: const Icon(Icons.play_arrow), 55 | label: const Padding( 56 | padding: EdgeInsets.symmetric(horizontal: 5), 57 | child: const Text( 58 | "Play", 59 | style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), 60 | ), 61 | )); 62 | } 63 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | import 'package:netflix/application/downloads/downloads_bloc.dart'; 5 | import 'package:netflix/application/fastLaugh/fastlaugh_bloc.dart'; 6 | import 'package:netflix/application/home/homebloc_bloc.dart'; 7 | import 'package:netflix/application/hot_and_new/hotandnew_bloc.dart'; 8 | import 'package:netflix/application/search/bloc/search_bloc.dart'; 9 | import 'package:netflix/core/colors/colors.dart'; 10 | import 'package:netflix/domain/core/di/injectable.dart'; 11 | 12 | import 'presentation/main_page/screen_main_page.dart'; 13 | 14 | void main() async { 15 | WidgetsFlutterBinding.ensureInitialized(); 16 | await configureInjection(); 17 | runApp(const MyApp()); 18 | } 19 | 20 | class MyApp extends StatelessWidget { 21 | const MyApp({Key? key}) : super(key: key); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return MultiBlocProvider( 26 | providers: [ 27 | BlocProvider( 28 | create: (context) => getIt(), 29 | ), 30 | BlocProvider( 31 | create: (context) => getIt(), 32 | ), 33 | BlocProvider( 34 | create: (context) => getIt(), 35 | ), 36 | BlocProvider( 37 | create: (context) => getIt(), 38 | ), 39 | BlocProvider( 40 | create: (context) => getIt(), 41 | ), 42 | ], 43 | child: MaterialApp( 44 | theme: ThemeData( 45 | appBarTheme: const AppBarTheme(backgroundColor: blackColor), 46 | fontFamily: GoogleFonts.montserrat().fontFamily, 47 | scaffoldBackgroundColor: backgroundColor, 48 | primarySwatch: Colors.blue, 49 | backgroundColor: backgroundColor, 50 | textTheme: const TextTheme( 51 | bodyText1: TextStyle(color: Colors.white), 52 | bodyText2: TextStyle(color: Colors.white))), 53 | debugShowCheckedModeBanner: false, 54 | home: ScreenMainPage(), 55 | ), 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | 36 | kotlinOptions { 37 | jvmTarget = '1.8' 38 | } 39 | 40 | sourceSets { 41 | main.java.srcDirs += 'src/main/kotlin' 42 | } 43 | 44 | defaultConfig { 45 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 46 | applicationId "com.example.netflix" 47 | minSdkVersion flutter.minSdkVersion 48 | targetSdkVersion flutter.targetSdkVersion 49 | versionCode flutterVersionCode.toInteger() 50 | versionName flutterVersionName 51 | } 52 | 53 | buildTypes { 54 | release { 55 | // TODO: Add your own signing config for the release build. 56 | // Signing with the debug keys for now, so `flutter run --release` works. 57 | signingConfig signingConfigs.debug 58 | } 59 | } 60 | } 61 | 62 | flutter { 63 | source '../..' 64 | } 65 | 66 | dependencies { 67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 68 | } 69 | -------------------------------------------------------------------------------- /lib/domain/search/models/search_resp/search_resp.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'search_resp.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SearchResp _$SearchRespFromJson(Map json) => SearchResp( 10 | results: (json['results'] as List?) 11 | ?.map((e) => SearchResultData.fromJson(e as Map)) 12 | .toList() ?? 13 | const [], 14 | ); 15 | 16 | Map _$SearchRespToJson(SearchResp instance) => 17 | { 18 | 'results': instance.results, 19 | }; 20 | 21 | SearchResultData _$SearchResultDataFromJson(Map json) => 22 | SearchResultData( 23 | adult: json['adult'] as bool?, 24 | backdropPath: json['backdrop_path'] as String?, 25 | genreIds: 26 | (json['genre_ids'] as List?)?.map((e) => e as int).toList(), 27 | id: json['id'] as int?, 28 | originalLanguage: json['original_language'] as String?, 29 | originalTitle: json['original_title'] as String?, 30 | overview: json['overview'] as String?, 31 | popularity: (json['popularity'] as num?)?.toDouble(), 32 | posterPath: json['poster_path'] as String?, 33 | releaseDate: json['release_date'] as String?, 34 | title: json['title'] as String?, 35 | video: json['video'] as bool?, 36 | voteAverage: (json['vote_average'] as num?)?.toDouble(), 37 | voteCount: json['vote_count'] as int?, 38 | ); 39 | 40 | Map _$SearchResultDataToJson(SearchResultData instance) => 41 | { 42 | 'adult': instance.adult, 43 | 'backdrop_path': instance.backdropPath, 44 | 'genre_ids': instance.genreIds, 45 | 'id': instance.id, 46 | 'original_language': instance.originalLanguage, 47 | 'original_title': instance.originalTitle, 48 | 'overview': instance.overview, 49 | 'popularity': instance.popularity, 50 | 'poster_path': instance.posterPath, 51 | 'release_date': instance.releaseDate, 52 | 'title': instance.title, 53 | 'video': instance.video, 54 | 'vote_average': instance.voteAverage, 55 | 'vote_count': instance.voteCount, 56 | }; 57 | -------------------------------------------------------------------------------- /lib/application/fastLaugh/fastlaugh_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:freezed_annotation/freezed_annotation.dart'; 5 | import 'package:injectable/injectable.dart'; 6 | import 'package:netflix/domain/core/main_failure.dart'; 7 | import 'package:netflix/domain/downloads/models/downloads.dart'; 8 | import 'package:netflix/domain/i_downloads%20_repo.dart'; 9 | 10 | part 'fastlaugh_event.dart'; 11 | part 'fastlaugh_state.dart'; 12 | part 'fastlaugh_bloc.freezed.dart'; 13 | 14 | final dummyVideoUrls = [ 15 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4", 16 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4", 17 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", 18 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", 19 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4" 20 | ]; 21 | 22 | @Injectable() 23 | class FastlaughBloc extends Bloc { 24 | FastlaughBloc(IDownloadsRepo _downloadsService) 25 | : super(FastlaughState.initialize()) { 26 | on((event, emit) async { 27 | // sending loading 28 | emit(const FastlaughState( 29 | videosList: [], 30 | isLoading: true, 31 | isError: false, 32 | )); 33 | 34 | // getTrending movies 35 | 36 | final _result = await _downloadsService.getDownloadsImages(); 37 | 38 | final _state = _result.fold((MainFailure failure) { 39 | return FastlaughState( 40 | videosList: [], 41 | isLoading: false, 42 | isError: true, 43 | ); 44 | }, (success) { 45 | return FastlaughState( 46 | videosList: success, 47 | isLoading: false, 48 | isError: false, 49 | ); 50 | }); 51 | 52 | // show to ui 53 | 54 | emit(_state); 55 | }); 56 | 57 | on((event, emit) async { 58 | // var list = state.likedVideosList; 59 | 60 | // list.add(event.id); 61 | 62 | // emit(state.copyWith(likedVideosList: list)); 63 | }); 64 | on((event, emit) { 65 | // var list = state.likedVideosList; 66 | 67 | // list.remove(event.id); 68 | // emit(state.copyWith(likedVideosList: list)); 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/domain/new_and_hot/models/hot_and_new_resp/hot_and_new_resp.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'hot_and_new_resp.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | HotAndNewResp _$HotAndNewRespFromJson(Map json) => 10 | HotAndNewResp( 11 | page: json['page'] as int?, 12 | results: (json['results'] as List?) 13 | ?.map((e) => HotAndNewData.fromJson(e as Map)) 14 | .toList() ?? 15 | const [], 16 | ); 17 | 18 | Map _$HotAndNewRespToJson(HotAndNewResp instance) => 19 | { 20 | 'page': instance.page, 21 | 'results': instance.results, 22 | }; 23 | 24 | HotAndNewData _$HotAndNewDataFromJson(Map json) => 25 | HotAndNewData( 26 | adult: json['adult'] as bool?, 27 | backdropPath: json['backdrop_path'] as String?, 28 | genreIds: 29 | (json['genre_ids'] as List?)?.map((e) => e as int).toList(), 30 | id: json['id'] as int?, 31 | originalLanguage: json['original_language'] as String?, 32 | originalTitle: json['original_title'] as String?, 33 | overview: json['overview'] as String?, 34 | popularity: (json['popularity'] as num?)?.toDouble(), 35 | posterPath: json['poster_path'] as String?, 36 | releaseDate: json['release_date'] as String?, 37 | title: json['title'] as String?, 38 | video: json['video'] as bool?, 39 | voteAverage: (json['vote_average'] as num?)?.toDouble(), 40 | voteCount: json['vote_count'] as int?, 41 | ); 42 | 43 | Map _$HotAndNewDataToJson(HotAndNewData instance) => 44 | { 45 | 'adult': instance.adult, 46 | 'backdrop_path': instance.backdropPath, 47 | 'genre_ids': instance.genreIds, 48 | 'id': instance.id, 49 | 'original_language': instance.originalLanguage, 50 | 'original_title': instance.originalTitle, 51 | 'overview': instance.overview, 52 | 'popularity': instance.popularity, 53 | 'poster_path': instance.posterPath, 54 | 'release_date': instance.releaseDate, 55 | 'title': instance.title, 56 | 'video': instance.video, 57 | 'vote_average': instance.voteAverage, 58 | 'vote_count': instance.voteCount, 59 | }; 60 | -------------------------------------------------------------------------------- /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/domain/core/di/injectable.config.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | // ************************************************************************** 4 | // InjectableConfigGenerator 5 | // ************************************************************************** 6 | 7 | import 'package:get_it/get_it.dart' as _i1; 8 | import 'package:injectable/injectable.dart' as _i2; 9 | 10 | import '../../../application/downloads/downloads_bloc.dart' as _i13; 11 | import '../../../application/fastLaugh/fastlaugh_bloc.dart' as _i14; 12 | import '../../../application/home/homebloc_bloc.dart' as _i5; 13 | import '../../../application/hot_and_new/hotandnew_bloc.dart' as _i8; 14 | import '../../../application/search/bloc/search_bloc.dart' as _i15; 15 | import '../../../infrastructure/downloads/downloads_repository.dart' as _i10; 16 | import '../../../infrastructure/home/main_screen_implementation.dart' as _i4; 17 | import '../../../infrastructure/hot_and_new/hot_and_new_implementation.dart' 18 | as _i7; 19 | import '../../../infrastructure/search/search_implementation.dart' as _i12; 20 | import '../../home/home_screen_service.dart' as _i3; 21 | import '../../i_downloads%20_repo.dart' as _i9; 22 | import '../../new_and_hot/hot_and_new_service.dart' as _i6; 23 | import '../../search/search_services.dart' 24 | as _i11; // ignore_for_file: unnecessary_lambdas 25 | 26 | // ignore_for_file: lines_longer_than_80_chars 27 | /// initializes the registration of provided dependencies inside of [GetIt] 28 | _i1.GetIt $initGetIt(_i1.GetIt get, 29 | {String? environment, _i2.EnvironmentFilter? environmentFilter}) { 30 | final gh = _i2.GetItHelper(get, environment, environmentFilter); 31 | gh.lazySingleton<_i3.HomeScreenService>(() => _i4.HomeScreenImplementation()); 32 | gh.factory<_i5.HomeblocBloc>( 33 | () => _i5.HomeblocBloc(get<_i3.HomeScreenService>())); 34 | gh.lazySingleton<_i6.HotAndNewService>(() => _i7.HotAndNewImplementation()); 35 | gh.factory<_i8.HotandnewBloc>( 36 | () => _i8.HotandnewBloc(get<_i6.HotAndNewService>())); 37 | gh.lazySingleton<_i9.IDownloadsRepo>(() => _i10.DownloadRepository()); 38 | gh.lazySingleton<_i11.SearchService>(() => _i12.SearchImpl()); 39 | gh.factory<_i13.DownloadsBloc>( 40 | () => _i13.DownloadsBloc(get<_i9.IDownloadsRepo>())); 41 | gh.factory<_i14.FastlaughBloc>( 42 | () => _i14.FastlaughBloc(get<_i9.IDownloadsRepo>())); 43 | gh.factory<_i15.SearchBloc>(() => 44 | _i15.SearchBloc(get<_i9.IDownloadsRepo>(), get<_i11.SearchService>())); 45 | return get; 46 | } 47 | -------------------------------------------------------------------------------- /lib/domain/home/model/main_screen/main_screen.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'main_screen.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MainScreenResp _$MainScreenRespFromJson(Map json) => 10 | MainScreenResp( 11 | page: json['page'] as int?, 12 | results: (json['results'] as List?) 13 | ?.map((e) => MainScreenData.fromJson(e as Map)) 14 | .toList(), 15 | ); 16 | 17 | Map _$MainScreenRespToJson(MainScreenResp instance) => 18 | { 19 | 'page': instance.page, 20 | 'results': instance.results, 21 | }; 22 | 23 | MainScreenData _$MainScreenDataFromJson(Map json) => 24 | MainScreenData( 25 | video: json['video'] as bool?, 26 | voteAverage: (json['vote_average'] as num?)?.toDouble(), 27 | overview: json['overview'] as String?, 28 | releaseDate: json['release_date'] as String?, 29 | adult: json['adult'] as bool?, 30 | backdropPath: json['backdrop_path'] as String?, 31 | voteCount: json['vote_count'] as int?, 32 | genreIds: 33 | (json['genre_ids'] as List?)?.map((e) => e as int).toList(), 34 | title: json['title'] as String?, 35 | originalLanguage: json['original_language'] as String?, 36 | originalTitle: json['original_title'] as String?, 37 | posterPath: json['poster_path'] as String?, 38 | id: json['id'] as int?, 39 | popularity: (json['popularity'] as num?)?.toDouble(), 40 | mediaType: json['media_type'] as String?, 41 | ); 42 | 43 | Map _$MainScreenDataToJson(MainScreenData instance) => 44 | { 45 | 'video': instance.video, 46 | 'vote_average': instance.voteAverage, 47 | 'overview': instance.overview, 48 | 'release_date': instance.releaseDate, 49 | 'adult': instance.adult, 50 | 'backdrop_path': instance.backdropPath, 51 | 'vote_count': instance.voteCount, 52 | 'genre_ids': instance.genreIds, 53 | 'title': instance.title, 54 | 'original_language': instance.originalLanguage, 55 | 'original_title': instance.originalTitle, 56 | 'poster_path': instance.posterPath, 57 | 'id': instance.id, 58 | 'popularity': instance.popularity, 59 | 'media_type': instance.mediaType, 60 | }; 61 | -------------------------------------------------------------------------------- /lib/presentation/main_page/widgets/bottom_navigation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:netflix/core/colors/colors.dart'; 4 | 5 | ValueNotifier indexChangedNotifier = ValueNotifier(0); 6 | 7 | class BottomNavigationWidget extends StatelessWidget { 8 | const BottomNavigationWidget({Key? key}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return ValueListenableBuilder( 13 | valueListenable: indexChangedNotifier, 14 | builder: (BuildContext context, int newIndex, _) { 15 | return Container( 16 | height: 70, 17 | child: BottomNavigationBar( 18 | onTap: (index) => indexChangedNotifier.value = index, 19 | type: BottomNavigationBarType.fixed, 20 | currentIndex: newIndex, 21 | backgroundColor: backgroundColor, 22 | selectedItemColor: Colors.white, 23 | unselectedItemColor: Colors.grey, 24 | selectedFontSize: 12, 25 | iconSize: 27, 26 | selectedIconTheme: IconThemeData( 27 | color: whiteColor, 28 | ), 29 | items: const [ 30 | BottomNavigationBarItem( 31 | icon: Padding( 32 | padding: EdgeInsets.only(bottom: 2), 33 | child: Icon(Icons.home), 34 | ), 35 | label: "Home", 36 | ), 37 | BottomNavigationBarItem( 38 | icon: Padding( 39 | padding: EdgeInsets.only(bottom: 2), 40 | child: Icon(Icons.collections), 41 | ), 42 | label: "New & Hot", 43 | ), 44 | BottomNavigationBarItem( 45 | icon: Padding( 46 | padding: EdgeInsets.only(bottom: 2), 47 | child: Icon(Icons.emoji_emotions), 48 | ), 49 | label: "Fast Laughs", 50 | ), 51 | BottomNavigationBarItem( 52 | icon: Padding( 53 | padding: EdgeInsets.only(bottom: 2), 54 | child: Icon(CupertinoIcons.search), 55 | ), 56 | label: "Search", 57 | ), 58 | BottomNavigationBarItem( 59 | icon: Padding( 60 | padding: EdgeInsets.only(bottom: 2), 61 | child: Icon(Icons.download_rounded), 62 | ), 63 | label: "Downloads", 64 | ), 65 | ], 66 | ), 67 | ); 68 | }, 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/presentation/search/widgets/search_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/application/search/bloc/search_bloc.dart'; 4 | import 'package:netflix/core/colors/colors.dart'; 5 | import 'package:netflix/core/colors/common.dart'; 6 | import 'package:netflix/presentation/search/widgets/search_text_widget.dart'; 7 | 8 | class SearchResultWidget extends StatelessWidget { 9 | const SearchResultWidget({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | const imageBase = "https://image.tmdb.org/t/p/w500"; 14 | return Column( 15 | crossAxisAlignment: CrossAxisAlignment.start, 16 | children: [ 17 | const SearchTextWidget(title: "Movies & TV"), 18 | const Gap( 19 | H: 10, 20 | ), 21 | Expanded( 22 | child: BlocBuilder( 23 | builder: (context, state) { 24 | return GridView.count( 25 | crossAxisCount: 3, 26 | shrinkWrap: true, 27 | mainAxisSpacing: 8, 28 | crossAxisSpacing: 8, 29 | childAspectRatio: 2 / 3, 30 | children: List.generate(20, (index) { 31 | final movie = state.searchResultData[index]; 32 | 33 | if (movie.posterPath==null) { 34 | return const Center( 35 | child: CircularProgressIndicator(color: greyColor), 36 | ); 37 | } else if (state.isError) { 38 | return const CircularProgressIndicator(); 39 | } else { 40 | return MainPosterCard( 41 | imgUrl: imageBase + movie.posterPath!, 42 | ); 43 | } 44 | }), 45 | ); 46 | }, 47 | ), 48 | ) 49 | ], 50 | ); 51 | } 52 | } 53 | 54 | final samplePosters = [ 55 | "https://www.themoviedb.org/t/p/w220_and_h330_face/nj5HmHRZsrYQEYYXyAusFv35erP.jpg", 56 | "https://www.themoviedb.org/t/p/w220_and_h330_face/lJA2RCMfsWoskqlQhXPSLFQGXEJ.jpg", 57 | "https://www.themoviedb.org/t/p/w220_and_h330_face/bcCBq9N1EMo3daNIjWJ8kYvrQm6.jpg" 58 | ]; 59 | 60 | class MainPosterCard extends StatelessWidget { 61 | final String imgUrl; 62 | const MainPosterCard({Key? key, required this.imgUrl}) : super(key: key); 63 | 64 | @override 65 | Widget build(BuildContext context) { 66 | return Container( 67 | decoration: BoxDecoration( 68 | borderRadius: BorderRadius.circular(5), 69 | image: DecorationImage( 70 | fit: BoxFit.cover, 71 | image: NetworkImage(imgUrl), 72 | ), 73 | )); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /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/presentation/home/discover_tv/discover_model.dart: -------------------------------------------------------------------------------- 1 | class Discover { 2 | int? page; 3 | List? results; 4 | int? totalPages; 5 | int? totalResults; 6 | 7 | Discover({this.page, this.results, this.totalPages, this.totalResults}); 8 | 9 | Discover.fromJson(Map json) { 10 | page = json['page']; 11 | if (json['results'] != null) { 12 | results = []; 13 | json['results'].forEach((v) { 14 | results!.add(new Results.fromJson(v)); 15 | }); 16 | } 17 | totalPages = json['total_pages']; 18 | totalResults = json['total_results']; 19 | } 20 | 21 | Map toJson() { 22 | final Map data = new Map(); 23 | data['page'] = this.page; 24 | if (this.results != null) { 25 | data['results'] = this.results!.map((v) => v.toJson()).toList(); 26 | } 27 | data['total_pages'] = this.totalPages; 28 | data['total_results'] = this.totalResults; 29 | return data; 30 | } 31 | } 32 | 33 | class Results { 34 | bool? adult; 35 | String? backdropPath; 36 | List? genreIds; 37 | int? id; 38 | String? originalLanguage; 39 | String? originalTitle; 40 | String? overview; 41 | double? popularity; 42 | String? posterPath; 43 | String? releaseDate; 44 | String? title; 45 | bool? video; 46 | double? voteAverage; 47 | int? voteCount; 48 | 49 | Results( 50 | {this.adult, 51 | this.backdropPath, 52 | this.genreIds, 53 | this.id, 54 | this.originalLanguage, 55 | this.originalTitle, 56 | this.overview, 57 | this.popularity, 58 | this.posterPath, 59 | this.releaseDate, 60 | this.title, 61 | this.video, 62 | this.voteAverage, 63 | this.voteCount}); 64 | 65 | Results.fromJson(Map json) { 66 | adult = json['adult']; 67 | backdropPath = json['backdrop_path']; 68 | genreIds = json['genre_ids'].cast(); 69 | id = json['id']; 70 | originalLanguage = json['original_language']; 71 | originalTitle = json['original_title']; 72 | overview = json['overview']; 73 | popularity = json['popularity']; 74 | posterPath = json['poster_path']; 75 | releaseDate = json['release_date']; 76 | title = json['title']; 77 | video = json['video']; 78 | voteAverage = json['vote_average']; 79 | voteCount = json['vote_count']; 80 | } 81 | 82 | Map toJson() { 83 | final Map data = new Map(); 84 | data['adult'] = this.adult; 85 | data['backdrop_path'] = this.backdropPath; 86 | data['genre_ids'] = this.genreIds; 87 | data['id'] = this.id; 88 | data['original_language'] = this.originalLanguage; 89 | data['original_title'] = this.originalTitle; 90 | data['overview'] = this.overview; 91 | data['popularity'] = this.popularity; 92 | data['poster_path'] = this.posterPath; 93 | data['release_date'] = this.releaseDate; 94 | data['title'] = this.title; 95 | data['video'] = this.video; 96 | data['vote_average'] = this.voteAverage; 97 | data['vote_count'] = this.voteCount; 98 | return data; 99 | } 100 | } -------------------------------------------------------------------------------- /lib/application/search/bloc/search_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:freezed_annotation/freezed_annotation.dart'; 5 | import 'package:injectable/injectable.dart'; 6 | import 'package:netflix/domain/core/main_failure.dart'; 7 | import 'package:netflix/domain/downloads/models/downloads.dart'; 8 | import 'package:netflix/domain/i_downloads%20_repo.dart'; 9 | import 'package:netflix/domain/search/models/search_resp/search_resp.dart'; 10 | import 'package:netflix/domain/search/search_services.dart'; 11 | 12 | part 'search_event.dart'; 13 | part 'search_state.dart'; 14 | part 'search_bloc.freezed.dart'; 15 | 16 | @injectable 17 | class SearchBloc extends Bloc { 18 | final IDownloadsRepo _downloadService; 19 | final SearchService _searchService; 20 | 21 | SearchBloc(this._downloadService, this._searchService) 22 | : super(SearchState.initial()) { 23 | /* 24 | idle State 25 | */ 26 | on((event, emit) async { 27 | if (state.IdleList.isNotEmpty) { 28 | // ignore: invalid_use_of_visible_for_testing_member 29 | emit(SearchState( 30 | searchResultData: [], 31 | IdleList: state.IdleList, 32 | isLoading: false, 33 | isError: false, 34 | )); 35 | 36 | return; 37 | } 38 | 39 | emit(const SearchState( 40 | searchResultData: [], 41 | IdleList: [], 42 | isLoading: true, 43 | isError: false, 44 | )); 45 | 46 | //get Trending 47 | final _result = await _downloadService.getDownloadsImages(); 48 | 49 | _result.fold((MainFailure faiure) { 50 | emit(const SearchState( 51 | searchResultData: [], 52 | IdleList: [], 53 | isLoading: false, 54 | isError: true, 55 | )); 56 | }, (List succes) { 57 | emit(SearchState( 58 | searchResultData: [], 59 | IdleList: succes, 60 | isLoading: false, 61 | isError: false, 62 | )); 63 | }); 64 | // show to ui 65 | }); 66 | 67 | /* 68 | idle State 69 | */ 70 | on((event, emit) async { 71 | log("searching for ${event.query}"); 72 | // search api 73 | 74 | emit( 75 | const SearchState( 76 | searchResultData: [], 77 | IdleList: [], 78 | isLoading: true, 79 | isError: false, 80 | ), 81 | ); 82 | 83 | final resulut = await _searchService.searchMovies(query: event.query); 84 | 85 | final _state = resulut.fold( 86 | (MainFailure failure) { 87 | return const SearchState( 88 | searchResultData: [], 89 | IdleList: [], 90 | isLoading: true, 91 | isError: false, 92 | ); 93 | }, 94 | (SearchResp success) { 95 | return SearchState( 96 | searchResultData: success.results!, 97 | IdleList: [], 98 | isLoading: false, 99 | isError: false, 100 | ); 101 | }, 102 | ); 103 | 104 | print(resulut); 105 | 106 | // show to ui 107 | 108 | emit(_state); 109 | }); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "netflix" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "netflix" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 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 | -------------------------------------------------------------------------------- /lib/presentation/widgets/number_main_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:bordered_text/bordered_text.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:netflix/application/home/homebloc_bloc.dart'; 5 | import 'package:netflix/core/colors/colors.dart'; 6 | import 'package:netflix/core/colors/common.dart'; 7 | import 'package:netflix/core/strings.dart'; 8 | import 'package:netflix/presentation/search/widgets/search_text_widget.dart'; 9 | 10 | class MainNumberCard extends StatelessWidget { 11 | const MainNumberCard({Key? key, required this.title,}) 12 | : super(key: key); 13 | final String title; 14 | 15 | 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Column( 20 | crossAxisAlignment: CrossAxisAlignment.start, 21 | children: [ 22 | SearchTextWidget(title: title), 23 | const Gap( 24 | H: 5, 25 | ), 26 | LimitedBox( 27 | maxHeight: 160, 28 | child: BlocBuilder( 29 | builder: (context, state) { 30 | return ListView.separated( 31 | scrollDirection: Axis.horizontal, 32 | separatorBuilder: (context, index) => const Gap( 33 | W: 0, 34 | ), 35 | itemCount: 10, 36 | itemBuilder: (context, index) { 37 | final _CurrentMovie = state.moviesList![index]; 38 | final _CurrentMoviePoster = 39 | imageBase + _CurrentMovie.posterPath.toString(); 40 | return Column( 41 | children: [ 42 | Stack( 43 | // alignment: Alignment.bottomLeft, 44 | children: [ 45 | Row( 46 | children: [ 47 | const SizedBox( 48 | width: 30, 49 | height: 160, 50 | ), 51 | Container( 52 | width: 110, 53 | height: 160, 54 | decoration: BoxDecoration( 55 | borderRadius: BorderRadius.circular(5), 56 | image: DecorationImage( 57 | fit: BoxFit.fill, 58 | image: NetworkImage(_CurrentMoviePoster))), 59 | ), 60 | ], 61 | ), 62 | Positioned( 63 | // left: 5, 64 | top: 50, 65 | child: BorderedText( 66 | strokeColor: whiteColor, 67 | strokeWidth: 2, 68 | child: Text( 69 | "${index + 1}", 70 | style: const TextStyle( 71 | fontSize: 120, 72 | color: blackColor, 73 | ), 74 | ), 75 | ), 76 | ) 77 | ], 78 | ), 79 | ], 80 | ); 81 | } 82 | ); 83 | }, 84 | ), 85 | ) 86 | ], 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /lib/presentation/search/screen_search.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:netflix/application/search/bloc/search_bloc.dart'; 5 | import 'package:netflix/core/colors/colors.dart'; 6 | import 'package:netflix/core/colors/common.dart'; 7 | import 'package:netflix/domain/core/debounce.dart'; 8 | import 'package:netflix/presentation/search/widgets/search_idle.dart'; 9 | import 'package:netflix/presentation/search/widgets/search_result.dart'; 10 | 11 | TextEditingController _controller = TextEditingController(); 12 | 13 | class ScreenSearch extends StatelessWidget { 14 | ScreenSearch({Key? key}) : super(key: key); 15 | 16 | final Debouncer _debouncer = Debouncer(milliseconds: 500); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | WidgetsBinding.instance.addPostFrameCallback((_) { 21 | BlocProvider.of(context).add(const Intialize()); 22 | }); 23 | 24 | return Scaffold( 25 | body: SafeArea( 26 | child: Padding( 27 | padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), 28 | child: Column( 29 | crossAxisAlignment: CrossAxisAlignment.start, 30 | children: [ 31 | Row( 32 | children: [ 33 | Expanded( 34 | child: CupertinoTextField( 35 | controller: _controller, 36 | onChanged: (value) { 37 | if (value.isEmpty) return; 38 | _debouncer.run(() { 39 | BlocProvider.of(context) 40 | .add(SearchMovie(query: value.toString())); 41 | }); 42 | }, 43 | placeholder: "Search", 44 | placeholderStyle: 45 | const TextStyle(color: greyTextColor, fontSize: 18), 46 | style: const TextStyle(color: greyTextColor, fontSize: 18), 47 | padding: const EdgeInsets.symmetric(vertical: 8), 48 | decoration: BoxDecoration( 49 | color: greyColor, 50 | borderRadius: BorderRadius.circular(5)), 51 | prefix: const Padding( 52 | padding: EdgeInsets.only(left: 10, right: 10), 53 | child: Icon( 54 | CupertinoIcons.search, 55 | color: greyTextColor, 56 | ), 57 | ), 58 | ), 59 | ), 60 | TextButton( 61 | onPressed: () {}, 62 | child: const SizedBox( 63 | child: Text( 64 | "Cancel", 65 | style: TextStyle(color: Colors.white), 66 | ), 67 | )) 68 | ], 69 | ), 70 | const Gap( 71 | H: 10, 72 | ), 73 | Expanded( 74 | child: BlocBuilder( 75 | builder: (context, state) { 76 | if (state.searchResultData.isEmpty) { 77 | return const SearchIdleWidget(); 78 | } else { 79 | return const SearchResultWidget(); 80 | } 81 | }, 82 | ), 83 | ) 84 | ], 85 | ), 86 | )), 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/categories.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:netflix/infrastructure/apis.dart'; 5 | import 'package:netflix/presentation/home/category_model/categories/genre.dart'; 6 | 7 | class Categories extends StatelessWidget { 8 | const Categories({Key? key}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return BackdropFilter( 13 | filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), 14 | child: Dialog( 15 | backgroundColor: Colors.transparent, 16 | child: Stack( 17 | alignment: Alignment.bottomCenter, 18 | children: [ 19 | FutureBuilder( 20 | future: MovieDB().category(), 21 | builder: (BuildContext context, 22 | AsyncSnapshot> categoryList) { 23 | if (categoryList.data == null) { 24 | return CircularProgressIndicator(); 25 | } 26 | return ListView.separated( 27 | physics: const BouncingScrollPhysics(), 28 | separatorBuilder: (context, index) => const SizedBox( 29 | height: 25, 30 | ), 31 | itemBuilder: (BuildContext context, int index) { 32 | return Column( 33 | children: [ 34 | SizedBox(height: index == 0 ? 100 : 0), 35 | Text( 36 | categoryList.data![index].name.toString(), 37 | style: const TextStyle( 38 | color: Colors.white, fontSize: 20), 39 | textAlign: TextAlign.center, 40 | ), 41 | Container( 42 | color: Colors.transparent, 43 | height: index == categoryList.data!.length - 1 44 | ? 200 45 | : 0, 46 | ) 47 | ], 48 | ); 49 | }, 50 | itemCount: categoryList.data!.length, 51 | ); 52 | }), 53 | InkWell( 54 | onTap: () => Navigator.pop(context), 55 | child: const CircleAvatar( 56 | radius: 25, 57 | child: Icon( 58 | Icons.close, 59 | size: 29, 60 | color: Colors.black, 61 | ), 62 | backgroundColor: Colors.white, 63 | ), 64 | ) 65 | ], 66 | ), 67 | ), 68 | ); 69 | } 70 | } 71 | 72 | // final List categoryList = [ 73 | // 'Home', 74 | // 'My List', 75 | // 'Available for Download', 76 | // 'Hindi', 77 | // 'Tamil', 78 | // 'Punjabi', 79 | // 'Telugu', 80 | // 'Malayalam', 81 | // 'Marathi', 82 | // 'Bengali', 83 | // 'English', 84 | // 'Action', 85 | // 'Anime', 86 | // 'Award Winners', 87 | // 'Biographical', 88 | // 'Bollywood', 89 | // 'Blockbusters', 90 | // 'Children & Family', 91 | // 'Comedies', 92 | // 'Documentaries', 93 | // 'Dramas', 94 | // 'Fantasy', 95 | // 'Hollywood', 96 | // 'Horror', 97 | // 'International', 98 | // 'Indian', 99 | // 'Music & Musicals', 100 | // 'Reality & Talk', 101 | // 'Romance', 102 | // 'Sci-Fi', 103 | // 'Stand-up', 104 | // 'Thrillers', 105 | // ]; 106 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(netflix LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "netflix") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: netflix 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.16.2 <3.0.0" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | bordered_text: ^2.0.0 31 | cupertino_icons: ^1.0.2 32 | dartz: ^0.10.1 33 | dio: ^4.0.6 34 | flutter: 35 | sdk: flutter 36 | flutter_bloc: ^8.0.1 37 | flutter_svg: ^1.0.3 38 | freezed_annotation: ^2.0.3 39 | get_test: ^4.0.1 40 | google_fonts: ^2.3.2 41 | http: ^0.13.4 42 | injectable: ^1.5.3 43 | json_annotation: ^4.5.0 44 | json_serializable: ^6.2.0 45 | share_plus: ^4.0.4 46 | video_player: ^2.4.2 47 | 48 | dev_dependencies: 49 | build_runner: ^2.1.10 50 | flutter_lints: ^1.0.0 51 | flutter_test: 52 | sdk: flutter 53 | freezed: ^2.0.3+1 54 | injectable_generator: ^1.5.3 55 | 56 | # For information on the generic Dart part of this file, see the 57 | # following page: https://dart.dev/tools/pub/pubspec 58 | # The following section is specific to Flutter. 59 | flutter: 60 | # The following line ensures that the Material Icons font is 61 | # included with your application, so that you can use the icons in 62 | # the material Icons class. 63 | uses-material-design: true 64 | # To add assets to your application, add an assets section, like this: 65 | assets: 66 | - assets/svg/Netflix_2015_N_logo.svg 67 | - assets/img/NetFlixOriginal.jpg 68 | # An image asset can refer to one or more resolution-specific "variants", see 69 | # https://flutter.dev/assets-and-images/#resolution-aware. 70 | # For details regarding adding assets from package dependencies, see 71 | # https://flutter.dev/assets-and-images/#from-packages 72 | # To add custom fonts to your application, add a fonts section here, 73 | # in this "flutter" section. Each entry in this list should have a 74 | # "family" key with the font family name, and a "fonts" key with a 75 | # list giving the asset and other descriptors for the font. For 76 | # example: 77 | # fonts: 78 | # - family: Schyler 79 | # fonts: 80 | # - asset: fonts/Schyler-Regular.ttf 81 | # - asset: fonts/Schyler-Italic.ttf 82 | # style: italic 83 | # - family: Trajan Pro 84 | # fonts: 85 | # - asset: fonts/TrajanPro.ttf 86 | # - asset: fonts/TrajanPro_Bold.ttf 87 | # weight: 700 88 | # 89 | # For details regarding fonts from package dependencies, 90 | # see https://flutter.dev/custom-fonts/#from-packages 91 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /lib/presentation/search/widgets/search_idle.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/application/search/bloc/search_bloc.dart'; 4 | import 'package:netflix/core/colors/colors.dart'; 5 | import 'package:netflix/core/colors/common.dart'; 6 | import 'package:netflix/presentation/search/widgets/search_text_widget.dart'; 7 | 8 | class SearchIdleWidget extends StatelessWidget { 9 | const SearchIdleWidget({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Column( 14 | crossAxisAlignment: CrossAxisAlignment.start, 15 | children: [ 16 | SearchTextWidget( 17 | title: "Top Searches", 18 | ), 19 | Gap( 20 | H: 10, 21 | ), 22 | Expanded( 23 | child: BlocBuilder( 24 | builder: (context, state) { 25 | if (state.isLoading) { 26 | return Center( 27 | child: CircularProgressIndicator( 28 | color: greyColor, 29 | ), 30 | ); 31 | } else if (state.isError) { 32 | return Text("Error While Getting Data Occured"); 33 | } else if (state.IdleList.isEmpty) { 34 | return Center( 35 | child: CircularProgressIndicator( 36 | color: greyColor, 37 | ), 38 | ); 39 | } 40 | 41 | return ListView.separated( 42 | shrinkWrap: true, 43 | itemBuilder: (context, index) => TopSearchItemTile( 44 | imgUrl: state.IdleList[index].verticalImage, 45 | title: state.IdleList[index].title, 46 | ), 47 | separatorBuilder: (context, index) => const Gap( 48 | H: 10, 49 | ), 50 | itemCount: state.IdleList.length, 51 | ); 52 | }, 53 | ), 54 | ), 55 | ], 56 | ); 57 | } 58 | } 59 | 60 | class TopSearchItemTile extends StatelessWidget { 61 | final String title; 62 | final String imgUrl; 63 | 64 | const TopSearchItemTile({Key? key, required this.imgUrl, required this.title}) 65 | : super(key: key); 66 | 67 | @override 68 | Widget build(BuildContext context) { 69 | const imageBase = "https://image.tmdb.org/t/p/w500"; 70 | final screenWidth = MediaQuery.of(context).size.width; 71 | return SizedBox( 72 | width: double.infinity, 73 | height: 80, 74 | // decoration: BoxDecoration(color: Colors.grey), 75 | child: Row(children: [ 76 | Container( 77 | height: 80, 78 | width: screenWidth * 0.33, 79 | decoration: BoxDecoration( 80 | borderRadius: BorderRadius.circular(5), 81 | image: DecorationImage( 82 | fit: BoxFit.cover, 83 | image: NetworkImage( 84 | imageBase + imgUrl, 85 | ))), 86 | ), 87 | const Gap( 88 | W: 8, 89 | ), 90 | Expanded( 91 | child: Text( 92 | title, 93 | textAlign: TextAlign.start, 94 | style: const TextStyle(color: whiteColor, fontSize: 18), 95 | ), 96 | ), 97 | // IconButton( 98 | // onPressed: () {}, 99 | // icon: Icon( 100 | // CupertinoIcons.play_arrow, 101 | // color: whiteColor, 102 | // )) 103 | 104 | const CircleAvatar( 105 | radius: 20, 106 | backgroundColor: whiteColor, 107 | child: CircleAvatar( 108 | radius: 18, 109 | backgroundColor: Colors.black, 110 | child: Icon( 111 | Icons.play_arrow_rounded, 112 | color: whiteColor, 113 | ), 114 | ), 115 | ) 116 | ]), 117 | ); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /lib/presentation/widgets/main_title_cad.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | import 'package:netflix/application/home/homebloc_bloc.dart'; 6 | import 'package:netflix/core/colors/colors.dart'; 7 | import 'package:netflix/core/colors/common.dart'; 8 | import 'package:netflix/core/strings.dart'; 9 | import 'package:netflix/domain/home/model/main_screen/main_screen.dart'; 10 | import 'package:netflix/presentation/detailed_screen/detailed_screen.dart'; 11 | import 'package:netflix/presentation/search/widgets/search_text_widget.dart'; 12 | 13 | class MainTitleCard extends StatelessWidget { 14 | MainTitleCard( 15 | {Key? key, required this.title, required this.api, List? poster}) 16 | : super(key: key); 17 | 18 | final title; 19 | List? api = []; 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Column( 24 | crossAxisAlignment: CrossAxisAlignment.start, 25 | children: [ 26 | SearchTextWidget(title: title), 27 | const Gap( 28 | H: 5, 29 | ), 30 | LimitedBox( 31 | maxHeight: 160, 32 | child: BlocBuilder( 33 | builder: (context, state) { 34 | if (state.isLoading) { 35 | return const Center( 36 | child: CircularProgressIndicator(color: greyColor), 37 | ); 38 | } else if (state.isError) { 39 | return const Center( 40 | child: Text( 41 | "Something went wrong", 42 | style: TextStyle(color: greyColor), 43 | ), 44 | ); 45 | } else if (state.moviesList!.isEmpty) { 46 | return const Center( 47 | child: Text( 48 | "Something Occured while fetching Data", 49 | style: TextStyle(color: greyColor), 50 | ), 51 | ); 52 | } else { 53 | return ListView.separated( 54 | scrollDirection: Axis.horizontal, 55 | separatorBuilder: (context, index) => const Gap( 56 | W: 10, 57 | ), 58 | itemCount: state.moviesList!.length, 59 | itemBuilder: (context, index) { 60 | List movieList = []; 61 | var newlist = api; 62 | 63 | movieList.addAll(newlist!); 64 | 65 | // movieList.shuffle(); 66 | 67 | 68 | final _CurrentMovie = movieList[index]; 69 | 70 | final _CurrentMoviePoster = 71 | imageBase + _CurrentMovie.posterPath!; 72 | 73 | return GestureDetector( 74 | onTap: () { 75 | Navigator.of(context).push(MaterialPageRoute( 76 | builder: (context) => Detailedscreen( 77 | index: index, 78 | movieData: _CurrentMovie, 79 | ))); 80 | }, 81 | child: Column( 82 | children: [ 83 | Container( 84 | width: 110, 85 | height: 160, 86 | decoration: BoxDecoration( 87 | borderRadius: BorderRadius.circular(5), 88 | image: DecorationImage( 89 | fit: BoxFit.fill, 90 | image: 91 | NetworkImage(_CurrentMoviePoster))), 92 | ), 93 | ], 94 | ), 95 | ); 96 | }); 97 | } 98 | }, 99 | ), 100 | ) 101 | ], 102 | ); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /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 | 39 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/main_card1.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: sized_box_for_whitespace 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:netflix/core/colors/colors.dart'; 6 | import 'package:netflix/core/colors/common.dart'; 7 | import 'package:netflix/infrastructure/apis.dart'; 8 | import 'package:netflix/presentation/home/discover_tv/discover_model.dart'; 9 | 10 | class MainCard1 extends StatelessWidget { 11 | const MainCard1({ 12 | Key? key, 13 | }) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Container( 18 | height: 180, 19 | width: 110, 20 | child: FutureBuilder( 21 | future: MovieDB().discoverTV(), 22 | builder: (BuildContext, AsyncSnapshot> discovertv) { 23 | if (discovertv.data == null) { 24 | return const SizedBox( 25 | height: 50, width: 50, child: CircularProgressIndicator()); 26 | } 27 | return ListView.separated( 28 | shrinkWrap: true, 29 | scrollDirection: Axis.horizontal, 30 | separatorBuilder: (context, index) => const Gap( 31 | W: 10, 32 | H: 0, 33 | ), 34 | itemCount: discovertv.data!.length, 35 | itemBuilder: (context, index) { 36 | return GestureDetector( 37 | child: Column( 38 | children: [ 39 | Stack( 40 | children: [ 41 | Container( 42 | width: 110, 43 | height: 160, 44 | decoration: BoxDecoration( 45 | borderRadius: BorderRadius.circular(5), 46 | image: DecorationImage( 47 | fit: BoxFit.fill, 48 | image: NetworkImage( 49 | "https://image.tmdb.org/t/p/original/${discovertv.data![index].posterPath}"))), 50 | ), 51 | Positioned.fill( 52 | child: Align( 53 | alignment: Alignment.center, 54 | child: Container( 55 | height: 50, 56 | width: 50, 57 | decoration: BoxDecoration( 58 | border: 59 | Border.all(color: whiteColor, width: 1), 60 | borderRadius: BorderRadius.circular(50), 61 | color: Colors.black.withOpacity(0.5), 62 | ), 63 | child: const Padding( 64 | padding: EdgeInsets.only(left: 5.0), 65 | child: Icon(CupertinoIcons.play_fill, 66 | size: 40, color: whiteColor), 67 | ), 68 | ), 69 | ), 70 | ), 71 | Positioned.fill( 72 | child: Align( 73 | alignment: Alignment.bottomCenter, 74 | child: Wrap( 75 | children: [ 76 | Container( 77 | height: 2, 78 | width: index % 2 == 0 ? 110 : 70, 79 | decoration: const BoxDecoration( 80 | color: Colors.red), 81 | ), 82 | Container( 83 | color: Colors.black.withOpacity(.8), 84 | height: 35, 85 | width: 130.0, 86 | child: Row( 87 | mainAxisAlignment: 88 | MainAxisAlignment.spaceBetween, 89 | children: const [ 90 | Icon( 91 | Icons.info_outline, 92 | size: 30, 93 | color: whiteColor, 94 | ), 95 | Icon( 96 | Icons.more_vert, 97 | color: whiteColor, 98 | size: 30, 99 | ) 100 | ], 101 | ), 102 | ), 103 | ], 104 | ), 105 | ), 106 | ) 107 | ], 108 | ), 109 | ], 110 | ), 111 | ); 112 | }); 113 | }), 114 | ); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /lib/presentation/new_and_hot/widgets/everones_watch_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix/core/colors/colors.dart'; 3 | import 'package:netflix/core/colors/common.dart'; 4 | import 'package:netflix/presentation/new_and_hot/widgets/nh_button_widget.dart'; 5 | 6 | class EveryOnesWatchingWidget extends StatelessWidget { 7 | final String id; 8 | final String month; 9 | final String day; 10 | final String posterPath; 11 | final String movieName; 12 | final String description; 13 | 14 | const EveryOnesWatchingWidget({ 15 | Key? key, 16 | required this.id, 17 | required this.month, 18 | required this.day, 19 | required this.posterPath, 20 | required this.movieName, 21 | required this.description, 22 | }); 23 | @override 24 | Widget build(BuildContext context) { 25 | Size size = MediaQuery.of(context).size; 26 | 27 | return Column( 28 | children: [ 29 | const Gap( 30 | H: 10, 31 | ), 32 | Row( 33 | crossAxisAlignment: CrossAxisAlignment.start, 34 | children: [ 35 | SizedBox( 36 | width: size.width - 20, 37 | // height: 500, 38 | // decoration: const BoxDecoration(color: greyColor), 39 | child: Column( 40 | crossAxisAlignment: CrossAxisAlignment.start, 41 | children: [ 42 | Stack( 43 | alignment: Alignment.topRight, 44 | children: [ 45 | Container( 46 | height: 200, 47 | width: double.infinity, 48 | decoration: BoxDecoration( 49 | borderRadius: BorderRadius.circular(15), 50 | image: DecorationImage( 51 | fit: BoxFit.cover, 52 | image: NetworkImage(posterPath))), 53 | ), 54 | SizedBox( 55 | height: 200, 56 | child: Padding( 57 | padding: const EdgeInsets.symmetric( 58 | vertical: 10, horizontal: 10), 59 | child: Column( 60 | // crossAxisAlignment: CrossAxisAlignment.end, 61 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 62 | children: [ 63 | Container( 64 | decoration: BoxDecoration( 65 | color: greyColor, 66 | borderRadius: BorderRadius.circular(3), 67 | ), 68 | child: const Padding( 69 | padding: EdgeInsets.symmetric( 70 | vertical: 5, horizontal: 5), 71 | child: Text( 72 | "U/A 13+", 73 | style: TextStyle( 74 | color: whiteColor, 75 | fontWeight: FontWeight.w700, 76 | ), 77 | ), 78 | ), 79 | ), 80 | IconButton( 81 | onPressed: () {}, 82 | icon: const Icon( 83 | Icons.volume_off, 84 | color: whiteColor, 85 | size: 28, 86 | )) 87 | ], 88 | ), 89 | ), 90 | ) 91 | ], 92 | ), 93 | const Gap( 94 | H: 10, 95 | ), 96 | Padding( 97 | padding: const EdgeInsets.only(top: 10), 98 | child: Row( 99 | children: [ 100 | Expanded( 101 | child: Text( 102 | movieName, 103 | maxLines: 1, 104 | overflow: TextOverflow.ellipsis, 105 | style: const TextStyle( 106 | color: Colors.green, 107 | fontSize: 30, 108 | fontWeight: FontWeight.bold), 109 | ), 110 | ), 111 | const NhButtonWidget( 112 | icon: Icons.send_outlined, title: "Share"), 113 | const Gap( 114 | W: 20, 115 | ), 116 | const NhButtonWidget(icon: Icons.add, title: "My List"), 117 | const Gap( 118 | W: 20, 119 | ), 120 | const NhButtonWidget( 121 | icon: Icons.play_arrow_rounded, title: "Play"), 122 | const Gap( 123 | H: 10, 124 | ) 125 | ], 126 | ), 127 | ), 128 | SizedBox( 129 | // padding: EdgeInsets.all(10), 130 | child: Column( 131 | crossAxisAlignment: CrossAxisAlignment.start, 132 | children: [ 133 | const Gap( 134 | H: 20, 135 | ), 136 | Text( 137 | movieName, 138 | style: const TextStyle( 139 | color: whiteColor, 140 | fontSize: 22, 141 | fontWeight: FontWeight.bold), 142 | ), 143 | const Gap( 144 | H: 10, 145 | ), 146 | Padding( 147 | padding: const EdgeInsets.only(right: 10), 148 | child: Text( 149 | description, 150 | maxLines: 5, 151 | style: const TextStyle( 152 | color: greyTextColor, height: 1.3), 153 | ), 154 | ), 155 | const Gap( 156 | H: 10, 157 | ), 158 | const Text( 159 | "Action - Thriller - Drama - SciFi - Mystery - Fanatacy", 160 | style: TextStyle( 161 | color: Color.fromARGB(255, 194, 194, 194), 162 | fontWeight: FontWeight.w300), 163 | ), 164 | ]), 165 | ) 166 | ], 167 | ), 168 | ), 169 | ], 170 | ), 171 | ], 172 | ); 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /lib/domain/downloads/models/downloads.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of 'downloads.dart'; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | Downloads _$DownloadsFromJson(Map json) { 18 | return _Downloads.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$Downloads { 23 | @JsonKey(name: "poster_path") 24 | String get posterPath => throw _privateConstructorUsedError; 25 | @JsonKey(name: "title") 26 | String get title => throw _privateConstructorUsedError; 27 | @JsonKey(name: "backdrop_path") 28 | String get verticalImage => throw _privateConstructorUsedError; 29 | 30 | Map toJson() => throw _privateConstructorUsedError; 31 | @JsonKey(ignore: true) 32 | $DownloadsCopyWith get copyWith => 33 | throw _privateConstructorUsedError; 34 | } 35 | 36 | /// @nodoc 37 | abstract class $DownloadsCopyWith<$Res> { 38 | factory $DownloadsCopyWith(Downloads value, $Res Function(Downloads) then) = 39 | _$DownloadsCopyWithImpl<$Res>; 40 | $Res call( 41 | {@JsonKey(name: "poster_path") String posterPath, 42 | @JsonKey(name: "title") String title, 43 | @JsonKey(name: "backdrop_path") String verticalImage}); 44 | } 45 | 46 | /// @nodoc 47 | class _$DownloadsCopyWithImpl<$Res> implements $DownloadsCopyWith<$Res> { 48 | _$DownloadsCopyWithImpl(this._value, this._then); 49 | 50 | final Downloads _value; 51 | // ignore: unused_field 52 | final $Res Function(Downloads) _then; 53 | 54 | @override 55 | $Res call({ 56 | Object? posterPath = freezed, 57 | Object? title = freezed, 58 | Object? verticalImage = freezed, 59 | }) { 60 | return _then(_value.copyWith( 61 | posterPath: posterPath == freezed 62 | ? _value.posterPath 63 | : posterPath // ignore: cast_nullable_to_non_nullable 64 | as String, 65 | title: title == freezed 66 | ? _value.title 67 | : title // ignore: cast_nullable_to_non_nullable 68 | as String, 69 | verticalImage: verticalImage == freezed 70 | ? _value.verticalImage 71 | : verticalImage // ignore: cast_nullable_to_non_nullable 72 | as String, 73 | )); 74 | } 75 | } 76 | 77 | /// @nodoc 78 | abstract class _$$_DownloadsCopyWith<$Res> implements $DownloadsCopyWith<$Res> { 79 | factory _$$_DownloadsCopyWith( 80 | _$_Downloads value, $Res Function(_$_Downloads) then) = 81 | __$$_DownloadsCopyWithImpl<$Res>; 82 | @override 83 | $Res call( 84 | {@JsonKey(name: "poster_path") String posterPath, 85 | @JsonKey(name: "title") String title, 86 | @JsonKey(name: "backdrop_path") String verticalImage}); 87 | } 88 | 89 | /// @nodoc 90 | class __$$_DownloadsCopyWithImpl<$Res> extends _$DownloadsCopyWithImpl<$Res> 91 | implements _$$_DownloadsCopyWith<$Res> { 92 | __$$_DownloadsCopyWithImpl( 93 | _$_Downloads _value, $Res Function(_$_Downloads) _then) 94 | : super(_value, (v) => _then(v as _$_Downloads)); 95 | 96 | @override 97 | _$_Downloads get _value => super._value as _$_Downloads; 98 | 99 | @override 100 | $Res call({ 101 | Object? posterPath = freezed, 102 | Object? title = freezed, 103 | Object? verticalImage = freezed, 104 | }) { 105 | return _then(_$_Downloads( 106 | posterPath: posterPath == freezed 107 | ? _value.posterPath 108 | : posterPath // ignore: cast_nullable_to_non_nullable 109 | as String, 110 | title: title == freezed 111 | ? _value.title 112 | : title // ignore: cast_nullable_to_non_nullable 113 | as String, 114 | verticalImage: verticalImage == freezed 115 | ? _value.verticalImage 116 | : verticalImage // ignore: cast_nullable_to_non_nullable 117 | as String, 118 | )); 119 | } 120 | } 121 | 122 | /// @nodoc 123 | @JsonSerializable() 124 | class _$_Downloads implements _Downloads { 125 | const _$_Downloads( 126 | {@JsonKey(name: "poster_path") required this.posterPath, 127 | @JsonKey(name: "title") required this.title, 128 | @JsonKey(name: "backdrop_path") required this.verticalImage}); 129 | 130 | factory _$_Downloads.fromJson(Map json) => 131 | _$$_DownloadsFromJson(json); 132 | 133 | @override 134 | @JsonKey(name: "poster_path") 135 | final String posterPath; 136 | @override 137 | @JsonKey(name: "title") 138 | final String title; 139 | @override 140 | @JsonKey(name: "backdrop_path") 141 | final String verticalImage; 142 | 143 | @override 144 | String toString() { 145 | return 'Downloads(posterPath: $posterPath, title: $title, verticalImage: $verticalImage)'; 146 | } 147 | 148 | @override 149 | bool operator ==(dynamic other) { 150 | return identical(this, other) || 151 | (other.runtimeType == runtimeType && 152 | other is _$_Downloads && 153 | const DeepCollectionEquality() 154 | .equals(other.posterPath, posterPath) && 155 | const DeepCollectionEquality().equals(other.title, title) && 156 | const DeepCollectionEquality() 157 | .equals(other.verticalImage, verticalImage)); 158 | } 159 | 160 | @JsonKey(ignore: true) 161 | @override 162 | int get hashCode => Object.hash( 163 | runtimeType, 164 | const DeepCollectionEquality().hash(posterPath), 165 | const DeepCollectionEquality().hash(title), 166 | const DeepCollectionEquality().hash(verticalImage)); 167 | 168 | @JsonKey(ignore: true) 169 | @override 170 | _$$_DownloadsCopyWith<_$_Downloads> get copyWith => 171 | __$$_DownloadsCopyWithImpl<_$_Downloads>(this, _$identity); 172 | 173 | @override 174 | Map toJson() { 175 | return _$$_DownloadsToJson(this); 176 | } 177 | } 178 | 179 | abstract class _Downloads implements Downloads { 180 | const factory _Downloads( 181 | {@JsonKey(name: "poster_path") 182 | required final String posterPath, 183 | @JsonKey(name: "title") 184 | required final String title, 185 | @JsonKey(name: "backdrop_path") 186 | required final String verticalImage}) = _$_Downloads; 187 | 188 | factory _Downloads.fromJson(Map json) = 189 | _$_Downloads.fromJson; 190 | 191 | @override 192 | @JsonKey(name: "poster_path") 193 | String get posterPath => throw _privateConstructorUsedError; 194 | @override 195 | @JsonKey(name: "title") 196 | String get title => throw _privateConstructorUsedError; 197 | @override 198 | @JsonKey(name: "backdrop_path") 199 | String get verticalImage => throw _privateConstructorUsedError; 200 | @override 201 | @JsonKey(ignore: true) 202 | _$$_DownloadsCopyWith<_$_Downloads> get copyWith => 203 | throw _privateConstructorUsedError; 204 | } 205 | -------------------------------------------------------------------------------- /lib/presentation/new_and_hot/screen_new_and_hot.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix/application/hot_and_new/hotandnew_bloc.dart'; 4 | import 'package:netflix/core/colors/colors.dart'; 5 | import 'package:netflix/core/colors/common.dart'; 6 | import 'package:netflix/core/strings.dart'; 7 | import 'package:netflix/presentation/new_and_hot/widgets/coming_soon_widget.dart'; 8 | import 'package:netflix/presentation/new_and_hot/widgets/everones_watch_widget.dart'; 9 | 10 | final samplerPosterHorizontal = 11 | "https://www.themoviedb.org/t/p/w533_and_h300_bestv2/vNnLAKmoczRlNarxyGrrw0KSOeX.jpg"; 12 | 13 | class ScreenNewAndHot extends StatelessWidget { 14 | const ScreenNewAndHot({Key? key}) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return DefaultTabController( 19 | length: 2, 20 | child: Scaffold( 21 | appBar: AppBar( 22 | title: const Text( 23 | "Hot & New", 24 | style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold), 25 | ), 26 | actions: [ 27 | IconButton( 28 | onPressed: () {}, 29 | icon: const Icon( 30 | Icons.cast_rounded, 31 | color: Colors.white, 32 | size: 25, 33 | )), 34 | const Gap( 35 | W: 10, 36 | ), 37 | // SizedBox( 38 | // height: 25, 39 | // width: 25, 40 | // child: Container( 41 | // decoration: const BoxDecoration( 42 | // gradient: LinearGradient( 43 | // begin: Alignment.topCenter, 44 | // end: Alignment.bottomCenter, 45 | // colors: [Colors.red, Colors.yellow])), 46 | // width: 25, 47 | // height: 25, 48 | // ), 49 | // ), 50 | SizedBox( 51 | height: 25, 52 | width: 25, 53 | child: IconButton( 54 | onPressed: () {}, icon: Icon(Icons.card_giftcard))), 55 | Gap( 56 | W: 15, 57 | ) 58 | ], 59 | bottom: PreferredSize( 60 | preferredSize: Size.fromHeight(50), 61 | child: Row( 62 | mainAxisAlignment: MainAxisAlignment.start, 63 | children: [ 64 | TabBar( 65 | indicator: BoxDecoration( 66 | borderRadius: BorderRadius.circular(30), 67 | color: whiteColor, 68 | ), 69 | labelColor: blackColor, 70 | isScrollable: true, 71 | labelStyle: const TextStyle( 72 | fontSize: 16, fontWeight: FontWeight.bold), 73 | unselectedLabelColor: whiteColor, 74 | labelPadding: 75 | EdgeInsets.symmetric(vertical: 0, horizontal: 20), 76 | padding: EdgeInsets.symmetric(horizontal: 15), 77 | tabs: const [ 78 | Tab( 79 | text: "🎁 Coming Soon", 80 | ), 81 | Tab( 82 | text: "🔥 Everyone's Watching", 83 | ), 84 | ]), 85 | ], 86 | ), 87 | ), 88 | ), 89 | body: const Padding( 90 | padding: EdgeInsets.symmetric(horizontal: 10), 91 | child: TabBarView(children: [ 92 | BuldComingSoon(), 93 | BuildEveryOnesWatching(), 94 | ]), 95 | ), 96 | ), 97 | ); 98 | } 99 | } 100 | 101 | class BuldComingSoon extends StatelessWidget { 102 | const BuldComingSoon({Key? key}) : super(key: key); 103 | 104 | @override 105 | Widget build(BuildContext context) { 106 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 107 | BlocProvider.of(context).add(const LoadDataInComingSoon()); 108 | }); 109 | return BlocBuilder( 110 | builder: (context, state) { 111 | if (state.isLoading) { 112 | return const Center( 113 | child: CircularProgressIndicator(color: greyColor), 114 | ); 115 | } else if (state.isError) { 116 | return const Center( 117 | child: Text( 118 | "Something went wrong", 119 | style: TextStyle(color: greyColor), 120 | ), 121 | ); 122 | } else if (state.comingSoonList!.isEmpty) { 123 | return const Center( 124 | child: Text( 125 | "No Coming Soon Available", 126 | style: TextStyle(color: greyColor), 127 | ), 128 | ); 129 | } else { 130 | return ListView.builder( 131 | // separatorBuilder: ((context, index) => Gap()), 132 | shrinkWrap: true, 133 | itemCount: state.comingSoonList!.length, 134 | itemBuilder: (context, index) { 135 | final movie = state.comingSoonList![index]; 136 | 137 | if (movie.id == null) return const SizedBox(); 138 | 139 | final month = movie.releaseDate!.split("-").elementAt(1); 140 | final day = movie.releaseDate!.split("-").elementAt(2); 141 | 142 | return ComingSoonWidget( 143 | id: movie.id.toString(), 144 | month: month, 145 | day: day, 146 | posterPath: "${imageBase + movie.backdropPath.toString()}", 147 | movieName: movie.originalTitle ?? "not available", 148 | description: movie.overview ?? "not available", 149 | ); 150 | }, 151 | ); 152 | } 153 | }); 154 | } 155 | } 156 | 157 | class BuildEveryOnesWatching extends StatelessWidget { 158 | const BuildEveryOnesWatching({Key? key}) : super(key: key); 159 | 160 | @override 161 | Widget build(BuildContext context) { 162 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 163 | BlocProvider.of(context) 164 | .add(const LoadDataInEveryOnesWatching()); 165 | }); 166 | return BlocBuilder( 167 | builder: (context, state) { 168 | if (state.isLoading) { 169 | return const Center( 170 | child: CircularProgressIndicator(color: greyColor), 171 | ); 172 | } else if (state.isError) { 173 | return const Center( 174 | child: Text( 175 | "Something went wrong", 176 | style: TextStyle(color: greyColor), 177 | ), 178 | ); 179 | } else if (state.comingSoonList!.isEmpty) { 180 | return const Center( 181 | child: Text( 182 | "No Coming Soon Available", 183 | style: TextStyle(color: greyColor), 184 | ), 185 | ); 186 | } else { 187 | return ListView.builder( 188 | // separatorBuilder: ((context, index) => Gap()), 189 | shrinkWrap: true, 190 | itemCount: state.comingSoonList!.length, 191 | itemBuilder: (context, index) { 192 | final movie = state.comingSoonList![index]; 193 | 194 | if (movie.id == null) return const SizedBox(); 195 | 196 | final month = movie.releaseDate!.split("-").elementAt(1); 197 | final day = movie.releaseDate!.split("-").elementAt(2); 198 | 199 | return EveryOnesWatchingWidget( 200 | id: movie.id.toString(), 201 | month: month, 202 | day: day, 203 | posterPath: "${imageBase + movie.backdropPath.toString()}", 204 | movieName: movie.originalTitle ?? "not available", 205 | description: movie.overview ?? "not available", 206 | ); 207 | }, 208 | ); 209 | } 210 | }); 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /lib/media/media_json.dart: -------------------------------------------------------------------------------- 1 | var mediaJSON = { 2 | "categories": [ 3 | { 4 | "name": "Movies", 5 | "videos": [ 6 | { 7 | "description": 8 | "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", 9 | "sources": [ 10 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" 11 | ], 12 | "subtitle": "By Blender Foundation", 13 | "thumb": "images/BigBuckBunny.jpg", 14 | "title": "Big Buck Bunny" 15 | }, 16 | { 17 | "description": "The first Blender Open Movie from 2006", 18 | "sources": [ 19 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" 20 | ], 21 | "subtitle": "By Blender Foundation", 22 | "thumb": "images/ElephantsDream.jpg", 23 | "title": "Elephant Dream" 24 | }, 25 | { 26 | "description": 27 | "HBO GO now works with Chromecast -- the easiest way to enjoy online video on your TV. For when you want to settle into your Iron Throne to watch the latest episodes. For 35.\nLearn how to use Chromecast with HBO GO and more at google.com/chromecast.", 28 | "sources": [ 29 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4" 30 | ], 31 | "subtitle": "By Google", 32 | "thumb": "images/ForBiggerBlazes.jpg", 33 | "title": "For Bigger Blazes" 34 | }, 35 | { 36 | "description": 37 | "Introducing Chromecast. The easiest way to enjoy online video and music on your TV—for when Batman's escapes aren't quite big enough. For 35. Learn how to use Chromecast with Google Play Movies and more at google.com/chromecast.", 38 | "sources": [ 39 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4" 40 | ], 41 | "subtitle": "By Google", 42 | "thumb": "images/ForBiggerEscapes.jpg", 43 | "title": "For Bigger Escape" 44 | }, 45 | { 46 | "description": 47 | "Introducing Chromecast. The easiest way to enjoy online video and music on your TV. For 35. Find out more at google.com/chromecast.", 48 | "sources": [ 49 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4" 50 | ], 51 | "subtitle": "By Google", 52 | "thumb": "images/ForBiggerFun.jpg", 53 | "title": "For Bigger Fun" 54 | }, 55 | { 56 | "description": 57 | "Introducing Chromecast. The easiest way to enjoy online video and music on your TV—for the times that call for bigger joyrides. For 35. Learn how to use Chromecast with YouTube and more at google.com/chromecast.", 58 | "sources": [ 59 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4" 60 | ], 61 | "subtitle": "By Google", 62 | "thumb": "images/ForBiggerJoyrides.jpg", 63 | "title": "For Bigger Joyrides" 64 | }, 65 | { 66 | "description": 67 | "Introducing Chromecast. The easiest way to enjoy online video and music on your TV—for when you want to make Buster's big meltdowns even bigger. For 35. Learn how to use Chromecast with Netflix and more at google.com/chromecast.", 68 | "sources": [ 69 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerMeltdowns.mp4" 70 | ], 71 | "subtitle": "By Google", 72 | "thumb": "images/ForBiggerMeltdowns.jpg", 73 | "title": "For Bigger Meltdowns" 74 | }, 75 | { 76 | "description": 77 | "Sintel is an independently produced short film, initiated by the Blender Foundation as a means to further improve and validate the free/open source 3D creation suite Blender. With initial funding provided by 1000s of donations via the internet community, it has again proven to be a viable development model for both open 3D technology as for independent animation film.\nThis 15 minute film has been realized in the studio of the Amsterdam Blender Institute, by an international team of artists and developers. In addition to that, several crucial technical and creative targets have been realized online, by developers and artists and teams all over the world.\nwww.sintel.org", 78 | "sources": [ 79 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/Sintel.mp4" 80 | ], 81 | "subtitle": "By Blender Foundation", 82 | "thumb": "images/Sintel.jpg", 83 | "title": "Sintel" 84 | }, 85 | { 86 | "description": 87 | "Smoking Tire takes the all-new Subaru Outback to the highest point we can find in hopes our customer-appreciation Balloon Launch will get some free T-shirts into the hands of our viewers.", 88 | "sources": [ 89 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/SubaruOutbackOnStreetAndDirt.mp4" 90 | ], 91 | "subtitle": "By Garage419", 92 | "thumb": "images/SubaruOutbackOnStreetAndDirt.jpg", 93 | "title": "Subaru Outback On Street And Dirt" 94 | }, 95 | { 96 | "description": 97 | "Tears of Steel was realized with crowd-funding by users of the open source 3D creation tool Blender. Target was to improve and test a complete open and free pipeline for visual effects in film - and to make a compelling sci-fi film in Amsterdam, the Netherlands. The film itself, and all raw material used for making it, have been released under the Creatieve Commons 3.0 Attribution license. Visit the tearsofsteel.org website to find out more about this, or to purchase the 4-DVD box with a lot of extras. (CC) Blender Foundation - http://www.tearsofsteel.org", 98 | "sources": [ 99 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/TearsOfSteel.mp4" 100 | ], 101 | "subtitle": "By Blender Foundation", 102 | "thumb": "images/TearsOfSteel.jpg", 103 | "title": "Tears of Steel" 104 | }, 105 | { 106 | "description": 107 | "The Smoking Tire heads out to Adams Motorsports Park in Riverside, CA to test the most requested car of 2010, the Volkswagen GTI. Will it beat the Mazdaspeed3's standard-setting lap time? Watch and see...", 108 | "sources": [ 109 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/VolkswagenGTIReview.mp4" 110 | ], 111 | "subtitle": "By Garage419", 112 | "thumb": "images/VolkswagenGTIReview.jpg", 113 | "title": "Volkswagen GTI Review" 114 | }, 115 | { 116 | "description": 117 | "The Smoking Tire is going on the 2010 Bullrun Live Rally in a 2011 Shelby GT500, and posting a video from the road every single day! The only place to watch them is by subscribing to The Smoking Tire or watching at BlackMagicShine.com", 118 | "sources": [ 119 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WeAreGoingOnBullrun.mp4" 120 | ], 121 | "subtitle": "By Garage419", 122 | "thumb": "images/WeAreGoingOnBullrun.jpg", 123 | "title": "We Are Going On Bullrun" 124 | }, 125 | { 126 | "description": 127 | "The Smoking Tire meets up with Chris and Jorge from CarsForAGrand.com to see just how far 1,000 can go when looking for a car.The Smoking Tire meets up with Chris and Jorge from CarsForAGrand.com to see just how far 1,000 can go when looking for a car.", 128 | "sources": [ 129 | "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/WhatCarCanYouGetForAGrand.mp4" 130 | ], 131 | "subtitle": "By Garage419", 132 | "thumb": "images/WhatCarCanYouGetForAGrand.jpg", 133 | "title": "What care can you get for a grand?" 134 | } 135 | ] 136 | } 137 | ] 138 | }; 139 | -------------------------------------------------------------------------------- /lib/presentation/downloads/screen_downloads.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: prefer_typing_uninitialized_variables 2 | import 'dart:math'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | import 'package:netflix/application/downloads/downloads_bloc.dart'; 6 | import 'package:netflix/core/colors/colors.dart'; 7 | import 'package:netflix/core/colors/common.dart'; 8 | import 'package:netflix/presentation/widgets/app_bar_widget.dart'; 9 | 10 | class ScreenDownloads extends StatelessWidget { 11 | ScreenDownloads({Key? key}) : super(key: key); 12 | final _widgets = [ 13 | const _SmartDownloads(), 14 | const Gap( 15 | H: 60, 16 | ), 17 | _SectionTwo(), 18 | const Gap( 19 | H: 60, 20 | ), 21 | const _SectionThree() 22 | ]; 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | // final size = MediaQuery.of(context).size; 27 | 28 | return Scaffold( 29 | appBar: const PreferredSize( 30 | preferredSize: Size.fromHeight(50), 31 | child: AppBarWidget( 32 | title: "Downloads", 33 | ), 34 | ), 35 | body: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), 37 | child: ListView.separated( 38 | itemBuilder: (context, index) => _widgets[index], 39 | separatorBuilder: (context, index) => const Gap(), 40 | itemCount: _widgets.length, 41 | ), 42 | )); 43 | } 44 | } 45 | 46 | class _SectionTwo extends StatelessWidget { 47 | _SectionTwo({ 48 | Key? key, 49 | }) : super(key: key); 50 | 51 | // final samplePosters = [ 52 | // "https://www.themoviedb.org/t/p/w220_and_h330_face/nj5HmHRZsrYQEYYXyAusFv35erP.jpg", 53 | // "https://www.themoviedb.org/t/p/w220_and_h330_face/lJA2RCMfsWoskqlQhXPSLFQGXEJ.jpg", 54 | // "https://www.themoviedb.org/t/p/w220_and_h330_face/bcCBq9N1EMo3daNIjWJ8kYvrQm6.jpg" 55 | // ]; 56 | 57 | @override 58 | Widget build(BuildContext context) { 59 | const imageBase = "https://image.tmdb.org/t/p/w500"; 60 | WidgetsBinding.instance.addPostFrameCallback((_) { 61 | BlocProvider.of(context) 62 | .add(const DownloadsEvent.getDownloadsImage()); 63 | }); 64 | // BlocProvider.of(context) 65 | // .add(const DownloadsEvent.getDownloadsImage()); 66 | 67 | final size = MediaQuery.of(context).size; 68 | return Column( 69 | children: [ 70 | const Text( 71 | "Introducing Downloads for You", 72 | textAlign: TextAlign.center, 73 | style: TextStyle( 74 | color: whiteColor, fontSize: 25, fontWeight: FontWeight.bold), 75 | ), 76 | const Gap( 77 | H: 20, 78 | ), 79 | Center( 80 | child: Container( 81 | constraints: const BoxConstraints(minWidth: 150, maxWidth: 300), 82 | child: const Text( 83 | "We will download a personlized selection of movies and shows for you, so there is always something watch on your device", 84 | textAlign: TextAlign.center, 85 | style: TextStyle( 86 | color: greyTextColor, 87 | fontSize: 15, 88 | ), 89 | ), 90 | ), 91 | ), 92 | const Gap( 93 | H: 20, 94 | ), 95 | BlocBuilder( 96 | builder: (context, state) { 97 | return SizedBox( 98 | height: 400, 99 | width: size.width, 100 | // color: whiteColor, 101 | child: state.isLoading == true || state.downloads.isEmpty 102 | ? const Center( 103 | child: CircularProgressIndicator( 104 | color: greyColor, 105 | )) 106 | : Stack(alignment: Alignment.center, children: [ 107 | Center( 108 | child: CircleAvatar( 109 | radius: size.width * 0.4, 110 | backgroundColor: greyColor, 111 | ), 112 | ), 113 | DownloadsImageWidget( 114 | img: "${imageBase + state.downloads[1].posterPath}", 115 | margin: const EdgeInsets.only( 116 | right: 150, 117 | ), 118 | angle: -15, 119 | ), 120 | DownloadsImageWidget( 121 | img: "${imageBase + state.downloads[0].posterPath}", 122 | margin: const EdgeInsets.only( 123 | left: 150, 124 | ), 125 | angle: 15, 126 | ), 127 | DownloadsImageWidget( 128 | img: "${imageBase + state.downloads[2].posterPath}", 129 | margin: const EdgeInsets.only( 130 | right: 0, 131 | top: 10, 132 | ), 133 | angle: 0, 134 | imgHeight: 0.6, 135 | imgWidth: 0.4, 136 | ), 137 | ]), 138 | ); 139 | }, 140 | ), 141 | ], 142 | ); 143 | } 144 | } 145 | 146 | class _SectionThree extends StatelessWidget { 147 | const _SectionThree({Key? key}) : super(key: key); 148 | 149 | @override 150 | Widget build(BuildContext context) { 151 | return Column( 152 | children: [ 153 | SizedBox( 154 | width: double.infinity, 155 | child: MaterialButton( 156 | shape: RoundedRectangleBorder( 157 | borderRadius: BorderRadius.circular(5)), 158 | color: buttonColor, 159 | onPressed: () {}, 160 | child: const Padding( 161 | padding: EdgeInsets.symmetric( 162 | vertical: 10, 163 | ), 164 | child: Text( 165 | "Set up", 166 | style: TextStyle( 167 | color: whiteColor, 168 | fontSize: 18, 169 | fontWeight: FontWeight.w600), 170 | ), 171 | ), 172 | ), 173 | ), 174 | SizedBox( 175 | width: double.infinity, 176 | child: MaterialButton( 177 | shape: RoundedRectangleBorder( 178 | borderRadius: BorderRadius.circular(5)), 179 | color: whiteColor, 180 | onPressed: () {}, 181 | child: const Padding( 182 | padding: EdgeInsets.symmetric(vertical: 10), 183 | child: Text( 184 | "See what you can download", 185 | style: TextStyle( 186 | color: blackColor, 187 | fontSize: 18, 188 | fontWeight: FontWeight.w600), 189 | ), 190 | ), 191 | ), 192 | ) 193 | ], 194 | ); 195 | } 196 | } 197 | 198 | class _SmartDownloads extends StatelessWidget { 199 | const _SmartDownloads({ 200 | Key? key, 201 | }) : super(key: key); 202 | 203 | @override 204 | Widget build(BuildContext context) { 205 | return Row( 206 | mainAxisAlignment: MainAxisAlignment.start, 207 | crossAxisAlignment: CrossAxisAlignment.center, 208 | children: const [ 209 | Icon( 210 | Icons.settings_outlined, 211 | color: whiteColor, 212 | ), 213 | Gap( 214 | W: 8, 215 | ), 216 | Text("Smart Downloads"), 217 | ], 218 | ); 219 | } 220 | } 221 | 222 | class DownloadsImageWidget extends StatelessWidget { 223 | const DownloadsImageWidget({ 224 | Key? key, 225 | // required this.size, 226 | required String this.img, 227 | required this.margin, 228 | required double this.angle, 229 | double this.imgHeight = 0.58, 230 | double this.imgWidth = 0.35, 231 | }) : super(key: key); 232 | final img; 233 | final margin; 234 | final angle; 235 | 236 | final imgHeight; 237 | final imgWidth; 238 | 239 | // final Size size; 240 | 241 | @override 242 | Widget build(BuildContext context) { 243 | final size = MediaQuery.of(context).size; 244 | 245 | return Transform.rotate( 246 | angle: angle * pi / 180, 247 | child: Container( 248 | margin: margin, 249 | width: size.width * imgWidth, 250 | height: size.width * imgHeight, 251 | decoration: BoxDecoration( 252 | borderRadius: BorderRadius.circular(5), 253 | image: 254 | DecorationImage(fit: BoxFit.cover, image: NetworkImage(img))), 255 | )); 256 | } 257 | } 258 | 259 | // width: size.width * 0.35, 260 | // height: size.width * 0.5, 261 | --------------------------------------------------------------------------------