├── .github └── workflows │ └── dart.yml ├── .gitignore ├── .metadata ├── README.md ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── xyarim │ │ │ │ └── upsplash_app │ │ │ │ └── MainActivity.kt │ │ └── 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 │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── blocs │ ├── collection_list │ │ ├── bloc.dart │ │ ├── collection_list_bloc.dart │ │ ├── collection_list_event.dart │ │ └── collection_list_state.dart │ ├── photo_detail │ │ ├── bloc.dart │ │ ├── photo_detail_bloc.dart │ │ ├── photo_detail_event.dart │ │ └── photo_detail_state.dart │ └── photo_list │ │ ├── bloc.dart │ │ ├── photo_list_bloc.dart │ │ ├── photo_list_event.dart │ │ └── photo_list_state.dart ├── main.dart ├── models │ ├── CollectionListResponse.dart │ └── PhotoListResponse.dart ├── repository │ ├── collection_repository.dart │ ├── download_repository.dart │ └── photo_repository.dart ├── ui │ ├── app.dart │ ├── pages │ │ ├── home.dart │ │ └── photo_detail.dart │ ├── styles │ │ └── theme.dart │ └── widgets │ │ ├── bottom_loader.dart │ │ ├── collection_list.dart │ │ └── photo_list.dart └── utils │ └── hex_color.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart └── web └── index.html /.github/workflows/dart.yml: -------------------------------------------------------------------------------- 1 | name: Flutter CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - uses: actions/setup-java@v1 12 | with: 13 | java-version: '12.x' 14 | - uses: subosito/flutter-action@v1 15 | with: 16 | flutter-version: '1.12.13+hotfix.8' 17 | - run: flutter pub get 18 | - run: flutter build apk 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Web related 33 | lib/generated_plugin_registrant.dart 34 | 35 | # Exceptions to above rules. 36 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 37 | -------------------------------------------------------------------------------- /.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: ee032f67c734e607d8ea5c870ba744daf4bf56e7 8 | channel: master 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Upsplash 2 | ![Flutter CI](https://github.com/xyarim/upsplash-flutter/workflows/Flutter%20CI/badge.svg) 3 | 4 | Unofficial [Unsplash](https://unsplash.com/) client written using dart and flutter 5 | 6 | ## Sreenshots 7 |
8 |

9 | 10 | 11 | 12 |

