├── LICENSE ├── README.md ├── assetss ├── NewsAppFlutterAsset_1.gif ├── NewsAppFlutterAsset_2.jpeg ├── NewsAppFlutterAsset_3.jpeg ├── NewsAppFlutterAsset_4.jpeg └── NewsAppFlutterAsset_5.gif └── news_app ├── .gitignore ├── .metadata ├── README.md ├── android ├── app │ ├── build.gradle │ ├── google-services.json │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── ic_launcher-web.png │ │ ├── java │ │ └── com │ │ │ └── kaparray │ │ │ └── newsapp │ │ │ └── MainActivity.java │ │ └── res │ │ ├── drawable │ │ └── launch_background.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── ic_launcher_background.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── key.properties └── settings.gradle ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── lib ├── blocs │ └── news_bloc.dart ├── main.dart ├── models │ └── news_model.dart ├── resources │ ├── news_api_provider.dart │ └── repository.dart └── ui │ ├── bottom_nav_bar.dart │ ├── screens │ ├── liked_list.dart │ ├── news_list.dart │ ├── serch_screen.dart │ ├── settings_screen.dart │ └── web_view.dart │ ├── utils │ └── back_to_start.dart │ └── views │ ├── item_build.dart │ ├── search_bar.dart │ └── stream_builder.dart ├── pubspec.yaml └── test └── widget_test.dart /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Kirill Adeshchenko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NewsApp 2 | News app in Flutter with BLOC pattern 3 | 4 | 5 | 6 | 7 | 8 | This example uses a CustomScrollView, JSON Rest API, BottonNavigationBar,SliverList, ClipRRect, Card, Progress Indicator, NetworkImage, Card, Column, Row, Container, InkWell, BoxDecoration. 9 | 10 | 11 | 12 | ### Library 13 | * [*__rxdart__*](https://pub.dartlang.org/packages/rxdart) 14 | * [*__http__*](https://pub.dartlang.org/packages/http) 15 | * [*__webview_flutter__*](https://pub.dartlang.org/packages/webview_flutter) 16 | * [*__shared_preferences__*](https://pub.dartlang.org/packages/shared_preferences) 17 | * [*__share__*](https://pub.dartlang.org/packages/share) 18 | * [*__cloud_firestore__*](https://pub.dartlang.org/packages/cloud_firestore) 19 | * [*__uuid__*](https://pub.dartlang.org/packages/uuid) 20 | * [*__dynamic_theme__*](https://pub.dartlang.org/packages/dynamic_theme) 21 | * [*__flutter_picker__*](https://pub.dartlang.org/packages/flutter_picker) 22 | * [*__flutter_material_color_picker__*](https://pub.dartlang.org/packages/flutter_material_color_picker) 23 | 24 | ### Bloc pattern 25 | 26 | *I used this pattern to design this application.* 27 | 28 | 29 | 30 | ```dart 31 | class NewsBloc { 32 | final _repository = Repository(); 33 | final _newsFetcher = PublishSubject(); 34 | final _newsSearchFetcher = PublishSubject(); 35 | final _newsLikeFetcher = PublishSubject(); 36 | 37 | Observable get allNews => _newsFetcher.stream; 38 | Observable get searchNews => _newsSearchFetcher.stream; 39 | Observable get likeNews => _newsLikeFetcher.stream; 40 | 41 | fetchLikedNews() async { 42 | NewsModel newsModel = await _repository.fetchLikedNews(); 43 | _newsLikeFetcher.sink.add(newsModel); 44 | } 45 | 46 | fetchAllNews() async { 47 | NewsModel newsModel = await _repository.fetchAllNews(); 48 | _newsFetcher.sink.add(newsModel); 49 | } 50 | 51 | fetchSearchNews() async { 52 | NewsModel newsModel = await _repository.fetchSearchNews(); 53 | _newsSearchFetcher.sink.add(newsModel); 54 | } 55 | 56 | // Set and delete from Firestore liked 57 | addFavorit(val) async => _repository.addFavorit(val); 58 | deliteFavorit(val) async => _repository.deliteFavorit(val); 59 | 60 | dispose() { 61 | _newsLikeFetcher.close(); 62 | _newsFetcher.close(); 63 | _newsSearchFetcher.close(); 64 | } 65 | } 66 | 67 | final bloc = NewsBloc(); 68 | ``` 69 | 70 | ### Screenshots 71 | 72 |

73 | 74 | 75 | 76 |

77 |

78 | 79 |

