├── 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_app │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── lib ├── core │ ├── url.dart │ ├── colors.dart │ └── constants.dart ├── Application │ ├── home │ │ ├── home_event.dart │ │ ├── home_state.dart │ │ └── home_bloc.dart │ ├── downloads │ │ ├── downloads_event.dart │ │ ├── downloads_state.dart │ │ ├── downloads_bloc.dart │ │ └── downloads_bloc.freezed.dart │ ├── search │ │ ├── search_event.dart │ │ ├── search_state.dart │ │ └── search_bloc.dart │ ├── new_and_hot │ │ ├── new_and_hot_event.dart │ │ ├── new_and_hot_state.dart │ │ └── new_and_hot_bloc.dart │ └── fast_laugh │ │ ├── fast_laugh_event.dart │ │ ├── fast_laugh_state.dart │ │ └── fast_laugh_bloc.dart ├── domain │ ├── core │ │ ├── failures │ │ │ ├── main_failure.dart │ │ │ └── main_failure.freezed.dart │ │ ├── di │ │ │ ├── injectable.dart │ │ │ └── injectable.config.dart │ │ ├── debounce │ │ │ └── debounce.dart │ │ └── api_endpoints.dart │ ├── downloads │ │ ├── i_downloads_repo.dart │ │ └── model │ │ │ ├── downloads.dart │ │ │ ├── downloads.g.dart │ │ │ └── downloads.freezed.dart │ ├── search │ │ ├── search_service.dart │ │ └── model │ │ │ └── search_resp │ │ │ ├── search_resp.dart │ │ │ └── search_resp.g.dart │ └── new_and_hot_resp │ │ ├── new_and_hot_service.dart │ │ └── model │ │ ├── new_and_hot_resp.dart │ │ └── new_and_hot_resp.g.dart ├── presentation │ ├── Widgets │ │ ├── main_title.dart │ │ ├── main_card.dart │ │ ├── app_bar_widget.dart │ │ └── video_widget.dart │ ├── fast_laugh │ │ ├── widgets │ │ │ ├── reel_buttons.dart │ │ │ └── video_list.dart │ │ └── screen_fast_laugh.dart │ ├── home │ │ └── widgets │ │ │ ├── horizontal_scroll.dart │ │ │ ├── animated_hori_scroll.dart │ │ │ ├── animated_num_card.dart │ │ │ └── top_section.dart │ ├── main_page │ │ ├── screen_main_page.dart │ │ └── widgets │ │ │ └── bottom_nav.dart │ ├── search │ │ ├── widgets │ │ │ ├── search_result.dart │ │ │ └── search_idle.dart │ │ └── screen_search.dart │ ├── new_and_hot │ │ ├── widgets │ │ │ ├── everyones_watching_content.dart │ │ │ └── coming_soon_content.dart │ │ └── screen_new_and_hot.dart │ └── downloads │ │ └── screen_downloads.dart ├── infrastructure │ ├── search │ │ └── search_implement.dart │ ├── downloads │ │ └── downloads_repository.dart │ └── new_and_hot │ │ └── new_and_hot_impl.dart └── main.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/rohit5krish/Netflix/HEAD/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /lib/core/url.dart: -------------------------------------------------------------------------------- 1 | const baseUrl = "https://api.themoviedb.org/3"; 2 | const imgBaseUrl = "https://image.tmdb.org/t/p/w500"; 3 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/core/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | const bgcolor = Colors.black; 4 | const whiteclr = Colors.white; 5 | const greyclr = Colors.grey; 6 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohit5krish/Netflix/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /lib/Application/home/home_event.dart: -------------------------------------------------------------------------------- 1 | part of 'home_bloc.dart'; 2 | 3 | @freezed 4 | class HomeEvent with _$HomeEvent { 5 | const factory HomeEvent.getHomeScreenData() = GetHomeScreenData; 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/netflix_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.netflix_app 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/downloads/downloads_event.dart: -------------------------------------------------------------------------------- 1 | part of 'downloads_bloc.dart'; 2 | 3 | @freezed 4 | class DownloadsEvent with _$DownloadsEvent { 5 | const factory DownloadsEvent.getDownloadsImages() = _GetDownloadsImages; 6 | } 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/Application/search/search_event.dart: -------------------------------------------------------------------------------- 1 | part of 'search_bloc.dart'; 2 | 3 | @freezed 4 | class SearchEvent with _$SearchEvent { 5 | const factory SearchEvent.initialize() = Initialize; 6 | const factory SearchEvent.searchMovies({ 7 | required String movieQuery, 8 | }) = SearchMovies; 9 | } 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/Application/new_and_hot/new_and_hot_event.dart: -------------------------------------------------------------------------------- 1 | part of 'new_and_hot_bloc.dart'; 2 | 3 | @freezed 4 | class NewAndHotEvent with _$NewAndHotEvent { 5 | const factory NewAndHotEvent.comingSoonLoadData() = ComingSoonLoadData; 6 | const factory NewAndHotEvent.everyoneWatchingLoadData() = 7 | EveryoneWatchingLoadData; 8 | } 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/domain/core/failures/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 | -------------------------------------------------------------------------------- /lib/domain/downloads/i_downloads_repo.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix_app/domain/core/failures/main_failure.dart'; 3 | import 'package:netflix_app/domain/downloads/model/downloads.dart'; 4 | 5 | abstract class IDownloadsRepo { 6 | Future>> getDownloadsImages(); 7 | } 8 | -------------------------------------------------------------------------------- /.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/domain/core/di/injectable.dart: -------------------------------------------------------------------------------- 1 | import 'package:get_it/get_it.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:netflix_app/domain/core/di/injectable.config.dart'; 4 | 5 | final getIt = GetIt.instance; 6 | 7 | @InjectableInit() 8 | Future configureInjection() async { 9 | await $initGetIt(getIt, environment: Environment.prod); 10 | } 11 | -------------------------------------------------------------------------------- /lib/domain/search/search_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix_app/domain/core/failures/main_failure.dart'; 3 | import 'package:netflix_app/domain/search/model/search_resp/search_resp.dart'; 4 | 5 | abstract class SearchService { 6 | Future> searchMovies({ 7 | required String movieQuery, 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/domain/core/debounce/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 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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/Application/fast_laugh/fast_laugh_event.dart: -------------------------------------------------------------------------------- 1 | part of 'fast_laugh_bloc.dart'; 2 | 3 | @freezed 4 | class FastLaughEvent with _$FastLaughEvent { 5 | const factory FastLaughEvent.initialize() = Initialize; 6 | const factory FastLaughEvent.likeVideo({ 7 | required int id, 8 | }) = LikeVideo; 9 | const factory FastLaughEvent.unLikeVideo({ 10 | required int id, 11 | }) = UnLikeVideo; 12 | } 13 | -------------------------------------------------------------------------------- /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/domain/new_and_hot_resp/new_and_hot_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:netflix_app/domain/core/failures/main_failure.dart'; 3 | import 'package:netflix_app/domain/new_and_hot_resp/model/new_and_hot_resp.dart'; 4 | 5 | abstract class NewAndHotService { 6 | Future> getHotAndNewMovieData(); 7 | Future> getHotAndNewTvData(); 8 | } 9 | -------------------------------------------------------------------------------- /lib/presentation/Widgets/main_title.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class mainTitle extends StatelessWidget { 4 | final String title; 5 | 6 | const mainTitle({ 7 | Key? key, 8 | required this.title, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Text( 14 | title, 15 | style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/domain/core/api_endpoints.dart: -------------------------------------------------------------------------------- 1 | import 'package:netflix_app/Infrastructure/api_key.dart'; 2 | import 'package:netflix_app/core/url.dart'; 3 | 4 | class ApiEndPoints { 5 | static const downloads = "$baseUrl/trending/all/day?api_key=$apiKey"; 6 | static const search = '$baseUrl/search/movie?api_key=$apiKey'; 7 | static const newAndHotMovie = '$baseUrl/discover/movie?api_key=$apiKey'; 8 | static const newAndHotTv = '$baseUrl/discover/tv?api_key=$apiKey'; 9 | } 10 | -------------------------------------------------------------------------------- /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/fast_laugh/fast_laugh_state.dart: -------------------------------------------------------------------------------- 1 | part of 'fast_laugh_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.initial() => const FastLaughState( 12 | videosList: [], 13 | isLoading: false, 14 | isError: false, 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /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/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>> downloadsResponse, 8 | required List downloads, 9 | }) = _DownloadsState; 10 | 11 | factory DownloadsState.initial() { 12 | return const DownloadsState( 13 | isLoading: false, 14 | downloadsResponse: None(), 15 | downloads: [], 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/Application/search/search_state.dart: -------------------------------------------------------------------------------- 1 | part of 'search_bloc.dart'; 2 | 3 | @freezed 4 | class SearchState with _$SearchState { 5 | const factory SearchState({ 6 | required List searchResultList, 7 | required List idleList, 8 | required bool isLoading, 9 | required bool isError, 10 | }) = _SearchState; 11 | 12 | factory SearchState.initial() { 13 | return const SearchState( 14 | searchResultList: [], 15 | idleList: [], 16 | isLoading: false, 17 | isError: false, 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | set(PLUGIN_BUNDLED_LIBRARIES) 10 | 11 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 12 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 13 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 15 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 16 | endforeach(plugin) 17 | -------------------------------------------------------------------------------- /lib/core/constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | const SbHeight10 = SizedBox(height: 10); 4 | const SbHeight20 = SizedBox(height: 20); 5 | const SbHeight30 = SizedBox(height: 30); 6 | const SbHeight50 = SizedBox(height: 50); 7 | const SbWidth10 = SizedBox(width: 10); 8 | const SbWidth20 = SizedBox(width: 20); 9 | 10 | // Border Radius 11 | final BorderRadius borderRad10 = BorderRadius.circular(10); 12 | final BorderRadius borderRad30 = BorderRadius.circular(30); 13 | 14 | // Text Style 15 | TextStyle homeTitle = TextStyle(fontSize: 16, fontWeight: FontWeight.bold); 16 | 17 | -------------------------------------------------------------------------------- /lib/Application/new_and_hot/new_and_hot_state.dart: -------------------------------------------------------------------------------- 1 | part of 'new_and_hot_bloc.dart'; 2 | 3 | @freezed 4 | class NewAndHotState with _$NewAndHotState { 5 | const factory NewAndHotState({ 6 | required List comingSoonList, 7 | required List everyoneWatchingList, 8 | required bool isLoading, 9 | required bool hasError, 10 | }) = _Initial; 11 | 12 | factory NewAndHotState.initial() => NewAndHotState( 13 | comingSoonList: [], 14 | everyoneWatchingList: [], 15 | isLoading: false, 16 | hasError: false, 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # netflix_app 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 | -------------------------------------------------------------------------------- /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/domain/downloads/model/downloads.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | part 'downloads.freezed.dart'; 4 | part 'downloads.g.dart'; 5 | 6 | @freezed 7 | class Downloads with _$Downloads { 8 | const factory Downloads({ 9 | @JsonKey(name: "poster_path") required String? posterPath, 10 | @JsonKey(name: "original_title") required String? title, 11 | @JsonKey(name: "name") required String? title2, 12 | @JsonKey(name: "backdrop_path") required String? backImg, 13 | }) = _Downloads; 14 | 15 | factory Downloads.fromJson(Map json) => 16 | _$DownloadsFromJson(json); 17 | } 18 | -------------------------------------------------------------------------------- /lib/presentation/Widgets/main_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix_app/core/constants.dart'; 3 | 4 | class MainCard extends StatelessWidget { 5 | final String imgUrl; 6 | const MainCard({Key? key, required this.imgUrl}) : super(key: key); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | margin: EdgeInsets.symmetric(horizontal: 4), 12 | width: 120, 13 | height: 200, 14 | decoration: BoxDecoration( 15 | borderRadius: borderRad10, 16 | image: DecorationImage( 17 | image: NetworkImage(imgUrl), 18 | fit: BoxFit.cover, 19 | ), 20 | ), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/Application/home/home_state.dart: -------------------------------------------------------------------------------- 1 | part of 'home_bloc.dart'; 2 | 3 | @freezed 4 | class HomeState with _$HomeState { 5 | const factory HomeState({ 6 | required List pastYearList, 7 | required List trendingMovieList, 8 | required List tenseDramaList, 9 | required List southIndianList, 10 | required List trendingTvList, 11 | required bool isLoading, 12 | required bool hasError, 13 | required String stateId, 14 | }) = _Initial; 15 | 16 | factory HomeState.initial() => const HomeState( 17 | pastYearList: [], 18 | trendingMovieList: [], 19 | tenseDramaList: [], 20 | southIndianList: [], 21 | trendingTvList: [], 22 | isLoading: false, 23 | hasError: false, 24 | stateId: '0', 25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /lib/presentation/fast_laugh/widgets/reel_buttons.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix_app/core/colors.dart'; 3 | 4 | class ReelActionButtons extends StatelessWidget { 5 | final IconData icon; 6 | final String title; 7 | const ReelActionButtons({Key? key, required this.icon, required this.title}) 8 | : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Padding( 13 | padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 7), 14 | child: Column( 15 | children: [ 16 | Icon( 17 | icon, 18 | color: whiteclr, 19 | size: 27, 20 | ), 21 | Text( 22 | title, 23 | style: const TextStyle(fontSize: 15), 24 | ), 25 | ], 26 | ), 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/domain/downloads/model/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['original_title'] as String?, 12 | title2: json['name'] as String?, 13 | backImg: json['backdrop_path'] as String?, 14 | ); 15 | 16 | Map _$$_DownloadsToJson(_$_Downloads instance) => 17 | { 18 | 'poster_path': instance.posterPath, 19 | 'original_title': instance.title, 20 | 'name': instance.title2, 21 | 'backdrop_path': instance.backImg, 22 | }; 23 | -------------------------------------------------------------------------------- /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 | # ignore files (apiKey) 49 | lib/infrastructure/api_key.dart 50 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netflix_app", 3 | "short_name": "netflix_app", 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 | -------------------------------------------------------------------------------- /lib/domain/search/model/search_resp/search_resp.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:netflix_app/core/url.dart'; 3 | 4 | part 'search_resp.g.dart'; 5 | 6 | @JsonSerializable() 7 | class SearchResp { 8 | @JsonKey(name: 'results') 9 | List results; 10 | 11 | SearchResp({this.results = const []}); 12 | 13 | factory SearchResp.fromJson(Map json) { 14 | return _$SearchRespFromJson(json); 15 | } 16 | 17 | Map toJson() => _$SearchRespToJson(this); 18 | } 19 | 20 | @JsonSerializable() 21 | class SearchResultData { 22 | @JsonKey(name: 'id') 23 | int? id; 24 | @JsonKey(name: 'original_title') 25 | String? originalTitle; 26 | @JsonKey(name: 'poster_path') 27 | String? posterPath; 28 | String get posterImgUrl => '$imgBaseUrl$posterPath'; 29 | 30 | SearchResultData({ 31 | this.id, 32 | this.originalTitle, 33 | this.posterPath, 34 | }); 35 | 36 | factory SearchResultData.fromJson(Map json) { 37 | return _$SearchResultDataFromJson(json); 38 | } 39 | 40 | Map toJson() => _$SearchResultDataToJson(this); 41 | } 42 | -------------------------------------------------------------------------------- /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_app/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/presentation/Widgets/app_bar_widget.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: prefer_const_constructors 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:google_fonts/google_fonts.dart'; 5 | import 'package:netflix_app/core/constants.dart'; 6 | 7 | class AppBarWidget extends StatelessWidget { 8 | final String title; 9 | 10 | const AppBarWidget({Key? key, required this.title}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Row( 15 | children: [ 16 | SbWidth10, 17 | Expanded( 18 | child: Text( 19 | title, 20 | style: GoogleFonts.montserrat( 21 | fontSize: 25, 22 | fontWeight: FontWeight.bold, 23 | ), 24 | )), 25 | IconButton( 26 | onPressed: () {}, 27 | icon: Icon( 28 | Icons.cast, 29 | color: Colors.white, 30 | size: 30, 31 | )), 32 | SbWidth10, 33 | Container( 34 | color: Colors.grey.withOpacity(0.5), 35 | height: 30, 36 | width: 30, 37 | ), 38 | SbWidth10 39 | ], 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/infrastructure/search/search_implement.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix_app/domain/core/api_endpoints.dart'; 6 | import 'package:netflix_app/domain/search/model/search_resp/search_resp.dart'; 7 | import 'package:netflix_app/domain/core/failures/main_failure.dart'; 8 | import 'package:dartz/dartz.dart'; 9 | import 'package:netflix_app/domain/search/search_service.dart'; 10 | 11 | @LazySingleton(as: SearchService) 12 | class SearchImplement implements SearchService { 13 | @override 14 | Future> searchMovies( 15 | {required String movieQuery}) async { 16 | try { 17 | final Response response = 18 | await Dio(BaseOptions()).get(ApiEndPoints.search, queryParameters: { 19 | 'query': movieQuery, 20 | }); 21 | if (response.statusCode == 200 || response.statusCode == 201) { 22 | final result = SearchResp.fromJson(response.data); 23 | 24 | return Right(result); 25 | } else { 26 | return const Left(MainFailure.serverFailure()); 27 | } 28 | } catch (e) { 29 | log(e.toString()); 30 | return const Left(MainFailure.clientFailure()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/domain/search/model/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 | id: json['id'] as int?, 24 | originalTitle: json['original_title'] as String?, 25 | posterPath: json['poster_path'] as String?, 26 | ); 27 | 28 | Map _$SearchResultDataToJson(SearchResultData instance) => 29 | { 30 | 'id': instance.id, 31 | 'original_title': instance.originalTitle, 32 | 'poster_path': instance.posterPath, 33 | }; 34 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/horizontal_scroll.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:netflix_app/Presentation/Widgets/main_title.dart'; 5 | import 'package:netflix_app/core/constants.dart'; 6 | import 'package:netflix_app/presentation/Widgets/main_card.dart'; 7 | 8 | class HorizontalScroll extends StatelessWidget { 9 | final String title; 10 | final List posterList; 11 | const HorizontalScroll({ 12 | Key? key, 13 | required this.title, 14 | required this.posterList, 15 | }) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Padding( 20 | padding: const EdgeInsets.only(left: 10), 21 | child: Column( 22 | crossAxisAlignment: CrossAxisAlignment.start, 23 | children: [ 24 | mainTitle( 25 | title: title, 26 | ), 27 | SbHeight10, 28 | LimitedBox( 29 | maxHeight: 200, 30 | child: ListView( 31 | scrollDirection: Axis.horizontal, 32 | children: List.generate(posterList.length, 33 | (index) => MainCard(imgUrl: posterList[index])), 34 | ), 35 | ) 36 | ], 37 | ), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/presentation/main_page/screen_main_page.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: prefer_const_constructors 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:netflix_app/Presentation/downloads/screen_downloads.dart'; 5 | import 'package:netflix_app/Presentation/fast_laugh/screen_fast_laugh.dart'; 6 | import 'package:netflix_app/Presentation/home/screen_home.dart'; 7 | import 'package:netflix_app/Presentation/main_page/widgets/bottom_nav.dart'; 8 | import 'package:netflix_app/Presentation/new_and_hot/screen_new_and_hot.dart'; 9 | import 'package:netflix_app/Presentation/search/screen_search.dart'; 10 | 11 | class ScreenMainPage extends StatelessWidget { 12 | ScreenMainPage({Key? key}) : super(key: key); 13 | 14 | final _pages = [ 15 | ScreenHome(), 16 | ScreenNewAndHot(), 17 | ScreenFastLaugh(), 18 | ScreenSearch(), 19 | ScreenDownloads() 20 | ]; 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Scaffold( 25 | body: SafeArea( 26 | child: ValueListenableBuilder( 27 | valueListenable: indexchange, 28 | builder: (BuildContext context, int index, Widget? child) { 29 | return _pages[index]; 30 | }, 31 | ), 32 | ), 33 | bottomNavigationBar: BottomNav(), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/infrastructure/downloads/downloads_repository.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: unrelated_type_equality_checks 2 | 3 | import 'dart:developer'; 4 | 5 | import 'package:dio/dio.dart'; 6 | import 'package:injectable/injectable.dart'; 7 | import 'package:netflix_app/domain/core/api_endpoints.dart'; 8 | import 'package:netflix_app/domain/core/failures/main_failure.dart'; 9 | import 'package:dartz/dartz.dart'; 10 | import 'package:netflix_app/domain/downloads/i_downloads_repo.dart'; 11 | import 'package:netflix_app/domain/downloads/model/downloads.dart'; 12 | 13 | @LazySingleton(as: IDownloadsRepo) 14 | class DownloadsRepository implements IDownloadsRepo { 15 | @override 16 | Future>> getDownloadsImages() async { 17 | try { 18 | final Response response = 19 | await Dio(BaseOptions()).get(ApiEndPoints.downloads); 20 | if (response.statusCode == 200 || response.statusCode == 201) { 21 | final List downloadsList = 22 | (response.data['results'] as List).map((e) { 23 | return Downloads.fromJson(e); 24 | }).toList(); 25 | return Right(downloadsList); 26 | } else { 27 | return const Left(MainFailure.serverFailure()); 28 | } 29 | } catch (e) { 30 | log(e.toString()); 31 | return const Left(MainFailure.clientFailure()); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/animated_hori_scroll.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix_app/core/constants.dart'; 3 | import 'package:netflix_app/presentation/Widgets/main_title.dart'; 4 | import 'package:netflix_app/presentation/home/widgets/animated_num_card.dart'; 5 | 6 | class AnimatedHorizontalScroll extends StatelessWidget { 7 | final List postersList; 8 | const AnimatedHorizontalScroll({ 9 | Key? key, 10 | required this.postersList, 11 | }) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Padding( 16 | padding: const EdgeInsets.all(5), 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.start, 19 | children: [ 20 | const mainTitle( 21 | title: 'Top 10 in India Today', 22 | ), 23 | SbHeight10, 24 | LimitedBox( 25 | maxHeight: 200, 26 | child: ListView( 27 | scrollDirection: Axis.horizontal, 28 | children: List.generate( 29 | postersList.length, 30 | (index) => AnimatedNumberCard( 31 | index: index, 32 | imgurl: postersList[index], 33 | )), 34 | ), 35 | ) 36 | ], 37 | ), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /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_app", 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/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_app/domain/core/failures/main_failure.dart'; 6 | import 'package:netflix_app/domain/downloads/i_downloads_repo.dart'; 7 | import 'package:netflix_app/domain/downloads/model/downloads.dart'; 8 | 9 | part 'downloads_event.dart'; 10 | part 'downloads_state.dart'; 11 | part 'downloads_bloc.freezed.dart'; 12 | 13 | @injectable 14 | class DownloadsBloc extends Bloc { 15 | final IDownloadsRepo _downloadsRepo; 16 | DownloadsBloc(this._downloadsRepo) : super(DownloadsState.initial()) { 17 | on<_GetDownloadsImages>((event, emit) async { 18 | if (state.downloads.isNotEmpty) { 19 | emit(state); 20 | return; 21 | } 22 | emit(state.copyWith(isLoading: true, downloadsResponse: none())); 23 | 24 | final Either> downloadsOption = 25 | await _downloadsRepo.getDownloadsImages(); 26 | emit(downloadsOption.fold( 27 | (failure) => state.copyWith( 28 | isLoading: false, downloadsResponse: Some(Left(failure))), 29 | (success) => state.copyWith( 30 | isLoading: false, 31 | downloadsResponse: Some(Right(success)), 32 | downloads: success, 33 | ))); 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /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/presentation/search/widgets/search_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix_app/Application/search/search_bloc.dart'; 4 | import 'package:netflix_app/Presentation/Widgets/main_title.dart'; 5 | import 'package:netflix_app/core/constants.dart'; 6 | import 'package:netflix_app/presentation/Widgets/main_card.dart'; 7 | 8 | class SearchResults extends StatelessWidget { 9 | const SearchResults({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Padding( 14 | padding: const EdgeInsets.all(8.0), 15 | child: Column( 16 | crossAxisAlignment: CrossAxisAlignment.start, 17 | children: [ 18 | const Padding( 19 | padding: EdgeInsets.only(left: 4), 20 | child: mainTitle(title: 'Movies & TV'), 21 | ), 22 | SbHeight20, 23 | Expanded(child: BlocBuilder( 24 | builder: (context, state) { 25 | return GridView.count( 26 | shrinkWrap: true, 27 | crossAxisCount: 3, 28 | mainAxisSpacing: 8, 29 | crossAxisSpacing: 8, 30 | childAspectRatio: 1 / 1.5, 31 | children: List.generate(20, (index) { 32 | final movie = state.searchResultList[index]; 33 | return MainCard( 34 | imgUrl: movie.posterImgUrl, 35 | ); 36 | }), 37 | ); 38 | }, 39 | )) 40 | ], 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/animated_num_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:bordered_text/bordered_text.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:netflix_app/core/colors.dart'; 4 | import 'package:netflix_app/core/constants.dart'; 5 | 6 | class AnimatedNumberCard extends StatelessWidget { 7 | final int index; 8 | final String imgurl; 9 | const AnimatedNumberCard( 10 | {Key? key, required this.index, required this.imgurl}) 11 | : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Stack( 16 | children: [ 17 | Row( 18 | children: [ 19 | const SizedBox(width: 30, height: 150), 20 | Container( 21 | width: 120, 22 | height: 200, 23 | decoration: BoxDecoration( 24 | borderRadius: borderRad10, 25 | image: DecorationImage( 26 | image: NetworkImage(imgurl), 27 | fit: BoxFit.cover, 28 | ), 29 | ), 30 | ), 31 | ], 32 | ), 33 | Positioned( 34 | left: 0, 35 | bottom: -24, 36 | child: BorderedText( 37 | strokeWidth: 3, 38 | strokeColor: whiteclr, 39 | child: Text( 40 | '${index + 1}', 41 | style: const TextStyle( 42 | color: bgcolor, 43 | fontSize: 110, 44 | fontWeight: FontWeight.bold, 45 | decoration: TextDecoration.none), 46 | ))), 47 | ], 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/presentation/fast_laugh/screen_fast_laugh.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix_app/Application/fast_laugh/fast_laugh_bloc.dart'; 4 | import 'package:netflix_app/presentation/fast_laugh/widgets/video_list.dart'; 5 | 6 | class ScreenFastLaugh extends StatelessWidget { 7 | const ScreenFastLaugh({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | WidgetsBinding.instance!.addPostFrameCallback((_) { 12 | BlocProvider.of(context).add(const Initialize()); 13 | }); 14 | return Scaffold( 15 | body: SafeArea( 16 | child: BlocBuilder( 17 | builder: (context, state) { 18 | if (state.isLoading) { 19 | return const Center( 20 | child: CircularProgressIndicator(), 21 | ); 22 | } else if (state.isError) { 23 | return const Center(child: Text('Error Occured')); 24 | } else if (state.videosList.isEmpty) { 25 | return const Center(child: Text('Video List Empty')); 26 | } else { 27 | return PageView( 28 | scrollDirection: Axis.vertical, 29 | children: List.generate(state.videosList.length, (index) { 30 | return VideoListItemInheritedWidget( 31 | widget: VideoListItems(index: index), 32 | movieData: state.videosList[index], 33 | ); 34 | }), 35 | ); 36 | } 37 | }, 38 | ), 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/presentation/Widgets/video_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix_app/core/colors.dart'; 3 | 4 | class VideoWidget extends StatelessWidget { 5 | final String url; 6 | const VideoWidget({ 7 | Key? key, 8 | required this.url, 9 | }) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Stack( 14 | children: [ 15 | SizedBox( 16 | width: double.infinity, 17 | height: 200, 18 | child: Image.network( 19 | url, 20 | fit: BoxFit.cover, 21 | loadingBuilder: 22 | (BuildContext _, Widget child, ImageChunkEvent? progress) { 23 | if (progress == null) { 24 | return child; 25 | } else { 26 | return const Center( 27 | child: CircularProgressIndicator( 28 | strokeWidth: 2, 29 | ), 30 | ); 31 | } 32 | }, 33 | errorBuilder: (BuildContext _, Object a, StackTrace? trace) { 34 | return const Center( 35 | child: Icon( 36 | Icons.wifi_off_rounded, 37 | color: whiteclr, 38 | )); 39 | }, 40 | ), 41 | ), 42 | Positioned( 43 | bottom: 10, 44 | right: 10, 45 | child: CircleAvatar( 46 | radius: 22, 47 | backgroundColor: bgcolor.withOpacity(0.3), 48 | child: const Icon( 49 | Icons.volume_off, 50 | color: whiteclr, 51 | size: 20, 52 | ), 53 | ), 54 | ) 55 | ], 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Netflix App 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | netflix_app 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_resp/model/new_and_hot_resp.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'new_and_hot_resp.g.dart'; 4 | 5 | @JsonSerializable() 6 | class NewAndHotResp { 7 | @JsonKey(name: 'page') 8 | int? page; 9 | 10 | @JsonKey(name: 'results') 11 | List results; 12 | 13 | NewAndHotResp({this.page, this.results = const []}); 14 | 15 | factory NewAndHotResp.fromJson(Map json) { 16 | return _$NewAndHotRespFromJson(json); 17 | } 18 | 19 | Map toJson() => _$NewAndHotRespToJson(this); 20 | } 21 | 22 | @JsonSerializable() 23 | class NewAndHotData { 24 | @JsonKey(name: 'backdrop_path') 25 | String? backdropPath; 26 | 27 | @JsonKey(name: 'id') 28 | int? id; 29 | 30 | @JsonKey(name: 'original_language') 31 | String? originalLanguage; 32 | 33 | @JsonKey(name: 'original_title') 34 | String? originalTitle; 35 | 36 | // In case of Tv Series, use this instead of original title 37 | @JsonKey(name: 'original_name') 38 | String? originalName; 39 | 40 | @JsonKey(name: 'overview') 41 | String? overview; 42 | 43 | @JsonKey(name: 'poster_path') 44 | String? posterPath; 45 | 46 | @JsonKey(name: 'release_date') 47 | @JsonKey(name: 'release_date') 48 | String? releaseDate; 49 | 50 | @JsonKey(name: 'title') 51 | String? title; 52 | 53 | NewAndHotData({ 54 | this.backdropPath, 55 | this.id, 56 | this.originalLanguage, 57 | this.originalTitle, 58 | this.overview, 59 | this.posterPath, 60 | this.releaseDate, 61 | this.title, 62 | }); 63 | 64 | factory NewAndHotData.fromJson(Map json) { 65 | return _$NewAndHotDataFromJson(json); 66 | } 67 | 68 | Map toJson() => _$NewAndHotDataToJson(this); 69 | } 70 | -------------------------------------------------------------------------------- /lib/presentation/main_page/widgets/bottom_nav.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix_app/core/colors.dart'; 3 | 4 | ValueNotifier indexchange = ValueNotifier(0); 5 | 6 | class BottomNav extends StatelessWidget { 7 | const BottomNav({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return ValueListenableBuilder( 12 | valueListenable: indexchange, 13 | builder: (BuildContext context, int newIndex, Widget? child) { 14 | return BottomNavigationBar( 15 | type: BottomNavigationBarType.fixed, 16 | currentIndex: newIndex, 17 | onTap: (index) { 18 | indexchange.value = index; 19 | }, 20 | backgroundColor: bgcolor, 21 | selectedItemColor: Colors.white, 22 | unselectedItemColor: Colors.grey, 23 | selectedLabelStyle: const TextStyle(color: Colors.white), 24 | unselectedLabelStyle: const TextStyle(color: Colors.grey), 25 | selectedFontSize: 12, 26 | unselectedFontSize: 10, 27 | items: const [ 28 | BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), 29 | BottomNavigationBarItem( 30 | icon: Icon(Icons.video_collection_outlined), 31 | label: 'New & Hot'), 32 | BottomNavigationBarItem( 33 | icon: Icon(Icons.emoji_emotions), label: 'Fast Laughs'), 34 | BottomNavigationBarItem( 35 | icon: Icon(Icons.search_rounded), label: 'Search'), 36 | BottomNavigationBarItem( 37 | icon: Icon(Icons.arrow_circle_down), label: 'Downloads') 38 | ]); 39 | }, 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/infrastructure/new_and_hot/new_and_hot_impl.dart: -------------------------------------------------------------------------------- 1 | import 'dart:developer'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix_app/domain/core/api_endpoints.dart'; 6 | import 'package:netflix_app/domain/new_and_hot_resp/model/new_and_hot_resp.dart'; 7 | import 'package:netflix_app/domain/core/failures/main_failure.dart'; 8 | import 'package:dartz/dartz.dart'; 9 | import 'package:netflix_app/domain/new_and_hot_resp/new_and_hot_service.dart'; 10 | 11 | @LazySingleton(as: NewAndHotService) 12 | class NewAndHotImpl implements NewAndHotService { 13 | @override 14 | Future> getHotAndNewMovieData() async { 15 | try { 16 | final Response response = 17 | await Dio(BaseOptions()).get(ApiEndPoints.newAndHotMovie); 18 | if (response.statusCode == 200 || response.statusCode == 201) { 19 | final result = NewAndHotResp.fromJson(response.data); 20 | 21 | return Right(result); 22 | } else { 23 | return const Left(MainFailure.serverFailure()); 24 | } 25 | } catch (e) { 26 | log(e.toString()); 27 | return const Left(MainFailure.clientFailure()); 28 | } 29 | } 30 | 31 | @override 32 | Future> getHotAndNewTvData() async { 33 | try { 34 | final Response response = 35 | await Dio(BaseOptions()).get(ApiEndPoints.newAndHotTv); 36 | if (response.statusCode == 200 || response.statusCode == 201) { 37 | final result = NewAndHotResp.fromJson(response.data); 38 | 39 | return Right(result); 40 | } else { 41 | return const Left(MainFailure.serverFailure()); 42 | } 43 | } catch (e) { 44 | log(e.toString()); 45 | return const Left(MainFailure.clientFailure()); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/domain/new_and_hot_resp/model/new_and_hot_resp.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'new_and_hot_resp.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | NewAndHotResp _$NewAndHotRespFromJson(Map json) => 10 | NewAndHotResp( 11 | page: json['page'] as int?, 12 | results: (json['results'] as List?) 13 | ?.map((e) => NewAndHotData.fromJson(e as Map)) 14 | .toList() ?? 15 | const [], 16 | ); 17 | 18 | Map _$NewAndHotRespToJson(NewAndHotResp instance) => 19 | { 20 | 'page': instance.page, 21 | 'results': instance.results, 22 | }; 23 | 24 | NewAndHotData _$NewAndHotDataFromJson(Map json) => 25 | NewAndHotData( 26 | backdropPath: json['backdrop_path'] as String?, 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 | posterPath: json['poster_path'] as String?, 32 | releaseDate: json['release_date'] as String?, 33 | title: json['title'] as String?, 34 | )..originalName = json['original_name'] as String?; 35 | 36 | Map _$NewAndHotDataToJson(NewAndHotData instance) => 37 | { 38 | 'backdrop_path': instance.backdropPath, 39 | 'id': instance.id, 40 | 'original_language': instance.originalLanguage, 41 | 'original_title': instance.originalTitle, 42 | 'original_name': instance.originalName, 43 | 'overview': instance.overview, 44 | 'poster_path': instance.posterPath, 45 | 'release_date': instance.releaseDate, 46 | 'title': instance.title, 47 | }; 48 | -------------------------------------------------------------------------------- /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_app/Application/downloads/downloads_bloc.dart'; 5 | import 'package:netflix_app/Application/fast_laugh/fast_laugh_bloc.dart'; 6 | import 'package:netflix_app/Application/home/home_bloc.dart'; 7 | import 'package:netflix_app/Application/new_and_hot/new_and_hot_bloc.dart'; 8 | import 'package:netflix_app/Application/search/search_bloc.dart'; 9 | import 'package:netflix_app/Presentation/main_page/screen_main_page.dart'; 10 | import 'package:netflix_app/core/colors.dart'; 11 | import 'package:netflix_app/domain/core/di/injectable.dart'; 12 | 13 | Future main() async { 14 | WidgetsFlutterBinding.ensureInitialized(); 15 | await configureInjection(); 16 | runApp(const MyApp()); 17 | } 18 | 19 | class MyApp extends StatelessWidget { 20 | const MyApp({Key? key}) : super(key: key); 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return MultiBlocProvider( 25 | providers: [ 26 | BlocProvider(create: (ctx) => getIt()), 27 | BlocProvider(create: (ctx) => getIt()), 28 | BlocProvider(create: (ctx) => getIt()), 29 | BlocProvider(create: (ctx) => getIt()), 30 | BlocProvider(create: (ctx) => getIt()), 31 | ], 32 | child: MaterialApp( 33 | debugShowCheckedModeBanner: false, 34 | theme: ThemeData( 35 | appBarTheme: AppBarTheme(backgroundColor: Colors.transparent), 36 | primarySwatch: Colors.blue, 37 | scaffoldBackgroundColor: bgcolor, 38 | fontFamily: GoogleFonts.montserrat().fontFamily, 39 | textTheme: const TextTheme( 40 | bodyText1: TextStyle(color: Colors.white), 41 | bodyText2: TextStyle(color: Colors.white)), 42 | ), 43 | home: ScreenMainPage(), 44 | ), 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /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/new_and_hot/widgets/everyones_watching_content.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix_app/Presentation/Widgets/video_widget.dart'; 3 | import 'package:netflix_app/Presentation/home/screen_home.dart'; 4 | import 'package:netflix_app/core/colors.dart'; 5 | import 'package:netflix_app/core/constants.dart'; 6 | 7 | class EveryonesWatchingContent extends StatelessWidget { 8 | final String posterPath; 9 | final String movieName; 10 | final String description; 11 | const EveryonesWatchingContent({ 12 | Key? key, 13 | required this.posterPath, 14 | required this.movieName, 15 | required this.description, 16 | }) : super(key: key); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Column( 21 | crossAxisAlignment: CrossAxisAlignment.start, 22 | children: [ 23 | SbHeight10, 24 | Text(movieName, 25 | style: const TextStyle( 26 | fontSize: 20, 27 | fontWeight: FontWeight.bold, 28 | )), 29 | SbHeight10, 30 | Text( 31 | description, 32 | style: const TextStyle(color: greyclr), 33 | ), 34 | SbHeight50, 35 | VideoWidget( 36 | url: posterPath, 37 | ), 38 | SbHeight10, 39 | Row( 40 | mainAxisAlignment: MainAxisAlignment.end, 41 | children: const [ 42 | CustomButtonHome( 43 | icon: Icons.share, 44 | icontxt: 'Share', 45 | iconSize: 35, 46 | textSize: 12, 47 | ), 48 | SbWidth20, 49 | CustomButtonHome( 50 | icon: Icons.add, 51 | icontxt: 'My List', 52 | iconSize: 35, 53 | textSize: 12, 54 | ), 55 | SbWidth20, 56 | CustomButtonHome( 57 | icon: Icons.play_arrow_rounded, 58 | icontxt: 'Play', 59 | iconSize: 35, 60 | textSize: 12, 61 | ), 62 | SbWidth10 63 | ], 64 | ) 65 | ], 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /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_app" 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/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 _i9; 11 | import '../../../Application/fast_laugh/fast_laugh_bloc.dart' as _i10; 12 | import '../../../Application/home/home_bloc.dart' as _i11; 13 | import '../../../Application/new_and_hot/new_and_hot_bloc.dart' as _i12; 14 | import '../../../Application/search/search_bloc.dart' as _i13; 15 | import '../../../infrastructure/downloads/downloads_repository.dart' as _i4; 16 | import '../../../infrastructure/new_and_hot/new_and_hot_impl.dart' as _i6; 17 | import '../../../infrastructure/search/search_implement.dart' as _i8; 18 | import '../../downloads/i_downloads_repo.dart' as _i3; 19 | import '../../new_and_hot_resp/new_and_hot_service.dart' as _i5; 20 | import '../../search/search_service.dart' 21 | as _i7; // ignore_for_file: unnecessary_lambdas 22 | 23 | // ignore_for_file: lines_longer_than_80_chars 24 | /// initializes the registration of provided dependencies inside of [GetIt] 25 | _i1.GetIt $initGetIt(_i1.GetIt get, 26 | {String? environment, _i2.EnvironmentFilter? environmentFilter}) { 27 | final gh = _i2.GetItHelper(get, environment, environmentFilter); 28 | gh.lazySingleton<_i3.IDownloadsRepo>(() => _i4.DownloadsRepository()); 29 | gh.lazySingleton<_i5.NewAndHotService>(() => _i6.NewAndHotImpl()); 30 | gh.lazySingleton<_i7.SearchService>(() => _i8.SearchImplement()); 31 | gh.factory<_i9.DownloadsBloc>( 32 | () => _i9.DownloadsBloc(get<_i3.IDownloadsRepo>())); 33 | gh.factory<_i10.FastLaughBloc>( 34 | () => _i10.FastLaughBloc(get<_i3.IDownloadsRepo>())); 35 | gh.factory<_i11.HomeBloc>(() => _i11.HomeBloc(get<_i5.NewAndHotService>())); 36 | gh.factory<_i12.NewAndHotBloc>( 37 | () => _i12.NewAndHotBloc(get<_i5.NewAndHotService>())); 38 | gh.factory<_i13.SearchBloc>(() => 39 | _i13.SearchBloc(get<_i3.IDownloadsRepo>(), get<_i7.SearchService>())); 40 | return get; 41 | } 42 | -------------------------------------------------------------------------------- /lib/Application/fast_laugh/fast_laugh_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | import 'package:injectable/injectable.dart'; 5 | import 'package:netflix_app/domain/downloads/i_downloads_repo.dart'; 6 | import 'package:netflix_app/domain/downloads/model/downloads.dart'; 7 | 8 | part 'fast_laugh_event.dart'; 9 | part 'fast_laugh_state.dart'; 10 | part 'fast_laugh_bloc.freezed.dart'; 11 | 12 | final videoUrls = [ 13 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", 14 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", 15 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4", 16 | "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp40", 17 | ]; 18 | 19 | ValueNotifier> likedVideoNotifier = ValueNotifier({}); 20 | 21 | @injectable 22 | class FastLaughBloc extends Bloc { 23 | FastLaughBloc(IDownloadsRepo _downloadService) 24 | : super(FastLaughState.initial()) { 25 | on((event, emit) async { 26 | if (state.videosList.isNotEmpty) { 27 | emit(state); 28 | return; 29 | } 30 | 31 | emit(FastLaughState( 32 | videosList: [], 33 | isLoading: true, 34 | isError: false, 35 | )); 36 | 37 | // get trending movies 38 | final _result = await _downloadService.getDownloadsImages(); 39 | final _state = _result.fold( 40 | (l) { 41 | return FastLaughState( 42 | videosList: [], 43 | isLoading: false, 44 | isError: true, 45 | ); 46 | }, 47 | (response) => FastLaughState( 48 | videosList: response, 49 | isLoading: false, 50 | isError: false, 51 | ), 52 | ); 53 | // send to ui 54 | emit(_state); 55 | }); 56 | 57 | on((event, emit) async { 58 | likedVideoNotifier.value.add(event.id); 59 | likedVideoNotifier.notifyListeners(); 60 | }); 61 | on((event, emit) async { 62 | likedVideoNotifier.value.remove(event.id); 63 | likedVideoNotifier.notifyListeners(); 64 | }); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /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_app/Application/search/search_bloc.dart'; 5 | import 'package:netflix_app/Presentation/search/widgets/search_result.dart'; 6 | import 'package:netflix_app/core/colors.dart'; 7 | import 'package:netflix_app/core/constants.dart'; 8 | import 'package:netflix_app/domain/core/debounce/debounce.dart'; 9 | import 'package:netflix_app/presentation/search/widgets/search_idle.dart'; 10 | 11 | class ScreenSearch extends StatelessWidget { 12 | ScreenSearch({Key? key}) : super(key: key); 13 | 14 | final _debouncer = Debouncer(milliseconds: 1000); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | WidgetsBinding.instance!.addPostFrameCallback((_) { 19 | BlocProvider.of(context).add(const Initialize()); 20 | }); 21 | return Scaffold( 22 | body: SafeArea( 23 | child: Padding( 24 | padding: const EdgeInsets.all(8.0), 25 | child: Column( 26 | children: [ 27 | CupertinoSearchTextField( 28 | backgroundColor: Colors.grey[800], 29 | prefixIcon: const Padding( 30 | padding: EdgeInsets.only(top: 4, left: 3, right: 3), 31 | child: Icon( 32 | CupertinoIcons.search, 33 | color: Colors.grey, 34 | ), 35 | ), 36 | suffixIcon: const Icon(CupertinoIcons.xmark_circle_fill, 37 | color: Colors.grey), 38 | style: const TextStyle(color: whiteclr), 39 | onChanged: (value) { 40 | if (value.isEmpty) { 41 | return; 42 | } 43 | _debouncer.run(() { 44 | BlocProvider.of(context) 45 | .add(SearchMovies(movieQuery: value)); 46 | }); 47 | }, 48 | ), 49 | SbHeight10, 50 | Expanded(child: BlocBuilder( 51 | builder: (context, state) { 52 | if (state.searchResultList.isEmpty) { 53 | return const SearchIdleWidget(); 54 | } else { 55 | return const SearchResults(); 56 | } 57 | }, 58 | )) 59 | ], 60 | ), 61 | )), 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /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/Application/new_and_hot/new_and_hot_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_app/domain/core/failures/main_failure.dart'; 5 | import 'package:netflix_app/domain/new_and_hot_resp/model/new_and_hot_resp.dart'; 6 | import 'package:netflix_app/domain/new_and_hot_resp/new_and_hot_service.dart'; 7 | 8 | part 'new_and_hot_event.dart'; 9 | part 'new_and_hot_state.dart'; 10 | part 'new_and_hot_bloc.freezed.dart'; 11 | 12 | @injectable 13 | class NewAndHotBloc extends Bloc { 14 | final NewAndHotService _newAndHotService; 15 | NewAndHotBloc(this._newAndHotService) : super(NewAndHotState.initial()) { 16 | on((event, emit) async { 17 | if (state.comingSoonList.isNotEmpty) { 18 | emit(state); 19 | return; 20 | } 21 | 22 | emit(const NewAndHotState( 23 | comingSoonList: [], 24 | everyoneWatchingList: [], 25 | isLoading: true, 26 | hasError: false, 27 | )); 28 | 29 | final _result = await _newAndHotService.getHotAndNewMovieData(); 30 | final newState = _result.fold((MainFailure f) { 31 | return const NewAndHotState( 32 | comingSoonList: [], 33 | everyoneWatchingList: [], 34 | isLoading: false, 35 | hasError: true, 36 | ); 37 | }, (NewAndHotResp resp) { 38 | return NewAndHotState( 39 | comingSoonList: resp.results, 40 | everyoneWatchingList: state.everyoneWatchingList, 41 | isLoading: false, 42 | hasError: false, 43 | ); 44 | }); 45 | emit(newState); 46 | }); 47 | 48 | on((event, emit) async { 49 | if (state.everyoneWatchingList.isNotEmpty) { 50 | emit(state); 51 | return; 52 | } 53 | 54 | emit(const NewAndHotState( 55 | comingSoonList: [], 56 | everyoneWatchingList: [], 57 | isLoading: true, 58 | hasError: false, 59 | )); 60 | 61 | final _result = await _newAndHotService.getHotAndNewTvData(); 62 | final newState = _result.fold((MainFailure f) { 63 | return const NewAndHotState( 64 | comingSoonList: [], 65 | everyoneWatchingList: [], 66 | isLoading: false, 67 | hasError: true, 68 | ); 69 | }, (NewAndHotResp resp) { 70 | return NewAndHotState( 71 | comingSoonList: state.comingSoonList, 72 | everyoneWatchingList: resp.results, 73 | isLoading: false, 74 | hasError: false, 75 | ); 76 | }); 77 | emit(newState); 78 | }); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/Application/search/search_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_app/domain/core/failures/main_failure.dart'; 5 | import 'package:netflix_app/domain/downloads/i_downloads_repo.dart'; 6 | import 'package:netflix_app/domain/downloads/model/downloads.dart'; 7 | import 'package:netflix_app/domain/search/model/search_resp/search_resp.dart'; 8 | import 'package:netflix_app/domain/search/search_service.dart'; 9 | 10 | part 'search_event.dart'; 11 | part 'search_state.dart'; 12 | part 'search_bloc.freezed.dart'; 13 | 14 | @injectable 15 | class SearchBloc extends Bloc { 16 | final IDownloadsRepo _downloadsService; 17 | final SearchService _searchService; 18 | SearchBloc(this._downloadsService, this._searchService) 19 | : super(SearchState.initial()) { 20 | on((event, emit) async { 21 | if (state.idleList.isNotEmpty) { 22 | emit(state); 23 | return; 24 | } 25 | emit(const SearchState( 26 | searchResultList: [], 27 | idleList: [], 28 | isLoading: true, 29 | isError: false, 30 | )); 31 | 32 | // Get Trending 33 | final _result = await _downloadsService.getDownloadsImages(); 34 | final _state = _result.fold( 35 | (MainFailure f) { 36 | return const SearchState( 37 | searchResultList: [], 38 | idleList: [], 39 | isLoading: false, 40 | isError: true, 41 | ); 42 | }, 43 | (List list) { 44 | return SearchState( 45 | searchResultList: [], 46 | idleList: list, 47 | isLoading: false, 48 | isError: false, 49 | ); 50 | }, 51 | ); 52 | emit(_state); 53 | // Display On UI 54 | }); 55 | 56 | on((event, emit) async { 57 | // Call Search Movie Api 58 | emit(SearchState( 59 | searchResultList: [], 60 | idleList: [], 61 | isLoading: true, 62 | isError: false, 63 | )); 64 | 65 | final result = 66 | await _searchService.searchMovies(movieQuery: event.movieQuery); 67 | final _state = result.fold( 68 | (MainFailure f) { 69 | return const SearchState( 70 | searchResultList: [], 71 | idleList: [], 72 | isLoading: false, 73 | isError: true, 74 | ); 75 | }, 76 | (SearchResp r) { 77 | return SearchState( 78 | searchResultList: r.results, 79 | idleList: [], 80 | isLoading: false, 81 | isError: false, 82 | ); 83 | }, 84 | ); 85 | // Display on UI 86 | emit(_state); 87 | }); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /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/search/widgets/search_idle.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_app/Application/search/search_bloc.dart'; 5 | import 'package:netflix_app/Presentation/Widgets/main_title.dart'; 6 | import 'package:netflix_app/core/colors.dart'; 7 | import 'package:netflix_app/core/constants.dart'; 8 | import 'package:netflix_app/core/url.dart'; 9 | 10 | class SearchIdleWidget extends StatelessWidget { 11 | const SearchIdleWidget({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Padding( 16 | padding: const EdgeInsets.all(8.0), 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.start, 19 | children: [ 20 | const mainTitle( 21 | title: 'Top Searches', 22 | ), 23 | SbHeight20, 24 | Expanded( 25 | child: BlocBuilder( 26 | builder: (context, state) { 27 | if (state.isLoading) { 28 | return const Center(child: CircularProgressIndicator()); 29 | } else if (state.idleList.isEmpty) { 30 | return const Center(child: Text('The List is Empty')); 31 | } else if (state.isError) { 32 | return const Center(child: Text('An error occured')); 33 | } 34 | return ListView.separated( 35 | shrinkWrap: true, 36 | itemBuilder: (context, index) { 37 | final movie = state.idleList[index]; 38 | return TopSearch( 39 | title: movie.title ?? movie.title2.toString(), 40 | imageUrl: '$imgBaseUrl${movie.backImg}', 41 | ); 42 | }, 43 | separatorBuilder: (context, index) => SbHeight20, 44 | itemCount: state.idleList.length); 45 | }, 46 | ), 47 | ) 48 | ], 49 | ), 50 | ); 51 | } 52 | } 53 | 54 | class TopSearch extends StatelessWidget { 55 | final String title; 56 | final String imageUrl; 57 | const TopSearch({ 58 | Key? key, 59 | required this.title, 60 | required this.imageUrl, 61 | }) : super(key: key); 62 | 63 | @override 64 | Widget build(BuildContext context) { 65 | final size = MediaQuery.of(context).size; 66 | return Row( 67 | children: [ 68 | Container( 69 | width: size.width * 0.3, 70 | height: 70, 71 | decoration: BoxDecoration( 72 | image: DecorationImage( 73 | fit: BoxFit.cover, 74 | image: NetworkImage(imageUrl), 75 | )), 76 | ), 77 | SbWidth10, 78 | Expanded( 79 | child: Text( 80 | title, 81 | style: const TextStyle( 82 | fontSize: 16, 83 | fontWeight: FontWeight.bold, 84 | ), 85 | ), 86 | ), 87 | const Icon( 88 | CupertinoIcons.play_circle, 89 | size: 50, 90 | color: whiteclr, 91 | ) 92 | ], 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /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_app" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "netflix_app" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "netflix_app.exe" "\0" 98 | VALUE "ProductName", "netflix_app" "\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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/Application/home/home_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_app/domain/core/failures/main_failure.dart'; 5 | import 'package:netflix_app/domain/new_and_hot_resp/model/new_and_hot_resp.dart'; 6 | import 'package:netflix_app/domain/new_and_hot_resp/new_and_hot_service.dart'; 7 | 8 | part 'home_event.dart'; 9 | part 'home_state.dart'; 10 | part 'home_bloc.freezed.dart'; 11 | 12 | @injectable 13 | class HomeBloc extends Bloc { 14 | final NewAndHotService _homeService; 15 | HomeBloc(this._homeService) : super(HomeState.initial()) { 16 | on((event, emit) async { 17 | if (state.pastYearList.isNotEmpty) { 18 | emit(state); 19 | return; 20 | } 21 | 22 | // Send Loading to UI 23 | emit(state.copyWith( 24 | isLoading: true, 25 | hasError: false, 26 | )); 27 | 28 | // Get Data 29 | final _movieResult = await _homeService.getHotAndNewMovieData(); 30 | final _tvResult = await _homeService.getHotAndNewTvData(); 31 | 32 | // Transform Data 33 | final _state1 = _movieResult.fold( 34 | (MainFailure failure) { 35 | return HomeState( 36 | pastYearList: [], 37 | trendingMovieList: [], 38 | tenseDramaList: [], 39 | southIndianList: [], 40 | trendingTvList: [], 41 | isLoading: false, 42 | hasError: true, 43 | stateId: DateTime.now().millisecondsSinceEpoch.toString(), 44 | ); 45 | }, 46 | (NewAndHotResp resp) { 47 | final pastYear = resp.results; 48 | final trendingMovie = resp.results; 49 | final tenseDrama = resp.results; 50 | final southIndian = resp.results; 51 | pastYear.shuffle(); 52 | trendingMovie.shuffle(); 53 | tenseDrama.shuffle(); 54 | southIndian.shuffle(); 55 | return HomeState( 56 | stateId: DateTime.now().millisecondsSinceEpoch.toString(), 57 | pastYearList: pastYear.sublist(0, 10), 58 | trendingMovieList: trendingMovie.sublist(0, 10), 59 | tenseDramaList: tenseDrama.sublist(0, 10), 60 | southIndianList: southIndian.sublist(0, 10), 61 | trendingTvList: state.trendingTvList, 62 | isLoading: false, 63 | hasError: false, 64 | ); 65 | }, 66 | ); 67 | emit(_state1); 68 | 69 | final _state2 = _tvResult.fold( 70 | (MainFailure failure) { 71 | return HomeState( 72 | stateId: DateTime.now().millisecondsSinceEpoch.toString(), 73 | pastYearList: [], 74 | trendingMovieList: [], 75 | tenseDramaList: [], 76 | southIndianList: [], 77 | trendingTvList: [], 78 | isLoading: false, 79 | hasError: true, 80 | ); 81 | }, 82 | (NewAndHotResp resp) { 83 | final top10List = resp.results; 84 | return HomeState( 85 | stateId: DateTime.now().millisecondsSinceEpoch.toString(), 86 | pastYearList: state.pastYearList, 87 | trendingMovieList: state.trendingMovieList, 88 | tenseDramaList: state.tenseDramaList, 89 | southIndianList: state.southIndianList, 90 | trendingTvList: top10List.sublist(0, 10), 91 | isLoading: false, 92 | hasError: false, 93 | ); 94 | }, 95 | ); 96 | 97 | // Send to UI 98 | 99 | emit(_state2); 100 | }); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(netflix_app LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "netflix_app") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.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/new_and_hot/widgets/coming_soon_content.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:netflix_app/Presentation/Widgets/video_widget.dart'; 3 | import 'package:netflix_app/Presentation/home/screen_home.dart'; 4 | import 'package:netflix_app/core/colors.dart'; 5 | import 'package:netflix_app/core/constants.dart'; 6 | 7 | class ComingSoonContent extends StatelessWidget { 8 | final String id; 9 | final String month; 10 | final String day; 11 | final String posterPath; 12 | final String movieName; 13 | final String description; 14 | const ComingSoonContent({ 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 | }) : super(key: key); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | final size = MediaQuery.of(context).size; 27 | return Row( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | SizedBox( 31 | width: 50, 32 | child: Column( 33 | children: [ 34 | Text( 35 | month, 36 | style: const TextStyle( 37 | color: greyclr, 38 | fontWeight: FontWeight.bold, 39 | ), 40 | ), 41 | Text(day, 42 | style: const TextStyle( 43 | letterSpacing: 4, 44 | color: whiteclr, 45 | fontSize: 25, 46 | fontWeight: FontWeight.bold)) 47 | ], 48 | ), 49 | ), 50 | SizedBox( 51 | width: size.width - 50, 52 | child: Column( 53 | crossAxisAlignment: CrossAxisAlignment.start, 54 | children: [ 55 | VideoWidget( 56 | url: posterPath, 57 | ), 58 | SbHeight20, 59 | Row( 60 | children: [ 61 | Expanded( 62 | child: Text( 63 | movieName, 64 | maxLines: 1, 65 | overflow: TextOverflow.ellipsis, 66 | style: const TextStyle( 67 | // letterSpacing: -3, 68 | fontSize: 18, 69 | fontWeight: FontWeight.bold), 70 | ), 71 | ), 72 | const CustomButtonHome( 73 | icon: Icons.notifications_outlined, 74 | icontxt: 'Remind Me', 75 | iconSize: 22, 76 | textSize: 10, 77 | ), 78 | SbWidth20, 79 | const CustomButtonHome( 80 | icon: Icons.info_outline, 81 | icontxt: 'Info', 82 | iconSize: 22, 83 | textSize: 10, 84 | ), 85 | SbWidth20, 86 | ], 87 | ), 88 | SbHeight10, 89 | Text( 90 | 'Coming on $day $month', 91 | style: const TextStyle( 92 | color: greyclr, 93 | fontWeight: FontWeight.bold, 94 | ), 95 | ), 96 | SbHeight20, 97 | SizedBox( 98 | width: 200, 99 | child: Text(movieName, 100 | style: const TextStyle( 101 | fontSize: 16, 102 | fontWeight: FontWeight.bold, 103 | )), 104 | ), 105 | SbHeight10, 106 | Text( 107 | description, 108 | maxLines: 4, 109 | style: const TextStyle(color: greyclr), 110 | ), 111 | SbHeight30, 112 | ], 113 | ), 114 | ), 115 | ], 116 | ); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: netflix_app 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 | flutter: 33 | sdk: flutter 34 | google_fonts: ^3.0.1 35 | video_player: ^2.4.5 36 | flutter_bloc: ^8.0.1 37 | json_serializable: ^6.2.0 38 | json_annotation: ^4.5.0 39 | freezed_annotation: ^2.0.3 40 | dio: ^4.0.6 41 | dartz: ^0.10.1 42 | get_it: ^7.2.0 43 | injectable: ^1.5.3 44 | share_plus: ^4.0.10 45 | intl: ^0.17.0 46 | 47 | dev_dependencies: 48 | build_runner: ^2.1.11 49 | freezed: ^2.0.3+1 50 | injectable_generator: ^1.5.3 51 | 52 | # The "flutter_lints" package below contains a set of recommended lints to 53 | # encourage good coding practices. The lint set provided by the package is 54 | # activated in the `analysis_options.yaml` file located at the root of your 55 | # package. See that file for information about deactivating specific lint 56 | # rules and activating additional ones. 57 | flutter_lints: ^1.0.0 58 | flutter_test: 59 | sdk: flutter 60 | 61 | # For information on the generic Dart part of this file, see the 62 | # following page: https://dart.dev/tools/pub/pubspec 63 | # The following section is specific to Flutter. 64 | flutter: 65 | 66 | # The following line ensures that the Material Icons font is 67 | # included with your application, so that you can use the icons in 68 | # the material Icons class. 69 | uses-material-design: true 70 | # To add assets to your application, add an assets section, like this: 71 | # assets: 72 | # - images/a_dot_burr.jpeg 73 | # - images/a_dot_ham.jpeg 74 | # An image asset can refer to one or more resolution-specific "variants", see 75 | # https://flutter.dev/assets-and-images/#resolution-aware. 76 | # For details regarding adding assets from package dependencies, see 77 | # https://flutter.dev/assets-and-images/#from-packages 78 | # To add custom fonts to your application, add a fonts section here, 79 | # in this "flutter" section. Each entry in this list should have a 80 | # "family" key with the font family name, and a "fonts" key with a 81 | # list giving the asset and other descriptors for the font. For 82 | # example: 83 | # fonts: 84 | # - family: Schyler 85 | # fonts: 86 | # - asset: fonts/Schyler-Regular.ttf 87 | # - asset: fonts/Schyler-Italic.ttf 88 | # style: italic 89 | # - family: Trajan Pro 90 | # fonts: 91 | # - asset: fonts/TrajanPro.ttf 92 | # - asset: fonts/TrajanPro_Bold.ttf 93 | # weight: 700 94 | # 95 | # For details regarding fonts from package dependencies, 96 | # see https://flutter.dev/custom-fonts/#from-packages 97 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | netflix_app 33 | 34 | 35 | 36 | 39 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /lib/presentation/home/widgets/top_section.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui' as ui; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:netflix_app/Presentation/home/screen_home.dart'; 5 | import 'package:netflix_app/core/colors.dart'; 6 | import 'package:netflix_app/core/constants.dart'; 7 | 8 | class HomeTopSection extends StatelessWidget { 9 | final List imgUrls; 10 | const HomeTopSection({ 11 | Key? key, 12 | required this.imgUrls, 13 | }) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Stack( 18 | children: [ 19 | Container( 20 | width: double.infinity, 21 | height: 600, 22 | decoration: BoxDecoration( 23 | image: DecorationImage( 24 | fit: BoxFit.cover, image: NetworkImage(imgUrls[2]))), 25 | ), 26 | Positioned( 27 | bottom: 0, 28 | right: 0, 29 | left: 0, 30 | child: Padding( 31 | padding: const EdgeInsets.only(bottom: 10), 32 | child: Row( 33 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 34 | children: [ 35 | const CustomButtonHome( 36 | icon: Icons.add, 37 | icontxt: 'My List', 38 | ), 39 | _playButtonHome(), 40 | const CustomButtonHome( 41 | icon: Icons.info_outline, 42 | icontxt: 'Info', 43 | ) 44 | ], 45 | ), 46 | ), 47 | ), 48 | ], 49 | ); 50 | } 51 | 52 | ElevatedButton _playButtonHome() { 53 | return ElevatedButton.icon( 54 | style: ElevatedButton.styleFrom(primary: whiteclr), 55 | onPressed: () {}, 56 | icon: const Icon( 57 | Icons.play_arrow_rounded, 58 | color: bgcolor, 59 | size: 30, 60 | ), 61 | label: const Text('Play', 62 | style: TextStyle( 63 | color: bgcolor, 64 | fontSize: 16, 65 | )), 66 | ); 67 | } 68 | } 69 | 70 | OverlayEntry getEntry(context) { 71 | OverlayEntry? entry; 72 | final List Categories = [ 73 | 'Home', 74 | 'My List', 75 | 'Available for Download', 76 | 'Hindi', 77 | 'Punjabi', 78 | 'Telugu', 79 | 'Malayalam', 80 | 'Marathi', 81 | 'Bengali', 82 | 'English', 83 | 'Action', 84 | 'Anime', 85 | 'Award Winners', 86 | 'Bollywood', 87 | 'Blockbusters', 88 | 'Biographical' 89 | 'Comedies', 90 | 'Documentaries', 91 | 'Fantasy', 92 | 'Horror', 93 | 'Indian', 94 | 'International', 95 | 'Romance', 96 | 'Sci-Fi', 97 | 'Tamil', 98 | 'Thrillers', 99 | ]; 100 | 101 | entry = OverlayEntry( 102 | opaque: false, 103 | maintainState: true, 104 | builder: (_) => BackdropFilter( 105 | filter: ui.ImageFilter.blur( 106 | sigmaX: 20, 107 | sigmaY: 20, 108 | ), 109 | child: Material( 110 | color: Colors.black.withOpacity(0.5), 111 | child: Column( 112 | children: [ 113 | SbHeight30, 114 | Expanded( 115 | child: ListView( 116 | physics: const BouncingScrollPhysics(), 117 | children: List.generate( 118 | Categories.length, 119 | (index) => Column( 120 | children: [ 121 | Text(Categories[index], 122 | style: TextStyle( 123 | color: Colors.grey[350], 124 | fontSize: 18, 125 | fontWeight: FontWeight.bold)), 126 | SbHeight30 127 | ], 128 | )), 129 | ), 130 | ), 131 | InkWell( 132 | onTap: () { 133 | entry!.remove(); 134 | }, 135 | child: const CircleAvatar( 136 | radius: 30, 137 | backgroundColor: whiteclr, 138 | child: Icon( 139 | Icons.close, 140 | size: 35, 141 | color: Colors.black, 142 | ), 143 | ), 144 | ) 145 | ], 146 | ), 147 | ), 148 | ), 149 | ); 150 | return entry; 151 | } 152 | 153 | class MyBehavior extends ScrollBehavior { 154 | @override 155 | Widget buildOverscrollIndicator( 156 | BuildContext context, Widget child, ScrollableDetails details) { 157 | return child; 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /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:intl/intl.dart'; 4 | import 'package:netflix_app/Application/new_and_hot/new_and_hot_bloc.dart'; 5 | import 'package:netflix_app/core/colors.dart'; 6 | import 'package:netflix_app/core/constants.dart'; 7 | import 'package:netflix_app/core/url.dart'; 8 | import 'package:netflix_app/presentation/new_and_hot/widgets/coming_soon_content.dart'; 9 | import 'package:netflix_app/presentation/new_and_hot/widgets/everyones_watching_content.dart'; 10 | 11 | class ScreenNewAndHot extends StatelessWidget { 12 | const ScreenNewAndHot({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return DefaultTabController( 17 | length: 2, 18 | child: Scaffold( 19 | appBar: AppBar( 20 | title: const Text('New & Hot', 21 | style: TextStyle( 22 | fontSize: 25, 23 | fontWeight: FontWeight.bold, 24 | )), 25 | actions: [ 26 | IconButton( 27 | onPressed: () {}, 28 | icon: const Icon( 29 | Icons.cast, 30 | color: Colors.white, 31 | size: 30, 32 | )), 33 | SbWidth10, 34 | Container( 35 | color: Colors.grey.withOpacity(0.5), 36 | height: 30, 37 | width: 30, 38 | ), 39 | SbWidth10 40 | ], 41 | bottom: TabBar( 42 | isScrollable: true, 43 | labelColor: bgcolor, 44 | labelStyle: const TextStyle( 45 | fontSize: 16, 46 | fontWeight: FontWeight.bold, 47 | ), 48 | unselectedLabelColor: whiteclr, 49 | indicator: BoxDecoration( 50 | color: whiteclr, 51 | borderRadius: borderRad30, 52 | ), 53 | tabs: const [ 54 | Tab( 55 | text: '🍿 Coming Soon', 56 | ), 57 | Tab(text: "👀 Everyone's Watching ") 58 | ]), 59 | ), 60 | body: const TabBarView(children: [ 61 | ComingSoonPage( 62 | key: Key('coming_soon'), 63 | ), 64 | EveryoneWatchingPage( 65 | key: Key('everyone_watching'), 66 | ), 67 | ]), 68 | ), 69 | ); 70 | } 71 | } 72 | 73 | class ComingSoonPage extends StatelessWidget { 74 | const ComingSoonPage({Key? key}) : super(key: key); 75 | 76 | @override 77 | Widget build(BuildContext context) { 78 | WidgetsBinding.instance!.addPostFrameCallback((_) { 79 | BlocProvider.of(context).add(const ComingSoonLoadData()); 80 | }); 81 | return RefreshIndicator( 82 | color: Colors.black, 83 | onRefresh: () async { 84 | BlocProvider.of(context).add(const ComingSoonLoadData()); 85 | }, 86 | child: 87 | BlocBuilder(builder: (context, state) { 88 | if (state.isLoading) { 89 | return const Center( 90 | child: CircularProgressIndicator( 91 | strokeWidth: 2, 92 | ), 93 | ); 94 | } else if (state.hasError) { 95 | return const Center( 96 | child: Text('Error while Loading coming soon list')); 97 | } else if (state.comingSoonList.isEmpty) { 98 | return const Center(child: Text('Coming soon List is empty')); 99 | } else { 100 | return ListView.builder( 101 | itemCount: state.comingSoonList.length, 102 | itemBuilder: (BuildContext context, int index) { 103 | final movie = state.comingSoonList[index]; 104 | if (movie.id == null) { 105 | return const SizedBox(); 106 | } 107 | String month = ''; 108 | try { 109 | final _date = DateTime.tryParse(movie.releaseDate.toString()); 110 | final formattedDate = DateFormat.yMMMMd('en_US').format(_date!); 111 | month = formattedDate.split(' ').first.substring(0, 3); 112 | } catch (_) { 113 | month = ''; 114 | } 115 | 116 | return Padding( 117 | padding: const EdgeInsets.only(top: 10), 118 | child: ComingSoonContent( 119 | id: movie.id.toString(), 120 | month: month, 121 | day: movie.releaseDate!.split('-')[1], 122 | posterPath: '$imgBaseUrl${movie.posterPath}', 123 | movieName: movie.originalTitle ?? 'No Title', 124 | description: movie.overview ?? 'No Description', 125 | ), 126 | ); 127 | }, 128 | ); 129 | } 130 | }), 131 | ); 132 | } 133 | } 134 | 135 | class EveryoneWatchingPage extends StatelessWidget { 136 | const EveryoneWatchingPage({Key? key}) : super(key: key); 137 | 138 | @override 139 | Widget build(BuildContext context) { 140 | WidgetsBinding.instance!.addPostFrameCallback((_) { 141 | BlocProvider.of(context) 142 | .add(const EveryoneWatchingLoadData()); 143 | }); 144 | return RefreshIndicator( 145 | color: Colors.black, 146 | onRefresh: () async { 147 | BlocProvider.of(context) 148 | .add(const EveryoneWatchingLoadData()); 149 | }, 150 | child: 151 | BlocBuilder(builder: (context, state) { 152 | if (state.isLoading) { 153 | return const Center( 154 | child: CircularProgressIndicator( 155 | strokeWidth: 2, 156 | ), 157 | ); 158 | } else if (state.hasError) { 159 | return const Center( 160 | child: Text('Error while Loading coming soon list')); 161 | } else if (state.everyoneWatchingList.isEmpty) { 162 | return const Center(child: Text('List is empty')); 163 | } else { 164 | return ListView.builder( 165 | itemCount: state.everyoneWatchingList.length, 166 | itemBuilder: (BuildContext context, int index) { 167 | final movie = state.everyoneWatchingList[index]; 168 | if (movie.id == null) { 169 | return const SizedBox(); 170 | } 171 | 172 | return Padding( 173 | padding: const EdgeInsets.only(top: 10, left: 10, right: 10), 174 | child: EveryonesWatchingContent( 175 | posterPath: '$imgBaseUrl${movie.posterPath}', 176 | movieName: movie.originalName ?? 'No Title', 177 | description: movie.overview ?? 'No Description', 178 | ), 179 | ); 180 | }, 181 | ); 182 | } 183 | }), 184 | ); 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /lib/presentation/fast_laugh/widgets/video_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:netflix_app/Application/fast_laugh/fast_laugh_bloc.dart'; 4 | import 'package:netflix_app/core/colors.dart'; 5 | import 'package:netflix_app/core/url.dart'; 6 | import 'package:netflix_app/domain/downloads/model/downloads.dart'; 7 | import 'package:netflix_app/presentation/fast_laugh/widgets/reel_buttons.dart'; 8 | import 'package:share_plus/share_plus.dart'; 9 | import 'package:video_player/video_player.dart'; 10 | 11 | class VideoListItemInheritedWidget extends InheritedWidget { 12 | final Widget widget; 13 | final Downloads movieData; 14 | 15 | VideoListItemInheritedWidget({ 16 | Key? key, 17 | required this.widget, 18 | required this.movieData, 19 | }) : super(key: key, child: widget); 20 | 21 | @override 22 | bool updateShouldNotify(covariant VideoListItemInheritedWidget oldWidget) { 23 | return oldWidget.movieData != movieData; 24 | } 25 | 26 | static VideoListItemInheritedWidget? of(BuildContext context) { 27 | return context 28 | .dependOnInheritedWidgetOfExactType(); 29 | } 30 | } 31 | 32 | class VideoListItems extends StatelessWidget { 33 | final int index; 34 | const VideoListItems({Key? key, required this.index}) : super(key: key); 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | final posterImg = 39 | VideoListItemInheritedWidget.of(context)?.movieData.posterPath; 40 | final videoLink = videoUrls[index % videoUrls.length]; 41 | return Stack( 42 | children: [ 43 | // BackGround Main Content 44 | FastLaughVideoPlayer( 45 | videoUrl: videoLink, 46 | onStateChanged: (bool) {}, 47 | ), 48 | Padding( 49 | padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), 50 | child: Row( 51 | crossAxisAlignment: CrossAxisAlignment.end, 52 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 53 | children: [ 54 | // Left Side Mute 55 | CircleAvatar( 56 | radius: 27, 57 | backgroundColor: bgcolor.withOpacity(0.3), 58 | child: const Icon( 59 | Icons.volume_off, 60 | color: whiteclr, 61 | size: 30, 62 | ), 63 | ), 64 | // Right Side 65 | Column( 66 | mainAxisAlignment: MainAxisAlignment.end, 67 | children: [ 68 | Padding( 69 | padding: const EdgeInsets.symmetric(vertical: 10), 70 | child: CircleAvatar( 71 | radius: 25, 72 | backgroundImage: posterImg == null 73 | ? null 74 | : NetworkImage( 75 | '$imgBaseUrl$posterImg', 76 | ), 77 | )), 78 | ValueListenableBuilder( 79 | valueListenable: likedVideoNotifier, 80 | builder: (BuildContext context, Set newLikedList, 81 | Widget? child) { 82 | final _index = index; 83 | if (newLikedList.contains(_index)) { 84 | return InkWell( 85 | onTap: () { 86 | BlocProvider.of(context) 87 | .add(UnLikeVideo(id: _index)); 88 | // likedVideoNotifier.value.remove(_index); 89 | // likedVideoNotifier.notifyListeners(); 90 | }, 91 | child: const ReelActionButtons( 92 | icon: Icons.favorite_outline, title: 'Liked'), 93 | ); 94 | } 95 | return InkWell( 96 | onTap: () { 97 | BlocProvider.of(context) 98 | .add(LikeVideo(id: _index)); 99 | // likedVideoNotifier.value.add(_index); 100 | // likedVideoNotifier.notifyListeners(); 101 | }, 102 | child: const ReelActionButtons( 103 | icon: Icons.emoji_emotions, title: 'LOL'), 104 | ); 105 | }), 106 | const ReelActionButtons(icon: Icons.add, title: 'My List'), 107 | InkWell( 108 | onTap: () { 109 | final movieDat = 110 | VideoListItemInheritedWidget.of(context)?.movieData; 111 | final movieName = movieDat!.title ?? movieDat.title2; 112 | Share.share(movieName.toString()); 113 | }, 114 | child: const ReelActionButtons( 115 | icon: Icons.share, title: 'Share'), 116 | ), 117 | const ReelActionButtons( 118 | icon: Icons.play_arrow, title: 'Play'), 119 | ], 120 | ) 121 | ], 122 | ), 123 | ) 124 | ], 125 | ); 126 | } 127 | } 128 | 129 | class FastLaughVideoPlayer extends StatefulWidget { 130 | final String videoUrl; 131 | final void Function(bool isPlaying) onStateChanged; 132 | 133 | const FastLaughVideoPlayer( 134 | {Key? key, required this.videoUrl, required this.onStateChanged}) 135 | : super(key: key); 136 | 137 | @override 138 | State createState() => _FastLaughVideoPlayerState(); 139 | } 140 | 141 | class _FastLaughVideoPlayerState extends State { 142 | late VideoPlayerController _videoPlayerController; 143 | 144 | @override 145 | void initState() { 146 | _videoPlayerController = VideoPlayerController.network(widget.videoUrl); 147 | _videoPlayerController.initialize().then((value) { 148 | setState(() { 149 | _videoPlayerController.play(); 150 | }); 151 | }); 152 | super.initState(); 153 | } 154 | 155 | @override 156 | Widget build(BuildContext context) { 157 | return SizedBox( 158 | width: double.infinity, 159 | height: double.infinity, 160 | child: _videoPlayerController.value.isInitialized 161 | ? AspectRatio( 162 | aspectRatio: _videoPlayerController.value.aspectRatio, 163 | child: VideoPlayer(_videoPlayerController), 164 | ) 165 | : const Center( 166 | child: CircularProgressIndicator( 167 | strokeWidth: 2, 168 | ), 169 | ), 170 | ); 171 | } 172 | 173 | @override 174 | void dispose() { 175 | _videoPlayerController.dispose(); 176 | super.dispose(); 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /lib/presentation/downloads/screen_downloads.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_bloc/flutter_bloc.dart'; 5 | import 'package:netflix_app/Application/downloads/downloads_bloc.dart'; 6 | import 'package:netflix_app/Presentation/Widgets/app_bar_widget.dart'; 7 | import 'package:netflix_app/core/colors.dart'; 8 | import 'package:netflix_app/core/constants.dart'; 9 | import 'package:netflix_app/core/url.dart'; 10 | 11 | class ScreenDownloads extends StatelessWidget { 12 | ScreenDownloads({Key? key}) : super(key: key); 13 | 14 | final _widgetsList = [ 15 | const _SmartDownload(), 16 | const Section2(), 17 | const Section3(), 18 | ]; 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return Scaffold( 23 | appBar: const PreferredSize( 24 | preferredSize: Size.fromHeight(50), 25 | child: AppBarWidget( 26 | title: 'Downloads', 27 | )), 28 | body: ListView.separated( 29 | physics: const BouncingScrollPhysics(), 30 | padding: const EdgeInsets.all(10), 31 | itemBuilder: (context, index) { 32 | return _widgetsList[index]; 33 | }, 34 | separatorBuilder: (context, index) { 35 | return const SizedBox(height: 30); 36 | }, 37 | itemCount: _widgetsList.length), 38 | ); 39 | } 40 | } 41 | 42 | class _SmartDownload extends StatelessWidget { 43 | const _SmartDownload({ 44 | Key? key, 45 | }) : super(key: key); 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return Row( 50 | children: const [ 51 | Icon( 52 | Icons.settings, 53 | color: whiteclr, 54 | ), 55 | Text('Smart Downloads') 56 | ], 57 | ); 58 | } 59 | } 60 | 61 | class Section2 extends StatelessWidget { 62 | const Section2({Key? key}) : super(key: key); 63 | @override 64 | Widget build(BuildContext context) { 65 | final Size size = MediaQuery.of(context).size; 66 | WidgetsBinding.instance!.addPostFrameCallback((_) { 67 | BlocProvider.of(context) 68 | .add(const DownloadsEvent.getDownloadsImages()); 69 | }); 70 | return Column( 71 | children: [ 72 | const Text( 73 | 'Introducing Downloads For You', 74 | textAlign: TextAlign.center, 75 | style: TextStyle( 76 | fontSize: 23, 77 | fontWeight: FontWeight.bold, 78 | ), 79 | ), 80 | SbHeight20, 81 | Text( 82 | "We'll Download a personalized selection of \nmovies and shows for you, so there's \nalways something to watch on your \ndevice.", 83 | style: TextStyle( 84 | color: Colors.grey[400], 85 | fontSize: 16, 86 | ), 87 | textAlign: TextAlign.center, 88 | ), 89 | BlocBuilder(builder: (context, state) { 90 | return SizedBox( 91 | width: size.width, 92 | height: size.width, 93 | child: state.isLoading 94 | ? const Center(child: CircularProgressIndicator()) 95 | : state.downloads.isEmpty 96 | ? const Center(child: CircularProgressIndicator()) 97 | : Stack( 98 | alignment: Alignment.center, 99 | children: [ 100 | CircleAvatar( 101 | radius: size.width * 0.33, 102 | backgroundColor: Colors.grey.withOpacity(0.3), 103 | ), 104 | DownloadsImageWidget( 105 | images: 106 | '$imgBaseUrl${state.downloads[0].posterPath}', 107 | imgMargin: 108 | const EdgeInsets.only(left: 160, bottom: 20), 109 | angle: 20, 110 | size: Size(size.width * 0.32, size.width * 0.50), 111 | ), 112 | DownloadsImageWidget( 113 | images: 114 | '$imgBaseUrl${state.downloads[1].posterPath}', 115 | imgMargin: 116 | const EdgeInsets.only(right: 160, bottom: 20), 117 | angle: -20, 118 | size: Size(size.width * 0.32, size.width * 0.50), 119 | ), 120 | DownloadsImageWidget( 121 | images: 122 | '$imgBaseUrl${state.downloads[2].posterPath}', 123 | imgMargin: const EdgeInsets.only(left: 0), 124 | size: Size(size.width * 0.35, size.width * 0.55), 125 | ), 126 | ], 127 | ), 128 | ); 129 | }), 130 | ], 131 | ); 132 | } 133 | } 134 | 135 | class Section3 extends StatelessWidget { 136 | const Section3({Key? key}) : super(key: key); 137 | 138 | @override 139 | Widget build(BuildContext context) { 140 | return Column( 141 | children: [ 142 | SizedBox( 143 | width: double.infinity, 144 | child: MaterialButton( 145 | color: Colors.blueAccent[700], 146 | onPressed: () {}, 147 | shape: RoundedRectangleBorder( 148 | borderRadius: BorderRadius.circular(5)), 149 | child: const Padding( 150 | padding: EdgeInsets.symmetric(vertical: 12), 151 | child: Text( 152 | 'Set Up', 153 | style: TextStyle( 154 | color: whiteclr, 155 | fontSize: 18, 156 | fontWeight: FontWeight.bold, 157 | ), 158 | ), 159 | )), 160 | ), 161 | SbHeight10, 162 | MaterialButton( 163 | color: whiteclr, 164 | onPressed: () {}, 165 | shape: 166 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), 167 | child: const Padding( 168 | padding: EdgeInsets.symmetric(vertical: 10), 169 | child: Text( 170 | 'See what you can download', 171 | style: TextStyle( 172 | color: bgcolor, 173 | fontSize: 18, 174 | fontWeight: FontWeight.bold, 175 | ), 176 | ), 177 | )), 178 | ], 179 | ); 180 | } 181 | } 182 | 183 | class DownloadsImageWidget extends StatelessWidget { 184 | const DownloadsImageWidget({ 185 | Key? key, 186 | required this.images, 187 | required this.imgMargin, 188 | required this.size, 189 | this.angle = 0, 190 | }) : super(key: key); 191 | 192 | final double angle; 193 | final String images; 194 | final EdgeInsets imgMargin; 195 | final Size size; 196 | 197 | @override 198 | Widget build(BuildContext context) { 199 | return Transform.rotate( 200 | angle: angle * pi / 180, 201 | child: Container( 202 | margin: imgMargin, 203 | width: size.width, 204 | height: size.height, 205 | decoration: BoxDecoration( 206 | borderRadius: BorderRadius.circular(12), 207 | image: DecorationImage( 208 | fit: BoxFit.cover, 209 | image: NetworkImage(images), 210 | )), 211 | ), 212 | ); 213 | } 214 | } 215 | -------------------------------------------------------------------------------- /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/domain/downloads/model/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: "original_title") 26 | String? get title => throw _privateConstructorUsedError; 27 | @JsonKey(name: "name") 28 | String? get title2 => throw _privateConstructorUsedError; 29 | @JsonKey(name: "backdrop_path") 30 | String? get backImg => throw _privateConstructorUsedError; 31 | 32 | Map toJson() => throw _privateConstructorUsedError; 33 | @JsonKey(ignore: true) 34 | $DownloadsCopyWith get copyWith => 35 | throw _privateConstructorUsedError; 36 | } 37 | 38 | /// @nodoc 39 | abstract class $DownloadsCopyWith<$Res> { 40 | factory $DownloadsCopyWith(Downloads value, $Res Function(Downloads) then) = 41 | _$DownloadsCopyWithImpl<$Res>; 42 | $Res call( 43 | {@JsonKey(name: "poster_path") String? posterPath, 44 | @JsonKey(name: "original_title") String? title, 45 | @JsonKey(name: "name") String? title2, 46 | @JsonKey(name: "backdrop_path") String? backImg}); 47 | } 48 | 49 | /// @nodoc 50 | class _$DownloadsCopyWithImpl<$Res> implements $DownloadsCopyWith<$Res> { 51 | _$DownloadsCopyWithImpl(this._value, this._then); 52 | 53 | final Downloads _value; 54 | // ignore: unused_field 55 | final $Res Function(Downloads) _then; 56 | 57 | @override 58 | $Res call({ 59 | Object? posterPath = freezed, 60 | Object? title = freezed, 61 | Object? title2 = freezed, 62 | Object? backImg = freezed, 63 | }) { 64 | return _then(_value.copyWith( 65 | posterPath: posterPath == freezed 66 | ? _value.posterPath 67 | : posterPath // ignore: cast_nullable_to_non_nullable 68 | as String?, 69 | title: title == freezed 70 | ? _value.title 71 | : title // ignore: cast_nullable_to_non_nullable 72 | as String?, 73 | title2: title2 == freezed 74 | ? _value.title2 75 | : title2 // ignore: cast_nullable_to_non_nullable 76 | as String?, 77 | backImg: backImg == freezed 78 | ? _value.backImg 79 | : backImg // ignore: cast_nullable_to_non_nullable 80 | as String?, 81 | )); 82 | } 83 | } 84 | 85 | /// @nodoc 86 | abstract class _$$_DownloadsCopyWith<$Res> implements $DownloadsCopyWith<$Res> { 87 | factory _$$_DownloadsCopyWith( 88 | _$_Downloads value, $Res Function(_$_Downloads) then) = 89 | __$$_DownloadsCopyWithImpl<$Res>; 90 | @override 91 | $Res call( 92 | {@JsonKey(name: "poster_path") String? posterPath, 93 | @JsonKey(name: "original_title") String? title, 94 | @JsonKey(name: "name") String? title2, 95 | @JsonKey(name: "backdrop_path") String? backImg}); 96 | } 97 | 98 | /// @nodoc 99 | class __$$_DownloadsCopyWithImpl<$Res> extends _$DownloadsCopyWithImpl<$Res> 100 | implements _$$_DownloadsCopyWith<$Res> { 101 | __$$_DownloadsCopyWithImpl( 102 | _$_Downloads _value, $Res Function(_$_Downloads) _then) 103 | : super(_value, (v) => _then(v as _$_Downloads)); 104 | 105 | @override 106 | _$_Downloads get _value => super._value as _$_Downloads; 107 | 108 | @override 109 | $Res call({ 110 | Object? posterPath = freezed, 111 | Object? title = freezed, 112 | Object? title2 = freezed, 113 | Object? backImg = freezed, 114 | }) { 115 | return _then(_$_Downloads( 116 | posterPath: posterPath == freezed 117 | ? _value.posterPath 118 | : posterPath // ignore: cast_nullable_to_non_nullable 119 | as String?, 120 | title: title == freezed 121 | ? _value.title 122 | : title // ignore: cast_nullable_to_non_nullable 123 | as String?, 124 | title2: title2 == freezed 125 | ? _value.title2 126 | : title2 // ignore: cast_nullable_to_non_nullable 127 | as String?, 128 | backImg: backImg == freezed 129 | ? _value.backImg 130 | : backImg // ignore: cast_nullable_to_non_nullable 131 | as String?, 132 | )); 133 | } 134 | } 135 | 136 | /// @nodoc 137 | @JsonSerializable() 138 | class _$_Downloads implements _Downloads { 139 | const _$_Downloads( 140 | {@JsonKey(name: "poster_path") required this.posterPath, 141 | @JsonKey(name: "original_title") required this.title, 142 | @JsonKey(name: "name") required this.title2, 143 | @JsonKey(name: "backdrop_path") required this.backImg}); 144 | 145 | factory _$_Downloads.fromJson(Map json) => 146 | _$$_DownloadsFromJson(json); 147 | 148 | @override 149 | @JsonKey(name: "poster_path") 150 | final String? posterPath; 151 | @override 152 | @JsonKey(name: "original_title") 153 | final String? title; 154 | @override 155 | @JsonKey(name: "name") 156 | final String? title2; 157 | @override 158 | @JsonKey(name: "backdrop_path") 159 | final String? backImg; 160 | 161 | @override 162 | String toString() { 163 | return 'Downloads(posterPath: $posterPath, title: $title, title2: $title2, backImg: $backImg)'; 164 | } 165 | 166 | @override 167 | bool operator ==(dynamic other) { 168 | return identical(this, other) || 169 | (other.runtimeType == runtimeType && 170 | other is _$_Downloads && 171 | const DeepCollectionEquality() 172 | .equals(other.posterPath, posterPath) && 173 | const DeepCollectionEquality().equals(other.title, title) && 174 | const DeepCollectionEquality().equals(other.title2, title2) && 175 | const DeepCollectionEquality().equals(other.backImg, backImg)); 176 | } 177 | 178 | @JsonKey(ignore: true) 179 | @override 180 | int get hashCode => Object.hash( 181 | runtimeType, 182 | const DeepCollectionEquality().hash(posterPath), 183 | const DeepCollectionEquality().hash(title), 184 | const DeepCollectionEquality().hash(title2), 185 | const DeepCollectionEquality().hash(backImg)); 186 | 187 | @JsonKey(ignore: true) 188 | @override 189 | _$$_DownloadsCopyWith<_$_Downloads> get copyWith => 190 | __$$_DownloadsCopyWithImpl<_$_Downloads>(this, _$identity); 191 | 192 | @override 193 | Map toJson() { 194 | return _$$_DownloadsToJson(this); 195 | } 196 | } 197 | 198 | abstract class _Downloads implements Downloads { 199 | const factory _Downloads( 200 | {@JsonKey(name: "poster_path") required final String? posterPath, 201 | @JsonKey(name: "original_title") required final String? title, 202 | @JsonKey(name: "name") required final String? title2, 203 | @JsonKey(name: "backdrop_path") required final String? backImg}) = 204 | _$_Downloads; 205 | 206 | factory _Downloads.fromJson(Map json) = 207 | _$_Downloads.fromJson; 208 | 209 | @override 210 | @JsonKey(name: "poster_path") 211 | String? get posterPath => throw _privateConstructorUsedError; 212 | @override 213 | @JsonKey(name: "original_title") 214 | String? get title => throw _privateConstructorUsedError; 215 | @override 216 | @JsonKey(name: "name") 217 | String? get title2 => throw _privateConstructorUsedError; 218 | @override 219 | @JsonKey(name: "backdrop_path") 220 | String? get backImg => throw _privateConstructorUsedError; 221 | @override 222 | @JsonKey(ignore: true) 223 | _$$_DownloadsCopyWith<_$_Downloads> get copyWith => 224 | throw _privateConstructorUsedError; 225 | } 226 | -------------------------------------------------------------------------------- /lib/domain/core/failures/main_failure.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 'main_failure.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 | /// @nodoc 18 | mixin _$MainFailure { 19 | @optionalTypeArgs 20 | TResult when({ 21 | required TResult Function() clientFailure, 22 | required TResult Function() serverFailure, 23 | }) => 24 | throw _privateConstructorUsedError; 25 | @optionalTypeArgs 26 | TResult? whenOrNull({ 27 | TResult Function()? clientFailure, 28 | TResult Function()? serverFailure, 29 | }) => 30 | throw _privateConstructorUsedError; 31 | @optionalTypeArgs 32 | TResult maybeWhen({ 33 | TResult Function()? clientFailure, 34 | TResult Function()? serverFailure, 35 | required TResult orElse(), 36 | }) => 37 | throw _privateConstructorUsedError; 38 | @optionalTypeArgs 39 | TResult map({ 40 | required TResult Function(_ClientFailure value) clientFailure, 41 | required TResult Function(_ServerFailure value) serverFailure, 42 | }) => 43 | throw _privateConstructorUsedError; 44 | @optionalTypeArgs 45 | TResult? mapOrNull({ 46 | TResult Function(_ClientFailure value)? clientFailure, 47 | TResult Function(_ServerFailure value)? serverFailure, 48 | }) => 49 | throw _privateConstructorUsedError; 50 | @optionalTypeArgs 51 | TResult maybeMap({ 52 | TResult Function(_ClientFailure value)? clientFailure, 53 | TResult Function(_ServerFailure value)? serverFailure, 54 | required TResult orElse(), 55 | }) => 56 | throw _privateConstructorUsedError; 57 | } 58 | 59 | /// @nodoc 60 | abstract class $MainFailureCopyWith<$Res> { 61 | factory $MainFailureCopyWith( 62 | MainFailure value, $Res Function(MainFailure) then) = 63 | _$MainFailureCopyWithImpl<$Res>; 64 | } 65 | 66 | /// @nodoc 67 | class _$MainFailureCopyWithImpl<$Res> implements $MainFailureCopyWith<$Res> { 68 | _$MainFailureCopyWithImpl(this._value, this._then); 69 | 70 | final MainFailure _value; 71 | // ignore: unused_field 72 | final $Res Function(MainFailure) _then; 73 | } 74 | 75 | /// @nodoc 76 | abstract class _$$_ClientFailureCopyWith<$Res> { 77 | factory _$$_ClientFailureCopyWith( 78 | _$_ClientFailure value, $Res Function(_$_ClientFailure) then) = 79 | __$$_ClientFailureCopyWithImpl<$Res>; 80 | } 81 | 82 | /// @nodoc 83 | class __$$_ClientFailureCopyWithImpl<$Res> 84 | extends _$MainFailureCopyWithImpl<$Res> 85 | implements _$$_ClientFailureCopyWith<$Res> { 86 | __$$_ClientFailureCopyWithImpl( 87 | _$_ClientFailure _value, $Res Function(_$_ClientFailure) _then) 88 | : super(_value, (v) => _then(v as _$_ClientFailure)); 89 | 90 | @override 91 | _$_ClientFailure get _value => super._value as _$_ClientFailure; 92 | } 93 | 94 | /// @nodoc 95 | 96 | class _$_ClientFailure implements _ClientFailure { 97 | const _$_ClientFailure(); 98 | 99 | @override 100 | String toString() { 101 | return 'MainFailure.clientFailure()'; 102 | } 103 | 104 | @override 105 | bool operator ==(dynamic other) { 106 | return identical(this, other) || 107 | (other.runtimeType == runtimeType && other is _$_ClientFailure); 108 | } 109 | 110 | @override 111 | int get hashCode => runtimeType.hashCode; 112 | 113 | @override 114 | @optionalTypeArgs 115 | TResult when({ 116 | required TResult Function() clientFailure, 117 | required TResult Function() serverFailure, 118 | }) { 119 | return clientFailure(); 120 | } 121 | 122 | @override 123 | @optionalTypeArgs 124 | TResult? whenOrNull({ 125 | TResult Function()? clientFailure, 126 | TResult Function()? serverFailure, 127 | }) { 128 | return clientFailure?.call(); 129 | } 130 | 131 | @override 132 | @optionalTypeArgs 133 | TResult maybeWhen({ 134 | TResult Function()? clientFailure, 135 | TResult Function()? serverFailure, 136 | required TResult orElse(), 137 | }) { 138 | if (clientFailure != null) { 139 | return clientFailure(); 140 | } 141 | return orElse(); 142 | } 143 | 144 | @override 145 | @optionalTypeArgs 146 | TResult map({ 147 | required TResult Function(_ClientFailure value) clientFailure, 148 | required TResult Function(_ServerFailure value) serverFailure, 149 | }) { 150 | return clientFailure(this); 151 | } 152 | 153 | @override 154 | @optionalTypeArgs 155 | TResult? mapOrNull({ 156 | TResult Function(_ClientFailure value)? clientFailure, 157 | TResult Function(_ServerFailure value)? serverFailure, 158 | }) { 159 | return clientFailure?.call(this); 160 | } 161 | 162 | @override 163 | @optionalTypeArgs 164 | TResult maybeMap({ 165 | TResult Function(_ClientFailure value)? clientFailure, 166 | TResult Function(_ServerFailure value)? serverFailure, 167 | required TResult orElse(), 168 | }) { 169 | if (clientFailure != null) { 170 | return clientFailure(this); 171 | } 172 | return orElse(); 173 | } 174 | } 175 | 176 | abstract class _ClientFailure implements MainFailure { 177 | const factory _ClientFailure() = _$_ClientFailure; 178 | } 179 | 180 | /// @nodoc 181 | abstract class _$$_ServerFailureCopyWith<$Res> { 182 | factory _$$_ServerFailureCopyWith( 183 | _$_ServerFailure value, $Res Function(_$_ServerFailure) then) = 184 | __$$_ServerFailureCopyWithImpl<$Res>; 185 | } 186 | 187 | /// @nodoc 188 | class __$$_ServerFailureCopyWithImpl<$Res> 189 | extends _$MainFailureCopyWithImpl<$Res> 190 | implements _$$_ServerFailureCopyWith<$Res> { 191 | __$$_ServerFailureCopyWithImpl( 192 | _$_ServerFailure _value, $Res Function(_$_ServerFailure) _then) 193 | : super(_value, (v) => _then(v as _$_ServerFailure)); 194 | 195 | @override 196 | _$_ServerFailure get _value => super._value as _$_ServerFailure; 197 | } 198 | 199 | /// @nodoc 200 | 201 | class _$_ServerFailure implements _ServerFailure { 202 | const _$_ServerFailure(); 203 | 204 | @override 205 | String toString() { 206 | return 'MainFailure.serverFailure()'; 207 | } 208 | 209 | @override 210 | bool operator ==(dynamic other) { 211 | return identical(this, other) || 212 | (other.runtimeType == runtimeType && other is _$_ServerFailure); 213 | } 214 | 215 | @override 216 | int get hashCode => runtimeType.hashCode; 217 | 218 | @override 219 | @optionalTypeArgs 220 | TResult when({ 221 | required TResult Function() clientFailure, 222 | required TResult Function() serverFailure, 223 | }) { 224 | return serverFailure(); 225 | } 226 | 227 | @override 228 | @optionalTypeArgs 229 | TResult? whenOrNull({ 230 | TResult Function()? clientFailure, 231 | TResult Function()? serverFailure, 232 | }) { 233 | return serverFailure?.call(); 234 | } 235 | 236 | @override 237 | @optionalTypeArgs 238 | TResult maybeWhen({ 239 | TResult Function()? clientFailure, 240 | TResult Function()? serverFailure, 241 | required TResult orElse(), 242 | }) { 243 | if (serverFailure != null) { 244 | return serverFailure(); 245 | } 246 | return orElse(); 247 | } 248 | 249 | @override 250 | @optionalTypeArgs 251 | TResult map({ 252 | required TResult Function(_ClientFailure value) clientFailure, 253 | required TResult Function(_ServerFailure value) serverFailure, 254 | }) { 255 | return serverFailure(this); 256 | } 257 | 258 | @override 259 | @optionalTypeArgs 260 | TResult? mapOrNull({ 261 | TResult Function(_ClientFailure value)? clientFailure, 262 | TResult Function(_ServerFailure value)? serverFailure, 263 | }) { 264 | return serverFailure?.call(this); 265 | } 266 | 267 | @override 268 | @optionalTypeArgs 269 | TResult maybeMap({ 270 | TResult Function(_ClientFailure value)? clientFailure, 271 | TResult Function(_ServerFailure value)? serverFailure, 272 | required TResult orElse(), 273 | }) { 274 | if (serverFailure != null) { 275 | return serverFailure(this); 276 | } 277 | return orElse(); 278 | } 279 | } 280 | 281 | abstract class _ServerFailure implements MainFailure { 282 | const factory _ServerFailure() = _$_ServerFailure; 283 | } 284 | -------------------------------------------------------------------------------- /lib/Application/downloads/downloads_bloc.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_bloc.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 | /// @nodoc 18 | mixin _$DownloadsEvent { 19 | @optionalTypeArgs 20 | TResult when({ 21 | required TResult Function() getDownloadsImages, 22 | }) => 23 | throw _privateConstructorUsedError; 24 | @optionalTypeArgs 25 | TResult? whenOrNull({ 26 | TResult Function()? getDownloadsImages, 27 | }) => 28 | throw _privateConstructorUsedError; 29 | @optionalTypeArgs 30 | TResult maybeWhen({ 31 | TResult Function()? getDownloadsImages, 32 | required TResult orElse(), 33 | }) => 34 | throw _privateConstructorUsedError; 35 | @optionalTypeArgs 36 | TResult map({ 37 | required TResult Function(_GetDownloadsImages value) getDownloadsImages, 38 | }) => 39 | throw _privateConstructorUsedError; 40 | @optionalTypeArgs 41 | TResult? mapOrNull({ 42 | TResult Function(_GetDownloadsImages value)? getDownloadsImages, 43 | }) => 44 | throw _privateConstructorUsedError; 45 | @optionalTypeArgs 46 | TResult maybeMap({ 47 | TResult Function(_GetDownloadsImages value)? getDownloadsImages, 48 | required TResult orElse(), 49 | }) => 50 | throw _privateConstructorUsedError; 51 | } 52 | 53 | /// @nodoc 54 | abstract class $DownloadsEventCopyWith<$Res> { 55 | factory $DownloadsEventCopyWith( 56 | DownloadsEvent value, $Res Function(DownloadsEvent) then) = 57 | _$DownloadsEventCopyWithImpl<$Res>; 58 | } 59 | 60 | /// @nodoc 61 | class _$DownloadsEventCopyWithImpl<$Res> 62 | implements $DownloadsEventCopyWith<$Res> { 63 | _$DownloadsEventCopyWithImpl(this._value, this._then); 64 | 65 | final DownloadsEvent _value; 66 | // ignore: unused_field 67 | final $Res Function(DownloadsEvent) _then; 68 | } 69 | 70 | /// @nodoc 71 | abstract class _$$_GetDownloadsImagesCopyWith<$Res> { 72 | factory _$$_GetDownloadsImagesCopyWith(_$_GetDownloadsImages value, 73 | $Res Function(_$_GetDownloadsImages) then) = 74 | __$$_GetDownloadsImagesCopyWithImpl<$Res>; 75 | } 76 | 77 | /// @nodoc 78 | class __$$_GetDownloadsImagesCopyWithImpl<$Res> 79 | extends _$DownloadsEventCopyWithImpl<$Res> 80 | implements _$$_GetDownloadsImagesCopyWith<$Res> { 81 | __$$_GetDownloadsImagesCopyWithImpl( 82 | _$_GetDownloadsImages _value, $Res Function(_$_GetDownloadsImages) _then) 83 | : super(_value, (v) => _then(v as _$_GetDownloadsImages)); 84 | 85 | @override 86 | _$_GetDownloadsImages get _value => super._value as _$_GetDownloadsImages; 87 | } 88 | 89 | /// @nodoc 90 | 91 | class _$_GetDownloadsImages implements _GetDownloadsImages { 92 | const _$_GetDownloadsImages(); 93 | 94 | @override 95 | String toString() { 96 | return 'DownloadsEvent.getDownloadsImages()'; 97 | } 98 | 99 | @override 100 | bool operator ==(dynamic other) { 101 | return identical(this, other) || 102 | (other.runtimeType == runtimeType && other is _$_GetDownloadsImages); 103 | } 104 | 105 | @override 106 | int get hashCode => runtimeType.hashCode; 107 | 108 | @override 109 | @optionalTypeArgs 110 | TResult when({ 111 | required TResult Function() getDownloadsImages, 112 | }) { 113 | return getDownloadsImages(); 114 | } 115 | 116 | @override 117 | @optionalTypeArgs 118 | TResult? whenOrNull({ 119 | TResult Function()? getDownloadsImages, 120 | }) { 121 | return getDownloadsImages?.call(); 122 | } 123 | 124 | @override 125 | @optionalTypeArgs 126 | TResult maybeWhen({ 127 | TResult Function()? getDownloadsImages, 128 | required TResult orElse(), 129 | }) { 130 | if (getDownloadsImages != null) { 131 | return getDownloadsImages(); 132 | } 133 | return orElse(); 134 | } 135 | 136 | @override 137 | @optionalTypeArgs 138 | TResult map({ 139 | required TResult Function(_GetDownloadsImages value) getDownloadsImages, 140 | }) { 141 | return getDownloadsImages(this); 142 | } 143 | 144 | @override 145 | @optionalTypeArgs 146 | TResult? mapOrNull({ 147 | TResult Function(_GetDownloadsImages value)? getDownloadsImages, 148 | }) { 149 | return getDownloadsImages?.call(this); 150 | } 151 | 152 | @override 153 | @optionalTypeArgs 154 | TResult maybeMap({ 155 | TResult Function(_GetDownloadsImages value)? getDownloadsImages, 156 | required TResult orElse(), 157 | }) { 158 | if (getDownloadsImages != null) { 159 | return getDownloadsImages(this); 160 | } 161 | return orElse(); 162 | } 163 | } 164 | 165 | abstract class _GetDownloadsImages implements DownloadsEvent { 166 | const factory _GetDownloadsImages() = _$_GetDownloadsImages; 167 | } 168 | 169 | /// @nodoc 170 | mixin _$DownloadsState { 171 | bool get isLoading => throw _privateConstructorUsedError; 172 | Option>> get downloadsResponse => 173 | throw _privateConstructorUsedError; 174 | List get downloads => throw _privateConstructorUsedError; 175 | 176 | @JsonKey(ignore: true) 177 | $DownloadsStateCopyWith get copyWith => 178 | throw _privateConstructorUsedError; 179 | } 180 | 181 | /// @nodoc 182 | abstract class $DownloadsStateCopyWith<$Res> { 183 | factory $DownloadsStateCopyWith( 184 | DownloadsState value, $Res Function(DownloadsState) then) = 185 | _$DownloadsStateCopyWithImpl<$Res>; 186 | $Res call( 187 | {bool isLoading, 188 | Option>> downloadsResponse, 189 | List downloads}); 190 | } 191 | 192 | /// @nodoc 193 | class _$DownloadsStateCopyWithImpl<$Res> 194 | implements $DownloadsStateCopyWith<$Res> { 195 | _$DownloadsStateCopyWithImpl(this._value, this._then); 196 | 197 | final DownloadsState _value; 198 | // ignore: unused_field 199 | final $Res Function(DownloadsState) _then; 200 | 201 | @override 202 | $Res call({ 203 | Object? isLoading = freezed, 204 | Object? downloadsResponse = freezed, 205 | Object? downloads = freezed, 206 | }) { 207 | return _then(_value.copyWith( 208 | isLoading: isLoading == freezed 209 | ? _value.isLoading 210 | : isLoading // ignore: cast_nullable_to_non_nullable 211 | as bool, 212 | downloadsResponse: downloadsResponse == freezed 213 | ? _value.downloadsResponse 214 | : downloadsResponse // ignore: cast_nullable_to_non_nullable 215 | as Option>>, 216 | downloads: downloads == freezed 217 | ? _value.downloads 218 | : downloads // ignore: cast_nullable_to_non_nullable 219 | as List, 220 | )); 221 | } 222 | } 223 | 224 | /// @nodoc 225 | abstract class _$$_DownloadsStateCopyWith<$Res> 226 | implements $DownloadsStateCopyWith<$Res> { 227 | factory _$$_DownloadsStateCopyWith( 228 | _$_DownloadsState value, $Res Function(_$_DownloadsState) then) = 229 | __$$_DownloadsStateCopyWithImpl<$Res>; 230 | @override 231 | $Res call( 232 | {bool isLoading, 233 | Option>> downloadsResponse, 234 | List downloads}); 235 | } 236 | 237 | /// @nodoc 238 | class __$$_DownloadsStateCopyWithImpl<$Res> 239 | extends _$DownloadsStateCopyWithImpl<$Res> 240 | implements _$$_DownloadsStateCopyWith<$Res> { 241 | __$$_DownloadsStateCopyWithImpl( 242 | _$_DownloadsState _value, $Res Function(_$_DownloadsState) _then) 243 | : super(_value, (v) => _then(v as _$_DownloadsState)); 244 | 245 | @override 246 | _$_DownloadsState get _value => super._value as _$_DownloadsState; 247 | 248 | @override 249 | $Res call({ 250 | Object? isLoading = freezed, 251 | Object? downloadsResponse = freezed, 252 | Object? downloads = freezed, 253 | }) { 254 | return _then(_$_DownloadsState( 255 | isLoading: isLoading == freezed 256 | ? _value.isLoading 257 | : isLoading // ignore: cast_nullable_to_non_nullable 258 | as bool, 259 | downloadsResponse: downloadsResponse == freezed 260 | ? _value.downloadsResponse 261 | : downloadsResponse // ignore: cast_nullable_to_non_nullable 262 | as Option>>, 263 | downloads: downloads == freezed 264 | ? _value._downloads 265 | : downloads // ignore: cast_nullable_to_non_nullable 266 | as List, 267 | )); 268 | } 269 | } 270 | 271 | /// @nodoc 272 | 273 | class _$_DownloadsState implements _DownloadsState { 274 | const _$_DownloadsState( 275 | {required this.isLoading, 276 | required this.downloadsResponse, 277 | required final List downloads}) 278 | : _downloads = downloads; 279 | 280 | @override 281 | final bool isLoading; 282 | @override 283 | final Option>> downloadsResponse; 284 | final List _downloads; 285 | @override 286 | List get downloads { 287 | // ignore: implicit_dynamic_type 288 | return EqualUnmodifiableListView(_downloads); 289 | } 290 | 291 | @override 292 | String toString() { 293 | return 'DownloadsState(isLoading: $isLoading, downloadsResponse: $downloadsResponse, downloads: $downloads)'; 294 | } 295 | 296 | @override 297 | bool operator ==(dynamic other) { 298 | return identical(this, other) || 299 | (other.runtimeType == runtimeType && 300 | other is _$_DownloadsState && 301 | const DeepCollectionEquality().equals(other.isLoading, isLoading) && 302 | const DeepCollectionEquality() 303 | .equals(other.downloadsResponse, downloadsResponse) && 304 | const DeepCollectionEquality() 305 | .equals(other._downloads, _downloads)); 306 | } 307 | 308 | @override 309 | int get hashCode => Object.hash( 310 | runtimeType, 311 | const DeepCollectionEquality().hash(isLoading), 312 | const DeepCollectionEquality().hash(downloadsResponse), 313 | const DeepCollectionEquality().hash(_downloads)); 314 | 315 | @JsonKey(ignore: true) 316 | @override 317 | _$$_DownloadsStateCopyWith<_$_DownloadsState> get copyWith => 318 | __$$_DownloadsStateCopyWithImpl<_$_DownloadsState>(this, _$identity); 319 | } 320 | 321 | abstract class _DownloadsState implements DownloadsState { 322 | const factory _DownloadsState( 323 | {required final bool isLoading, 324 | required final Option>> 325 | downloadsResponse, 326 | required final List downloads}) = _$_DownloadsState; 327 | 328 | @override 329 | bool get isLoading => throw _privateConstructorUsedError; 330 | @override 331 | Option>> get downloadsResponse => 332 | throw _privateConstructorUsedError; 333 | @override 334 | List get downloads => throw _privateConstructorUsedError; 335 | @override 336 | @JsonKey(ignore: true) 337 | _$$_DownloadsStateCopyWith<_$_DownloadsState> get copyWith => 338 | throw _privateConstructorUsedError; 339 | } 340 | --------------------------------------------------------------------------------