13 |
14 | 15 | ## Architecture 16 | Bloc Architecture 17 | 18 | The goal of this pattern is to make it easy to separate presentation from business logic, facilitating testability and reusability. 19 | 20 | 21 | ## Libraries 22 | 23 | ### Architecture 24 | * [flutter_bloc](https://bloclibrary.dev) A predictable state management library that helps implement the BLoC design pattern 25 | 26 | ### Networking 27 | * [dio](https://github.com/flutterchina/dio) A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout etc. 28 | 29 | ### Image utils 30 | * [image_downloader](https://github.com/ko2ic/image_downloader) Flutter plugin that downloads images and movies on the Internet and saves to Photo Library on iOS or specified directory on Android. 31 | * [transparent_image](https://github.com/brianegan/transparent_image) A transparent image in Dart code, represented as a Uint8List. 32 | 33 | ### Permissions 34 | * [permission](https://github.com/once10301/permission) Flutter plugin for getting and requesting permission on Android. 35 | 36 | 37 | ### Reactive functional programming 38 | * [RxDart](https://github.com/ReactiveX/rxdart) RxDart is a reactive functional programming library for Google Dart, based on ReactiveX. 39 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.xyarim.upsplash_app" 42 | minSdkVersion 20 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 10 | 11 | 15 | 22 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/xyarim/upsplash_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.xyarim.upsplash_app 2 | 3 | import android.os.Bundle 4 | import io.flutter.app.FlutterActivity 5 | import io.flutter.plugins.GeneratedPluginRegistrant 6 | 7 | class MainActivity: FlutterActivity() { 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | GeneratedPluginRegistrant.registerWith(this) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /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-5.6.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 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 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 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 18 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 19 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXCopyFilesBuildPhase section */ 23 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 24 | isa = PBXCopyFilesBuildPhase; 25 | buildActionMask = 2147483647; 26 | dstPath = ""; 27 | dstSubfolderSpec = 10; 28 | files = ( 29 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 30 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 31 | ); 32 | name = "Embed Frameworks"; 33 | runOnlyForDeploymentPostprocessing = 0; 34 | }; 35 | /* End PBXCopyFilesBuildPhase section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 39 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 40 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 41 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 42 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 43 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 46 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 47 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 48 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 51 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 52 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 61 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 9740EEB11CF90186004384FC /* Flutter */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 3B80C3931E831B6300D905FE /* App.framework */, 72 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 73 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 75 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 76 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 77 | ); 78 | name = Flutter; 79 | sourceTree = ""; 80 | }; 81 | 97C146E51CF9000F007C117D = { 82 | isa = PBXGroup; 83 | children = ( 84 | 9740EEB11CF90186004384FC /* Flutter */, 85 | 97C146F01CF9000F007C117D /* Runner */, 86 | 97C146EF1CF9000F007C117D /* Products */, 87 | ); 88 | sourceTree = ""; 89 | }; 90 | 97C146EF1CF9000F007C117D /* Products */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 97C146EE1CF9000F007C117D /* Runner.app */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 97C146F01CF9000F007C117D /* Runner */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 102 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 103 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 104 | 97C147021CF9000F007C117D /* Info.plist */, 105 | 97C146F11CF9000F007C117D /* Supporting Files */, 106 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 107 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 108 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 109 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 110 | ); 111 | path = Runner; 112 | sourceTree = ""; 113 | }; 114 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | ); 118 | name = "Supporting Files"; 119 | sourceTree = ""; 120 | }; 121 | /* End PBXGroup section */ 122 | 123 | /* Begin PBXNativeTarget section */ 124 | 97C146ED1CF9000F007C117D /* Runner */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 127 | buildPhases = ( 128 | 9740EEB61CF901F6004384FC /* Run Script */, 129 | 97C146EA1CF9000F007C117D /* Sources */, 130 | 97C146EB1CF9000F007C117D /* Frameworks */, 131 | 97C146EC1CF9000F007C117D /* Resources */, 132 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 133 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 134 | ); 135 | buildRules = ( 136 | ); 137 | dependencies = ( 138 | ); 139 | name = Runner; 140 | productName = Runner; 141 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 142 | productType = "com.apple.product-type.application"; 143 | }; 144 | /* End PBXNativeTarget section */ 145 | 146 | /* Begin PBXProject section */ 147 | 97C146E61CF9000F007C117D /* Project object */ = { 148 | isa = PBXProject; 149 | attributes = { 150 | LastUpgradeCheck = 1020; 151 | ORGANIZATIONNAME = "The Chromium Authors"; 152 | TargetAttributes = { 153 | 97C146ED1CF9000F007C117D = { 154 | CreatedOnToolsVersion = 7.3.1; 155 | LastSwiftMigration = 1100; 156 | }; 157 | }; 158 | }; 159 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 160 | compatibilityVersion = "Xcode 3.2"; 161 | developmentRegion = en; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | Base, 166 | ); 167 | mainGroup = 97C146E51CF9000F007C117D; 168 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 169 | projectDirPath = ""; 170 | projectRoot = ""; 171 | targets = ( 172 | 97C146ED1CF9000F007C117D /* Runner */, 173 | ); 174 | }; 175 | /* End PBXProject section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | 97C146EC1CF9000F007C117D /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 183 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 184 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 185 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXResourcesBuildPhase section */ 190 | 191 | /* Begin PBXShellScriptBuildPhase section */ 192 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 193 | isa = PBXShellScriptBuildPhase; 194 | buildActionMask = 2147483647; 195 | files = ( 196 | ); 197 | inputPaths = ( 198 | ); 199 | name = "Thin Binary"; 200 | outputPaths = ( 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | shellPath = /bin/sh; 204 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 205 | }; 206 | 9740EEB61CF901F6004384FC /* Run Script */ = { 207 | isa = PBXShellScriptBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | inputPaths = ( 212 | ); 213 | name = "Run Script"; 214 | outputPaths = ( 215 | ); 216 | runOnlyForDeploymentPostprocessing = 0; 217 | shellPath = /bin/sh; 218 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 219 | }; 220 | /* End PBXShellScriptBuildPhase section */ 221 | 222 | /* Begin PBXSourcesBuildPhase section */ 223 | 97C146EA1CF9000F007C117D /* Sources */ = { 224 | isa = PBXSourcesBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 228 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXVariantGroup section */ 235 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 236 | isa = PBXVariantGroup; 237 | children = ( 238 | 97C146FB1CF9000F007C117D /* Base */, 239 | ); 240 | name = Main.storyboard; 241 | sourceTree = ""; 242 | }; 243 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 97C147001CF9000F007C117D /* Base */, 247 | ); 248 | name = LaunchScreen.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 255 | isa = XCBuildConfiguration; 256 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 257 | buildSettings = { 258 | ALWAYS_SEARCH_USER_PATHS = NO; 259 | CLANG_ANALYZER_NONNULL = YES; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 265 | CLANG_WARN_BOOL_CONVERSION = YES; 266 | CLANG_WARN_COMMA = YES; 267 | CLANG_WARN_CONSTANT_CONVERSION = YES; 268 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 269 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 270 | CLANG_WARN_EMPTY_BODY = YES; 271 | CLANG_WARN_ENUM_CONVERSION = YES; 272 | CLANG_WARN_INFINITE_RECURSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 275 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 279 | CLANG_WARN_STRICT_PROTOTYPES = YES; 280 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 281 | CLANG_WARN_UNREACHABLE_CODE = YES; 282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 283 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | SUPPORTED_PLATFORMS = iphoneos; 300 | TARGETED_DEVICE_FAMILY = "1,2"; 301 | VALIDATE_PRODUCT = YES; 302 | }; 303 | name = Profile; 304 | }; 305 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 306 | isa = XCBuildConfiguration; 307 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 308 | buildSettings = { 309 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 310 | CLANG_ENABLE_MODULES = YES; 311 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 312 | ENABLE_BITCODE = NO; 313 | FRAMEWORK_SEARCH_PATHS = ( 314 | "$(inherited)", 315 | "$(PROJECT_DIR)/Flutter", 316 | ); 317 | INFOPLIST_FILE = Runner/Info.plist; 318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 319 | LIBRARY_SEARCH_PATHS = ( 320 | "$(inherited)", 321 | "$(PROJECT_DIR)/Flutter", 322 | ); 323 | PRODUCT_BUNDLE_IDENTIFIER = com.xyarim.upsplashApp; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 326 | SWIFT_VERSION = 5.0; 327 | VERSIONING_SYSTEM = "apple-generic"; 328 | }; 329 | name = Profile; 330 | }; 331 | 97C147031CF9000F007C117D /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | CLANG_ANALYZER_NONNULL = YES; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = dwarf; 363 | ENABLE_STRICT_OBJC_MSGSEND = YES; 364 | ENABLE_TESTABILITY = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_DYNAMIC_NO_PIC = NO; 367 | GCC_NO_COMMON_BLOCKS = YES; 368 | GCC_OPTIMIZATION_LEVEL = 0; 369 | GCC_PREPROCESSOR_DEFINITIONS = ( 370 | "DEBUG=1", 371 | "$(inherited)", 372 | ); 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 380 | MTL_ENABLE_DEBUG_INFO = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | TARGETED_DEVICE_FAMILY = "1,2"; 384 | }; 385 | name = Debug; 386 | }; 387 | 97C147041CF9000F007C117D /* Release */ = { 388 | isa = XCBuildConfiguration; 389 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_COMMA = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INFINITE_RECURSION = YES; 406 | CLANG_WARN_INT_CONVERSION = YES; 407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 412 | CLANG_WARN_STRICT_PROTOTYPES = YES; 413 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 417 | COPY_PHASE_STRIP = NO; 418 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 419 | ENABLE_NS_ASSERTIONS = NO; 420 | ENABLE_STRICT_OBJC_MSGSEND = YES; 421 | GCC_C_LANGUAGE_STANDARD = gnu99; 422 | GCC_NO_COMMON_BLOCKS = YES; 423 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 424 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 425 | GCC_WARN_UNDECLARED_SELECTOR = YES; 426 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 427 | GCC_WARN_UNUSED_FUNCTION = YES; 428 | GCC_WARN_UNUSED_VARIABLE = YES; 429 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 430 | MTL_ENABLE_DEBUG_INFO = NO; 431 | SDKROOT = iphoneos; 432 | SUPPORTED_PLATFORMS = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = com.xyarim.upsplashApp; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_VERSION = 5.0; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CLANG_ENABLE_MODULES = YES; 472 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 473 | ENABLE_BITCODE = NO; 474 | FRAMEWORK_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | INFOPLIST_FILE = Runner/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | LIBRARY_SEARCH_PATHS = ( 481 | "$(inherited)", 482 | "$(PROJECT_DIR)/Flutter", 483 | ); 484 | PRODUCT_BUNDLE_IDENTIFIER = com.xyarim.upsplashApp; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 487 | SWIFT_VERSION = 5.0; 488 | VERSIONING_SYSTEM = "apple-generic"; 489 | }; 490 | name = Release; 491 | }; 492 | /* End XCBuildConfiguration section */ 493 | 494 | /* Begin XCConfigurationList section */ 495 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147031CF9000F007C117D /* Debug */, 499 | 97C147041CF9000F007C117D /* Release */, 500 | 249021D3217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 97C147061CF9000F007C117D /* Debug */, 509 | 97C147071CF9000F007C117D /* Release */, 510 | 249021D4217E4FDB00AE95B9 /* Profile */, 511 | ); 512 | defaultConfigurationIsVisible = 0; 513 | defaultConfigurationName = Release; 514 | }; 515 | /* End XCConfigurationList section */ 516 | }; 517 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 518 | } 519 | -------------------------------------------------------------------------------- /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 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyarim/upsplash-flutter/8eca43b6cc1e9a165b0d4367937cca422d0cce2d/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 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | upsplash_app 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/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /lib/blocs/collection_list/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'collection_list_bloc.dart'; 2 | export 'collection_list_event.dart'; 3 | export 'collection_list_state.dart'; 4 | -------------------------------------------------------------------------------- /lib/blocs/collection_list/collection_list_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:rxdart/rxdart.dart'; 5 | import 'package:upsplash_app/repository/collection_repository.dart'; 6 | 7 | import './bloc.dart'; 8 | 9 | class CollectionListBloc 10 | extends Bloc { 11 | final CollectionRepository _repository; 12 | 13 | CollectionListBloc(this._repository); 14 | 15 | @override 16 | CollectionListState get initialState => InitialCollectionListState(); 17 | 18 | @override 19 | Stream transformEvents( 20 | Stream events, 21 | Stream Function(CollectionListEvent event) next, 22 | ) { 23 | return super.transformEvents( 24 | (events as Observable).debounceTime( 25 | Duration(milliseconds: 500), 26 | ), 27 | next, 28 | ); 29 | } 30 | 31 | @override 32 | Stream mapEventToState( 33 | CollectionListEvent event, 34 | ) async* { 35 | final currentState = state; 36 | if (event is FetchEvent) { 37 | try { 38 | if (currentState is InitialCollectionListState) { 39 | final collections = await _repository.getCollections(0); 40 | yield CollectionListLoaded(collections, 0); 41 | } else if (currentState is CollectionListLoaded) { 42 | var fetchPage = currentState.page + 1; 43 | final collections = await _repository.getCollections(fetchPage); 44 | 45 | yield collections.isEmpty 46 | ? currentState.copyWith(collections, fetchPage) 47 | : CollectionListLoaded( 48 | currentState.collections + collections, fetchPage); 49 | } 50 | } catch (error, stacktrace) { 51 | yield CollectionListError(); 52 | print(error); 53 | print(stacktrace); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/blocs/collection_list/collection_list_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | 3 | @immutable 4 | abstract class CollectionListEvent {} 5 | 6 | class FetchEvent extends CollectionListEvent {} 7 | -------------------------------------------------------------------------------- /lib/blocs/collection_list/collection_list_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | import 'package:upsplash_app/models/CollectionListResponse.dart'; 3 | 4 | @immutable 5 | abstract class CollectionListState {} 6 | 7 | class InitialCollectionListState extends CollectionListState {} 8 | 9 | class CollectionListError extends CollectionListState {} 10 | 11 | class CollectionListLoaded extends CollectionListState { 12 | final List collections; 13 | final int page; 14 | 15 | CollectionListLoaded(this.collections, this.page); 16 | 17 | CollectionListLoaded copyWith(List collections, page) { 18 | return CollectionListLoaded(collections, page); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/blocs/photo_detail/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'photo_detail_bloc.dart'; 2 | export 'photo_detail_event.dart'; 3 | export 'photo_detail_state.dart'; -------------------------------------------------------------------------------- /lib/blocs/photo_detail/photo_detail_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:upsplash_app/models/PhotoListResponse.dart'; 5 | import 'package:upsplash_app/repository/download_repository.dart'; 6 | 7 | import './bloc.dart'; 8 | 9 | class PhotoDetailBloc extends Bloc { 10 | final PhotoListBean _photoListBean; 11 | final DownloadRepository downloadRepository = UpshplashDownloadRepository(); 12 | 13 | PhotoDetailBloc(this._photoListBean); 14 | 15 | @override 16 | PhotoDetailState get initialState => InitialPhotoDetailState(); 17 | 18 | @override 19 | Stream mapEventToState( 20 | PhotoDetailEvent event, 21 | ) async* { 22 | final currentState = state; 23 | if (event is DownloadImageEvent && !(currentState is DownloadingState)) { 24 | yield* _mapDownloadToState(); 25 | } 26 | } 27 | 28 | Stream _mapDownloadToState() async* { 29 | try { 30 | yield DownloadingState(); 31 | await downloadRepository.downloadImage(_photoListBean); 32 | yield DownloadedState(); 33 | } catch (error, stacktrace) { 34 | print(error); 35 | print(stacktrace); 36 | yield ErrorDownloadingState(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/blocs/photo_detail/photo_detail_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | 3 | @immutable 4 | abstract class PhotoDetailEvent {} 5 | 6 | class DownloadImageEvent extends PhotoDetailEvent {} 7 | 8 | -------------------------------------------------------------------------------- /lib/blocs/photo_detail/photo_detail_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:meta/meta.dart'; 2 | 3 | @immutable 4 | abstract class PhotoDetailState {} 5 | 6 | class InitialPhotoDetailState extends PhotoDetailState {} 7 | 8 | class DownloadingState extends PhotoDetailState {} 9 | 10 | class DownloadedState extends PhotoDetailState {} 11 | 12 | class ErrorDownloadingState extends PhotoDetailState {} 13 | -------------------------------------------------------------------------------- /lib/blocs/photo_list/bloc.dart: -------------------------------------------------------------------------------- 1 | export 'photo_list_bloc.dart'; 2 | export 'photo_list_event.dart'; 3 | export 'photo_list_state.dart'; -------------------------------------------------------------------------------- /lib/blocs/photo_list/photo_list_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bloc/bloc.dart'; 4 | import 'package:rxdart/rxdart.dart'; 5 | import 'package:upsplash_app/repository/photo_repository.dart'; 6 | 7 | import './bloc.dart'; 8 | 9 | class PhotoListBloc extends Bloc { 10 | final PhotoRepository photoRepository; 11 | 12 | PhotoListBloc(this.photoRepository); 13 | 14 | @override 15 | PhotoListState get initialState => InitialPhotoListState(); 16 | 17 | @override 18 | Stream transformEvents( 19 | Stream events, 20 | Stream Function(PhotoListEvent event) next, 21 | ) { 22 | return super.transformEvents( 23 | (events as Observable).debounceTime( 24 | Duration(milliseconds: 500), 25 | ), 26 | next, 27 | ); 28 | } 29 | 30 | @override 31 | Stream mapEventToState( 32 | PhotoListEvent event, 33 | ) async* { 34 | final currentState = state; 35 | if (event is FetchEvent) { 36 | try { 37 | if (currentState is InitialPhotoListState) { 38 | final photos = await photoRepository.getPhotos(0); 39 | yield PhotoListLoaded(photos, 0); 40 | } else if (currentState is PhotoListLoaded) { 41 | int currentPage = currentState.page; 42 | final photos = 43 | await photoRepository.getPhotos(currentPage++); 44 | print("current_page = $currentPage"); 45 | yield photos.isEmpty 46 | ? currentState.copyWith(photos) 47 | : PhotoListLoaded(currentState.photos + photos, currentPage); 48 | } 49 | } catch (error, stacktrace) { 50 | yield PhotoListError(); 51 | print(error); 52 | print(stacktrace); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/blocs/photo_list/photo_list_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class PhotoListEvent extends Equatable { 4 | const PhotoListEvent(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class FetchEvent extends PhotoListEvent {} 11 | -------------------------------------------------------------------------------- /lib/blocs/photo_list/photo_list_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:upsplash_app/models/PhotoListResponse.dart'; 2 | 3 | abstract class PhotoListState { 4 | const PhotoListState(); 5 | } 6 | 7 | class InitialPhotoListState extends PhotoListState {} 8 | 9 | class PhotoListError extends PhotoListState {} 10 | 11 | class PhotoListLoaded extends PhotoListState { 12 | final List photos; 13 | final int page; 14 | 15 | PhotoListLoaded(this.photos, this.page); 16 | 17 | PhotoListLoaded copyWith(List photos) { 18 | return PhotoListLoaded(photos, page); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:upsplash_app/ui/app.dart'; 4 | 5 | void main() { 6 | SystemChrome.setSystemUIOverlayStyle( 7 | SystemUiOverlayStyle(statusBarColor: Colors.white)); 8 | runApp(MyApp()); 9 | } 10 | -------------------------------------------------------------------------------- /lib/models/CollectionListResponse.dart: -------------------------------------------------------------------------------- 1 | import 'package:upsplash_app/models/PhotoListResponse.dart'; 2 | 3 | class CollectionListResponse { 4 | final List results; 5 | 6 | CollectionListResponse(this.results); 7 | 8 | CollectionListResponse.fromJsonArray(List json) 9 | : results = json.map((i) => new CollectionListItem.fromJson(i)).toList(); 10 | } 11 | 12 | class CollectionListItem { 13 | String title; 14 | String description; 15 | String publishedAt; 16 | String updatedAt; 17 | String shareKey; 18 | bool private; 19 | int id; 20 | int totalPhotos; 21 | CoverPhotoBean coverPhoto; 22 | LinksBean links; 23 | UserBean user; 24 | 25 | CollectionListItem( 26 | {this.title, 27 | this.description, 28 | this.publishedAt, 29 | this.updatedAt, 30 | this.shareKey, 31 | this.private, 32 | this.id, 33 | this.totalPhotos, 34 | this.coverPhoto, 35 | this.links, 36 | this.user}); 37 | 38 | CollectionListItem.fromJson(Map json) { 39 | this.title = json['title']; 40 | this.description = json['description']; 41 | this.publishedAt = json['published_at']; 42 | this.updatedAt = json['updated_at']; 43 | this.shareKey = json['share_key']; 44 | this.private = json['private']; 45 | this.id = json['id']; 46 | this.totalPhotos = json['total_photos']; 47 | this.coverPhoto = json['cover_photo'] != null 48 | ? CoverPhotoBean.fromJson(json['cover_photo']) 49 | : null; 50 | this.links = 51 | json['links'] != null ? LinksBean.fromJson(json['links']) : null; 52 | this.user = json['user'] != null ? UserBean.fromJson(json['user']) : null; 53 | } 54 | 55 | Map toJson() { 56 | final Map data = new Map(); 57 | data['title'] = this.title; 58 | data['description'] = this.description; 59 | data['published_at'] = this.publishedAt; 60 | data['updated_at'] = this.updatedAt; 61 | data['share_key'] = this.shareKey; 62 | data['private'] = this.private; 63 | data['id'] = this.id; 64 | data['total_photos'] = this.totalPhotos; 65 | if (this.coverPhoto != null) { 66 | data['cover_photo'] = this.coverPhoto.toJson(); 67 | } 68 | if (this.links != null) { 69 | data['links'] = this.links.toJson(); 70 | } 71 | if (this.user != null) { 72 | data['user'] = this.user.toJson(); 73 | } 74 | return data; 75 | } 76 | } 77 | 78 | class CoverPhotoBean { 79 | String id; 80 | String color; 81 | String description; 82 | bool likedByUser; 83 | int width; 84 | int height; 85 | int likes; 86 | LinksBean links; 87 | UrlsBean urls; 88 | UserBean user; 89 | 90 | CoverPhotoBean( 91 | {this.id, 92 | this.color, 93 | this.description, 94 | this.likedByUser, 95 | this.width, 96 | this.height, 97 | this.likes, 98 | this.links, 99 | this.urls, 100 | this.user}); 101 | 102 | CoverPhotoBean.fromJson(Map json) { 103 | this.id = json['id']; 104 | this.color = json['color']; 105 | this.description = json['description']; 106 | this.likedByUser = json['liked_by_user']; 107 | this.width = json['width']; 108 | this.height = json['height']; 109 | this.likes = json['likes']; 110 | this.links = 111 | json['links'] != null ? LinksBean.fromJson(json['links']) : null; 112 | this.urls = json['urls'] != null ? UrlsBean.fromJson(json['urls']) : null; 113 | this.user = json['user'] != null ? UserBean.fromJson(json['user']) : null; 114 | } 115 | 116 | Map toJson() { 117 | final Map data = new Map(); 118 | data['id'] = this.id; 119 | data['color'] = this.color; 120 | data['description'] = this.description; 121 | data['liked_by_user'] = this.likedByUser; 122 | data['width'] = this.width; 123 | data['height'] = this.height; 124 | data['likes'] = this.likes; 125 | if (this.links != null) { 126 | data['links'] = this.links.toJson(); 127 | } 128 | if (this.urls != null) { 129 | data['urls'] = this.urls.toJson(); 130 | } 131 | if (this.user != null) { 132 | data['user'] = this.user.toJson(); 133 | } 134 | return data; 135 | } 136 | } 137 | 138 | class LinksBean { 139 | String self; 140 | String html; 141 | String photos; 142 | String likes; 143 | String portfolio; 144 | 145 | LinksBean({this.self, this.html, this.photos, this.likes, this.portfolio}); 146 | 147 | LinksBean.fromJson(Map json) { 148 | this.self = json['self']; 149 | this.html = json['html']; 150 | this.photos = json['photos']; 151 | this.likes = json['likes']; 152 | this.portfolio = json['portfolio']; 153 | } 154 | 155 | Map toJson() { 156 | final Map data = new Map(); 157 | data['self'] = this.self; 158 | data['html'] = this.html; 159 | data['photos'] = this.photos; 160 | data['likes'] = this.likes; 161 | data['portfolio'] = this.portfolio; 162 | return data; 163 | } 164 | } 165 | 166 | class UserBean { 167 | String id; 168 | String username; 169 | String name; 170 | String portfolioUrl; 171 | String bio; 172 | String location; 173 | int totalLikes; 174 | int totalPhotos; 175 | int totalCollections; 176 | LinksBean links; 177 | ProfileImageBean profileImage; 178 | 179 | UserBean( 180 | {this.id, 181 | this.username, 182 | this.name, 183 | this.portfolioUrl, 184 | this.bio, 185 | this.location, 186 | this.totalLikes, 187 | this.totalPhotos, 188 | this.totalCollections, 189 | this.links, 190 | this.profileImage}); 191 | 192 | UserBean.fromJson(Map json) { 193 | this.id = json['id']; 194 | this.username = json['username']; 195 | this.name = json['name']; 196 | this.portfolioUrl = json['portfolio_url']; 197 | this.bio = json['bio']; 198 | this.location = json['location']; 199 | this.totalLikes = json['total_likes']; 200 | this.totalPhotos = json['total_photos']; 201 | this.totalCollections = json['total_collections']; 202 | this.links = 203 | json['links'] != null ? LinksBean.fromJson(json['links']) : null; 204 | this.profileImage = json['profile_image'] != null 205 | ? ProfileImageBean.fromJson(json['profile_image']) 206 | : null; 207 | } 208 | 209 | Map toJson() { 210 | final Map data = new Map(); 211 | data['id'] = this.id; 212 | data['username'] = this.username; 213 | data['name'] = this.name; 214 | data['portfolio_url'] = this.portfolioUrl; 215 | data['bio'] = this.bio; 216 | data['location'] = this.location; 217 | data['total_likes'] = this.totalLikes; 218 | data['total_photos'] = this.totalPhotos; 219 | data['total_collections'] = this.totalCollections; 220 | if (this.links != null) { 221 | data['links'] = this.links.toJson(); 222 | } 223 | if (this.profileImage != null) { 224 | data['profile_image'] = this.profileImage.toJson(); 225 | } 226 | return data; 227 | } 228 | } 229 | 230 | class ProfileImageBean { 231 | String small; 232 | String medium; 233 | String large; 234 | 235 | ProfileImageBean({this.small, this.medium, this.large}); 236 | 237 | ProfileImageBean.fromJson(Map json) { 238 | this.small = json['small']; 239 | this.medium = json['medium']; 240 | this.large = json['large']; 241 | } 242 | 243 | Map toJson() { 244 | final Map data = new Map(); 245 | data['small'] = this.small; 246 | data['medium'] = this.medium; 247 | data['large'] = this.large; 248 | return data; 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /lib/models/PhotoListResponse.dart: -------------------------------------------------------------------------------- 1 | class PhotoListResponse { 2 | final List results; 3 | 4 | PhotoListResponse(this.results); 5 | 6 | PhotoListResponse.fromJsonArray(List json) 7 | : results = json.map((i) => new PhotoListBean.fromJson(i)).toList(); 8 | } 9 | 10 | class PhotoListBean { 11 | String id; 12 | String createdAt; 13 | String updatedAt; 14 | String color; 15 | String altDescription; 16 | bool likedByUser; 17 | int width; 18 | int height; 19 | int likes; 20 | LinksBean links; 21 | SponsorshipBean sponsorship; 22 | UrlsBean urls; 23 | UserBean user; 24 | 25 | PhotoListBean( 26 | {this.id, 27 | this.createdAt, 28 | this.updatedAt, 29 | this.color, 30 | this.altDescription, 31 | this.likedByUser, 32 | this.width, 33 | this.height, 34 | this.likes, 35 | this.links, 36 | this.sponsorship, 37 | this.urls, 38 | this.user}); 39 | 40 | PhotoListBean.fromJson(Map json) { 41 | this.id = json['id']; 42 | this.createdAt = json['created_at']; 43 | this.updatedAt = json['updated_at']; 44 | this.color = json['color']; 45 | this.altDescription = json['alt_description']; 46 | this.likedByUser = json['liked_by_user']; 47 | this.width = json['width']; 48 | this.height = json['height']; 49 | this.likes = json['likes']; 50 | this.links = 51 | json['links'] != null ? LinksBean.fromJson(json['links']) : null; 52 | this.sponsorship = json['sponsorship'] != null 53 | ? SponsorshipBean.fromJson(json['sponsorship']) 54 | : null; 55 | this.urls = json['urls'] != null ? UrlsBean.fromJson(json['urls']) : null; 56 | this.user = json['user'] != null ? UserBean.fromJson(json['user']) : null; 57 | } 58 | 59 | Map toJson() { 60 | final Map data = new Map(); 61 | data['id'] = this.id; 62 | data['created_at'] = this.createdAt; 63 | data['updated_at'] = this.updatedAt; 64 | data['color'] = this.color; 65 | data['alt_description'] = this.altDescription; 66 | data['liked_by_user'] = this.likedByUser; 67 | data['width'] = this.width; 68 | data['height'] = this.height; 69 | data['likes'] = this.likes; 70 | if (this.links != null) { 71 | data['links'] = this.links.toJson(); 72 | } 73 | if (this.sponsorship != null) { 74 | data['sponsorship'] = this.sponsorship.toJson(); 75 | } 76 | if (this.urls != null) { 77 | data['urls'] = this.urls.toJson(); 78 | } 79 | if (this.user != null) { 80 | data['user'] = this.user.toJson(); 81 | } 82 | return data; 83 | } 84 | } 85 | 86 | class LinksBean { 87 | String self; 88 | String html; 89 | String photos; 90 | String likes; 91 | String portfolio; 92 | String following; 93 | String followers; 94 | 95 | LinksBean( 96 | {this.self, 97 | this.html, 98 | this.photos, 99 | this.likes, 100 | this.portfolio, 101 | this.following, 102 | this.followers}); 103 | 104 | LinksBean.fromJson(Map json) { 105 | this.self = json['self']; 106 | this.html = json['html']; 107 | this.photos = json['photos']; 108 | this.likes = json['likes']; 109 | this.portfolio = json['portfolio']; 110 | this.following = json['following']; 111 | this.followers = json['followers']; 112 | } 113 | 114 | Map toJson() { 115 | final Map data = new Map(); 116 | data['self'] = this.self; 117 | data['html'] = this.html; 118 | data['photos'] = this.photos; 119 | data['likes'] = this.likes; 120 | data['portfolio'] = this.portfolio; 121 | data['following'] = this.following; 122 | data['followers'] = this.followers; 123 | return data; 124 | } 125 | } 126 | 127 | class SponsorshipBean { 128 | String impressionsId; 129 | String tagline; 130 | SponsorBean sponsor; 131 | List impressionUrls; 132 | 133 | SponsorshipBean( 134 | {this.impressionsId, this.tagline, this.sponsor, this.impressionUrls}); 135 | 136 | SponsorshipBean.fromJson(Map json) { 137 | this.impressionsId = json['impressions_id']; 138 | this.tagline = json['tagline']; 139 | this.sponsor = 140 | json['sponsor'] != null ? SponsorBean.fromJson(json['sponsor']) : null; 141 | 142 | List impressionUrlsList = json['impression_urls']; 143 | this.impressionUrls = new List(); 144 | this.impressionUrls.addAll(impressionUrlsList.map((o) => o.toString())); 145 | } 146 | 147 | Map toJson() { 148 | final Map data = new Map(); 149 | data['impressions_id'] = this.impressionsId; 150 | data['tagline'] = this.tagline; 151 | if (this.sponsor != null) { 152 | data['sponsor'] = this.sponsor.toJson(); 153 | } 154 | data['impression_urls'] = this.impressionUrls; 155 | return data; 156 | } 157 | } 158 | 159 | class UrlsBean { 160 | String raw; 161 | String full; 162 | String regular; 163 | String small; 164 | String thumb; 165 | 166 | UrlsBean({this.raw, this.full, this.regular, this.small, this.thumb}); 167 | 168 | UrlsBean.fromJson(Map json) { 169 | this.raw = json['raw']; 170 | this.full = json['full']; 171 | this.regular = json['regular']; 172 | this.small = json['small']; 173 | this.thumb = json['thumb']; 174 | } 175 | 176 | Map toJson() { 177 | final Map data = new Map(); 178 | data['raw'] = this.raw; 179 | data['full'] = this.full; 180 | data['regular'] = this.regular; 181 | data['small'] = this.small; 182 | data['thumb'] = this.thumb; 183 | return data; 184 | } 185 | } 186 | 187 | class UserBean { 188 | String id; 189 | String updatedAt; 190 | String username; 191 | String name; 192 | String firstName; 193 | String lastName; 194 | String twitterUsername; 195 | String portfolioUrl; 196 | String bio; 197 | String instagramUsername; 198 | bool acceptedTos; 199 | int totalCollections; 200 | int totalLikes; 201 | int totalPhotos; 202 | LinksBean links; 203 | ProfileImageBean profileImage; 204 | 205 | UserBean( 206 | {this.id, 207 | this.updatedAt, 208 | this.username, 209 | this.name, 210 | this.firstName, 211 | this.lastName, 212 | this.twitterUsername, 213 | this.portfolioUrl, 214 | this.bio, 215 | this.instagramUsername, 216 | this.acceptedTos, 217 | this.totalCollections, 218 | this.totalLikes, 219 | this.totalPhotos, 220 | this.links, 221 | this.profileImage}); 222 | 223 | UserBean.fromJson(Map json) { 224 | this.id = json['id']; 225 | this.updatedAt = json['updated_at']; 226 | this.username = json['username']; 227 | this.name = json['name']; 228 | this.firstName = json['first_name']; 229 | this.lastName = json['last_name']; 230 | this.twitterUsername = json['twitter_username']; 231 | this.portfolioUrl = json['portfolio_url']; 232 | this.bio = json['bio']; 233 | this.instagramUsername = json['instagram_username']; 234 | this.acceptedTos = json['accepted_tos']; 235 | this.totalCollections = json['total_collections']; 236 | this.totalLikes = json['total_likes']; 237 | this.totalPhotos = json['total_photos']; 238 | this.links = 239 | json['links'] != null ? LinksBean.fromJson(json['links']) : null; 240 | this.profileImage = json['profile_image'] != null 241 | ? ProfileImageBean.fromJson(json['profile_image']) 242 | : null; 243 | } 244 | 245 | Map toJson() { 246 | final Map data = new Map(); 247 | data['id'] = this.id; 248 | data['updated_at'] = this.updatedAt; 249 | data['username'] = this.username; 250 | data['name'] = this.name; 251 | data['first_name'] = this.firstName; 252 | data['last_name'] = this.lastName; 253 | data['twitter_username'] = this.twitterUsername; 254 | data['portfolio_url'] = this.portfolioUrl; 255 | data['bio'] = this.bio; 256 | data['instagram_username'] = this.instagramUsername; 257 | data['accepted_tos'] = this.acceptedTos; 258 | data['total_collections'] = this.totalCollections; 259 | data['total_likes'] = this.totalLikes; 260 | data['total_photos'] = this.totalPhotos; 261 | if (this.links != null) { 262 | data['links'] = this.links.toJson(); 263 | } 264 | if (this.profileImage != null) { 265 | data['profile_image'] = this.profileImage.toJson(); 266 | } 267 | return data; 268 | } 269 | } 270 | 271 | class SponsorBean { 272 | String id; 273 | String updatedAt; 274 | String username; 275 | String name; 276 | String firstName; 277 | String lastName; 278 | String twitterUsername; 279 | String portfolioUrl; 280 | String bio; 281 | String instagramUsername; 282 | bool acceptedTos; 283 | int totalCollections; 284 | int totalLikes; 285 | int totalPhotos; 286 | LinksBean links; 287 | ProfileImageBean profileImage; 288 | 289 | SponsorBean( 290 | {this.id, 291 | this.updatedAt, 292 | this.username, 293 | this.name, 294 | this.firstName, 295 | this.lastName, 296 | this.twitterUsername, 297 | this.portfolioUrl, 298 | this.bio, 299 | this.instagramUsername, 300 | this.acceptedTos, 301 | this.totalCollections, 302 | this.totalLikes, 303 | this.totalPhotos, 304 | this.links, 305 | this.profileImage}); 306 | 307 | SponsorBean.fromJson(Map json) { 308 | this.id = json['id']; 309 | this.updatedAt = json['updated_at']; 310 | this.username = json['username']; 311 | this.name = json['name']; 312 | this.firstName = json['first_name']; 313 | this.lastName = json['last_name']; 314 | this.twitterUsername = json['twitter_username']; 315 | this.portfolioUrl = json['portfolio_url']; 316 | this.bio = json['bio']; 317 | this.instagramUsername = json['instagram_username']; 318 | this.acceptedTos = json['accepted_tos']; 319 | this.totalCollections = json['total_collections']; 320 | this.totalLikes = json['total_likes']; 321 | this.totalPhotos = json['total_photos']; 322 | this.links = 323 | json['links'] != null ? LinksBean.fromJson(json['links']) : null; 324 | this.profileImage = json['profile_image'] != null 325 | ? ProfileImageBean.fromJson(json['profile_image']) 326 | : null; 327 | } 328 | 329 | Map toJson() { 330 | final Map data = new Map(); 331 | data['id'] = this.id; 332 | data['updated_at'] = this.updatedAt; 333 | data['username'] = this.username; 334 | data['name'] = this.name; 335 | data['first_name'] = this.firstName; 336 | data['last_name'] = this.lastName; 337 | data['twitter_username'] = this.twitterUsername; 338 | data['portfolio_url'] = this.portfolioUrl; 339 | data['bio'] = this.bio; 340 | data['instagram_username'] = this.instagramUsername; 341 | data['accepted_tos'] = this.acceptedTos; 342 | data['total_collections'] = this.totalCollections; 343 | data['total_likes'] = this.totalLikes; 344 | data['total_photos'] = this.totalPhotos; 345 | if (this.links != null) { 346 | data['links'] = this.links.toJson(); 347 | } 348 | if (this.profileImage != null) { 349 | data['profile_image'] = this.profileImage.toJson(); 350 | } 351 | return data; 352 | } 353 | } 354 | 355 | class ProfileImageBean { 356 | String small; 357 | String medium; 358 | String large; 359 | 360 | ProfileImageBean({this.small, this.medium, this.large}); 361 | 362 | ProfileImageBean.fromJson(Map json) { 363 | this.small = json['small']; 364 | this.medium = json['medium']; 365 | this.large = json['large']; 366 | } 367 | 368 | Map toJson() { 369 | final Map data = new Map(); 370 | data['small'] = this.small; 371 | data['medium'] = this.medium; 372 | data['large'] = this.large; 373 | return data; 374 | } 375 | } 376 | -------------------------------------------------------------------------------- /lib/repository/collection_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:upsplash_app/models/CollectionListResponse.dart'; 3 | 4 | abstract class CollectionRepository { 5 | Future> getCollections(int page); 6 | } 7 | 8 | class MainCollectionRepository extends CollectionRepository { 9 | @override 10 | Future> getCollections(int page) async { 11 | Response response = await Dio().get( 12 | "https://api.unsplash.com/collections/?client_id=e2658d4b6b17ae24b50a7ab36d13ca67da9761322a5e4cb0e9cc531e69cecb90&page=$page"); 13 | 14 | List list = 15 | CollectionListResponse.fromJsonArray(response.data).results; 16 | print(list.length); 17 | return list; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/repository/download_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:image_downloader/image_downloader.dart'; 2 | import 'package:upsplash_app/models/PhotoListResponse.dart'; 3 | 4 | abstract class DownloadRepository { 5 | Future downloadImage(PhotoListBean photoListBean); 6 | } 7 | 8 | class UpshplashDownloadRepository implements DownloadRepository { 9 | @override 10 | downloadImage(PhotoListBean photoListBean) async { 11 | await ImageDownloader.downloadImage( 12 | photoListBean.urls.raw, 13 | destination: AndroidDestinationType.custom( 14 | directory: "upsplash", 15 | )..subDirectory("${photoListBean.id}.jpg"), 16 | ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/repository/photo_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:upsplash_app/models/PhotoListResponse.dart'; 3 | 4 | abstract class PhotoRepository { 5 | Future> getPhotos(int page); 6 | } 7 | 8 | class MainPhotoRepository implements PhotoRepository { 9 | @override 10 | Future> getPhotos(int page) async { 11 | try { 12 | Response response = await Dio().get( 13 | "https://api.unsplash.com/photos/?client_id=e2658d4b6b17ae24b50a7ab36d13ca67da9761322a5e4cb0e9cc531e69cecb90&page=$page"); 14 | 15 | List list = 16 | PhotoListResponse.fromJsonArray(response.data).results; 17 | list.forEach((value){ 18 | print(value.color); 19 | }); 20 | print(list.length); 21 | return list; 22 | } catch (error, stacktrace) { 23 | print(error); 24 | print(stacktrace); 25 | return null; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/ui/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:upsplash_app/ui/pages/home.dart'; 3 | import 'package:upsplash_app/ui/pages/photo_detail.dart'; 4 | import 'package:upsplash_app/ui/styles/theme.dart'; 5 | 6 | class MyApp extends StatelessWidget { 7 | // This widget is the root of your application. 8 | @override 9 | Widget build(BuildContext context) { 10 | return MaterialApp( 11 | title: 'Flutter Demo', 12 | theme: mainTheme, 13 | debugShowCheckedModeBanner: false, 14 | initialRoute: HomePage.routeName, 15 | routes: { 16 | HomePage.routeName: (context) => HomePage(), 17 | PhotoDetailPage.routeName: (context) => PhotoDetailPage(), 18 | }, 19 | ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/ui/pages/home.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:upsplash_app/repository/photo_repository.dart'; 4 | import 'package:upsplash_app/ui/widgets/collection_list.dart'; 5 | import 'package:upsplash_app/ui/widgets/photo_list.dart'; 6 | 7 | class HomePage extends StatelessWidget { 8 | static final routeName = "homePage"; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return DefaultTabController( 13 | length: 2, 14 | child: Scaffold( 15 | appBar: AppBar( 16 | title: Text("Upsplash"), 17 | bottom: TabBar( 18 | tabs: [ 19 | Tab( 20 | text: "Home", 21 | ), 22 | Tab( 23 | text: "Collections", 24 | ) 25 | ], 26 | ), 27 | ), 28 | body: TabBarView( 29 | children: [ 30 | PhotoListWidget(MainPhotoRepository()), 31 | CollectionListWidget() 32 | ], 33 | ), 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/ui/pages/photo_detail.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:permission/permission.dart'; 5 | import 'package:upsplash_app/blocs/photo_detail/bloc.dart'; 6 | import 'package:upsplash_app/models/PhotoListResponse.dart'; 7 | 8 | class PhotoDetailPageArguments { 9 | final PhotoListBean photoListBean; 10 | 11 | PhotoDetailPageArguments(this.photoListBean); 12 | } 13 | 14 | class PhotoDetailPage extends StatelessWidget { 15 | static final routeName = "photoDetailPage"; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | PhotoDetailPageArguments args = ModalRoute.of(context).settings.arguments; 20 | return BlocProvider( 21 | create: (context) => PhotoDetailBloc(args.photoListBean), 22 | child: PhotoDetailWidget( 23 | photoListBean: args.photoListBean, 24 | ), 25 | ); 26 | } 27 | } 28 | 29 | class PhotoDetailWidget extends StatefulWidget { 30 | final PhotoListBean photoListBean; 31 | 32 | const PhotoDetailWidget({Key key, this.photoListBean}) : super(key: key); 33 | 34 | @override 35 | State createState() { 36 | return PhotoDetailWidgetState(); 37 | } 38 | } 39 | 40 | class PhotoDetailWidgetState extends State { 41 | PhotoDetailBloc _bloc; 42 | 43 | @override 44 | void initState() { 45 | _bloc = BlocProvider.of(context); 46 | super.initState(); 47 | } 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | return BlocBuilder( 52 | builder: (context, state) { 53 | return Scaffold( 54 | appBar: AppBar( 55 | title: Text(widget.photoListBean.user.name), 56 | ), 57 | body: Hero( 58 | tag: "photo${widget.photoListBean.id}", 59 | child: Image.network(widget.photoListBean.urls.regular), 60 | ), 61 | floatingActionButton: FloatingActionButton( 62 | onPressed: () async { 63 | _onSavePressed(); 64 | }, 65 | child: (state is DownloadingState) 66 | ? _buildLoading() 67 | : Icon(Icons.file_download,color: Colors.white,))); 68 | }); 69 | } 70 | 71 | Future _checkPermission() async { 72 | var permissions = await Permission.getPermissionsStatus([ 73 | PermissionName.Storage, 74 | ]); 75 | return permissions[0].permissionStatus == PermissionStatus.allow; 76 | } 77 | 78 | _onSavePressed() async { 79 | if (await _checkPermission()) { 80 | _bloc.add(DownloadImageEvent()); 81 | } else { 82 | await _requestPermission(); 83 | _onSavePressed(); 84 | } 85 | } 86 | 87 | _requestPermission() async { 88 | var permissionNames = 89 | await Permission.requestPermissions([PermissionName.Storage]); 90 | } 91 | 92 | _buildLoading() { 93 | return CircularProgressIndicator( 94 | valueColor: AlwaysStoppedAnimation(Colors.white), 95 | ); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /lib/ui/styles/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | final mainTheme = ThemeData( 4 | fontFamily: 'Roboto', 5 | scaffoldBackgroundColor: Colors.white, 6 | primarySwatch: Colors.grey, 7 | appBarTheme: AppBarTheme( 8 | brightness: Brightness.light, 9 | iconTheme: IconThemeData(color: Colors.black87), 10 | actionsIconTheme: IconThemeData(color: Colors.black87), 11 | color: Colors.white, 12 | textTheme: TextTheme( 13 | title: TextStyle(color: Colors.black87, fontSize: 18), 14 | button: TextStyle(color: Colors.black87), 15 | ))); 16 | -------------------------------------------------------------------------------- /lib/ui/widgets/bottom_loader.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class BottomLoader extends StatelessWidget { 4 | @override 5 | Widget build(BuildContext context) { 6 | return Container( 7 | alignment: Alignment.center, 8 | child: Center( 9 | child: SizedBox( 10 | width: 50, 11 | height: 50, 12 | child: Center(child: CircularProgressIndicator()), 13 | ), 14 | ), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/ui/widgets/collection_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:upsplash_app/blocs/collection_list/bloc.dart'; 5 | import 'package:upsplash_app/repository/collection_repository.dart'; 6 | import 'package:upsplash_app/ui/widgets/bottom_loader.dart'; 7 | 8 | class CollectionListWidget extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) => BlocProvider( 11 | create: (context) => CollectionListBloc(MainCollectionRepository()), 12 | child: _CollectionListWidget()); 13 | } 14 | 15 | class _CollectionListWidget extends StatefulWidget { 16 | @override 17 | State createState() => _CollectionListState(); 18 | } 19 | 20 | class _CollectionListState extends State<_CollectionListWidget> 21 | with AutomaticKeepAliveClientMixin { 22 | CollectionListBloc _bloc; 23 | final _scrollController = ScrollController(); 24 | final _scrollThreshold = 200.0; 25 | 26 | @override 27 | void initState() { 28 | _scrollController.addListener(_onScroll); 29 | _bloc = BlocProvider.of(context)..add(FetchEvent()); 30 | super.initState(); 31 | } 32 | 33 | @override 34 | void dispose() { 35 | _scrollController.dispose(); 36 | super.dispose(); 37 | } 38 | 39 | void _onScroll() { 40 | final maxScroll = _scrollController.position.maxScrollExtent; 41 | final currentScroll = _scrollController.position.pixels; 42 | if (maxScroll - currentScroll <= _scrollThreshold) { 43 | _bloc.add(FetchEvent()); 44 | } 45 | } 46 | 47 | @override 48 | // TODO: implement wantKeepAlive 49 | bool get wantKeepAlive => true; 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | return BlocBuilder( 54 | builder: (context, state) { 55 | if (state is CollectionListError) 56 | return Center( 57 | child: Text("error"), 58 | ); 59 | if (state is InitialCollectionListState) { 60 | return Center( 61 | child: CircularProgressIndicator(), 62 | ); 63 | } 64 | if (state is CollectionListLoaded) { 65 | return ListView.builder( 66 | itemCount: state.collections.length + 1, 67 | controller: _scrollController, 68 | itemBuilder: (context, index) { 69 | if (index >= state.collections.length) return BottomLoader(); 70 | 71 | final item = state.collections[index]; 72 | double displayHeight = MediaQuery.of(context).size.height; 73 | double displayWidth = MediaQuery.of(context).size.width; 74 | 75 | return Stack(children: [ 76 | Image.network(item.coverPhoto.urls.regular, 77 | height: displayHeight / 3, 78 | width: displayWidth, 79 | fit: BoxFit.cover), 80 | Positioned( 81 | bottom: 10, 82 | left: 10, 83 | child: Text( 84 | item.title, 85 | style: TextStyle( 86 | color: Colors.white, 87 | fontSize: 40, 88 | ), 89 | ), 90 | ), 91 | ]); 92 | }); 93 | } 94 | 95 | return Center(); 96 | }, 97 | ); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/ui/widgets/photo_list.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_bloc/flutter_bloc.dart'; 6 | import 'package:transparent_image/transparent_image.dart'; 7 | import 'package:upsplash_app/blocs/photo_list/bloc.dart'; 8 | import 'package:upsplash_app/models/PhotoListResponse.dart'; 9 | import 'package:upsplash_app/repository/photo_repository.dart'; 10 | import 'package:upsplash_app/ui/pages/photo_detail.dart'; 11 | import 'package:upsplash_app/utils/hex_color.dart'; 12 | 13 | import 'bottom_loader.dart'; 14 | 15 | class PhotoListWidget extends StatelessWidget { 16 | final PhotoRepository repository; 17 | 18 | const PhotoListWidget(this.repository) : super(); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return BlocProvider( 23 | child: _PhotoListWidget(), 24 | create: (context) => PhotoListBloc(repository), 25 | ); 26 | } 27 | } 28 | 29 | class _PhotoListWidget extends StatefulWidget { 30 | @override 31 | State createState() => _PhotoListWidgetState(); 32 | } 33 | 34 | class _PhotoListWidgetState extends State<_PhotoListWidget> 35 | with AutomaticKeepAliveClientMixin { 36 | PhotoListBloc _bloc; 37 | final _scrollController = ScrollController(); 38 | final _scrollThreshold = 200.0; 39 | 40 | @override 41 | void initState() { 42 | _scrollController.addListener(_onScroll); 43 | _bloc = BlocProvider.of(context); 44 | _bloc.add(FetchEvent()); 45 | super.initState(); 46 | } 47 | 48 | @override 49 | void dispose() { 50 | _scrollController.dispose(); 51 | super.dispose(); 52 | } 53 | 54 | void _onScroll() { 55 | final maxScroll = _scrollController.position.maxScrollExtent; 56 | final currentScroll = _scrollController.position.pixels; 57 | if (maxScroll - currentScroll <= _scrollThreshold) { 58 | _bloc.add(FetchEvent()); 59 | } 60 | } 61 | 62 | @override 63 | Widget build(BuildContext context) { 64 | return BlocBuilder( 65 | builder: (buildContext, state) { 66 | if (state is PhotoListError) 67 | return Center( 68 | child: Text("error"), 69 | ); 70 | 71 | if (state is InitialPhotoListState) 72 | return Center( 73 | child: CircularProgressIndicator(), 74 | ); 75 | if (state is PhotoListLoaded) { 76 | return ListView.builder( 77 | itemCount: state.photos.length + 1, 78 | controller: _scrollController, 79 | itemBuilder: (buildContext, index) { 80 | if (index >= state.photos.length) return BottomLoader(); 81 | PhotoListBean item = state.photos[index]; 82 | double displayWidth = MediaQuery.of(context).size.width; 83 | double finalHeight = displayWidth / (item.width / item.height); 84 | Color primaryColor = HexColor(item.color); 85 | return InkWell( 86 | onTap: () { 87 | _onPhotoTap(item); 88 | }, 89 | child: Hero( 90 | tag: "photo${item.id}", 91 | child: Stack( 92 | children: [ 93 | SizedBox( 94 | width: displayWidth, 95 | height: finalHeight, 96 | child: DecoratedBox( 97 | decoration: BoxDecoration(color: primaryColor), 98 | ), 99 | ), 100 | FadeInImage.memoryNetwork( 101 | image: item.urls.thumb, 102 | placeholder: kTransparentImage, 103 | fit: BoxFit.fitWidth, 104 | width: displayWidth, 105 | height: finalHeight, 106 | ), 107 | FadeInImage.memoryNetwork( 108 | image: item.urls.regular, 109 | placeholder: kTransparentImage, 110 | fit: BoxFit.fitWidth, 111 | width: displayWidth, 112 | height: finalHeight, 113 | ), 114 | ], 115 | ), 116 | ), 117 | ); 118 | }); 119 | } 120 | 121 | return Center(child: Text("sesh")); 122 | }, 123 | ); 124 | } 125 | 126 | _onPhotoTap(PhotoListBean photoListBean) { 127 | Navigator.push( 128 | context, 129 | MaterialPageRoute( 130 | builder: (context) => PhotoDetailPage(), 131 | // Pass the arguments as part of the RouteSettings. The 132 | // ExtractArgumentScreen reads the arguments from these 133 | // settings. 134 | settings: RouteSettings( 135 | arguments: PhotoDetailPageArguments(photoListBean), 136 | ), 137 | ), 138 | ); 139 | } 140 | 141 | @override 142 | // TODO: implement wantKeepAlive 143 | bool get wantKeepAlive => true; 144 | } 145 | -------------------------------------------------------------------------------- /lib/utils/hex_color.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | class HexColor extends Color { 4 | static int _getColorFromHex(String hexColor) { 5 | hexColor = hexColor.toUpperCase().replaceAll("#", ""); 6 | if (hexColor.length == 6) { 7 | hexColor = "FF" + hexColor; 8 | } 9 | return int.parse(hexColor, radix: 16); 10 | } 11 | 12 | static int _inverted(int color) { 13 | return Color(0xffffff).value ^ color; 14 | } 15 | 16 | HexColor(final String hexColor, {bool inverted = false}) 17 | : super(inverted 18 | ? _inverted(_getColorFromHex(hexColor)) 19 | : _getColorFromHex(hexColor)); 20 | } 21 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.10" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.0" 25 | bloc: 26 | dependency: transitive 27 | description: 28 | name: bloc 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.0.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.0.5" 39 | charcode: 40 | dependency: transitive 41 | description: 42 | name: charcode 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.1.2" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.14.11" 53 | convert: 54 | dependency: transitive 55 | description: 56 | name: convert 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.1" 60 | crypto: 61 | dependency: transitive 62 | description: 63 | name: crypto 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.1.3" 67 | cupertino_icons: 68 | dependency: "direct main" 69 | description: 70 | name: cupertino_icons 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "0.1.2" 74 | dio: 75 | dependency: "direct main" 76 | description: 77 | name: dio 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "3.0.7" 81 | equatable: 82 | dependency: "direct main" 83 | description: 84 | name: equatable 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "0.6.1" 88 | flutter: 89 | dependency: "direct main" 90 | description: flutter 91 | source: sdk 92 | version: "0.0.0" 93 | flutter_bloc: 94 | dependency: "direct main" 95 | description: 96 | name: flutter_bloc 97 | url: "https://pub.dartlang.org" 98 | source: hosted 99 | version: "2.1.1" 100 | flutter_test: 101 | dependency: "direct dev" 102 | description: flutter 103 | source: sdk 104 | version: "0.0.0" 105 | http_parser: 106 | dependency: transitive 107 | description: 108 | name: http_parser 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "3.1.3" 112 | image: 113 | dependency: transitive 114 | description: 115 | name: image 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "2.1.4" 119 | image_downloader: 120 | dependency: "direct main" 121 | description: 122 | name: image_downloader 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "0.19.1" 126 | matcher: 127 | dependency: transitive 128 | description: 129 | name: matcher 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "0.12.5" 133 | meta: 134 | dependency: transitive 135 | description: 136 | name: meta 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "1.1.7" 140 | path: 141 | dependency: transitive 142 | description: 143 | name: path 144 | url: "https://pub.dartlang.org" 145 | source: hosted 146 | version: "1.6.4" 147 | pedantic: 148 | dependency: transitive 149 | description: 150 | name: pedantic 151 | url: "https://pub.dartlang.org" 152 | source: hosted 153 | version: "1.8.0+1" 154 | permission: 155 | dependency: "direct main" 156 | description: 157 | name: permission 158 | url: "https://pub.dartlang.org" 159 | source: hosted 160 | version: "0.1.5" 161 | petitparser: 162 | dependency: transitive 163 | description: 164 | name: petitparser 165 | url: "https://pub.dartlang.org" 166 | source: hosted 167 | version: "2.4.0" 168 | provider: 169 | dependency: transitive 170 | description: 171 | name: provider 172 | url: "https://pub.dartlang.org" 173 | source: hosted 174 | version: "3.2.0" 175 | quiver: 176 | dependency: transitive 177 | description: 178 | name: quiver 179 | url: "https://pub.dartlang.org" 180 | source: hosted 181 | version: "2.0.5" 182 | rxdart: 183 | dependency: "direct main" 184 | description: 185 | name: rxdart 186 | url: "https://pub.dartlang.org" 187 | source: hosted 188 | version: "0.22.6" 189 | sky_engine: 190 | dependency: transitive 191 | description: flutter 192 | source: sdk 193 | version: "0.0.99" 194 | source_span: 195 | dependency: transitive 196 | description: 197 | name: source_span 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "1.5.5" 201 | stack_trace: 202 | dependency: transitive 203 | description: 204 | name: stack_trace 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.9.3" 208 | stream_channel: 209 | dependency: transitive 210 | description: 211 | name: stream_channel 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "2.0.0" 215 | string_scanner: 216 | dependency: transitive 217 | description: 218 | name: string_scanner 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "1.0.5" 222 | term_glyph: 223 | dependency: transitive 224 | description: 225 | name: term_glyph 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "1.1.0" 229 | test_api: 230 | dependency: transitive 231 | description: 232 | name: test_api 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.2.5" 236 | transparent_image: 237 | dependency: "direct main" 238 | description: 239 | name: transparent_image 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "1.0.0" 243 | typed_data: 244 | dependency: transitive 245 | description: 246 | name: typed_data 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "1.1.6" 250 | vector_math: 251 | dependency: transitive 252 | description: 253 | name: vector_math 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "2.0.8" 257 | xml: 258 | dependency: transitive 259 | description: 260 | name: xml 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "3.5.0" 264 | sdks: 265 | dart: ">2.4.0 <3.0.0" 266 | flutter: ">=0.1.4 <2.0.0" 267 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: upsplash_app 2 | description: Flutter application using unsplash api. 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 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | dio: 3.0.7 23 | rxdart: ^0.22.0 24 | equatable: ^0.6.0 25 | flutter_bloc: ^2.0.0 26 | transparent_image: 1.0.0 27 | permission: 0.1.5 28 | image_downloader: 0.19.1 29 | 30 | 31 | 32 | 33 | 34 | # The following adds the Cupertino Icons font to your application. 35 | # Use with the CupertinoIcons class for iOS style icons. 36 | cupertino_icons: ^0.1.2 37 | 38 | dev_dependencies: 39 | flutter_test: 40 | sdk: flutter 41 | 42 | 43 | # For information on the generic Dart part of this file, see the 44 | # following page: https://dart.dev/tools/pub/pubspec 45 | 46 | # The following section is specific to Flutter. 47 | flutter: 48 | 49 | # The following line ensures that the Material Icons font is 50 | # included with your application, so that you can use the icons in 51 | # the material Icons class. 52 | uses-material-design: true 53 | 54 | # To add assets to your application, add an assets section, like this: 55 | # assets: 56 | # - images/a_dot_burr.jpeg 57 | # - images/a_dot_ham.jpeg 58 | 59 | # An image asset can refer to one or more resolution-specific "variants", see 60 | # https://flutter.dev/assets-and-images/#resolution-aware. 61 | 62 | # For details regarding adding assets from package dependencies, see 63 | # https://flutter.dev/assets-and-images/#from-packages 64 | 65 | # To add custom fonts to your application, add a fonts section here, 66 | # in this "flutter" section. Each entry in this list should have a 67 | # "family" key with the font family name, and a "fonts" key with a 68 | # list giving the asset and other descriptors for the font. For 69 | # example: 70 | # fonts: 71 | # - family: Schyler 72 | # fonts: 73 | # - asset: fonts/Schyler-Regular.ttf 74 | # - asset: fonts/Schyler-Italic.ttf 75 | # style: italic 76 | # - family: Trajan Pro 77 | # fonts: 78 | # - asset: fonts/TrajanPro.ttf 79 | # - asset: fonts/TrajanPro_Bold.ttf 80 | # weight: 700 81 | # 82 | # For details regarding fonts from package dependencies, 83 | # see https://flutter.dev/custom-fonts/#from-packages 84 | -------------------------------------------------------------------------------- /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:upsplash_app/main.dart'; 12 | import 'package:upsplash_app/ui/app.dart'; 13 | 14 | void main() { 15 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 16 | // Build our app and trigger a frame. 17 | await tester.pumpWidget(MyApp()); 18 | 19 | // Verify that our counter starts at 0. 20 | expect(find.text('0'), findsOneWidget); 21 | expect(find.text('1'), findsNothing); 22 | 23 | // Tap the '+' icon and trigger a frame. 24 | await tester.tap(find.byIcon(Icons.add)); 25 | await tester.pump(); 26 | 27 | // Verify that our counter has incremented. 28 | expect(find.text('0'), findsNothing); 29 | expect(find.text('1'), findsOneWidget); 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | upsplash_app 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------------------------------------