├── .gitignore ├── .metadata ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── blocimplementation │ │ │ └── MainActivity.java │ │ └── res │ │ ├── drawable │ │ └── launch_background.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── images └── flags │ ├── argentina.png │ ├── brazil.png │ ├── england.png │ ├── france.png │ ├── germany.png │ ├── italy.png │ └── spain.png ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── lib ├── bloc │ ├── player_listing_bloc.dart │ ├── player_listing_events.dart │ └── player_listing_states.dart ├── main.dart ├── models │ ├── api_models.dart │ └── nation.dart ├── pages │ ├── HomePage.dart │ └── player_listing.dart ├── services │ ├── player_api_provider.dart │ └── repository.dart ├── themes │ └── themes.dart └── widgets │ ├── horizontal_bar.dart │ ├── message.dart │ └── search_bar.dart ├── pubspec.yaml ├── screenshots ├── no_players.png ├── searched_players.png ├── state_player_fetched.png ├── state_player_fetching.png └── state_uninitialized.png └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 2e2f19d3e9dd9bbc4e97e6b79bd573ab67c65109 8 | channel: master 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bloc_implementation 2 | 3 | A flutter project showcasing possibilities of bloc pattern 4 | 5 | ## Getting Started 6 | 7 | **foundation branch** - Showing multiple states for an event and how bloc provider and bloc builder are used to manage state of the app. This project uses flutter_bloc package. 8 | 9 | ## Video Series 10 | **Part 1** State Management - Foundation - https://youtu.be/S2KmxzgsTwk 11 | 12 | **Part 2** State Management - Debounce Search - https://youtu.be/EGNSH4aG_fU 13 | 14 | ## Screenshots 15 |
State Uninitialized
State Uninitialized
State Player Fetching
State Player Fetching
State Player Fetched
State Player Fetched
State Player Empty
State Player Empty
State Player Fetched
State Player Fetched
16 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.blocimplementation" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/blocimplementation/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.blocimplementation; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /images/flags/argentina.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/images/flags/argentina.png -------------------------------------------------------------------------------- /images/flags/brazil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/images/flags/brazil.png -------------------------------------------------------------------------------- /images/flags/england.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/images/flags/england.png -------------------------------------------------------------------------------- /images/flags/france.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/images/flags/france.png -------------------------------------------------------------------------------- /images/flags/germany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/images/flags/germany.png -------------------------------------------------------------------------------- /images/flags/italy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/images/flags/italy.png -------------------------------------------------------------------------------- /images/flags/spain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/images/flags/spain.png -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 9740EEB11CF90186004384FC /* Flutter */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 77 | 3B80C3931E831B6300D905FE /* App.framework */, 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 83 | ); 84 | name = Flutter; 85 | sourceTree = ""; 86 | }; 87 | 97C146E51CF9000F007C117D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9740EEB11CF90186004384FC /* Flutter */, 91 | 97C146F01CF9000F007C117D /* Runner */, 92 | 97C146EF1CF9000F007C117D /* Products */, 93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 97C146EF1CF9000F007C117D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 97C146EE1CF9000F007C117D /* Runner.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 97C146F01CF9000F007C117D /* Runner */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 110 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 113 | 97C147021CF9000F007C117D /* Info.plist */, 114 | 97C146F11CF9000F007C117D /* Supporting Files */, 115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 97C146F21CF9000F007C117D /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 97C146ED1CF9000F007C117D /* Runner */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 135 | buildPhases = ( 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = Runner; 148 | productName = Runner; 149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 97C146E61CF9000F007C117D /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 0910; 159 | ORGANIZATIONNAME = "The Chromium Authors"; 160 | TargetAttributes = { 161 | 97C146ED1CF9000F007C117D = { 162 | CreatedOnToolsVersion = 7.3.1; 163 | }; 164 | }; 165 | }; 166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 167 | compatibilityVersion = "Xcode 3.2"; 168 | developmentRegion = English; 169 | hasScannedForEncodings = 0; 170 | knownRegions = ( 171 | en, 172 | Base, 173 | ); 174 | mainGroup = 97C146E51CF9000F007C117D; 175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 176 | projectDirPath = ""; 177 | projectRoot = ""; 178 | targets = ( 179 | 97C146ED1CF9000F007C117D /* Runner */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | 97C146EC1CF9000F007C117D /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Thin Binary"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 214 | }; 215 | 9740EEB61CF901F6004384FC /* Run Script */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputPaths = ( 221 | ); 222 | name = "Run Script"; 223 | outputPaths = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 228 | }; 229 | /* End PBXShellScriptBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 97C146EA1CF9000F007C117D /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 237 | 97C146F31CF9000F007C117D /* main.m in Sources */, 238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXVariantGroup section */ 245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C146FB1CF9000F007C117D /* Base */, 249 | ); 250 | name = Main.storyboard; 251 | sourceTree = ""; 252 | }; 253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 97C147001CF9000F007C117D /* Base */, 257 | ); 258 | name = LaunchScreen.storyboard; 259 | sourceTree = ""; 260 | }; 261 | /* End PBXVariantGroup section */ 262 | 263 | /* Begin XCBuildConfiguration section */ 264 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 265 | isa = XCBuildConfiguration; 266 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_COMMA = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | GCC_C_LANGUAGE_STANDARD = gnu99; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 305 | MTL_ENABLE_DEBUG_INFO = NO; 306 | SDKROOT = iphoneos; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | VALIDATE_PRODUCT = YES; 309 | }; 310 | name = Profile; 311 | }; 312 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 313 | isa = XCBuildConfiguration; 314 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 318 | DEVELOPMENT_TEAM = S8QB4VV633; 319 | ENABLE_BITCODE = NO; 320 | FRAMEWORK_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | INFOPLIST_FILE = Runner/Info.plist; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | LIBRARY_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "$(PROJECT_DIR)/Flutter", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = com.example.blocImplementation; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | VERSIONING_SYSTEM = "apple-generic"; 333 | }; 334 | name = Profile; 335 | }; 336 | 97C147031CF9000F007C117D /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNREACHABLE_CODE = YES; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | DEBUG_INFORMATION_FORMAT = dwarf; 366 | ENABLE_STRICT_OBJC_MSGSEND = YES; 367 | ENABLE_TESTABILITY = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_DYNAMIC_NO_PIC = NO; 370 | GCC_NO_COMMON_BLOCKS = YES; 371 | GCC_OPTIMIZATION_LEVEL = 0; 372 | GCC_PREPROCESSOR_DEFINITIONS = ( 373 | "DEBUG=1", 374 | "$(inherited)", 375 | ); 376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 378 | GCC_WARN_UNDECLARED_SELECTOR = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 380 | GCC_WARN_UNUSED_FUNCTION = YES; 381 | GCC_WARN_UNUSED_VARIABLE = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 383 | MTL_ENABLE_DEBUG_INFO = YES; 384 | ONLY_ACTIVE_ARCH = YES; 385 | SDKROOT = iphoneos; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Debug; 389 | }; 390 | 97C147041CF9000F007C117D /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 393 | buildSettings = { 394 | ALWAYS_SEARCH_USER_PATHS = NO; 395 | CLANG_ANALYZER_NONNULL = YES; 396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 397 | CLANG_CXX_LIBRARY = "libc++"; 398 | CLANG_ENABLE_MODULES = YES; 399 | CLANG_ENABLE_OBJC_ARC = YES; 400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 401 | CLANG_WARN_BOOL_CONVERSION = YES; 402 | CLANG_WARN_COMMA = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | TARGETED_DEVICE_FAMILY = "1,2"; 434 | VALIDATE_PRODUCT = YES; 435 | }; 436 | name = Release; 437 | }; 438 | 97C147061CF9000F007C117D /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 444 | ENABLE_BITCODE = NO; 445 | FRAMEWORK_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "$(PROJECT_DIR)/Flutter", 448 | ); 449 | INFOPLIST_FILE = Runner/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | LIBRARY_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | PRODUCT_BUNDLE_IDENTIFIER = com.example.blocImplementation; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | VERSIONING_SYSTEM = "apple-generic"; 458 | }; 459 | name = Debug; 460 | }; 461 | 97C147071CF9000F007C117D /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 464 | buildSettings = { 465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 467 | ENABLE_BITCODE = NO; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | INFOPLIST_FILE = Runner/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 474 | LIBRARY_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | PRODUCT_BUNDLE_IDENTIFIER = com.example.blocImplementation; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | VERSIONING_SYSTEM = "apple-generic"; 481 | }; 482 | name = Release; 483 | }; 484 | /* End XCBuildConfiguration section */ 485 | 486 | /* Begin XCConfigurationList section */ 487 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | 97C147031CF9000F007C117D /* Debug */, 491 | 97C147041CF9000F007C117D /* Release */, 492 | 249021D3217E4FDB00AE95B9 /* Profile */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 97C147061CF9000F007C117D /* Debug */, 501 | 97C147071CF9000F007C117D /* Release */, 502 | 249021D4217E4FDB00AE95B9 /* Profile */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | /* End XCConfigurationList section */ 508 | }; 509 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 510 | } 511 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/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/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | bloc_implementation 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/bloc/player_listing_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:bloc_implementation/bloc/player_listing_events.dart'; 3 | import 'package:bloc_implementation/bloc/player_listing_states.dart'; 4 | import 'package:bloc_implementation/models/api_models.dart'; 5 | import 'package:bloc_implementation/services/repository.dart'; 6 | import 'package:rxdart/rxdart.dart'; 7 | 8 | class PlayerListingBloc extends Bloc { 9 | final PlayerRepository playerRepository; 10 | 11 | PlayerListingBloc({this.playerRepository}) : assert(playerRepository != null); 12 | 13 | @override 14 | Stream transform(Stream events) { 15 | return (events as PublishSubject) 16 | .transform(DebounceStreamTransformer(Duration(milliseconds: 250))); 17 | } 18 | 19 | @override 20 | void onTransition(Transition transition) { 21 | super.onTransition(transition); 22 | print(transition); 23 | } 24 | 25 | @override 26 | PlayerListingState get initialState => PlayerUninitializedState(); 27 | 28 | @override 29 | Stream mapEventToState( 30 | PlayerListingState currentState, PlayerListingEvent event) async* { 31 | print("mapEventToState"); 32 | yield PlayerFetchingState(); 33 | try { 34 | List players; 35 | if (event is CountrySelectedEvent) { 36 | players = await playerRepository 37 | .fetchPlayersByCountry(event.nationModel.countryId); 38 | } else if (event is SearchTextChangedEvent) { 39 | print("hitting service"); 40 | players = await playerRepository.fetchPlayersByName(event.searchTerm); 41 | } 42 | if (players.length == 0) { 43 | yield PlayerEmptyState(); 44 | } else { 45 | yield PlayerFetchedState(players: players); 46 | } 47 | } catch (_) { 48 | yield PlayerErrorState(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/bloc/player_listing_events.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/models/nation.dart'; 2 | import 'package:meta/meta.dart'; 3 | 4 | abstract class PlayerListingEvent {} 5 | 6 | class CountrySelectedEvent extends PlayerListingEvent { 7 | final NationModel nationModel; 8 | 9 | CountrySelectedEvent({@required this.nationModel}) 10 | : assert(nationModel != null); 11 | } 12 | 13 | class SearchTextChangedEvent extends PlayerListingEvent { 14 | final String searchTerm; 15 | 16 | SearchTextChangedEvent({this.searchTerm}) : assert(searchTerm != null); 17 | } 18 | -------------------------------------------------------------------------------- /lib/bloc/player_listing_states.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/models/api_models.dart'; 2 | import 'package:meta/meta.dart'; 3 | 4 | abstract class PlayerListingState {} 5 | 6 | class PlayerUninitializedState extends PlayerListingState{} 7 | 8 | class PlayerFetchingState extends PlayerListingState{} 9 | 10 | class PlayerFetchedState extends PlayerListingState{ 11 | final List players; 12 | 13 | PlayerFetchedState({@required this.players}) : assert (players != null); 14 | 15 | } 16 | 17 | class PlayerErrorState extends PlayerListingState{} 18 | 19 | class PlayerEmptyState extends PlayerListingState{} -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/pages/HomePage.dart'; 2 | import 'package:bloc_implementation/services/repository.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | void main() { 6 | PlayerRepository _repository = PlayerRepository(); 7 | 8 | runApp(MyApp(playerRepository: _repository,)); 9 | } 10 | 11 | class MyApp extends StatelessWidget { 12 | 13 | final PlayerRepository playerRepository; 14 | 15 | MyApp({this.playerRepository}); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return MaterialApp( 20 | debugShowCheckedModeBanner: false, 21 | title: 'Bloc Implementation', 22 | home: HomePage(playerRepository: playerRepository), 23 | ); 24 | } 25 | } -------------------------------------------------------------------------------- /lib/models/api_models.dart: -------------------------------------------------------------------------------- 1 | class ApiResult { 2 | int page; 3 | int totalPages; 4 | int totalResults; 5 | String type; 6 | int count; 7 | List items; 8 | 9 | ApiResult( 10 | {this.page, 11 | this.totalPages, 12 | this.totalResults, 13 | this.type, 14 | this.count, 15 | this.items}); 16 | 17 | ApiResult.fromJson(Map json) { 18 | page = json['page']; 19 | totalPages = json['totalPages']; 20 | totalResults = json['totalResults']; 21 | type = json['type']; 22 | count = json['count']; 23 | if (json['items'] != null) { 24 | items = new List(); 25 | json['items'].forEach((v) { 26 | items.add(new Players.fromJson(v)); 27 | }); 28 | } 29 | } 30 | 31 | Map toJson() { 32 | final Map data = new Map(); 33 | data['page'] = this.page; 34 | data['totalPages'] = this.totalPages; 35 | data['totalResults'] = this.totalResults; 36 | data['type'] = this.type; 37 | data['count'] = this.count; 38 | if (this.items != null) { 39 | data['items'] = this.items.map((v) => v.toJson()).toList(); 40 | } 41 | return data; 42 | } 43 | } 44 | 45 | class Players { 46 | String commonName; 47 | String firstName; 48 | String lastName; 49 | League league; 50 | Nation nation; 51 | Club club; 52 | Headshot headshot; 53 | String position; 54 | int composure; 55 | String playStyle; 56 | Null playStyleId; 57 | int height; 58 | int weight; 59 | String birthdate; 60 | int age; 61 | int acceleration; 62 | int aggression; 63 | int agility; 64 | int balance; 65 | int ballcontrol; 66 | String foot; 67 | int skillMoves; 68 | int crossing; 69 | int curve; 70 | int dribbling; 71 | int finishing; 72 | int freekickaccuracy; 73 | int gkdiving; 74 | int gkhandling; 75 | int gkkicking; 76 | int gkpositioning; 77 | int gkreflexes; 78 | int headingaccuracy; 79 | int interceptions; 80 | int jumping; 81 | int longpassing; 82 | int longshots; 83 | int marking; 84 | int penalties; 85 | int positioning; 86 | int potential; 87 | int reactions; 88 | int shortpassing; 89 | int shotpower; 90 | int slidingtackle; 91 | int sprintspeed; 92 | int standingtackle; 93 | int stamina; 94 | int strength; 95 | int vision; 96 | int volleys; 97 | int weakFoot; 98 | List traits; 99 | List specialities; 100 | String atkWorkRate; 101 | String defWorkRate; 102 | Null playerType; 103 | List attributes; 104 | String name; 105 | int rarityId; 106 | bool isIcon; 107 | String quality; 108 | bool isGK; 109 | String positionFull; 110 | bool isSpecialType; 111 | Null contracts; 112 | Null fitness; 113 | Null rawAttributeChemistryBonus; 114 | Null isLoan; 115 | Null squadPosition; 116 | IconAttributes iconAttributes; 117 | String itemType; 118 | Null discardValue; 119 | String id; 120 | String modelName; 121 | int baseId; 122 | int rating; 123 | 124 | Players( 125 | {this.commonName, 126 | this.firstName, 127 | this.lastName, 128 | this.league, 129 | this.nation, 130 | this.club, 131 | this.headshot, 132 | this.position, 133 | this.composure, 134 | this.playStyle, 135 | this.playStyleId, 136 | this.height, 137 | this.weight, 138 | this.birthdate, 139 | this.age, 140 | this.acceleration, 141 | this.aggression, 142 | this.agility, 143 | this.balance, 144 | this.ballcontrol, 145 | this.foot, 146 | this.skillMoves, 147 | this.crossing, 148 | this.curve, 149 | this.dribbling, 150 | this.finishing, 151 | this.freekickaccuracy, 152 | this.gkdiving, 153 | this.gkhandling, 154 | this.gkkicking, 155 | this.gkpositioning, 156 | this.gkreflexes, 157 | this.headingaccuracy, 158 | this.interceptions, 159 | this.jumping, 160 | this.longpassing, 161 | this.longshots, 162 | this.marking, 163 | this.penalties, 164 | this.positioning, 165 | this.potential, 166 | this.reactions, 167 | this.shortpassing, 168 | this.shotpower, 169 | this.slidingtackle, 170 | this.sprintspeed, 171 | this.standingtackle, 172 | this.stamina, 173 | this.strength, 174 | this.vision, 175 | this.volleys, 176 | this.weakFoot, 177 | this.traits, 178 | this.specialities, 179 | this.atkWorkRate, 180 | this.defWorkRate, 181 | this.playerType, 182 | this.attributes, 183 | this.name, 184 | this.rarityId, 185 | this.isIcon, 186 | this.quality, 187 | this.isGK, 188 | this.positionFull, 189 | this.isSpecialType, 190 | this.contracts, 191 | this.fitness, 192 | this.rawAttributeChemistryBonus, 193 | this.isLoan, 194 | this.squadPosition, 195 | this.iconAttributes, 196 | this.itemType, 197 | this.discardValue, 198 | this.id, 199 | this.modelName, 200 | this.baseId, 201 | this.rating}); 202 | 203 | Players.fromJson(Map json) { 204 | commonName = json['commonName']; 205 | firstName = json['firstName']; 206 | lastName = json['lastName']; 207 | league = 208 | json['league'] != null ? new League.fromJson(json['league']) : null; 209 | nation = 210 | json['nation'] != null ? new Nation.fromJson(json['nation']) : null; 211 | club = json['club'] != null ? new Club.fromJson(json['club']) : null; 212 | headshot = json['headshot'] != null 213 | ? new Headshot.fromJson(json['headshot']) 214 | : null; 215 | position = json['position']; 216 | composure = json['composure']; 217 | playStyle = json['playStyle']; 218 | playStyleId = json['playStyleId']; 219 | height = json['height']; 220 | weight = json['weight']; 221 | birthdate = json['birthdate']; 222 | age = json['age']; 223 | acceleration = json['acceleration']; 224 | aggression = json['aggression']; 225 | agility = json['agility']; 226 | balance = json['balance']; 227 | ballcontrol = json['ballcontrol']; 228 | foot = json['foot']; 229 | skillMoves = json['skillMoves']; 230 | crossing = json['crossing']; 231 | curve = json['curve']; 232 | dribbling = json['dribbling']; 233 | finishing = json['finishing']; 234 | freekickaccuracy = json['freekickaccuracy']; 235 | gkdiving = json['gkdiving']; 236 | gkhandling = json['gkhandling']; 237 | gkkicking = json['gkkicking']; 238 | gkpositioning = json['gkpositioning']; 239 | gkreflexes = json['gkreflexes']; 240 | headingaccuracy = json['headingaccuracy']; 241 | interceptions = json['interceptions']; 242 | jumping = json['jumping']; 243 | longpassing = json['longpassing']; 244 | longshots = json['longshots']; 245 | marking = json['marking']; 246 | penalties = json['penalties']; 247 | positioning = json['positioning']; 248 | potential = json['potential']; 249 | reactions = json['reactions']; 250 | shortpassing = json['shortpassing']; 251 | shotpower = json['shotpower']; 252 | slidingtackle = json['slidingtackle']; 253 | sprintspeed = json['sprintspeed']; 254 | standingtackle = json['standingtackle']; 255 | stamina = json['stamina']; 256 | strength = json['strength']; 257 | vision = json['vision']; 258 | volleys = json['volleys']; 259 | weakFoot = json['weakFoot']; 260 | //traits = json['traits'].cast(); 261 | //specialities = json['specialities'].cast(); 262 | atkWorkRate = json['atkWorkRate']; 263 | defWorkRate = json['defWorkRate']; 264 | playerType = json['playerType']; 265 | if (json['attributes'] != null) { 266 | attributes = new List(); 267 | json['attributes'].forEach((v) { 268 | attributes.add(new Attributes.fromJson(v)); 269 | }); 270 | } 271 | name = json['name']; 272 | rarityId = json['rarityId']; 273 | isIcon = json['isIcon']; 274 | quality = json['quality']; 275 | isGK = json['isGK']; 276 | positionFull = json['positionFull']; 277 | isSpecialType = json['isSpecialType']; 278 | contracts = json['contracts']; 279 | fitness = json['fitness']; 280 | rawAttributeChemistryBonus = json['rawAttributeChemistryBonus']; 281 | isLoan = json['isLoan']; 282 | squadPosition = json['squadPosition']; 283 | iconAttributes = json['iconAttributes'] != null 284 | ? new IconAttributes.fromJson(json['iconAttributes']) 285 | : null; 286 | itemType = json['itemType']; 287 | discardValue = json['discardValue']; 288 | id = json['id']; 289 | modelName = json['modelName']; 290 | baseId = json['baseId']; 291 | rating = json['rating']; 292 | } 293 | 294 | Map toJson() { 295 | final Map data = new Map(); 296 | data['commonName'] = this.commonName; 297 | data['firstName'] = this.firstName; 298 | data['lastName'] = this.lastName; 299 | if (this.league != null) { 300 | data['league'] = this.league.toJson(); 301 | } 302 | if (this.nation != null) { 303 | data['nation'] = this.nation.toJson(); 304 | } 305 | if (this.club != null) { 306 | data['club'] = this.club.toJson(); 307 | } 308 | if (this.headshot != null) { 309 | data['headshot'] = this.headshot.toJson(); 310 | } 311 | data['position'] = this.position; 312 | data['composure'] = this.composure; 313 | data['playStyle'] = this.playStyle; 314 | data['playStyleId'] = this.playStyleId; 315 | data['height'] = this.height; 316 | data['weight'] = this.weight; 317 | data['birthdate'] = this.birthdate; 318 | data['age'] = this.age; 319 | data['acceleration'] = this.acceleration; 320 | data['aggression'] = this.aggression; 321 | data['agility'] = this.agility; 322 | data['balance'] = this.balance; 323 | data['ballcontrol'] = this.ballcontrol; 324 | data['foot'] = this.foot; 325 | data['skillMoves'] = this.skillMoves; 326 | data['crossing'] = this.crossing; 327 | data['curve'] = this.curve; 328 | data['dribbling'] = this.dribbling; 329 | data['finishing'] = this.finishing; 330 | data['freekickaccuracy'] = this.freekickaccuracy; 331 | data['gkdiving'] = this.gkdiving; 332 | data['gkhandling'] = this.gkhandling; 333 | data['gkkicking'] = this.gkkicking; 334 | data['gkpositioning'] = this.gkpositioning; 335 | data['gkreflexes'] = this.gkreflexes; 336 | data['headingaccuracy'] = this.headingaccuracy; 337 | data['interceptions'] = this.interceptions; 338 | data['jumping'] = this.jumping; 339 | data['longpassing'] = this.longpassing; 340 | data['longshots'] = this.longshots; 341 | data['marking'] = this.marking; 342 | data['penalties'] = this.penalties; 343 | data['positioning'] = this.positioning; 344 | data['potential'] = this.potential; 345 | data['reactions'] = this.reactions; 346 | data['shortpassing'] = this.shortpassing; 347 | data['shotpower'] = this.shotpower; 348 | data['slidingtackle'] = this.slidingtackle; 349 | data['sprintspeed'] = this.sprintspeed; 350 | data['standingtackle'] = this.standingtackle; 351 | data['stamina'] = this.stamina; 352 | data['strength'] = this.strength; 353 | data['vision'] = this.vision; 354 | data['volleys'] = this.volleys; 355 | data['weakFoot'] = this.weakFoot; 356 | data['traits'] = this.traits; 357 | data['specialities'] = this.specialities; 358 | data['atkWorkRate'] = this.atkWorkRate; 359 | data['defWorkRate'] = this.defWorkRate; 360 | data['playerType'] = this.playerType; 361 | if (this.attributes != null) { 362 | data['attributes'] = this.attributes.map((v) => v.toJson()).toList(); 363 | } 364 | data['name'] = this.name; 365 | data['rarityId'] = this.rarityId; 366 | data['isIcon'] = this.isIcon; 367 | data['quality'] = this.quality; 368 | data['isGK'] = this.isGK; 369 | data['positionFull'] = this.positionFull; 370 | data['isSpecialType'] = this.isSpecialType; 371 | data['contracts'] = this.contracts; 372 | data['fitness'] = this.fitness; 373 | data['rawAttributeChemistryBonus'] = this.rawAttributeChemistryBonus; 374 | data['isLoan'] = this.isLoan; 375 | data['squadPosition'] = this.squadPosition; 376 | if (this.iconAttributes != null) { 377 | data['iconAttributes'] = this.iconAttributes.toJson(); 378 | } 379 | data['itemType'] = this.itemType; 380 | data['discardValue'] = this.discardValue; 381 | data['id'] = this.id; 382 | data['modelName'] = this.modelName; 383 | data['baseId'] = this.baseId; 384 | data['rating'] = this.rating; 385 | return data; 386 | } 387 | } 388 | 389 | class League { 390 | LeagueImageUrls imageUrls; 391 | String abbrName; 392 | int id; 393 | Null imgUrl; 394 | String name; 395 | 396 | League({this.imageUrls, this.abbrName, this.id, this.imgUrl, this.name}); 397 | 398 | League.fromJson(Map json) { 399 | imageUrls = json['imageUrls'] != null 400 | ? new LeagueImageUrls.fromJson(json['imageUrls']) 401 | : null; 402 | abbrName = json['abbrName']; 403 | id = json['id']; 404 | imgUrl = json['imgUrl']; 405 | name = json['name']; 406 | } 407 | 408 | Map toJson() { 409 | final Map data = new Map(); 410 | if (this.imageUrls != null) { 411 | data['imageUrls'] = this.imageUrls.toJson(); 412 | } 413 | data['abbrName'] = this.abbrName; 414 | data['id'] = this.id; 415 | data['imgUrl'] = this.imgUrl; 416 | data['name'] = this.name; 417 | return data; 418 | } 419 | } 420 | 421 | class LeagueImageUrls { 422 | String dark; 423 | String light; 424 | 425 | LeagueImageUrls({this.dark, this.light}); 426 | 427 | LeagueImageUrls.fromJson(Map json) { 428 | dark = json['dark']; 429 | light = json['light']; 430 | } 431 | 432 | Map toJson() { 433 | final Map data = new Map(); 434 | data['dark'] = this.dark; 435 | data['light'] = this.light; 436 | return data; 437 | } 438 | } 439 | 440 | class Nation { 441 | NationImageUrls imageUrls; 442 | String abbrName; 443 | int id; 444 | Null imgUrl; 445 | String name; 446 | 447 | Nation({this.imageUrls, this.abbrName, this.id, this.imgUrl, this.name}); 448 | 449 | Nation.fromJson(Map json) { 450 | imageUrls = json['imageUrls'] != null 451 | ? new NationImageUrls.fromJson(json['imageUrls']) 452 | : null; 453 | abbrName = json['abbrName']; 454 | id = json['id']; 455 | imgUrl = json['imgUrl']; 456 | name = json['name']; 457 | } 458 | 459 | Map toJson() { 460 | final Map data = new Map(); 461 | if (this.imageUrls != null) { 462 | data['imageUrls'] = this.imageUrls.toJson(); 463 | } 464 | data['abbrName'] = this.abbrName; 465 | data['id'] = this.id; 466 | data['imgUrl'] = this.imgUrl; 467 | data['name'] = this.name; 468 | return data; 469 | } 470 | } 471 | 472 | class NationImageUrls { 473 | String small; 474 | String medium; 475 | String large; 476 | 477 | NationImageUrls({this.small, this.medium, this.large}); 478 | 479 | NationImageUrls.fromJson(Map json) { 480 | small = json['small']; 481 | medium = json['medium']; 482 | large = json['large']; 483 | } 484 | 485 | Map toJson() { 486 | final Map data = new Map(); 487 | data['small'] = this.small; 488 | data['medium'] = this.medium; 489 | data['large'] = this.large; 490 | return data; 491 | } 492 | } 493 | 494 | class Club { 495 | ImageUrls imageUrls; 496 | String abbrName; 497 | int id; 498 | Null imgUrl; 499 | String name; 500 | 501 | Club({this.imageUrls, this.abbrName, this.id, this.imgUrl, this.name}); 502 | 503 | Club.fromJson(Map json) { 504 | imageUrls = json['imageUrls'] != null 505 | ? new ImageUrls.fromJson(json['imageUrls']) 506 | : null; 507 | abbrName = json['abbrName']; 508 | id = json['id']; 509 | imgUrl = json['imgUrl']; 510 | name = json['name']; 511 | } 512 | 513 | Map toJson() { 514 | final Map data = new Map(); 515 | if (this.imageUrls != null) { 516 | data['imageUrls'] = this.imageUrls.toJson(); 517 | } 518 | data['abbrName'] = this.abbrName; 519 | data['id'] = this.id; 520 | data['imgUrl'] = this.imgUrl; 521 | data['name'] = this.name; 522 | return data; 523 | } 524 | } 525 | 526 | class ImageUrls { 527 | Dark dark; 528 | Light light; 529 | 530 | ImageUrls({this.dark, this.light}); 531 | 532 | ImageUrls.fromJson(Map json) { 533 | dark = json['dark'] != null ? new Dark.fromJson(json['dark']) : null; 534 | light = json['light'] != null ? new Light.fromJson(json['light']) : null; 535 | } 536 | 537 | Map toJson() { 538 | final Map data = new Map(); 539 | if (this.dark != null) { 540 | data['dark'] = this.dark.toJson(); 541 | } 542 | if (this.light != null) { 543 | data['light'] = this.light.toJson(); 544 | } 545 | return data; 546 | } 547 | } 548 | 549 | class Dark { 550 | String small; 551 | String medium; 552 | String large; 553 | 554 | Dark({this.small, this.medium, this.large}); 555 | 556 | Dark.fromJson(Map json) { 557 | small = json['small']; 558 | medium = json['medium']; 559 | large = json['large']; 560 | } 561 | 562 | Map toJson() { 563 | final Map data = new Map(); 564 | data['small'] = this.small; 565 | data['medium'] = this.medium; 566 | data['large'] = this.large; 567 | return data; 568 | } 569 | } 570 | 571 | class Light { 572 | String small; 573 | String medium; 574 | String large; 575 | 576 | Light({this.small, this.medium, this.large}); 577 | 578 | Light.fromJson(Map json) { 579 | small = json['small']; 580 | medium = json['medium']; 581 | large = json['large']; 582 | } 583 | 584 | Map toJson() { 585 | final Map data = new Map(); 586 | data['small'] = this.small; 587 | data['medium'] = this.medium; 588 | data['large'] = this.large; 589 | return data; 590 | } 591 | } 592 | 593 | class Headshot { 594 | String imgUrl; 595 | bool isDynamicPortrait; 596 | 597 | Headshot({this.imgUrl, this.isDynamicPortrait}); 598 | 599 | Headshot.fromJson(Map json) { 600 | imgUrl = json['imgUrl']; 601 | isDynamicPortrait = json['isDynamicPortrait']; 602 | } 603 | 604 | Map toJson() { 605 | final Map data = new Map(); 606 | data['imgUrl'] = this.imgUrl; 607 | data['isDynamicPortrait'] = this.isDynamicPortrait; 608 | return data; 609 | } 610 | } 611 | 612 | class Attributes { 613 | String name; 614 | int value; 615 | List chemistryBonus; 616 | 617 | Attributes({this.name, this.value, this.chemistryBonus}); 618 | 619 | Attributes.fromJson(Map json) { 620 | name = json['name']; 621 | value = json['value']; 622 | chemistryBonus = json['chemistryBonus'].cast(); 623 | } 624 | 625 | Map toJson() { 626 | final Map data = new Map(); 627 | data['name'] = this.name; 628 | data['value'] = this.value; 629 | data['chemistryBonus'] = this.chemistryBonus; 630 | return data; 631 | } 632 | } 633 | 634 | class IconAttributes { 635 | List clubTeamStats; 636 | List nationalTeamStats; 637 | String iconText; 638 | 639 | IconAttributes({this.clubTeamStats, this.nationalTeamStats, this.iconText}); 640 | 641 | IconAttributes.fromJson(Map json) { 642 | if (json['clubTeamStats'] != null) { 643 | clubTeamStats = new List(); 644 | json['clubTeamStats'].forEach((v) { 645 | clubTeamStats.add(new ClubTeamStats.fromJson(v)); 646 | }); 647 | } 648 | if (json['nationalTeamStats'] != null) { 649 | nationalTeamStats = new List(); 650 | json['nationalTeamStats'].forEach((v) { 651 | nationalTeamStats.add(new NationalTeamStats.fromJson(v)); 652 | }); 653 | } 654 | iconText = json['iconText']; 655 | } 656 | 657 | Map toJson() { 658 | final Map data = new Map(); 659 | if (this.clubTeamStats != null) { 660 | data['clubTeamStats'] = 661 | this.clubTeamStats.map((v) => v.toJson()).toList(); 662 | } 663 | if (this.nationalTeamStats != null) { 664 | data['nationalTeamStats'] = 665 | this.nationalTeamStats.map((v) => v.toJson()).toList(); 666 | } 667 | data['iconText'] = this.iconText; 668 | return data; 669 | } 670 | } 671 | 672 | class ClubTeamStats { 673 | int years; 674 | int clubId; 675 | String clubName; 676 | int appearances; 677 | int goals; 678 | 679 | ClubTeamStats( 680 | {this.years, this.clubId, this.clubName, this.appearances, this.goals}); 681 | 682 | ClubTeamStats.fromJson(Map json) { 683 | years = json['years']; 684 | clubId = json['clubId']; 685 | clubName = json['clubName']; 686 | appearances = json['appearances']; 687 | goals = json['goals']; 688 | } 689 | 690 | Map toJson() { 691 | final Map data = new Map(); 692 | data['years'] = this.years; 693 | data['clubId'] = this.clubId; 694 | data['clubName'] = this.clubName; 695 | data['appearances'] = this.appearances; 696 | data['goals'] = this.goals; 697 | return data; 698 | } 699 | } 700 | 701 | class NationalTeamStats { 702 | int years; 703 | int clubId; 704 | String clubName; 705 | int appearances; 706 | int goals; 707 | 708 | NationalTeamStats( 709 | {this.years, this.clubId, this.clubName, this.appearances, this.goals}); 710 | 711 | NationalTeamStats.fromJson(Map json) { 712 | years = json['years']; 713 | clubId = json['clubId']; 714 | clubName = json['clubName']; 715 | appearances = json['appearances']; 716 | goals = json['goals']; 717 | } 718 | 719 | Map toJson() { 720 | final Map data = new Map(); 721 | data['years'] = this.years; 722 | data['clubId'] = this.clubId; 723 | data['clubName'] = this.clubName; 724 | data['appearances'] = this.appearances; 725 | data['goals'] = this.goals; 726 | return data; 727 | } 728 | } -------------------------------------------------------------------------------- /lib/models/nation.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | 3 | class NationModel { 4 | final String nationName; 5 | final String imagePath; 6 | final String countryId; 7 | 8 | NationModel({@required this.nationName, @required this.imagePath, @required this.countryId}); 9 | } 10 | 11 | List nations = [ 12 | NationModel(nationName: "Argentina", imagePath: "images/flags/argentina.png", countryId: "52"), 13 | NationModel(nationName: "Brazil", imagePath: "images/flags/brazil.png", countryId: "54"), 14 | NationModel(nationName: "Germany", imagePath: "images/flags/germany.png", countryId: "21"), 15 | NationModel(nationName: "England", imagePath: "images/flags/england.png", countryId: "14"), 16 | NationModel(nationName: "France", imagePath: "images/flags/france.png", countryId: "18"), 17 | NationModel(nationName: "Italy", imagePath: "images/flags/italy.png", countryId: "27"), 18 | NationModel(nationName: "Spain", imagePath: "images/flags/spain.png", countryId: "45") 19 | ]; -------------------------------------------------------------------------------- /lib/pages/HomePage.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/bloc/player_listing_bloc.dart'; 2 | import 'package:bloc_implementation/pages/player_listing.dart'; 3 | import 'package:bloc_implementation/services/repository.dart'; 4 | import 'package:bloc_implementation/themes/themes.dart'; 5 | import 'package:bloc_implementation/widgets/horizontal_bar.dart'; 6 | import 'package:bloc_implementation/widgets/search_bar.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_bloc/flutter_bloc.dart'; 9 | 10 | class HomePage extends StatefulWidget { 11 | final PlayerRepository playerRepository; 12 | 13 | HomePage({this.playerRepository}); 14 | 15 | @override 16 | HomePageState createState() { 17 | return new HomePageState(); 18 | } 19 | } 20 | 21 | class HomePageState extends State { 22 | PlayerListingBloc _playerListingBloc; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | _playerListingBloc = 28 | PlayerListingBloc(playerRepository: widget.playerRepository); 29 | } 30 | 31 | @override 32 | void didUpdateWidget(HomePage oldWidget) { 33 | super.didUpdateWidget(oldWidget); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return BlocProvider( 39 | bloc: _playerListingBloc, 40 | child: Scaffold( 41 | appBar: AppBar( 42 | elevation: 0.0, 43 | backgroundColor: Colors.white, 44 | title: Text( 45 | 'Football Players', 46 | style: appBarTextStyle, 47 | ), 48 | ), 49 | body: Column( 50 | children: [ 51 | HorizontalBar(), 52 | SizedBox(height: 10.0), 53 | SearchBar(), 54 | SizedBox(height: 10.0), 55 | PlayerListing() 56 | ], 57 | ), 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/pages/player_listing.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/bloc/player_listing_bloc.dart'; 2 | import 'package:bloc_implementation/bloc/player_listing_states.dart'; 3 | import 'package:bloc_implementation/models/api_models.dart'; 4 | import 'package:bloc_implementation/themes/themes.dart'; 5 | import 'package:bloc_implementation/widgets/message.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter_bloc/flutter_bloc.dart'; 8 | 9 | class PlayerListing extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) { 12 | return BlocBuilder( 13 | bloc: BlocProvider.of(context), 14 | builder: (context, state) { 15 | if (state is PlayerUninitializedState) { 16 | return Message( 17 | message: "Please select a country flag to fetch players from"); 18 | } else if (state is PlayerEmptyState) { 19 | return Message(message: "No Players found"); 20 | } else if (state is PlayerErrorState) { 21 | return Message(message: "Something went wrong"); 22 | } else if (state is PlayerFetchingState) { 23 | return Expanded(child: Center(child: CircularProgressIndicator())); 24 | } else { 25 | final stateAsPlayerFetchedState = state as PlayerFetchedState; 26 | final players = stateAsPlayerFetchedState.players; 27 | return buildPlayersList(players); 28 | } 29 | }, 30 | ); 31 | } 32 | 33 | Widget buildPlayersList(List players) { 34 | return Expanded( 35 | child: ListView.separated( 36 | itemBuilder: (BuildContext context, index) { 37 | Players player = players[index]; 38 | return ListTile( 39 | leading: Image.network( 40 | player.headshot.imgUrl, 41 | width: 70.0, 42 | height: 70.0, 43 | ), 44 | title: Text(player.name, style: titleStyle), 45 | subtitle: Text(player.club.name, style: subTitleStyle), 46 | ); 47 | }, 48 | separatorBuilder: (BuildContext context, index) { 49 | return Divider( 50 | height: 8.0, 51 | color: Colors.transparent, 52 | ); 53 | }, 54 | itemCount: players.length, 55 | ), 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/services/player_api_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/models/api_models.dart'; 2 | import 'package:http/http.dart' as http; 3 | import 'dart:convert'; 4 | 5 | class PlayerApiProvider { 6 | 7 | String baseUrl = "https://www.easports.com/fifa/ultimate-team/api/fut/item?"; 8 | final successCode = 200; 9 | 10 | Future> fetchPlayersByCountry(String countryId) async { 11 | final response = await http.get(baseUrl + "country=" + countryId); 12 | 13 | return parseResponse(response); 14 | } 15 | 16 | Future> fetchPlayersByName(String name) async { 17 | final response = await http.get(baseUrl+"name="+name); 18 | 19 | return parseResponse(response); 20 | } 21 | 22 | List parseResponse(http.Response response) { 23 | final responseString = jsonDecode(response.body); 24 | 25 | if (response.statusCode == successCode) { 26 | return ApiResult.fromJson(responseString).items; 27 | } else { 28 | throw Exception('failed to load players'); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /lib/services/repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/models/api_models.dart'; 2 | import 'package:bloc_implementation/services/player_api_provider.dart'; 3 | 4 | class PlayerRepository { 5 | PlayerApiProvider _playerApiProvider = PlayerApiProvider(); 6 | 7 | Future> fetchPlayersByCountry(String countryId) => 8 | _playerApiProvider.fetchPlayersByCountry(countryId); 9 | 10 | Future> fetchPlayersByName(String name) => 11 | _playerApiProvider.fetchPlayersByName(name); 12 | } 13 | -------------------------------------------------------------------------------- /lib/themes/themes.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | TextStyle appBarTextStyle = TextStyle(color: Colors.black, fontSize: 24.0); 4 | TextStyle messageTextStyle = TextStyle(color: Colors.black, fontSize: 28.0); 5 | TextStyle titleStyle = TextStyle(color: Colors.black, fontSize: 20.0); 6 | TextStyle searchTextStyle = TextStyle(color: Colors.black, fontSize: 22.0); 7 | TextStyle subTitleStyle = TextStyle(color: Colors.black, fontSize: 14.0); 8 | TextStyle hintStyle = TextStyle(color: Colors.black54, fontSize: 20.0); -------------------------------------------------------------------------------- /lib/widgets/horizontal_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/bloc/player_listing_bloc.dart'; 2 | import 'package:bloc_implementation/bloc/player_listing_events.dart'; 3 | import 'package:bloc_implementation/models/nation.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | 7 | class HorizontalBar extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | height: 80.0, 12 | child: ListView.builder( 13 | itemBuilder: buildItem, 14 | itemCount: nations.length, 15 | scrollDirection: Axis.horizontal, 16 | ), 17 | ); 18 | } 19 | 20 | Widget buildItem(context, index) { 21 | return InkWell( 22 | onTap: () { 23 | BlocProvider.of(context).dispatch( 24 | CountrySelectedEvent(nationModel: nations[index])); 25 | }, 26 | child: Container( 27 | width: 70.0, 28 | height: 70.0, 29 | decoration: BoxDecoration( 30 | shape: BoxShape.circle, 31 | image: DecorationImage( 32 | image: AssetImage(nations[index].imagePath), 33 | ), 34 | ), 35 | margin: EdgeInsets.symmetric(horizontal: 16.0), 36 | ), 37 | ); 38 | } 39 | 40 | Widget buildSeparator(context, index) { 41 | return VerticalDivider( 42 | width: 32.0, 43 | color: Colors.transparent, 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/widgets/message.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/themes/themes.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class Message extends StatelessWidget { 5 | final String message; 6 | 7 | Message({this.message}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Expanded( 12 | child: Center( 13 | child: Text(message, style: messageTextStyle, textAlign: TextAlign.center,), 14 | ), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/widgets/search_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_implementation/bloc/player_listing_bloc.dart'; 2 | import 'package:bloc_implementation/bloc/player_listing_events.dart'; 3 | import 'package:bloc_implementation/themes/themes.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | 7 | class SearchBar extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | margin: EdgeInsets.symmetric(horizontal: 16.0), 12 | decoration: BoxDecoration( 13 | color: Colors.black12, 14 | borderRadius: BorderRadius.all(Radius.circular(20.0)), 15 | ), 16 | child: TextField( 17 | onChanged: (term) { 18 | BlocProvider.of(context) 19 | .dispatch(SearchTextChangedEvent(searchTerm: term)); 20 | }, 21 | style: searchTextStyle, 22 | decoration: InputDecoration( 23 | border: InputBorder.none, 24 | contentPadding: EdgeInsets.symmetric(horizontal: 8.0, vertical: 12.0), 25 | hintStyle: hintStyle, 26 | hintText: 'Search for a player', 27 | prefixIcon: Icon( 28 | Icons.person, 29 | size: 30.0, 30 | color: Colors.black, 31 | ), 32 | ), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: bloc_implementation 2 | description: A flutter project showcasing possibilities of bloc pattern 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | 19 | # The following adds the Cupertino Icons font to your application. 20 | # Use with the CupertinoIcons class for iOS style icons. 21 | cupertino_icons: ^0.1.2 22 | flutter_bloc: ^0.5.4 23 | http: ^0.12.0+1 24 | 25 | dev_dependencies: 26 | flutter_test: 27 | sdk: flutter 28 | 29 | 30 | # For information on the generic Dart part of this file, see the 31 | # following page: https://www.dartlang.org/tools/pub/pubspec 32 | 33 | # The following section is specific to Flutter. 34 | flutter: 35 | 36 | # The following line ensures that the Material Icons font is 37 | # included with your application, so that you can use the icons in 38 | # the material Icons class. 39 | uses-material-design: true 40 | assets: 41 | - images/flags/ 42 | 43 | # To add assets to your application, add an assets section, like this: 44 | # assets: 45 | # - images/a_dot_burr.jpeg 46 | # - images/a_dot_ham.jpeg 47 | 48 | # An image asset can refer to one or more resolution-specific "variants", see 49 | # https://flutter.io/assets-and-images/#resolution-aware. 50 | 51 | # For details regarding adding assets from package dependencies, see 52 | # https://flutter.io/assets-and-images/#from-packages 53 | 54 | # To add custom fonts to your application, add a fonts section here, 55 | # in this "flutter" section. Each entry in this list should have a 56 | # "family" key with the font family name, and a "fonts" key with a 57 | # list giving the asset and other descriptors for the font. For 58 | # example: 59 | # fonts: 60 | # - family: Schyler 61 | # fonts: 62 | # - asset: fonts/Schyler-Regular.ttf 63 | # - asset: fonts/Schyler-Italic.ttf 64 | # style: italic 65 | # - family: Trajan Pro 66 | # fonts: 67 | # - asset: fonts/TrajanPro.ttf 68 | # - asset: fonts/TrajanPro_Bold.ttf 69 | # weight: 700 70 | # 71 | # For details regarding fonts from package dependencies, 72 | # see https://flutter.io/custom-fonts/#from-packages 73 | -------------------------------------------------------------------------------- /screenshots/no_players.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/screenshots/no_players.png -------------------------------------------------------------------------------- /screenshots/searched_players.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/screenshots/searched_players.png -------------------------------------------------------------------------------- /screenshots/state_player_fetched.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/screenshots/state_player_fetched.png -------------------------------------------------------------------------------- /screenshots/state_player_fetching.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/screenshots/state_player_fetching.png -------------------------------------------------------------------------------- /screenshots/state_uninitialized.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TechieBlossom/bloc_implementation/ff7b46a11a07f3993ace950108b64afbbccec65c/screenshots/state_uninitialized.png -------------------------------------------------------------------------------- /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:bloc_implementation/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(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 | --------------------------------------------------------------------------------