80 | 81 | 82 | 83 | ## Built With 84 | * [Flutter](https://flutter.io) - Crossplatform App Development Framework 85 | 86 | ### License 87 | Released under the [MIT license](https://github.com/kaparray/NewsApp/blob/master/LICENSE) 88 | 89 | ### Author 90 | 91 | Adeshchenko Kirill (Cyrill) ([@kaparray](https://www.linkedin.com/in/kirill-adeshchenko-b86362161/)) 92 | -------------------------------------------------------------------------------- /assetss/NewsAppFlutterAsset_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/assetss/NewsAppFlutterAsset_1.gif -------------------------------------------------------------------------------- /assetss/NewsAppFlutterAsset_2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/assetss/NewsAppFlutterAsset_2.jpeg -------------------------------------------------------------------------------- /assetss/NewsAppFlutterAsset_3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/assetss/NewsAppFlutterAsset_3.jpeg -------------------------------------------------------------------------------- /assetss/NewsAppFlutterAsset_4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/assetss/NewsAppFlutterAsset_4.jpeg -------------------------------------------------------------------------------- /assetss/NewsAppFlutterAsset_5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/assetss/NewsAppFlutterAsset_5.gif -------------------------------------------------------------------------------- /news_app/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /news_app/.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: 5391447fae6209bb21a89e6a5a6583cac1af9b4b 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /news_app/README.md: -------------------------------------------------------------------------------- 1 | # news_app 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.io/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /news_app/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | def keystoreProperties = new Properties() 28 | def keystorePropertiesFile = rootProject.file('key.properties') 29 | if (keystorePropertiesFile.exists()) { 30 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 31 | } 32 | 33 | 34 | android { 35 | compileSdkVersion 27 36 | 37 | lintOptions { 38 | disable 'InvalidPackage' 39 | } 40 | 41 | defaultConfig { 42 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 43 | applicationId "com.kaparray.newsapp" 44 | minSdkVersion 16 45 | targetSdkVersion 27 46 | versionCode flutterVersionCode.toInteger() 47 | versionName flutterVersionName 48 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 49 | } 50 | 51 | signingConfigs { 52 | release { 53 | keyAlias keystoreProperties['keyAlias'] 54 | keyPassword keystoreProperties['keyPassword'] 55 | storeFile file(keystoreProperties['storeFile']) 56 | storePassword keystoreProperties['storePassword'] 57 | } 58 | } 59 | 60 | buildTypes { 61 | release { 62 | signingConfig signingConfigs.release 63 | minifyEnabled true 64 | useProguard true 65 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 66 | // Signing with the debug keys for now, so `flutter run --release` works. 67 | } 68 | } 69 | } 70 | 71 | flutter { 72 | source '../..' 73 | } 74 | 75 | dependencies { 76 | testImplementation 'junit:junit:4.12' 77 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 78 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 79 | 80 | } 81 | 82 | apply plugin: 'com.google.gms.google-services' 83 | -------------------------------------------------------------------------------- /news_app/android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "145757579857", 4 | "firebase_url": "https://newsapp-c16eb.firebaseio.com", 5 | "project_id": "newsapp-c16eb", 6 | "storage_bucket": "newsapp-c16eb.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:145757579857:android:8e57a176bac48fcb", 12 | "android_client_info": { 13 | "package_name": "com.kaparray.newsapp" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "145757579857-ltnn78dqbj66a3sogogqsrksog1uj1ss.apps.googleusercontent.com", 19 | "client_type": 3 20 | } 21 | ], 22 | "api_key": [ 23 | { 24 | "current_key": "AIzaSyAppMzhiok_6hFYANC0UcK742b-Jzst9L8" 25 | } 26 | ], 27 | "services": { 28 | "analytics_service": { 29 | "status": 1 30 | }, 31 | "appinvite_service": { 32 | "status": 1, 33 | "other_platform_oauth_client": [] 34 | }, 35 | "ads_service": { 36 | "status": 2 37 | } 38 | } 39 | } 40 | ], 41 | "configuration_version": "1" 42 | } 43 | -------------------------------------------------------------------------------- /news_app/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | #Flutter Wrapper 2 | -keep class io.flutter.app.** { *; } 3 | -keep class io.flutter.plugin.** { *; } 4 | -keep class io.flutter.util.** { *; } 5 | -keep class io.flutter.view.** { *; } 6 | -keep class io.flutter.** { *; } 7 | -keep class io.flutter.plugins.** { *; } 8 | -------------------------------------------------------------------------------- /news_app/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /news_app/android/app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/java/com/kaparray/newsapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.kaparray.newsapp; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /news_app/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /news_app/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | classpath 'com.google.gms:google-services:4.2.0' 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | jcenter() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /news_app/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /news_app/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /news_app/android/key.properties: -------------------------------------------------------------------------------- 1 | storePassword=PROKIRILL15 2 | keyPassword=PROKIRILL15 3 | keyAlias=key 4 | storeFile=/Users/kaparray/key.jks 5 | -------------------------------------------------------------------------------- /news_app/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 | -------------------------------------------------------------------------------- /news_app/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /news_app/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /news_app/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /news_app/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 37 | # referring to absolute paths on developers' machines. 38 | system('rm -rf .symlinks') 39 | system('mkdir -p .symlinks/plugins') 40 | 41 | # Flutter Pods 42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 43 | if generated_xcode_build_settings.empty? 44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 45 | end 46 | generated_xcode_build_settings.map { |p| 47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 48 | symlink = File.join('.symlinks', 'flutter') 49 | File.symlink(File.dirname(p[:path]), symlink) 50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 51 | end 52 | } 53 | 54 | # Plugin Pods 55 | plugin_pods = parse_KV_file('../.flutter-plugins') 56 | plugin_pods.map { |p| 57 | symlink = File.join('.symlinks', 'plugins', p[:name]) 58 | File.symlink(p[:path], symlink) 59 | pod p[:name], :path => File.join(symlink, 'ios') 60 | } 61 | end 62 | 63 | post_install do |installer| 64 | installer.pods_project.targets.each do |target| 65 | target.build_configurations.each do |config| 66 | config.build_settings['ENABLE_BITCODE'] = 'NO' 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /news_app/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 48A3790505D8F03D7F54661F /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22C382B4CEA637E6BC290376 /* libPods-Runner.a */; }; 16 | 6C4A5971220AD2AC00AC139E /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6C4A5970220AD2AC00AC139E /* GoogleService-Info.plist */; }; 17 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 18 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 19 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 20 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 21 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 22 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 23 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 24 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXCopyFilesBuildPhase section */ 28 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 29 | isa = PBXCopyFilesBuildPhase; 30 | buildActionMask = 2147483647; 31 | dstPath = ""; 32 | dstSubfolderSpec = 10; 33 | files = ( 34 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 35 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 36 | ); 37 | name = "Embed Frameworks"; 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXCopyFilesBuildPhase section */ 41 | 42 | /* Begin PBXFileReference section */ 43 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 44 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 45 | 22C382B4CEA637E6BC290376 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 47 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 48 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 49 | 6C4A5970220AD2AC00AC139E /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../Downloads/GoogleService-Info.plist"; sourceTree = ""; }; 50 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 51 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 52 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 53 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 54 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 55 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 56 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 58 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 59 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 60 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 61 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 70 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 71 | 48A3790505D8F03D7F54661F /* libPods-Runner.a in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXFrameworksBuildPhase section */ 76 | 77 | /* Begin PBXGroup section */ 78 | 0C890A7571D1AD75D7C932AB /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 22C382B4CEA637E6BC290376 /* libPods-Runner.a */, 82 | ); 83 | name = Frameworks; 84 | sourceTree = ""; 85 | }; 86 | 9740EEB11CF90186004384FC /* Flutter */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 90 | 3B80C3931E831B6300D905FE /* App.framework */, 91 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 92 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 93 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 94 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 95 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 96 | ); 97 | name = Flutter; 98 | sourceTree = ""; 99 | }; 100 | 97C146E51CF9000F007C117D = { 101 | isa = PBXGroup; 102 | children = ( 103 | 9740EEB11CF90186004384FC /* Flutter */, 104 | 97C146F01CF9000F007C117D /* Runner */, 105 | 97C146EF1CF9000F007C117D /* Products */, 106 | B34CC6382A582746F81D7EB7 /* Pods */, 107 | 0C890A7571D1AD75D7C932AB /* Frameworks */, 108 | ); 109 | sourceTree = ""; 110 | }; 111 | 97C146EF1CF9000F007C117D /* Products */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 97C146EE1CF9000F007C117D /* Runner.app */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 97C146F01CF9000F007C117D /* Runner */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 6C4A5970220AD2AC00AC139E /* GoogleService-Info.plist */, 123 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 124 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 125 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 126 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 127 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 128 | 97C147021CF9000F007C117D /* Info.plist */, 129 | 97C146F11CF9000F007C117D /* Supporting Files */, 130 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 131 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 132 | ); 133 | path = Runner; 134 | sourceTree = ""; 135 | }; 136 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 97C146F21CF9000F007C117D /* main.m */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | B34CC6382A582746F81D7EB7 /* Pods */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | ); 148 | name = Pods; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | 97C146ED1CF9000F007C117D /* Runner */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 157 | buildPhases = ( 158 | 3857EB6C6AF8C14F1786EBAD /* [CP] Check Pods Manifest.lock */, 159 | 9740EEB61CF901F6004384FC /* Run Script */, 160 | 97C146EA1CF9000F007C117D /* Sources */, 161 | 97C146EB1CF9000F007C117D /* Frameworks */, 162 | 97C146EC1CF9000F007C117D /* Resources */, 163 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 164 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 165 | 95F9A6053AC41626F4A84638 /* [CP] Embed Pods Frameworks */, 166 | 3C158D4AFD8EB1070F639630 /* [CP] Copy Pods Resources */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | ); 172 | name = Runner; 173 | productName = Runner; 174 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 175 | productType = "com.apple.product-type.application"; 176 | }; 177 | /* End PBXNativeTarget section */ 178 | 179 | /* Begin PBXProject section */ 180 | 97C146E61CF9000F007C117D /* Project object */ = { 181 | isa = PBXProject; 182 | attributes = { 183 | LastUpgradeCheck = 0910; 184 | ORGANIZATIONNAME = "The Chromium Authors"; 185 | TargetAttributes = { 186 | 97C146ED1CF9000F007C117D = { 187 | CreatedOnToolsVersion = 7.3.1; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = 97C146E51CF9000F007C117D; 200 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | 97C146ED1CF9000F007C117D /* Runner */, 205 | ); 206 | }; 207 | /* End PBXProject section */ 208 | 209 | /* Begin PBXResourcesBuildPhase section */ 210 | 97C146EC1CF9000F007C117D /* Resources */ = { 211 | isa = PBXResourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 215 | 6C4A5971220AD2AC00AC139E /* GoogleService-Info.plist in Resources */, 216 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 217 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 218 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 219 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 220 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | /* End PBXResourcesBuildPhase section */ 225 | 226 | /* Begin PBXShellScriptBuildPhase section */ 227 | 3857EB6C6AF8C14F1786EBAD /* [CP] Check Pods Manifest.lock */ = { 228 | isa = PBXShellScriptBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | ); 232 | inputPaths = ( 233 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 234 | "${PODS_ROOT}/Manifest.lock", 235 | ); 236 | name = "[CP] Check Pods Manifest.lock"; 237 | outputPaths = ( 238 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | shellPath = /bin/sh; 242 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 243 | showEnvVarsInLog = 0; 244 | }; 245 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 246 | isa = PBXShellScriptBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | ); 250 | inputPaths = ( 251 | ); 252 | name = "Thin Binary"; 253 | outputPaths = ( 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | shellPath = /bin/sh; 257 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 258 | }; 259 | 3C158D4AFD8EB1070F639630 /* [CP] Copy Pods Resources */ = { 260 | isa = PBXShellScriptBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | inputPaths = ( 265 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", 266 | "${PODS_CONFIGURATION_BUILD_DIR}/FirebaseFirestore/gRPCCertificates.bundle", 267 | ); 268 | name = "[CP] Copy Pods Resources"; 269 | outputPaths = ( 270 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | shellPath = /bin/sh; 274 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; 275 | showEnvVarsInLog = 0; 276 | }; 277 | 95F9A6053AC41626F4A84638 /* [CP] Embed Pods Frameworks */ = { 278 | isa = PBXShellScriptBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | ); 282 | inputPaths = ( 283 | "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 284 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", 285 | ); 286 | name = "[CP] Embed Pods Frameworks"; 287 | outputPaths = ( 288 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | shellPath = /bin/sh; 292 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 293 | showEnvVarsInLog = 0; 294 | }; 295 | 9740EEB61CF901F6004384FC /* Run Script */ = { 296 | isa = PBXShellScriptBuildPhase; 297 | buildActionMask = 2147483647; 298 | files = ( 299 | ); 300 | inputPaths = ( 301 | ); 302 | name = "Run Script"; 303 | outputPaths = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | shellPath = /bin/sh; 307 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 308 | }; 309 | /* End PBXShellScriptBuildPhase section */ 310 | 311 | /* Begin PBXSourcesBuildPhase section */ 312 | 97C146EA1CF9000F007C117D /* Sources */ = { 313 | isa = PBXSourcesBuildPhase; 314 | buildActionMask = 2147483647; 315 | files = ( 316 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 317 | 97C146F31CF9000F007C117D /* main.m in Sources */, 318 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | /* End PBXSourcesBuildPhase section */ 323 | 324 | /* Begin PBXVariantGroup section */ 325 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | 97C146FB1CF9000F007C117D /* Base */, 329 | ); 330 | name = Main.storyboard; 331 | sourceTree = ""; 332 | }; 333 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 334 | isa = PBXVariantGroup; 335 | children = ( 336 | 97C147001CF9000F007C117D /* Base */, 337 | ); 338 | name = LaunchScreen.storyboard; 339 | sourceTree = ""; 340 | }; 341 | /* End PBXVariantGroup section */ 342 | 343 | /* Begin XCBuildConfiguration section */ 344 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 345 | isa = XCBuildConfiguration; 346 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 347 | buildSettings = { 348 | ALWAYS_SEARCH_USER_PATHS = NO; 349 | CLANG_ANALYZER_NONNULL = YES; 350 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 351 | CLANG_CXX_LIBRARY = "libc++"; 352 | CLANG_ENABLE_MODULES = YES; 353 | CLANG_ENABLE_OBJC_ARC = YES; 354 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 355 | CLANG_WARN_BOOL_CONVERSION = YES; 356 | CLANG_WARN_COMMA = YES; 357 | CLANG_WARN_CONSTANT_CONVERSION = YES; 358 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 359 | CLANG_WARN_EMPTY_BODY = YES; 360 | CLANG_WARN_ENUM_CONVERSION = YES; 361 | CLANG_WARN_INFINITE_RECURSION = YES; 362 | CLANG_WARN_INT_CONVERSION = YES; 363 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 364 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 365 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 366 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 367 | CLANG_WARN_STRICT_PROTOTYPES = YES; 368 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 369 | CLANG_WARN_UNREACHABLE_CODE = YES; 370 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 371 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 372 | COPY_PHASE_STRIP = NO; 373 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 374 | ENABLE_NS_ASSERTIONS = NO; 375 | ENABLE_STRICT_OBJC_MSGSEND = YES; 376 | GCC_C_LANGUAGE_STANDARD = gnu99; 377 | GCC_NO_COMMON_BLOCKS = YES; 378 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 379 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 380 | GCC_WARN_UNDECLARED_SELECTOR = YES; 381 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 382 | GCC_WARN_UNUSED_FUNCTION = YES; 383 | GCC_WARN_UNUSED_VARIABLE = YES; 384 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 385 | MTL_ENABLE_DEBUG_INFO = NO; 386 | SDKROOT = iphoneos; 387 | TARGETED_DEVICE_FAMILY = "1,2"; 388 | VALIDATE_PRODUCT = YES; 389 | }; 390 | name = Profile; 391 | }; 392 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 393 | isa = XCBuildConfiguration; 394 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 395 | buildSettings = { 396 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 397 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 398 | DEVELOPMENT_TEAM = S8QB4VV633; 399 | ENABLE_BITCODE = NO; 400 | FRAMEWORK_SEARCH_PATHS = ( 401 | "$(inherited)", 402 | "$(PROJECT_DIR)/Flutter", 403 | ); 404 | INFOPLIST_FILE = Runner/Info.plist; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 406 | LIBRARY_SEARCH_PATHS = ( 407 | "$(inherited)", 408 | "$(PROJECT_DIR)/Flutter", 409 | ); 410 | PRODUCT_BUNDLE_IDENTIFIER = com.example.newsApp; 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | VERSIONING_SYSTEM = "apple-generic"; 413 | }; 414 | name = Profile; 415 | }; 416 | 97C147031CF9000F007C117D /* Debug */ = { 417 | isa = XCBuildConfiguration; 418 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 419 | buildSettings = { 420 | ALWAYS_SEARCH_USER_PATHS = NO; 421 | CLANG_ANALYZER_NONNULL = YES; 422 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 423 | CLANG_CXX_LIBRARY = "libc++"; 424 | CLANG_ENABLE_MODULES = YES; 425 | CLANG_ENABLE_OBJC_ARC = YES; 426 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 427 | CLANG_WARN_BOOL_CONVERSION = YES; 428 | CLANG_WARN_COMMA = YES; 429 | CLANG_WARN_CONSTANT_CONVERSION = YES; 430 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 431 | CLANG_WARN_EMPTY_BODY = YES; 432 | CLANG_WARN_ENUM_CONVERSION = YES; 433 | CLANG_WARN_INFINITE_RECURSION = YES; 434 | CLANG_WARN_INT_CONVERSION = YES; 435 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 436 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 437 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 438 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 439 | CLANG_WARN_STRICT_PROTOTYPES = YES; 440 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 441 | CLANG_WARN_UNREACHABLE_CODE = YES; 442 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 443 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 444 | COPY_PHASE_STRIP = NO; 445 | DEBUG_INFORMATION_FORMAT = dwarf; 446 | ENABLE_STRICT_OBJC_MSGSEND = YES; 447 | ENABLE_TESTABILITY = YES; 448 | GCC_C_LANGUAGE_STANDARD = gnu99; 449 | GCC_DYNAMIC_NO_PIC = NO; 450 | GCC_NO_COMMON_BLOCKS = YES; 451 | GCC_OPTIMIZATION_LEVEL = 0; 452 | GCC_PREPROCESSOR_DEFINITIONS = ( 453 | "DEBUG=1", 454 | "$(inherited)", 455 | ); 456 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 457 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 458 | GCC_WARN_UNDECLARED_SELECTOR = YES; 459 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 460 | GCC_WARN_UNUSED_FUNCTION = YES; 461 | GCC_WARN_UNUSED_VARIABLE = YES; 462 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 463 | MTL_ENABLE_DEBUG_INFO = YES; 464 | ONLY_ACTIVE_ARCH = YES; 465 | SDKROOT = iphoneos; 466 | TARGETED_DEVICE_FAMILY = "1,2"; 467 | }; 468 | name = Debug; 469 | }; 470 | 97C147041CF9000F007C117D /* Release */ = { 471 | isa = XCBuildConfiguration; 472 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 473 | buildSettings = { 474 | ALWAYS_SEARCH_USER_PATHS = NO; 475 | CLANG_ANALYZER_NONNULL = YES; 476 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 477 | CLANG_CXX_LIBRARY = "libc++"; 478 | CLANG_ENABLE_MODULES = YES; 479 | CLANG_ENABLE_OBJC_ARC = YES; 480 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 481 | CLANG_WARN_BOOL_CONVERSION = YES; 482 | CLANG_WARN_COMMA = YES; 483 | CLANG_WARN_CONSTANT_CONVERSION = YES; 484 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 485 | CLANG_WARN_EMPTY_BODY = YES; 486 | CLANG_WARN_ENUM_CONVERSION = YES; 487 | CLANG_WARN_INFINITE_RECURSION = YES; 488 | CLANG_WARN_INT_CONVERSION = YES; 489 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 490 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 491 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 492 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 493 | CLANG_WARN_STRICT_PROTOTYPES = YES; 494 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 495 | CLANG_WARN_UNREACHABLE_CODE = YES; 496 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 497 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 498 | COPY_PHASE_STRIP = NO; 499 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 500 | ENABLE_NS_ASSERTIONS = NO; 501 | ENABLE_STRICT_OBJC_MSGSEND = YES; 502 | GCC_C_LANGUAGE_STANDARD = gnu99; 503 | GCC_NO_COMMON_BLOCKS = YES; 504 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 505 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 506 | GCC_WARN_UNDECLARED_SELECTOR = YES; 507 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 508 | GCC_WARN_UNUSED_FUNCTION = YES; 509 | GCC_WARN_UNUSED_VARIABLE = YES; 510 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 511 | MTL_ENABLE_DEBUG_INFO = NO; 512 | SDKROOT = iphoneos; 513 | TARGETED_DEVICE_FAMILY = "1,2"; 514 | VALIDATE_PRODUCT = YES; 515 | }; 516 | name = Release; 517 | }; 518 | 97C147061CF9000F007C117D /* Debug */ = { 519 | isa = XCBuildConfiguration; 520 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 521 | buildSettings = { 522 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 523 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 524 | ENABLE_BITCODE = NO; 525 | FRAMEWORK_SEARCH_PATHS = ( 526 | "$(inherited)", 527 | "$(PROJECT_DIR)/Flutter", 528 | ); 529 | INFOPLIST_FILE = Runner/Info.plist; 530 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 531 | LIBRARY_SEARCH_PATHS = ( 532 | "$(inherited)", 533 | "$(PROJECT_DIR)/Flutter", 534 | ); 535 | PRODUCT_BUNDLE_IDENTIFIER = com.example.newsApp; 536 | PRODUCT_NAME = "$(TARGET_NAME)"; 537 | VERSIONING_SYSTEM = "apple-generic"; 538 | }; 539 | name = Debug; 540 | }; 541 | 97C147071CF9000F007C117D /* Release */ = { 542 | isa = XCBuildConfiguration; 543 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 544 | buildSettings = { 545 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 546 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 547 | ENABLE_BITCODE = NO; 548 | FRAMEWORK_SEARCH_PATHS = ( 549 | "$(inherited)", 550 | "$(PROJECT_DIR)/Flutter", 551 | ); 552 | INFOPLIST_FILE = Runner/Info.plist; 553 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 554 | LIBRARY_SEARCH_PATHS = ( 555 | "$(inherited)", 556 | "$(PROJECT_DIR)/Flutter", 557 | ); 558 | PRODUCT_BUNDLE_IDENTIFIER = com.example.newsApp; 559 | PRODUCT_NAME = "$(TARGET_NAME)"; 560 | VERSIONING_SYSTEM = "apple-generic"; 561 | }; 562 | name = Release; 563 | }; 564 | /* End XCBuildConfiguration section */ 565 | 566 | /* Begin XCConfigurationList section */ 567 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 568 | isa = XCConfigurationList; 569 | buildConfigurations = ( 570 | 97C147031CF9000F007C117D /* Debug */, 571 | 97C147041CF9000F007C117D /* Release */, 572 | 249021D3217E4FDB00AE95B9 /* Profile */, 573 | ); 574 | defaultConfigurationIsVisible = 0; 575 | defaultConfigurationName = Release; 576 | }; 577 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 578 | isa = XCConfigurationList; 579 | buildConfigurations = ( 580 | 97C147061CF9000F007C117D /* Debug */, 581 | 97C147071CF9000F007C117D /* Release */, 582 | 249021D4217E4FDB00AE95B9 /* Profile */, 583 | ); 584 | defaultConfigurationIsVisible = 0; 585 | defaultConfigurationName = Release; 586 | }; 587 | /* End XCConfigurationList section */ 588 | }; 589 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 590 | } 591 | -------------------------------------------------------------------------------- /news_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /news_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /news_app/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /news_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /news_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /news_app/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /news_app/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /news_app/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 | -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /news_app/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 | -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /news_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaparray/NewsDaily/0fd7871bdd7d1b9fde698526ab7c45003aa66b43/news_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /news_app/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. -------------------------------------------------------------------------------- /news_app/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 | -------------------------------------------------------------------------------- /news_app/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 | -------------------------------------------------------------------------------- /news_app/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | News Daily 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 | io.flutter.embedded_views_preview 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /news_app/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /news_app/lib/blocs/news_bloc.dart: -------------------------------------------------------------------------------- 1 | import '../resources/repository.dart'; 2 | import 'package:rxdart/rxdart.dart'; 3 | import '../models/news_model.dart'; 4 | 5 | class NewsBloc { 6 | final _repository = Repository(); 7 | final _newsFetcher = PublishSubject(); 8 | final _newsSearchFetcher = PublishSubject(); 9 | final _newsLikeFetcher = PublishSubject(); 10 | 11 | Observable get allNews => _newsFetcher.stream; 12 | Observable get searchNews => _newsSearchFetcher.stream; 13 | Observable get likeNews => _newsLikeFetcher.stream; 14 | 15 | fetchLikedNews() async { 16 | NewsModel newsModel = await _repository.fetchLikedNews(); 17 | _newsLikeFetcher.sink.add(newsModel); 18 | } 19 | 20 | fetchAllNews() async { 21 | NewsModel newsModel = await _repository.fetchAllNews(); 22 | _newsFetcher.sink.add(newsModel); 23 | } 24 | 25 | fetchSearchNews() async { 26 | NewsModel newsModel = await _repository.fetchSearchNews(); 27 | _newsSearchFetcher.sink.add(newsModel); 28 | } 29 | 30 | // Set and dellite from Firestore liked 31 | addFavorit(val) async => _repository.addFavorit(val); 32 | deliteFavorit(val) async => _repository.deliteFavorit(val); 33 | 34 | dispose() { 35 | _newsLikeFetcher.close(); 36 | _newsFetcher.close(); 37 | _newsSearchFetcher.close(); 38 | } 39 | } 40 | 41 | final bloc = NewsBloc(); 42 | -------------------------------------------------------------------------------- /news_app/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:news_app/blocs/news_bloc.dart'; 3 | import 'package:news_app/ui/bottom_nav_bar.dart'; 4 | import 'package:dynamic_theme/dynamic_theme.dart'; 5 | import 'package:shared_preferences/shared_preferences.dart'; 6 | 7 | Future _prefs = SharedPreferences.getInstance(); 8 | 9 | int color; 10 | String theme; 11 | 12 | void main() async { 13 | await initApp(); 14 | runApp(App()); 15 | } 16 | 17 | initApp() async { 18 | final SharedPreferences prefs = await _prefs; 19 | List _list = []; 20 | if (prefs.getBool('firtStart') == null) { 21 | await prefs.setStringList('liked', _list); 22 | await prefs.setString('country', 'US'); 23 | await prefs.setBool('firtStart', false); 24 | await prefs.setInt('color', 0xFF26A69A); 25 | await prefs.setString('theme', 'light'); 26 | await prefs.setBool('browser', true); 27 | } else if (prefs.getBool('firtStart') == false) { 28 | color = prefs.getInt('color'); 29 | theme = prefs.getString('theme'); 30 | } 31 | } 32 | 33 | @immutable 34 | class App extends StatefulWidget { 35 | @override 36 | createState() => AppState(); 37 | } 38 | 39 | class AppState extends State { 40 | Brightness _brightness; 41 | 42 | @override 43 | void dispose() { 44 | bloc.dispose(); 45 | super.dispose(); 46 | } 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | if (theme == 'dark') 51 | _brightness = Brightness.dark; 52 | else if (theme == 'light') _brightness = Brightness.light; 53 | 54 | return DynamicTheme( 55 | defaultBrightness: _brightness, 56 | data: (brightness) => ThemeData( 57 | brightness: _brightness, accentColor: Color(color ?? 0xFF26A69A)), 58 | themedWidgetBuilder: (context, theme) { 59 | return MaterialApp( 60 | debugShowCheckedModeBanner: false, 61 | home: BottomNavBar(), 62 | theme: theme, 63 | routes: { 64 | "/news": (_) => BottomNavBar(), 65 | }, 66 | ); 67 | }); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /news_app/lib/models/news_model.dart: -------------------------------------------------------------------------------- 1 | class NewsModel { 2 | String status; 3 | int totalResults; 4 | List articles; 5 | 6 | NewsModel({this.status, this.totalResults, this.articles}); 7 | 8 | NewsModel.fromJson(Map json) { 9 | status = json['status']; 10 | totalResults = json['totalResults']; 11 | if (json['articles'] != null) { 12 | articles = new List(); 13 | json['articles'].forEach((v) { 14 | articles.add(new Articles.fromJson(v)); 15 | }); 16 | } 17 | } 18 | 19 | Map toJson() { 20 | final Map data = new Map(); 21 | data['status'] = this.status; 22 | data['totalResults'] = this.totalResults; 23 | if (this.articles != null) { 24 | data['articles'] = this.articles.map((v) => v.toJson()).toList(); 25 | } 26 | return data; 27 | } 28 | } 29 | 30 | class Articles { 31 | Source source; 32 | String author; 33 | String title; 34 | String description; 35 | String url; 36 | String urlToImage; 37 | String publishedAt; 38 | String content; 39 | 40 | Articles( 41 | {this.source, 42 | this.author, 43 | this.title, 44 | this.description, 45 | this.url, 46 | this.urlToImage, 47 | this.publishedAt, 48 | this.content}); 49 | 50 | Articles.fromJson(Map json) { 51 | source = json['source'] != null ? Source.fromJson(json['source']) : null; 52 | author = json['author']; 53 | title = json['title']; 54 | description = json['description']; 55 | url = json['url']; 56 | urlToImage = json['urlToImage']; 57 | content = json['content']; 58 | publishedAt = json['publishedAt']; 59 | } 60 | 61 | Map toJson() { 62 | final Map data = Map(); 63 | if (this.source != null) { 64 | data['source'] = this.source.toJson(); 65 | } 66 | data['author'] = this.author; 67 | data['title'] = this.title; 68 | data['description'] = this.description; 69 | data['url'] = this.url; 70 | data['urlToImage'] = this.urlToImage; 71 | data['publishedAt'] = this.publishedAt; 72 | data['content'] = this.content; 73 | return data; 74 | } 75 | } 76 | 77 | class Source { 78 | String id; 79 | String name; 80 | 81 | Source({this.id, this.name}); 82 | 83 | Source.fromJson(Map json) { 84 | id = json['id']; 85 | name = json['name']; 86 | } 87 | 88 | Map toJson() { 89 | final Map data = new Map(); 90 | data['id'] = this.id; 91 | data['name'] = this.name; 92 | return data; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /news_app/lib/resources/news_api_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:http/http.dart' show Client; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | import 'dart:convert'; 5 | import '../models/news_model.dart'; 6 | import 'package:cloud_firestore/cloud_firestore.dart'; 7 | import 'package:uuid/uuid.dart'; 8 | 9 | class NewsApiProvider { 10 | Client client = Client(); 11 | final _prefs = SharedPreferences.getInstance(); 12 | 13 | String cntry = 'us'; 14 | 15 | final _apiKey = '53ea041b1e1c4c659b41767532da63f2'; 16 | 17 | // Chech shared preference, push requset to newsapi.org server and parse to model 18 | Future fetchNewsList() async { 19 | final SharedPreferences pref = await _prefs; 20 | String country = pref.getString('country'); 21 | 22 | if (country == 'Russia') 23 | cntry = 'ru'; 24 | else if (country == 'US') 25 | cntry = 'us'; 26 | else if (country == 'Germany') 27 | cntry = 'de'; 28 | else if (country == 'United Kingdom') 29 | cntry = 'gb'; 30 | else if (country == 'France') cntry = 'fr'; 31 | 32 | String url = 33 | "https://newsapi.org/v2/top-headlines?country=$cntry&apiKey=$_apiKey"; 34 | 35 | final response = await client.get(url); 36 | if (response.statusCode == 200) { 37 | return NewsModel.fromJson(json.decode(response.body)); 38 | } else { 39 | throw Exception("Faild to post!"); 40 | } 41 | } 42 | 43 | Future fetchSearchNews() async { 44 | final SharedPreferences prefs = await _prefs; 45 | String priorityTheme = prefs.getString("priorityTheme"); 46 | 47 | String url = 48 | "https://newsapi.org/v2/everything?q=$priorityTheme&apiKey=$_apiKey"; 49 | 50 | final response = await client.get(url); 51 | if (response.statusCode == 200) { 52 | return NewsModel.fromJson(json.decode(response.body)); 53 | } else { 54 | throw Exception("Faild to post!"); 55 | } 56 | } 57 | 58 | Future getFavoriteNews() async { 59 | final NewsModel nm = NewsModel(); 60 | List list = List(); 61 | var articles = await Firestore.instance 62 | .collection("users") 63 | .document(await getMyUID()) 64 | .get(); 65 | if (articles.data != null) { 66 | for (int i = 0; i < articles.data.length; i++) 67 | list.add(Articles.fromJson(articles.data.values.toList()[i])); 68 | } 69 | nm.articles = list; 70 | return nm; 71 | } 72 | 73 | generateUID() async { 74 | final myUID = Uuid().v4(); 75 | (await _prefs).setString('id', myUID); 76 | } 77 | 78 | getMyUID() async { 79 | String uid = (await _prefs).getString('id'); 80 | return uid ?? generateUID(); 81 | } 82 | 83 | addToFiresstore(val) async { 84 | final String key = 85 | val['url'].toString().replaceAll('/', '').replaceAll('.', ''); 86 | Firestore.instance 87 | .collection('users') 88 | .document(await getMyUID()) 89 | .setData({key: val}, merge: true); 90 | } 91 | 92 | deliteFromFirestore(val) async { 93 | final String key = 94 | val['url'].toString().replaceAll('/', '').replaceAll('.', ''); 95 | Firestore.instance 96 | .collection('users') 97 | .document(await getMyUID()) 98 | .updateData({key: FieldValue.delete()}); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /news_app/lib/resources/repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'news_api_provider.dart'; 4 | import '../models/news_model.dart'; 5 | 6 | class Repository { 7 | final newsApiProvider = NewsApiProvider(); 8 | 9 | // Get news from server 10 | Future fetchAllNews() => newsApiProvider.fetchNewsList(); 11 | 12 | // Get news from server 13 | Future fetchSearchNews() => newsApiProvider.fetchSearchNews(); 14 | 15 | // Get favorite news from firebase 16 | Future fetchLikedNews() => newsApiProvider.getFavoriteNews(); 17 | 18 | addFavorit(val) => newsApiProvider.addToFiresstore(val); 19 | 20 | deliteFavorit(val) => newsApiProvider.deliteFromFirestore(val); 21 | } 22 | -------------------------------------------------------------------------------- /news_app/lib/ui/bottom_nav_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:news_app/ui/screens/liked_list.dart'; 3 | import 'package:news_app/ui/screens/news_list.dart'; 4 | import 'package:news_app/ui/screens/settings_screen.dart'; 5 | import 'package:news_app/ui/utils/back_to_start.dart'; 6 | 7 | class BottomNavBar extends StatefulWidget { 8 | @override 9 | State createState() { 10 | return BottomNavBarState(); 11 | } 12 | } 13 | 14 | class BottomNavBarState extends State { 15 | num _currentItem = 0; 16 | final _listWidgets = [ 17 | NewsList(), 18 | LikedList(), 19 | SettingsScreen(), 20 | ]; 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Scaffold( 25 | bottomNavigationBar: BottomNavigationBar( 26 | items: [ 27 | BottomNavigationBarItem( 28 | icon: Icon(Icons.chrome_reader_mode), title: Text('News')), 29 | BottomNavigationBarItem( 30 | icon: Icon(Icons.favorite_border), 31 | title: Text('Favorit'), 32 | activeIcon: Icon(Icons.favorite)), 33 | BottomNavigationBarItem( 34 | icon: Icon(Icons.settings), title: Text('Settings')) 35 | ], 36 | currentIndex: _currentItem, 37 | fixedColor: Theme.of(context).accentColor, 38 | onTap: _onItemTapped, 39 | ), 40 | body: _listWidgets[_currentItem]); 41 | } 42 | 43 | _onItemTapped(int index) { 44 | setState(() { 45 | if (index == _currentItem && index == 0) 46 | backToStart(scrollControllerNewsList); 47 | if (index == _currentItem && index == 1) 48 | backToStart(scrollControllerLikedList); 49 | if (index == _currentItem && index == 2) 50 | backToStart(scrollControllerSettings); 51 | _currentItem = index; 52 | }); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /news_app/lib/ui/screens/liked_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:news_app/blocs/news_bloc.dart'; 2 | import 'package:news_app/ui/views/stream_builder.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | ScrollController scrollControllerLikedList; 6 | 7 | class LikedList extends StatefulWidget { 8 | @override 9 | createState() => LikedListState(); 10 | } 11 | 12 | class LikedListState extends State { 13 | @override 14 | void initState() { 15 | scrollControllerLikedList = ScrollController(initialScrollOffset: 84); 16 | super.initState(); 17 | } 18 | 19 | @override 20 | void dispose() { 21 | scrollControllerLikedList.dispose(); 22 | super.dispose(); 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | bloc.fetchLikedNews(); 28 | return SafeArea( 29 | child: CustomScrollView( 30 | controller: scrollControllerLikedList, 31 | slivers: [ 32 | SliverToBoxAdapter( 33 | child: Container( 34 | decoration: BoxDecoration( 35 | border: Border.all( 36 | color: Theme.of(context).accentColor, width: 2), 37 | borderRadius: BorderRadius.circular(16)), 38 | margin: EdgeInsets.only( 39 | bottom: 10, left: 10.0, right: 10.0, top: 10.0), 40 | padding: EdgeInsets.all(6), 41 | alignment: Alignment.center, 42 | child: Text( 43 | 'You favorite news', 44 | textAlign: TextAlign.center, 45 | style: TextStyle(fontSize: 24), 46 | ), 47 | ), 48 | ), 49 | streamBuilder(bloc.likeNews), 50 | ], 51 | ), 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /news_app/lib/ui/screens/news_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:news_app/blocs/news_bloc.dart'; 2 | import 'package:news_app/ui/views/search_bar.dart'; 3 | import 'package:news_app/ui/views/stream_builder.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | ScrollController scrollControllerNewsList; 7 | 8 | class NewsList extends StatefulWidget { 9 | @override 10 | createState() => NewsListState(); 11 | } 12 | 13 | class NewsListState extends State { 14 | @override 15 | void initState() { 16 | setState(() {}); 17 | scrollControllerNewsList = ScrollController(initialScrollOffset: 84); 18 | super.initState(); 19 | } 20 | 21 | @override 22 | void dispose() { 23 | scrollControllerNewsList.dispose(); 24 | super.dispose(); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | bloc.fetchAllNews(); 30 | setState(() {}); 31 | return SafeArea( 32 | child: CustomScrollView( 33 | controller: scrollControllerNewsList, 34 | slivers: [ 35 | buildSearchBar(context), // Serach 36 | streamBuilder(bloc.allNews), 37 | ], 38 | ), 39 | ); 40 | } 41 | } -------------------------------------------------------------------------------- /news_app/lib/ui/screens/serch_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:news_app/blocs/news_bloc.dart'; 3 | import 'package:news_app/ui/views/stream_builder.dart'; 4 | import 'package:shared_preferences/shared_preferences.dart'; 5 | 6 | Future _prefs = SharedPreferences.getInstance(); 7 | ScrollController scrollController; 8 | 9 | class SearchScreen extends StatefulWidget { 10 | final String title; 11 | SearchScreen({this.title}); 12 | 13 | @override 14 | createState() => _SearchScreenState(); 15 | } 16 | 17 | class _SearchScreenState extends State { 18 | @override 19 | void initState() { 20 | scrollController = ScrollController() 21 | ..addListener(() { 22 | print("offset = ${scrollController.offset}"); 23 | if (scrollController.offset > 1700) { 24 | // ToDo listener and get next page on newsapi.org 25 | } 26 | }); 27 | super.initState(); 28 | } 29 | 30 | @override 31 | void dispose() { 32 | scrollController.dispose(); 33 | super.dispose(); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | bloc.fetchSearchNews(); 39 | return Scaffold( 40 | body: SafeArea( 41 | child: CustomScrollView( 42 | controller: scrollController, 43 | slivers: [ 44 | _cuctomAppBar(), 45 | streamBuilder(bloc.searchNews), 46 | ], 47 | ), 48 | ), 49 | ); 50 | } 51 | 52 | _cuctomAppBar() { 53 | return SliverList( 54 | delegate: SliverChildListDelegate([ 55 | Row( 56 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 57 | children: [ 58 | IconButton( 59 | icon: Icon(Icons.arrow_back_ios), 60 | onPressed: () => goBack(), 61 | ), 62 | Expanded( 63 | child: Padding( 64 | padding: const EdgeInsets.only(right: 48.0), 65 | child: Text( 66 | "${widget.title}", 67 | textAlign: TextAlign.center, 68 | style: TextStyle(fontSize: 24), 69 | ), 70 | ), 71 | ), 72 | ], 73 | ) 74 | ]), 75 | ); 76 | } 77 | 78 | goBack() async { 79 | final SharedPreferences prefs = await _prefs; 80 | prefs.setString("priorityTheme", null); 81 | Navigator.pop(context); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /news_app/lib/ui/screens/settings_screen.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:flutter_picker/flutter_picker.dart'; 3 | import 'package:dynamic_theme/dynamic_theme.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:shared_preferences/shared_preferences.dart'; 6 | import 'package:flutter_material_color_picker/flutter_material_color_picker.dart'; 7 | 8 | Future _prefs = SharedPreferences.getInstance(); 9 | 10 | ScrollController scrollControllerSettings; 11 | 12 | class SettingsScreen extends StatefulWidget { 13 | @override 14 | SettingsState createState() => SettingsState(); 15 | } 16 | 17 | class SettingsState extends State { 18 | bool swBrowser = false; 19 | bool swTheme = false; 20 | String country = ''; 21 | Color _local = Color(0x000); 22 | 23 | bool initData; 24 | 25 | @override 26 | void initState() { 27 | scrollControllerSettings = ScrollController(initialScrollOffset: 84); 28 | initStateCustome().then((_) { 29 | setState((){}); 30 | }); 31 | super.initState(); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | scrollControllerSettings.dispose(); 37 | super.dispose(); 38 | } 39 | 40 | // Init state logic 41 | Future initStateCustome() async { 42 | SharedPreferences prefs = await _prefs; 43 | country = prefs.getString('country'); 44 | swBrowser = prefs.getBool('browser'); 45 | _local = Color(prefs.getInt('color') ?? 0xFF26A69A); 46 | initData = true; 47 | } 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | if (initData == false || initData == null) { 52 | print(initData); 53 | return LinearProgressIndicator(); 54 | } 55 | return SafeArea( 56 | child: SingleChildScrollView( 57 | controller: scrollControllerSettings, 58 | child: Column( 59 | children: [ 60 | Container( 61 | decoration: BoxDecoration( 62 | border: Border.all( 63 | color: Theme.of(context).accentColor, width: 2), 64 | borderRadius: BorderRadius.circular(16)), 65 | margin: EdgeInsets.only( 66 | bottom: 10, left: 10.0, right: 10.0, top: 10.0), 67 | padding: EdgeInsets.all(6), 68 | alignment: Alignment.center, 69 | child: Text( 70 | 'Settings', 71 | textAlign: TextAlign.center, 72 | style: TextStyle(fontSize: 24), 73 | ), 74 | ), 75 | ListTile( 76 | onTap: () => changeTheme(!swTheme), 77 | title: Text('Dark theme'), 78 | subtitle: Text('Enable dark theme throughout the app'), 79 | trailing: Switch( 80 | activeColor: Theme.of(context).accentColor, 81 | onChanged: (bool value) => changeTheme(value), 82 | value: Theme.of(context).brightness == Brightness.dark 83 | ? swTheme = true 84 | : swTheme = false, 85 | ), 86 | ), 87 | Divider(), // Divider 88 | ListTile( 89 | title: Text('News country'), 90 | subtitle: Text(country), 91 | onTap: () => showPickerArray(context), 92 | ), 93 | Divider(), // Divider 94 | ListTile( 95 | title: Text('Primary color'), 96 | trailing: Container( 97 | child: CircleColor( 98 | color: _local, 99 | circleSize: 50, 100 | ), 101 | ), 102 | onTap: () => changePrimaryColor(), 103 | ), 104 | Divider(), // Divider 105 | ListTile( 106 | onTap: () => changeBrowser(!swBrowser), 107 | title: Text('Open in browser'), 108 | subtitle: Text('To work more efficiently'), 109 | trailing: Switch( 110 | value: swBrowser, 111 | activeColor: Theme.of(context).accentColor, 112 | onChanged: (bool value) => changeBrowser(value), 113 | ), 114 | ), 115 | Divider(), // Divider 116 | ], 117 | ), 118 | ), 119 | ); 120 | } 121 | 122 | // Theme Logic 123 | changeTheme(value) async { 124 | SharedPreferences prefs = await _prefs; 125 | DynamicTheme.of(context).setThemeData(ThemeData( 126 | accentColor: Theme.of(context).accentColor, 127 | brightness: Theme.of(context).brightness == Brightness.dark 128 | ? Brightness.light 129 | : Brightness.dark)); 130 | setState(() { 131 | swTheme = value; 132 | }); 133 | await prefs.setString('theme', swTheme ? 'dark' : 'light'); 134 | } 135 | 136 | // Picer Logic 137 | showPickerArray(BuildContext context) async { 138 | SharedPreferences prefs = await _prefs; 139 | String country = prefs.getString('country'); 140 | int selected = 0; 141 | Color textStyle = Theme.of(context).brightness == Brightness.dark 142 | ? Colors.white 143 | : Colors.grey[800]; 144 | Color backgroundColor = Theme.of(context).brightness == Brightness.dark 145 | ? Colors.grey[800] 146 | : Colors.white; 147 | 148 | if (country == 'Russia') 149 | selected = 0; 150 | else if (country == 'US') 151 | selected = 1; 152 | else if (country == 'United Kingdom') 153 | selected = 2; 154 | else if (country == 'Germany') 155 | selected = 3; 156 | else if (country == 'France') selected = 4; 157 | 158 | Picker( 159 | selecteds: [selected], 160 | textStyle: TextStyle(color: textStyle, fontSize: 24), 161 | backgroundColor: backgroundColor, 162 | adapter: PickerDataAdapter( 163 | pickerdata: JsonDecoder().convert(PickerCountry), isArray: true), 164 | hideHeader: true, 165 | title: new Text("Please Select"), 166 | onConfirm: (Picker picker, List value) { 167 | prefs.setString( 168 | 'country', 169 | picker 170 | .getSelectedValues() 171 | .toString() 172 | .replaceAll('[', '') 173 | .replaceAll(']', '')); 174 | }).showDialog(context); 175 | } 176 | 177 | // Change Coloro L 178 | changePrimaryColor() async { 179 | SharedPreferences prefs = await _prefs; 180 | Color local = Color(prefs.getInt('color') ?? 0xFF26A69A); 181 | 182 | showDialog( 183 | context: context, 184 | child: SimpleDialog( 185 | title: Text('Primary color', style: TextStyle(fontSize: 24)), 186 | children: [ 187 | MaterialColorPicker( 188 | selectedColor: local, 189 | onColorChange: (Color color) { 190 | local = color; 191 | }, 192 | colors: [ 193 | Colors.red, 194 | Colors.pink, 195 | Colors.purple, 196 | Colors.deepPurple, 197 | Colors.indigo, 198 | Colors.blue, 199 | Colors.lightBlue, 200 | Colors.cyan, 201 | Colors.teal, 202 | Colors.green, 203 | Colors.lightGreen, 204 | Colors.lime, 205 | Colors.yellow, 206 | Colors.amber, 207 | Colors.orange, 208 | ]), 209 | Row( 210 | mainAxisAlignment: MainAxisAlignment.end, 211 | children: [ 212 | FlatButton( 213 | onPressed: () { 214 | Navigator.pop(context, false); 215 | }, 216 | child: Text("Cancel")), 217 | FlatButton( 218 | onPressed: () async { 219 | DynamicTheme.of(context).setThemeData(ThemeData( 220 | accentColor: local, 221 | brightness: Theme.of(context).brightness)); 222 | await prefs.setInt('color', local.value); 223 | Navigator.pop(context, false); 224 | }, 225 | child: Text("Confirm")) 226 | ], 227 | ), 228 | ], 229 | )); 230 | } 231 | 232 | changeBrowser(bool value) async { 233 | SharedPreferences prefs = await _prefs; 234 | await prefs.setBool('browser', value); 235 | setState(() { 236 | swBrowser = value; 237 | }); 238 | } 239 | } 240 | 241 | const PickerCountry = ''' 242 | [ 243 | [ 244 | "Russia", 245 | "US", 246 | "United Kingdom", 247 | "Germany", 248 | "France" 249 | ] 250 | ] 251 | '''; 252 | -------------------------------------------------------------------------------- /news_app/lib/ui/screens/web_view.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:news_app/models/news_model.dart'; 4 | import 'package:news_app/resources/news_api_provider.dart'; 5 | import 'package:shared_preferences/shared_preferences.dart'; 6 | import 'package:webview_flutter/webview_flutter.dart'; 7 | 8 | @immutable 9 | class WebViewScreen extends StatefulWidget { 10 | final Future _prefs = SharedPreferences.getInstance(); 11 | final Articles model; 12 | 13 | WebViewScreen({this.model}); 14 | 15 | @override 16 | WebViewState createState() => WebViewState(); 17 | } 18 | 19 | class WebViewState extends State { 20 | IconData icons; 21 | List _listLiked = []; 22 | SharedPreferences prefs; 23 | 24 | initSharedPref() async { 25 | prefs = await widget._prefs; 26 | _listLiked = prefs.getStringList("liked"); 27 | if (_listLiked.indexOf(widget.model.url) >= 0) 28 | icons = Icons.favorite; 29 | else 30 | icons = Icons.favorite_border; 31 | setState(() {}); 32 | } 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | initSharedPref(); 37 | return Scaffold( 38 | appBar: AppBar( 39 | backgroundColor: Theme.of(context).accentColor, 40 | title: Text('${widget.model.source.name}'), 41 | actions: [ 42 | IconButton(icon: Icon(icons), onPressed: () => _likeUiLogi()), 43 | ], 44 | ), 45 | body: WebView( 46 | initialUrl: widget.model.url, 47 | javascriptMode: JavascriptMode.unrestricted, 48 | ), 49 | ); 50 | } 51 | 52 | _likeUiLogi() async { 53 | if (_listLiked.indexOf(widget.model.url) < 0) { 54 | icons = Icons.favorite; 55 | _listLiked.add("${widget.model.url}"); 56 | await prefs.setStringList("liked", _listLiked); 57 | await NewsApiProvider().addToFiresstore({ 58 | "url": widget.model.url, 59 | "urlToImage": widget.model.urlToImage, 60 | "title": widget.model.title, 61 | "author": widget.model.author, 62 | "publishedAt": widget.model.publishedAt, 63 | "source": widget.model.source.toJson() 64 | }); 65 | } else if (_listLiked.indexOf(widget.model.url) >= 0) { 66 | icons = Icons.favorite_border; 67 | num index = _listLiked.indexOf(widget.model.url); 68 | _listLiked.removeAt(index); 69 | await prefs.setStringList("liked", _listLiked); 70 | await NewsApiProvider().deliteFromFirestore({ 71 | "url": widget.model.url, 72 | "urlToImage": widget.model.urlToImage, 73 | "title": widget.model.title, 74 | "author": widget.model.author, 75 | "publishedAt": widget.model.publishedAt, 76 | "source": widget.model.source.toJson() 77 | }); 78 | } 79 | setState(() {}); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /news_app/lib/ui/utils/back_to_start.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | backToStart(ScrollController scrollController) async { 4 | if (scrollController.positions.isNotEmpty) { 5 | await scrollController.animateTo(0, 6 | curve: Curves.ease, duration: Duration(seconds: 2)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /news_app/lib/ui/views/item_build.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:intl/intl.dart'; 3 | import 'package:news_app/models/news_model.dart'; 4 | import 'package:news_app/resources/news_api_provider.dart'; 5 | import 'package:news_app/ui/screens/web_view.dart'; 6 | import 'package:share/share.dart'; 7 | import 'package:url_launcher/url_launcher.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | 10 | Future _prefs = SharedPreferences.getInstance(); 11 | 12 | buildListSliver(NewsModel values, BuildContext context) { 13 | if (values.articles.length == 0) { 14 | return SliverToBoxAdapter( 15 | child: Container( 16 | padding: EdgeInsets.all(20), 17 | child: Center( 18 | child: Text('You didn\'t like anything', 19 | style: TextStyle( 20 | color: Theme.of(context).accentColor, fontSize: 24))), 21 | )); 22 | } else { 23 | return SliverList( 24 | delegate: SliverChildBuilderDelegate( 25 | (context, index) => ListItemBuild(values.articles[index]), 26 | childCount: values.articles.length), 27 | ); 28 | } 29 | } 30 | 31 | class ListItemBuild extends StatefulWidget { 32 | final Articles model; 33 | ListItemBuild(this.model); 34 | 35 | createState() => ListItemState(); 36 | } 37 | 38 | class ListItemState extends State with TickerProviderStateMixin { 39 | // Animations 40 | Animation colorAnimation; 41 | AnimationController colorAnimationController; 42 | // List 43 | List _listLiked = []; 44 | // Shared Preferences 45 | SharedPreferences prefs; 46 | // Icons 47 | IconData icons; 48 | // Height and len 49 | double height = 150; 50 | int maxline = 2; 51 | 52 | initSharedPref() async { 53 | prefs = await _prefs; 54 | _listLiked = prefs.getStringList("liked"); 55 | if (_listLiked.indexOf(widget.model.url) >= 0) 56 | icons = Icons.favorite; 57 | else 58 | icons = Icons.favorite_border; 59 | setState(() {}); 60 | } 61 | 62 | initHeight() { 63 | if (widget.model.title.length >= 90) { 64 | height += 10; 65 | maxline++; 66 | } 67 | if (widget.model.title.length >= 110) { 68 | height += 15; 69 | maxline++; 70 | } 71 | } 72 | 73 | initState() { 74 | initSharedPref(); 75 | initHeight(); 76 | colorAnimationController = AnimationController( 77 | duration: const Duration(milliseconds: 700), vsync: this); 78 | colorAnimation = 79 | Tween(begin: 1.0, end: .5).animate(colorAnimationController); 80 | super.initState(); 81 | } 82 | 83 | dispose() { 84 | colorAnimationController.dispose(); 85 | super.dispose(); 86 | } 87 | 88 | @override 89 | Widget build(BuildContext context) { 90 | return AnimatedBuilder( 91 | animation: colorAnimation, 92 | builder: (context, _) { 93 | return _buildItem(context); 94 | }, 95 | ); 96 | } 97 | 98 | _buildItem(context) { 99 | String url = widget.model.urlToImage; 100 | var image = Image.network(url).image; 101 | image 102 | .resolve(ImageConfiguration()) 103 | .addListener((imageInfo, synchronousCall) { 104 | colorAnimationController.forward(); 105 | 106 | }); 107 | 108 | if (url == null) 109 | url = 'https://avatars1.githubusercontent.com/u/31259204?s=40&v=1'; 110 | 111 | return Container( 112 | height: height, 113 | child: InkWell( 114 | onTap: () => logicWeb(widget.model, context), 115 | child: Card( 116 | color: Colors.black54, 117 | shape: 118 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), 119 | child: ClipRRect( 120 | borderRadius: BorderRadius.circular(20), 121 | child: Container( 122 | padding: EdgeInsets.all(14), 123 | decoration: BoxDecoration( 124 | image: DecorationImage( 125 | colorFilter: ColorFilter.mode( 126 | Colors.black54.withOpacity(colorAnimation.value), 127 | BlendMode.hardLight), 128 | fit: BoxFit.cover, 129 | image: image), 130 | ), 131 | child: _columnWithContent(), 132 | ), 133 | )), 134 | ), 135 | ); 136 | } 137 | 138 | _columnWithContent() { 139 | return Column( 140 | children: [ 141 | _headerItemBuild(), 142 | _textItemBuild(), 143 | _dateItemBuild(), 144 | ], 145 | ); 146 | } 147 | 148 | _headerItemBuild() { 149 | return Row( 150 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 151 | children: [ 152 | Text( 153 | widget.model.source.name, 154 | style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), 155 | ), 156 | Container( 157 | child: Row( 158 | children: [ 159 | IconButton( 160 | icon: Icon( 161 | Icons.share, 162 | color: Theme.of(context).accentColor, 163 | ), 164 | onPressed: () { 165 | Share.share(widget.model.url); 166 | }, 167 | ), 168 | IconButton( 169 | icon: Icon( 170 | icons, 171 | color: Theme.of(context).accentColor, 172 | ), 173 | onPressed: () => _likeUiLogi(), 174 | ), 175 | ], 176 | ), 177 | ), 178 | ], 179 | ); 180 | } 181 | 182 | _dateItemBuild() { 183 | // Parse date to normal format 184 | DateFormat format = DateFormat("yyyy-MM-dd'T'HH:mm:ss"); 185 | final unformedDate = format.parse(widget.model.publishedAt); 186 | Duration difference = unformedDate.difference(DateTime.now()); 187 | 188 | return Container( 189 | padding: EdgeInsets.only(top: 12), 190 | child: Text( 191 | (int.tryParse(difference.inHours.abs().toString()) < 12) 192 | ? difference.inHours.abs().toString() + " hours ago" 193 | : difference.inDays.abs().toString() + " days ago", 194 | style: TextStyle(color: Colors.white, fontWeight: FontWeight.w600), 195 | ), 196 | alignment: Alignment.centerLeft, 197 | ); 198 | } 199 | 200 | _likeUiLogi() async { 201 | if (_listLiked.indexOf(widget.model.url) < 0) { 202 | icons = Icons.favorite; 203 | _listLiked.add("${widget.model.url}"); 204 | await prefs.setStringList("liked", _listLiked); 205 | await NewsApiProvider().addToFiresstore({ 206 | "url": widget.model.url, 207 | "urlToImage": widget.model.urlToImage, 208 | "title": widget.model.title, 209 | "author": widget.model.author, 210 | "publishedAt": widget.model.publishedAt, 211 | "source": widget.model.source.toJson() 212 | }); 213 | } else if (_listLiked.indexOf(widget.model.url) >= 0) { 214 | icons = Icons.favorite_border; 215 | num index = _listLiked.indexOf(widget.model.url); 216 | _listLiked.removeAt(index); 217 | await prefs.setStringList("liked", _listLiked); 218 | await NewsApiProvider().deliteFromFirestore({ 219 | "url": widget.model.url, 220 | "urlToImage": widget.model.urlToImage, 221 | "title": widget.model.title, 222 | "author": widget.model.author, 223 | "publishedAt": widget.model.publishedAt, 224 | "source": widget.model.source.toJson() 225 | }); 226 | } 227 | setState(() {}); 228 | } 229 | 230 | logicWeb(Articles values, context) async { 231 | String url = values.url; 232 | SharedPreferences prefs = await _prefs; 233 | if (!prefs.getBool('browser')) 234 | _openWebSite(values, context); 235 | else if (prefs.getBool('browser')) { 236 | if (await canLaunch(url)) { 237 | await launch(url); 238 | } else { 239 | throw 'Could not launch $url'; 240 | } 241 | } 242 | } 243 | 244 | _openWebSite(Articles model, context) { 245 | Navigator.push(context, 246 | MaterialPageRoute(builder: (context) => WebViewScreen(model: model))); 247 | } 248 | 249 | _textItemBuild() { 250 | return Flexible( 251 | child: new Text( 252 | widget.model.title, 253 | maxLines: maxline, 254 | overflow: TextOverflow.ellipsis, 255 | style: new TextStyle( 256 | fontWeight: FontWeight.bold, fontSize: 16, color: Colors.white), 257 | ), 258 | ); 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /news_app/lib/ui/views/search_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:news_app/ui/screens/serch_screen.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | 5 | Future _prefs = SharedPreferences.getInstance(); 6 | 7 | buildSearchBar(BuildContext context) { 8 | return SliverPadding( 9 | padding: EdgeInsets.only(left: 16.0, right: 16.0, top: 16.0), 10 | sliver: SliverList( 11 | delegate: SliverChildListDelegate([ 12 | Card( 13 | color: Colors.transparent, 14 | elevation: 8, 15 | child: ClipRRect( 16 | borderRadius: BorderRadius.all(Radius.circular(16.0)), 17 | child: Container( 18 | padding: EdgeInsets.symmetric(horizontal: 16.0), 19 | color: Theme.of(context).accentColor, 20 | child: TextField( 21 | decoration: InputDecoration( 22 | icon: Icon(Icons.search), 23 | border: InputBorder.none, 24 | hintStyle: 25 | TextStyle(fontSize: 18, color: Colors.black54), 26 | hintText: 'Search news'), 27 | textInputAction: TextInputAction.search, 28 | cursorColor: Colors.black54, 29 | style: TextStyle(fontSize: 18, color: Colors.black54), 30 | controller: TextEditingController(), 31 | onSubmitted: (text) => searchLogic(context, text), 32 | ), 33 | ))) 34 | ]), 35 | ), 36 | ); 37 | } 38 | 39 | searchLogic(BuildContext context, String text) { 40 | Navigator.popUntil(context, (route) { 41 | sarePref(text); 42 | Navigator.of(context).push(MaterialPageRoute( 43 | builder: (BuildContext context) => SearchScreen( 44 | title: text, 45 | ))); 46 | }); 47 | } 48 | 49 | sarePref(text) async { 50 | final SharedPreferences prefs = await _prefs; 51 | prefs.setString("priorityTheme", text); 52 | } 53 | -------------------------------------------------------------------------------- /news_app/lib/ui/views/stream_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:news_app/ui/views/item_build.dart'; 3 | 4 | streamBuilder(val) { 5 | return StreamBuilder( 6 | stream: val, 7 | builder: (context, snapshot) { 8 | if (snapshot.hasData) { 9 | return buildListSliver(snapshot.data, context); 10 | } else if (snapshot.hashCode.toString() == 'apiKeyMissing') { 11 | return SliverToBoxAdapter( 12 | child: Center( 13 | child: Text('Oppps! Error server'), 14 | ), 15 | ); 16 | } else { 17 | return SliverToBoxAdapter( 18 | child: Container( 19 | padding: EdgeInsets.all(20), 20 | child: Center( 21 | child: CircularProgressIndicator( 22 | valueColor: 23 | AlwaysStoppedAnimation(Theme.of(context).accentColor), 24 | ), 25 | ), 26 | )); 27 | } 28 | }, 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /news_app/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: news_app 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.5 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | rxdart: ^0.18.0 19 | http: any 20 | webview_flutter: ^0.3.0 21 | url_launcher: ^4.2.0+1 22 | shared_preferences: ^0.4.3 23 | share: ^0.5.3 24 | cloud_firestore: ^0.8.2+3 25 | uuid: ^1.0.3 26 | dynamic_theme: ^1.0.0 27 | flutter_picker: ^1.0.6 28 | flutter_material_color_picker: ^0.0.4 29 | intl: ^0.15.7 30 | 31 | 32 | # The following adds the Cupertino Icons font to your application. 33 | # Use with the CupertinoIcons class for iOS style icons. 34 | cupertino_icons: ^0.1.2 35 | 36 | dev_dependencies: 37 | flutter_test: 38 | sdk: flutter 39 | 40 | 41 | # For information on the generic Dart part of this file, see the 42 | # following page: https://www.dartlang.org/tools/pub/pubspec 43 | 44 | # The following section is specific to Flutter. 45 | flutter: 46 | 47 | # The following line ensures that the Material Icons font is 48 | # included with your application, so that you can use the icons in 49 | # the material Icons class. 50 | uses-material-design: true 51 | 52 | # To add assets to your application, add an assets section, like this: 53 | # assets: 54 | # - images/a_dot_burr.jpeg 55 | # - images/a_dot_ham.jpeg 56 | 57 | # An image asset can refer to one or more resolution-specific "variants", see 58 | # https://flutter.io/assets-and-images/#resolution-aware. 59 | 60 | # For details regarding adding assets from package dependencies, see 61 | # https://flutter.io/assets-and-images/#from-packages 62 | 63 | # To add custom fonts to your application, add a fonts section here, 64 | # in this "flutter" section. Each entry in this list should have a 65 | # "family" key with the font family name, and a "fonts" key with a 66 | # list giving the asset and other descriptors for the font. For 67 | # example: 68 | # fonts: 69 | # - family: Schyler 70 | # fonts: 71 | # - asset: fonts/Schyler-Regular.ttf 72 | # - asset: fonts/Schyler-Italic.ttf 73 | # style: italic 74 | # - family: Trajan Pro 75 | # fonts: 76 | # - asset: fonts/TrajanPro.ttf 77 | # - asset: fonts/TrajanPro_Bold.ttf 78 | # weight: 700 79 | # 80 | # For details regarding fonts from package dependencies, 81 | # see https://flutter.io/custom-fonts/#from-packages 82 | -------------------------------------------------------------------------------- /news_app/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_test/flutter_test.dart'; 9 | 10 | 11 | void main() { 12 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 13 | // Build our app and trigger a frame. 14 | // await tester.pumpWidget(App()); 15 | 16 | // // Verify that our counter starts at 0. 17 | // expect(find.text('0'), findsOneWidget); 18 | // expect(find.text('1'), findsNothing); 19 | 20 | // // Tap the '+' icon and trigger a frame. 21 | // await tester.tap(find.byIcon(Icons.add)); 22 | // await tester.pump(); 23 | 24 | // // Verify that our counter has incremented. 25 | // expect(find.text('0'), findsNothing); 26 | // expect(find.text('1'), findsOneWidget); 27 | }); 28 | } 29 | --------------------------------------------------------------------------------