├── .gitignore ├── .metadata ├── .vscode └── settings.json ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_firebase_full_news_app │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets └── icon │ ├── ic_app_logo.png │ └── ic_microphone.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h └── firebase_app_id_file.json ├── lib ├── feature │ ├── auth │ │ ├── authentication_provider.dart │ │ └── authentication_view.dart │ ├── home │ │ ├── home_provider.dart │ │ ├── home_view.dart │ │ └── sub_view │ │ │ ├── home_chips.dart │ │ │ ├── home_news_list_view.dart │ │ │ └── home_serach_delegate.dart │ ├── home_create │ │ ├── home_create_view.dart │ │ └── home_logic.dart │ └── splash │ │ ├── splash_provider.dart │ │ └── splash_view.dart ├── main.dart └── product │ ├── constants │ ├── color_constants.dart │ ├── index.dart │ └── string_constants.dart │ ├── enums │ ├── cache_items.dart │ ├── image_constants.dart │ ├── image_size.dart │ ├── index.dart │ ├── platform_enum.dart │ └── widget_size.dart │ ├── initialize │ ├── app_builder.dart │ ├── app_cache.dart │ ├── app_theme.dart │ └── application_start.dart │ ├── models │ ├── category.dart │ ├── index.dart │ ├── news.dart │ ├── number_model.dart │ ├── recomanded.dart │ └── tag.dart │ ├── services │ └── firebase_service.dart │ ├── utility │ ├── base │ │ └── base_firebase_model.dart │ ├── exception │ │ └── custom_exception.dart │ ├── firebase │ │ ├── firebase_collections.dart │ │ └── firebase_utility.dart │ ├── image │ │ └── pick_image.dart │ └── version_manager.dart │ └── widget │ ├── card │ ├── home_news_card.dart │ └── recommended.dart │ ├── custom_button.dart │ ├── custom_chip.dart │ ├── index.dart │ └── text │ ├── sub_title_text.dart │ ├── title_text.dart │ └── wavy_text.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements └── firebase_app_id_file.json ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | android/app/google-services.json 46 | ios/Runner/GoogleService-Info.plist 47 | macos/Runner/GoogleService-Info.plist 48 | lib/firebase_options.dart 49 | -------------------------------------------------------------------------------- /.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. 5 | 6 | version: 7 | revision: c07f7888888435fd9df505aa2efc38d3cf65681b 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 17 | base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 18 | - platform: android 19 | create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 20 | base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 21 | - platform: ios 22 | create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 23 | base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 24 | - platform: linux 25 | create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 26 | base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 27 | - platform: macos 28 | create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 29 | base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 30 | - platform: web 31 | create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 32 | base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 33 | - platform: windows 34 | create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 35 | base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "Firestore", 4 | "riverpod" 5 | ], 6 | "dart.lineLength": 80 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hızlı ve iyi proje geliştir - IosAndroidWeb+Firebase (Riverpod) 2 | ![image](https://miro.medium.com/v2/resize:fit:1400/format:webp/1*fySJIiyDo2mxvkxZM5otEg.png) 3 | * Ülkemizde yaşanan deprem felaketinin ardından herkes üstüne düşen görev ve sorumlulukları elinden geldiğinin en iyisi şeklinde yapmaya başladı. Burda bizim üstümüze düşen bunu bir sorumluluk haline getirip düzenli hale getirmekti. 4 | * **Hızlı ve iyi proje geliştir** eğitim içeriği ile beraber deprem bölgesine yardımda bulunmak amaçlandı. İçerik 9 [Youtube Video Serisinden](https://youtube.com/playlist?list=PL1k5oWAuBhgWRZRQHHtTJBKOFan9NeP-Z) oluşmaktadır ve ücretsiz erişime açıktır. 5 | * İçeriğe ait videoları detaylı olarak da anlatılmış [MEDIUM](https://medium.com/@vbacik-10/firebase-ve-flutter-ile-hızlı-ve-iyi-proje-geliştir-öğren-paylaş-bağış-yap-e898e5f58e88) yazısını okuyabilirsiniz 6 | 7 | ### Bağış : 8 | Hedef doğrultusunda beraber katkı yapabilmek amacıyla kodlar ilk aşamada github da private olarak tutuluyor, bağış yapanlara izin veriliyordu. Destek olmak isteyenler herhangi bir kuruma bağış yapıp bu dekontları ilgili [FORM](https://forms.gle/4yb45rRZDWR99bBQA) alanına yükleyebilirler. 9 | | Eğitim içeriği | 10 | |:-------:| 11 | | [Neden Flutter? Neden Firebase? Analiz Yapma, Proje Detayları](https://youtu.be/cwrT25zY7Zg) | 12 | | [Flutter Projesi Mimari Hazırlama, Gerekli Paketleri Kurma](https://youtu.be/BghpLf2pj7Q) | 13 | | [Firebase Entegrasyonu ve Alt Yapı Hazırlama](https://youtu.be/Z6vqfFImsN4) | 14 | | [Giriş(Splash) Ekranı, Platform Özel Kod Yazma ve Zorunlu Güncelleme](https://youtu.be/feypWC4EjVM) | 15 | | [Firebase Auth Entegrasyonu ve Ekran Tasarımı (flutterfire_ui)](https://youtu.be/jpy0geq3g1g) | 16 | | [Ana Sayfa Ekran Tasarımı, Küçük Parçalara Ayırma](https://youtu.be/OBWOJJS-QFU) | 17 | | [Ana Sayfa Firebase Entegrasyonu Listeleme ve Arama (riverpod))](https://youtu.be/LZcCtDdM1G8) | 18 | | [Firebase Yeni Veri ekleme, Validasyonlarını Sağlama](https://youtu.be/QXpW8G-7NdE) | 19 | | [Github İş Yönetimi- Proje Sonu Değerlendirme](https://youtu.be/KF7ithLyq-Q) | 20 | 21 | 22 | ### Dikkat 23 | 24 | "editor.codeActionsOnSave": { 25 | "source.fixAll": true 26 | } 27 | 28 | https://api.flutter.dev/flutter/material/TextTheme-class.html 29 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:very_good_analysis/analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | public_member_api_docs: false 6 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /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 | // START: FlutterFire Configuration 26 | apply plugin: 'com.google.gms.google-services' 27 | // END: FlutterFire Configuration 28 | apply plugin: 'kotlin-android' 29 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 30 | 31 | android { 32 | compileSdkVersion flutter.compileSdkVersion 33 | ndkVersion flutter.ndkVersion 34 | 35 | compileOptions { 36 | sourceCompatibility JavaVersion.VERSION_1_8 37 | targetCompatibility JavaVersion.VERSION_1_8 38 | } 39 | 40 | kotlinOptions { 41 | jvmTarget = '1.8' 42 | } 43 | 44 | sourceSets { 45 | main.java.srcDirs += 'src/main/kotlin' 46 | } 47 | 48 | defaultConfig { 49 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 50 | applicationId "com.example.flutter_firebase_full_news_app" 51 | // You can update the following values to match your application needs. 52 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 53 | minSdkVersion 21 54 | targetSdkVersion flutter.targetSdkVersion 55 | versionCode flutterVersionCode.toInteger() 56 | versionName flutterVersionName 57 | } 58 | 59 | buildTypes { 60 | release { 61 | // TODO: Add your own signing config for the release build. 62 | // Signing with the debug keys for now, so `flutter run --release` works. 63 | signingConfig signingConfigs.debug 64 | } 65 | } 66 | } 67 | 68 | flutter { 69 | source '../..' 70 | } 71 | 72 | dependencies { 73 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 74 | } 75 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flutter_firebase_full_news_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_firebase_full_news_app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | // START: FlutterFire Configuration 11 | classpath 'com.google.gms:google-services:4.3.10' 12 | // END: FlutterFire Configuration 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | rootProject.buildDir = '../build' 25 | subprojects { 26 | project.buildDir = "${rootProject.buildDir}/${project.name}" 27 | } 28 | subprojects { 29 | project.evaluationDependsOn(':app') 30 | } 31 | 32 | task clean(type: Delete) { 33 | delete rootProject.buildDir 34 | } 35 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/icon/ic_app_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/assets/icon/ic_app_logo.png -------------------------------------------------------------------------------- /assets/icon/ic_microphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/assets/icon/ic_microphone.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.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 flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Flutter Firebase Full News App 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_firebase_full_news_app 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/firebase_app_id_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_generated_by": "FlutterFire CLI", 3 | "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", 4 | "GOOGLE_APP_ID": "1:340466855888:ios:607a41b574212bd1ca53d5", 5 | "FIREBASE_PROJECT_ID": "flutter-full-news", 6 | "GCM_SENDER_ID": "340466855888" 7 | } -------------------------------------------------------------------------------- /lib/feature/auth/authentication_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:firebase_auth/firebase_auth.dart'; 3 | import 'package:flutter_firebase_full_news_app/product/enums/cache_items.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | 6 | class AuthenticationNotifier extends StateNotifier { 7 | AuthenticationNotifier() : super(const AuthenticationState()); 8 | 9 | Future fetchUserDetail(User? user) async { 10 | if (user == null) return; 11 | final token = await user.getIdToken(); 12 | await tokenSaveToCache(token); 13 | state = state.copyWith(isRedirect: true); 14 | } 15 | 16 | Future tokenSaveToCache(String token) async { 17 | await CacheItems.token.write(token); 18 | } 19 | } 20 | 21 | class AuthenticationState extends Equatable { 22 | const AuthenticationState({this.isRedirect = false}); 23 | 24 | final bool isRedirect; 25 | 26 | @override 27 | List get props => [isRedirect]; 28 | 29 | AuthenticationState copyWith({ 30 | bool? isRedirect, 31 | }) { 32 | return AuthenticationState( 33 | isRedirect: isRedirect ?? this.isRedirect, 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/feature/auth/authentication_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_auth/firebase_auth.dart'; 2 | import 'package:firebase_ui_auth/firebase_ui_auth.dart' as firebase; 3 | import 'package:firebase_ui_auth/firebase_ui_auth.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_firebase_full_news_app/feature/auth/authentication_provider.dart'; 6 | import 'package:flutter_firebase_full_news_app/product/constants/index.dart'; 7 | import 'package:flutter_firebase_full_news_app/product/widget/text/sub_title_text.dart'; 8 | import 'package:flutter_firebase_full_news_app/product/widget/text/title_text.dart'; 9 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 10 | import 'package:kartal/kartal.dart'; 11 | import 'package:responsive_builder/responsive_builder.dart'; 12 | 13 | class AuthenticationView extends ConsumerStatefulWidget { 14 | const AuthenticationView({super.key}); 15 | 16 | @override 17 | ConsumerState createState() => 18 | _AuthenticationViewState(); 19 | } 20 | 21 | class _AuthenticationViewState extends ConsumerState { 22 | final authProvider = 23 | StateNotifierProvider((ref) { 24 | return AuthenticationNotifier(); 25 | }); 26 | 27 | @override 28 | void initState() { 29 | super.initState(); 30 | checkUser(FirebaseAuth.instance.currentUser); 31 | } 32 | 33 | void checkUser(User? user) { 34 | ref.read(authProvider.notifier).fetchUserDetail(user); 35 | } 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return Scaffold( 40 | body: firebase.FirebaseUIActions( 41 | actions: [ 42 | AuthStateChangeAction((context, state) { 43 | if (state.user != null) checkUser(state.user); 44 | }), 45 | ], 46 | child: SafeArea( 47 | child: Padding( 48 | padding: context.paddingLow, 49 | child: Center( 50 | child: Row( 51 | children: [ 52 | const _LeftPlaceHolder(), 53 | Expanded( 54 | child: Column( 55 | mainAxisAlignment: MainAxisAlignment.center, 56 | children: [ 57 | const _Header(), 58 | const _FirebaseAuth(), 59 | if (!ref.watch(authProvider).isRedirect) 60 | TextButton( 61 | onPressed: () {}, 62 | child: Text( 63 | StringConstants.continueToApp, 64 | textAlign: TextAlign.center, 65 | style: context.textTheme.bodySmall?.copyWith( 66 | decoration: TextDecoration.underline, 67 | ), 68 | ), 69 | ) 70 | ], 71 | ), 72 | ), 73 | ], 74 | ), 75 | ), 76 | ), 77 | ), 78 | ), 79 | ); 80 | } 81 | } 82 | 83 | class _FirebaseAuth extends StatelessWidget { 84 | const _FirebaseAuth(); 85 | 86 | @override 87 | Widget build(BuildContext context) { 88 | return Padding( 89 | padding: context.paddingNormal, 90 | child: firebase.LoginView( 91 | action: AuthAction.signIn, 92 | showTitle: false, 93 | providers: firebase.FirebaseUIAuth.providersFor( 94 | FirebaseAuth.instance.app, 95 | ), 96 | ), 97 | ); 98 | } 99 | } 100 | 101 | class _LeftPlaceHolder extends StatelessWidget { 102 | const _LeftPlaceHolder(); 103 | 104 | @override 105 | Widget build(BuildContext context) { 106 | return UnconstrainedBox( 107 | child: getValueForScreenType( 108 | context: context, 109 | mobile: const SizedBox(), 110 | tablet: Placeholder( 111 | fallbackHeight: context.dynamicHeight(0.3), 112 | fallbackWidth: context.dynamicWidth(0.3), 113 | ), 114 | ), 115 | ); 116 | } 117 | } 118 | 119 | class _Header extends StatelessWidget { 120 | const _Header(); 121 | 122 | @override 123 | Widget build(BuildContext context) { 124 | return Column( 125 | crossAxisAlignment: CrossAxisAlignment.start, 126 | children: [ 127 | const TitleText( 128 | value: StringConstants.loginWelcomeBack, 129 | ), 130 | Padding( 131 | padding: context.onlyTopPaddingLow, 132 | child: const SubTitleText( 133 | value: StringConstants.loginWelcomeDetail, 134 | ), 135 | ), 136 | ], 137 | ); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /lib/feature/home/home_provider.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter_firebase_full_news_app/product/models/news.dart'; 4 | import 'package:flutter_firebase_full_news_app/product/models/recomanded.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/models/tag.dart'; 6 | import 'package:flutter_firebase_full_news_app/product/utility/firebase/firebase_collections.dart'; 7 | import 'package:flutter_firebase_full_news_app/product/utility/firebase/firebase_utility.dart'; 8 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 9 | 10 | class HomeNotifier extends StateNotifier with FirebaseUtility { 11 | HomeNotifier() : super(const HomeState()); 12 | 13 | List _fullTagList = []; 14 | List get fullTagList => _fullTagList; 15 | 16 | Future fetchNews() async { 17 | final newsCollectionReference = FirebaseCollections.news.reference; 18 | final response = await newsCollectionReference.withConverter( 19 | fromFirestore: (snapshot, options) { 20 | return const News().fromFirebase(snapshot); 21 | }, 22 | toFirestore: (value, options) { 23 | return value.toJson(); 24 | }, 25 | ).get(); 26 | 27 | if (response.docs.isNotEmpty) { 28 | final values = response.docs.map((e) => e.data()).toList(); 29 | state = state.copyWith(news: values); 30 | } 31 | } 32 | 33 | Future fetchTags() async { 34 | final items = 35 | await fetchList(const Tag(), FirebaseCollections.tag); 36 | state = state.copyWith(tags: items); 37 | _fullTagList = items ?? []; 38 | } 39 | 40 | Future fetchRecommended() async { 41 | final items = await fetchList( 42 | const Recommended(), 43 | FirebaseCollections.recommended, 44 | ); 45 | state = state.copyWith(recommended: items); 46 | } 47 | 48 | Future fetchAndLoad() async { 49 | state = state.copyWith(isLoading: true); 50 | await Future.wait([fetchNews(), fetchTags(), fetchRecommended()]); 51 | state = state.copyWith(isLoading: false); 52 | } 53 | 54 | void updateSelectedTag(Tag? tag) { 55 | if (tag == null) return; 56 | state = state.copyWith(selectedTag: tag); 57 | } 58 | } 59 | 60 | class HomeState extends Equatable { 61 | const HomeState({ 62 | this.news, 63 | this.isLoading, 64 | this.tags, 65 | this.recommended, 66 | this.selectedTag, 67 | }); 68 | // paging 69 | final List? news; 70 | final List? tags; 71 | final List? recommended; 72 | final bool? isLoading; 73 | final Tag? selectedTag; 74 | 75 | @override 76 | List get props => [news, tags, recommended, isLoading, selectedTag]; 77 | 78 | HomeState copyWith({ 79 | List? news, 80 | List? tags, 81 | List? recommended, 82 | bool? isLoading, 83 | Tag? selectedTag, 84 | }) { 85 | return HomeState( 86 | news: news ?? this.news, 87 | tags: tags ?? this.tags, 88 | recommended: recommended ?? this.recommended, 89 | isLoading: isLoading ?? this.isLoading, 90 | selectedTag: selectedTag ?? this.selectedTag, 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/feature/home/home_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_firebase_full_news_app/feature/home/home_provider.dart'; 3 | import 'package:flutter_firebase_full_news_app/feature/home/sub_view/home_serach_delegate.dart'; 4 | import 'package:flutter_firebase_full_news_app/feature/home_create/home_create_view.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/constants/color_constants.dart'; 6 | import 'package:flutter_firebase_full_news_app/product/constants/string_constants.dart'; 7 | import 'package:flutter_firebase_full_news_app/product/models/tag.dart'; 8 | import 'package:flutter_firebase_full_news_app/product/widget/card/home_news_card.dart'; 9 | import 'package:flutter_firebase_full_news_app/product/widget/card/recommended.dart'; 10 | import 'package:flutter_firebase_full_news_app/product/widget/text/sub_title_text.dart'; 11 | import 'package:flutter_firebase_full_news_app/product/widget/text/title_text.dart'; 12 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 13 | import 'package:kartal/kartal.dart'; 14 | 15 | part './sub_view/home_chips.dart'; 16 | 17 | final _homeProvider = StateNotifierProvider((ref) { 18 | return HomeNotifier(); 19 | }); 20 | 21 | class HomeView extends ConsumerStatefulWidget { 22 | const HomeView({super.key}); 23 | 24 | @override 25 | ConsumerState createState() => _HomeViewState(); 26 | } 27 | 28 | class _HomeViewState extends ConsumerState { 29 | final TextEditingController _controller = TextEditingController(); 30 | 31 | @override 32 | void dispose() { 33 | super.dispose(); 34 | _controller.dispose(); 35 | } 36 | 37 | @override 38 | void initState() { 39 | super.initState(); 40 | Future.microtask(() { 41 | ref.read(_homeProvider.notifier).fetchAndLoad(); 42 | }); 43 | 44 | ref.read(_homeProvider.notifier).addListener((state) { 45 | if (state.selectedTag != null) { 46 | _controller.text = state.selectedTag?.name ?? ''; 47 | } 48 | }); 49 | } 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | return Scaffold( 54 | floatingActionButton: FloatingActionButton( 55 | child: const Icon(Icons.add), 56 | onPressed: () async { 57 | final response = await context.navigateToPage( 58 | const HomeCreateView(), 59 | type: SlideType.BOTTOM, 60 | ); 61 | 62 | if (response ?? false) { 63 | await ref.read(_homeProvider.notifier).fetchAndLoad(); 64 | } 65 | }, 66 | ), 67 | body: SafeArea( 68 | child: Stack( 69 | children: [ 70 | ListView( 71 | padding: context.paddingNormal, 72 | children: [ 73 | const _Header(), 74 | _CustomField(_controller), 75 | const _TagListView(), 76 | const _BrowseHorizontalListView(), 77 | const _RecommendedHeader(), 78 | const _RecommendedListView(), 79 | ], 80 | ), 81 | if (ref.watch(_homeProvider).isLoading ?? false) 82 | const Center(child: CircularProgressIndicator()) 83 | ], 84 | ), 85 | ), 86 | ); 87 | } 88 | } 89 | 90 | class _CustomField extends ConsumerWidget { 91 | const _CustomField(this.controller); 92 | final TextEditingController controller; 93 | 94 | @override 95 | Widget build(BuildContext context, WidgetRef ref) { 96 | return TextField( 97 | controller: controller, 98 | onTap: () async { 99 | final response = await showSearch( 100 | context: context, 101 | delegate: HomeSearchDelegate( 102 | ref.read(_homeProvider.notifier).fullTagList, 103 | ), 104 | ); 105 | ref.read(_homeProvider.notifier).updateSelectedTag(response); 106 | }, 107 | decoration: const InputDecoration( 108 | suffixIcon: Icon(Icons.mic_outlined), 109 | prefixIcon: Icon(Icons.search_off_outlined), 110 | border: OutlineInputBorder( 111 | borderSide: BorderSide.none, 112 | ), 113 | filled: true, 114 | fillColor: ColorConstants.grayLighter, 115 | hintText: StringConstants.homeSearchHint, 116 | ), 117 | ); 118 | } 119 | } 120 | 121 | class _TagListView extends ConsumerWidget { 122 | const _TagListView(); 123 | @override 124 | Widget build(BuildContext context, WidgetRef ref) { 125 | final newsItems = ref.watch(_homeProvider).tags ?? []; 126 | return SizedBox( 127 | height: context.dynamicHeight(.1), 128 | child: ListView.builder( 129 | itemCount: newsItems.length, 130 | scrollDirection: Axis.horizontal, 131 | itemBuilder: (BuildContext context, int index) { 132 | final tagItem = newsItems[index]; 133 | if (tagItem.active ?? false) { 134 | return _ActiveChip(tagItem); 135 | } 136 | return _PassiveChip(tagItem); 137 | }, 138 | ), 139 | ); 140 | } 141 | } 142 | 143 | class _BrowseHorizontalListView extends ConsumerWidget { 144 | const _BrowseHorizontalListView(); 145 | 146 | @override 147 | Widget build(BuildContext context, WidgetRef ref) { 148 | final newsItems = ref.watch(_homeProvider).news; 149 | return SizedBox( 150 | height: context.dynamicHeight(.3), 151 | child: ListView.builder( 152 | itemCount: newsItems?.length ?? 0, 153 | scrollDirection: Axis.horizontal, 154 | itemBuilder: (BuildContext context, int index) { 155 | return HomeNewsCard(newsItem: newsItems?[index]); 156 | }, 157 | ), 158 | ); 159 | } 160 | } 161 | 162 | class _RecommendedHeader extends StatelessWidget { 163 | const _RecommendedHeader(); 164 | 165 | @override 166 | Widget build(BuildContext context) { 167 | return Padding( 168 | padding: context.onlyTopPaddingLow, 169 | child: Row( 170 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 171 | children: [ 172 | const Expanded( 173 | child: TitleText(value: StringConstants.homeTitle), 174 | ), 175 | TextButton( 176 | onPressed: () {}, 177 | child: const SubTitleText(value: StringConstants.homeSeeAll), 178 | ) 179 | ], 180 | ), 181 | ); 182 | } 183 | } 184 | 185 | class _RecommendedListView extends ConsumerWidget { 186 | const _RecommendedListView(); 187 | @override 188 | Widget build(BuildContext context, WidgetRef ref) { 189 | final values = ref.watch(_homeProvider).recommended ?? []; 190 | return ListView.builder( 191 | itemCount: values.length, 192 | shrinkWrap: true, 193 | physics: const ClampingScrollPhysics(), 194 | itemBuilder: (BuildContext context, int index) { 195 | return RecommendedCard(recommended: values[index]); 196 | }, 197 | ); 198 | } 199 | } 200 | 201 | class _Header extends StatelessWidget { 202 | const _Header(); 203 | 204 | @override 205 | Widget build(BuildContext context) { 206 | return Column( 207 | crossAxisAlignment: CrossAxisAlignment.start, 208 | children: [ 209 | const TitleText( 210 | value: StringConstants.homeBrowse, 211 | ), 212 | Padding( 213 | padding: context.onlyTopPaddingLow, 214 | child: const SubTitleText( 215 | value: StringConstants.homeMessage, 216 | ), 217 | ), 218 | ], 219 | ); 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /lib/feature/home/sub_view/home_chips.dart: -------------------------------------------------------------------------------- 1 | part of '../home_view.dart'; 2 | 3 | class _ActiveChip extends StatelessWidget { 4 | const _ActiveChip(this.tag); 5 | final Tag tag; 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Chip( 10 | label: Text( 11 | tag.name ?? '', 12 | style: context.textTheme.bodySmall?.copyWith( 13 | color: ColorConstants.white, 14 | ), 15 | ), 16 | backgroundColor: ColorConstants.purplePrimary, 17 | padding: context.paddingLow, 18 | ); 19 | } 20 | } 21 | 22 | class _PassiveChip extends StatelessWidget { 23 | const _PassiveChip(this.tag); 24 | final Tag tag; 25 | @override 26 | Widget build(BuildContext context) { 27 | return Chip( 28 | label: Text( 29 | tag.name ?? '', 30 | style: context.textTheme.bodySmall?.copyWith( 31 | color: ColorConstants.grayPrimary, 32 | ), 33 | ), 34 | backgroundColor: ColorConstants.grayLighter, 35 | padding: context.paddingLow, 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/feature/home/sub_view/home_news_list_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_firebase_full_news_app/product/models/news.dart'; 4 | import 'package:flutter_firebase_full_news_app/product/utility/exception/custom_exception.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/utility/firebase/firebase_collections.dart'; 6 | import 'package:kartal/kartal.dart'; 7 | 8 | class HomeListView extends StatelessWidget { 9 | const HomeListView({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | final news = FirebaseCollections.news.reference; 14 | 15 | final response = news.withConverter( 16 | fromFirestore: (snapshot, options) { 17 | return const News().fromFirebase(snapshot); 18 | }, 19 | toFirestore: (value, options) { 20 | if (value == null) throw FirebaseCustomException('$value not null'); 21 | return value.toJson(); 22 | }, 23 | ).get(); 24 | return FutureBuilder( 25 | future: response, 26 | builder: 27 | (BuildContext context, AsyncSnapshot> snapshot) { 28 | switch (snapshot.connectionState) { 29 | case ConnectionState.none: 30 | return const Placeholder(); 31 | case ConnectionState.waiting: 32 | case ConnectionState.active: 33 | return const LinearProgressIndicator(); 34 | case ConnectionState.done: 35 | if (snapshot.hasData) { 36 | final values = snapshot.data!.docs.map((e) => e.data()).toList(); 37 | return ListView.builder( 38 | itemCount: values.length, 39 | shrinkWrap: true, 40 | itemBuilder: (BuildContext context, int index) { 41 | return Card( 42 | child: Column( 43 | children: [ 44 | Image.network( 45 | values[index]?.backgroundImage ?? '', 46 | height: context.dynamicHeight(.1), 47 | ), 48 | Text( 49 | values[index]?.title ?? '', 50 | style: context.textTheme.labelLarge, 51 | ) 52 | ], 53 | ), 54 | ); 55 | }, 56 | ); 57 | } else { 58 | return const SizedBox(); 59 | } 60 | } 61 | }, 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/feature/home/sub_view/home_serach_delegate.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'package:flutter_firebase_full_news_app/product/models/tag.dart'; 4 | 5 | class HomeSearchDelegate extends SearchDelegate { 6 | HomeSearchDelegate(this.tagItems); 7 | 8 | final List tagItems; 9 | @override 10 | List? buildActions(BuildContext context) { 11 | return [ 12 | IconButton( 13 | onPressed: () { 14 | query = ''; 15 | }, 16 | icon: const Icon(Icons.clear), 17 | ) 18 | ]; 19 | } 20 | 21 | @override 22 | Widget? buildLeading(BuildContext context) { 23 | return IconButton( 24 | onPressed: () { 25 | close(context, null); 26 | }, 27 | icon: const Icon(Icons.arrow_back_outlined), 28 | ); 29 | } 30 | 31 | @override 32 | Widget buildResults(BuildContext context) { 33 | final results = tagItems.where( 34 | (element) => 35 | element.name?.toLowerCase().contains(query.toLowerCase()) ?? false, 36 | ); 37 | 38 | return ListView.builder( 39 | itemCount: results.length, 40 | itemBuilder: (BuildContext context, int index) { 41 | return Card( 42 | child: ListTile( 43 | title: Text(results.elementAt(index).name ?? ''), 44 | ), 45 | ); 46 | }, 47 | ); 48 | } 49 | 50 | @override 51 | Widget buildSuggestions(BuildContext context) { 52 | final results = tagItems.where( 53 | (element) => 54 | element.name?.toLowerCase().contains(query.toLowerCase()) ?? false, 55 | ); 56 | 57 | return ListView.builder( 58 | itemCount: results.length, 59 | itemBuilder: (BuildContext context, int index) { 60 | return Card( 61 | child: ListTile( 62 | onTap: () { 63 | close(context, results.elementAt(index)); 64 | }, 65 | title: Text(results.elementAt(index).name ?? ''), 66 | ), 67 | ); 68 | }, 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/feature/home_create/home_create_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_firebase_full_news_app/feature/home_create/home_logic.dart'; 3 | import 'package:flutter_firebase_full_news_app/product/constants/index.dart'; 4 | import 'package:flutter_firebase_full_news_app/product/enums/index.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/models/category.dart'; 6 | import 'package:kartal/kartal.dart'; 7 | 8 | class HomeCreateView extends StatefulWidget { 9 | const HomeCreateView({super.key}); 10 | @override 11 | State createState() => _HomeCreateViewState(); 12 | } 13 | 14 | class _HomeCreateViewState extends State with Loading { 15 | late final HomeLogic _homeLogic; 16 | @override 17 | void initState() { 18 | super.initState(); 19 | _homeLogic = HomeLogic(); 20 | _fetchInitialCategory(); 21 | } 22 | 23 | Future _fetchInitialCategory() async { 24 | await _homeLogic.fetchAllCategory(); 25 | setState(() {}); 26 | } 27 | 28 | @override 29 | void dispose() { 30 | super.dispose(); 31 | _homeLogic.dispose(); 32 | } 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | return Scaffold( 37 | appBar: AppBar( 38 | title: const Text(StringConstants.addItemTitle), 39 | centerTitle: false, 40 | actions: [ 41 | if (isLoading) 42 | const Center( 43 | child: CircularProgressIndicator( 44 | color: ColorConstants.white, 45 | ), 46 | ) 47 | ], 48 | ), 49 | body: Form( 50 | key: _homeLogic.formKey, 51 | onChanged: () { 52 | _homeLogic.checkValidateAndSave( 53 | (value) { 54 | setState(() {}); 55 | }, 56 | ); 57 | }, 58 | autovalidateMode: AutovalidateMode.always, 59 | child: Padding( 60 | padding: context.paddingLow, 61 | child: ListView( 62 | children: [ 63 | _HomeCategoryDropDown( 64 | categories: _homeLogic.categories, 65 | onSelected: _homeLogic.updateCategory, 66 | ), 67 | const _EmptySizeBox(), 68 | TextFormField( 69 | controller: _homeLogic.titleController, 70 | validator: (value) => value.isNullOrEmpty ? 'Not empty' : null, 71 | decoration: const InputDecoration( 72 | hintText: StringConstants.addItemTitle, 73 | border: OutlineInputBorder(), 74 | ), 75 | ), 76 | const _EmptySizeBox(), 77 | InkWell( 78 | onTap: () async { 79 | await _homeLogic.pickAndCheck( 80 | (value) { 81 | setState(() {}); 82 | }, 83 | ); 84 | }, 85 | child: SizedBox( 86 | height: context.dynamicHeight(0.2), 87 | child: DecoratedBox( 88 | decoration: BoxDecoration( 89 | border: Border.all( 90 | color: ColorConstants.grayPrimary, 91 | ), 92 | ), 93 | child: _homeLogic.selectedFileBytes != null 94 | ? Image.memory(_homeLogic.selectedFileBytes!) 95 | : const Icon(Icons.add_a_photo_outlined), 96 | ), 97 | ), 98 | ), 99 | const _EmptySizeBox(), 100 | ElevatedButton.icon( 101 | style: ElevatedButton.styleFrom( 102 | fixedSize: 103 | Size.fromHeight(WidgetSize.buttonNormal.value.toDouble()), 104 | ), 105 | onPressed: !_homeLogic.isValidateAllForm 106 | ? null 107 | : () async { 108 | changeLoading(); 109 | final response = await _homeLogic.save(); 110 | changeLoading(); 111 | if (!mounted) return; 112 | await context.pop(response); 113 | }, 114 | icon: const Icon(Icons.send), 115 | label: const Text(StringConstants.buttonSave), 116 | ) 117 | ], 118 | ), 119 | ), 120 | ), 121 | ); 122 | } 123 | } 124 | 125 | class _EmptySizeBox extends StatelessWidget { 126 | const _EmptySizeBox(); 127 | 128 | @override 129 | Widget build(BuildContext context) { 130 | return context.emptySizedHeightBoxLow; 131 | } 132 | } 133 | 134 | class _HomeCategoryDropDown extends StatelessWidget { 135 | const _HomeCategoryDropDown({ 136 | required this.categories, 137 | required this.onSelected, 138 | }); 139 | final List categories; 140 | final ValueSetter onSelected; 141 | @override 142 | Widget build(BuildContext context) { 143 | return DropdownButtonFormField( 144 | validator: (value) => value == null ? 'Not empty' : null, 145 | items: categories.map((e) { 146 | return DropdownMenuItem( 147 | value: e, 148 | child: Text(e.name ?? ''), 149 | ); 150 | }).toList(), 151 | hint: const Text(StringConstants.dropdownHint), 152 | onChanged: (value) { 153 | if (value == null) return; 154 | onSelected.call(value); 155 | }, 156 | ); 157 | } 158 | } 159 | 160 | mixin Loading on State { 161 | bool isLoading = false; 162 | void changeLoading() { 163 | setState(() { 164 | isLoading = !isLoading; 165 | }); 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /lib/feature/home_create/home_logic.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | import 'package:firebase_storage/firebase_storage.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/models/category.dart'; 6 | import 'package:flutter_firebase_full_news_app/product/models/index.dart'; 7 | import 'package:flutter_firebase_full_news_app/product/utility/exception/custom_exception.dart'; 8 | import 'package:flutter_firebase_full_news_app/product/utility/firebase/firebase_collections.dart'; 9 | import 'package:flutter_firebase_full_news_app/product/utility/firebase/firebase_utility.dart'; 10 | import 'package:flutter_firebase_full_news_app/product/utility/image/pick_image.dart'; 11 | import 'package:image_picker/image_picker.dart'; 12 | import 'package:kartal/kartal.dart'; 13 | 14 | class HomeLogic with FirebaseUtility { 15 | final TextEditingController titleController = TextEditingController(); 16 | CategoryModel? _categoryModel; 17 | List _categories = []; 18 | Uint8List? _selectedFileBytes; 19 | XFile? _selectedFile; 20 | 21 | bool isValidateAllForm = false; 22 | final GlobalKey formKey = GlobalKey(); 23 | List get categories => _categories; 24 | Uint8List? get selectedFileBytes => _selectedFileBytes; 25 | 26 | void updateCategory(CategoryModel categoryModel) { 27 | _categoryModel = categoryModel; 28 | } 29 | 30 | bool checkValidateAndSave(ValueSetter? onUpdate) { 31 | final value = formKey.currentState?.validate() ?? false; 32 | 33 | if (value != isValidateAllForm && selectedFileBytes != null) { 34 | isValidateAllForm = value; 35 | onUpdate?.call(value); 36 | } 37 | 38 | return isValidateAllForm; 39 | } 40 | 41 | Future pickAndCheck(ValueSetter onUpdate) async { 42 | _selectedFile = await PickImage().pickImageFromGallery(); 43 | _selectedFileBytes = await _selectedFile?.readAsBytes(); 44 | checkValidateAndSave( 45 | (value) {}, 46 | ); 47 | onUpdate.call(true); 48 | } 49 | 50 | void dispose() { 51 | titleController.dispose(); 52 | _categoryModel = null; 53 | } 54 | 55 | Future fetchAllCategory() async { 56 | final response = await fetchList( 57 | CategoryModel(), 58 | FirebaseCollections.category, 59 | ); 60 | 61 | _categories = response ?? []; 62 | } 63 | 64 | Future save() async { 65 | if (!checkValidateAndSave(null)) return false; 66 | final imageReference = createImageReference(); 67 | if (imageReference == null) throw ItemCreateException('image not empty'); 68 | if (_selectedFileBytes == null) return false; 69 | await imageReference.putData(_selectedFileBytes!); 70 | final urlPath = await imageReference.getDownloadURL(); 71 | final response = await FirebaseCollections.news.reference.add( 72 | News( 73 | backgroundImage: urlPath, 74 | category: _categoryModel?.name, 75 | categoryId: _categoryModel?.id, 76 | title: titleController.text, 77 | ).toJson(), 78 | ); 79 | 80 | if (response.id.isNullOrEmpty) return false; 81 | return true; 82 | } 83 | 84 | Reference? createImageReference() { 85 | if (_selectedFile == null || (_selectedFile?.name.isNullOrEmpty ?? true)) { 86 | return null; 87 | } 88 | final storageRef = FirebaseStorage.instance.ref(); 89 | 90 | final imageRef = storageRef.child(_selectedFile!.name); 91 | return imageRef; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/feature/splash/splash_provider.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter_firebase_full_news_app/product/enums/platform_enum.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/models/number_model.dart'; 6 | import 'package:flutter_firebase_full_news_app/product/utility/firebase/firebase_collections.dart'; 7 | import 'package:flutter_firebase_full_news_app/product/utility/version_manager.dart'; 8 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 9 | 10 | class SplashProvider extends StateNotifier { 11 | SplashProvider() : super(const SplashState()); 12 | 13 | Future checkApplicationVersion(String clientVersion) async { 14 | final databaseValue = await getVersionNumberFromDatabase(); 15 | 16 | if (databaseValue == null || databaseValue.isEmpty) { 17 | state = state.copyWith(isRedirectHome: false); 18 | return; 19 | } 20 | 21 | final checkIsNeedForceUpdate = VersionManager( 22 | deviceValue: clientVersion, 23 | databaseValue: databaseValue, 24 | ); 25 | 26 | if (checkIsNeedForceUpdate.isNeedUpdate()) { 27 | state = state.copyWith(isRequiredForceUpdate: true); 28 | return; 29 | } 30 | 31 | state = state.copyWith(isRedirectHome: true); 32 | } 33 | 34 | // If user coming from browser, we dont need to check version control 35 | Future getVersionNumberFromDatabase() async { 36 | if (kIsWeb) return null; 37 | 38 | final response = await FirebaseCollections.version.reference 39 | .withConverter( 40 | fromFirestore: (snapshot, options) => 41 | NumberModel().fromFirebase(snapshot), 42 | toFirestore: (value, options) => value.toJson(), 43 | ) 44 | .doc(PlatformEnum.versionName) 45 | .get(); 46 | 47 | return response.data()?.number; 48 | } 49 | } 50 | 51 | class SplashState extends Equatable { 52 | const SplashState({ 53 | this.isRequiredForceUpdate, 54 | this.isRedirectHome, 55 | }); 56 | 57 | final bool? isRequiredForceUpdate; 58 | final bool? isRedirectHome; 59 | 60 | @override 61 | List get props => [isRequiredForceUpdate, isRedirectHome]; 62 | 63 | SplashState copyWith({ 64 | bool? isRequiredForceUpdate, 65 | bool? isRedirectHome, 66 | }) { 67 | return SplashState( 68 | isRequiredForceUpdate: 69 | isRequiredForceUpdate ?? this.isRequiredForceUpdate, 70 | isRedirectHome: isRedirectHome ?? this.isRedirectHome, 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/feature/splash/splash_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_firebase_full_news_app/feature/home/home_view.dart'; 3 | import 'package:flutter_firebase_full_news_app/feature/splash/splash_provider.dart'; 4 | import 'package:flutter_firebase_full_news_app/product/constants/index.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/enums/index.dart'; 6 | import 'package:flutter_firebase_full_news_app/product/widget/text/wavy_text.dart'; 7 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 8 | import 'package:kartal/kartal.dart'; 9 | 10 | class SplashView extends ConsumerStatefulWidget { 11 | const SplashView({super.key}); 12 | 13 | @override 14 | ConsumerState createState() => _SplashViewState(); 15 | } 16 | 17 | class _SplashViewState extends ConsumerState 18 | with _SplashViewListenMixin { 19 | final splashProvider = 20 | StateNotifierProvider((ref) { 21 | return SplashProvider(); 22 | }); 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | ref.read(splashProvider.notifier).checkApplicationVersion(''.version); 28 | } 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | listenAndNavigate(splashProvider); 33 | return Scaffold( 34 | backgroundColor: ColorConstants.purplePrimary, 35 | body: Center( 36 | child: Column( 37 | mainAxisAlignment: MainAxisAlignment.center, 38 | children: [ 39 | IconConstants.appIcon.toImage, 40 | Padding( 41 | padding: context.onlyTopPaddingLow, 42 | child: const WavyBoldText(title: StringConstants.appName), 43 | ), 44 | ], 45 | ), 46 | ), 47 | ); 48 | } 49 | } 50 | 51 | mixin _SplashViewListenMixin on ConsumerState { 52 | void listenAndNavigate( 53 | StateNotifierProvider provider, 54 | ) { 55 | ref.listen(provider, (previous, next) { 56 | if (next.isRequiredForceUpdate ?? false) { 57 | showAboutDialog(context: context); 58 | return; 59 | } 60 | if (next.isRedirectHome != null) { 61 | if (next.isRedirectHome!) { 62 | context.navigateToPage(const HomeView()); 63 | } else { 64 | // false 65 | } 66 | } 67 | }); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_firebase_full_news_app/feature/auth/authentication_view.dart'; 3 | import 'package:flutter_firebase_full_news_app/feature/home/home_view.dart'; 4 | import 'package:flutter_firebase_full_news_app/product/constants/index.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/initialize/app_builder.dart'; 6 | import 'package:flutter_firebase_full_news_app/product/initialize/app_theme.dart'; 7 | import 'package:flutter_firebase_full_news_app/product/initialize/application_start.dart'; 8 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 9 | 10 | Future main() async { 11 | await ApplicationStart.init(); 12 | 13 | runApp(const ProviderScope(child: MyApp())); 14 | } 15 | 16 | class MyApp extends StatelessWidget { 17 | const MyApp({super.key}); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return MaterialApp( 22 | builder: (context, child) => AppBuilder(child).build(), 23 | title: StringConstants.appName, 24 | home: const HomeView(), 25 | theme: AppTheme(context).theme, 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/product/constants/color_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | @immutable 4 | class ColorConstants { 5 | const ColorConstants._(); 6 | static const Color purpleDark = Color(0xff2536A7); 7 | static const Color purplePrimary = Color(0xff475AD7); 8 | static const Color white = Colors.white; 9 | static const Color grayPrimary = Color(0xff7C82A1); 10 | static const Color grayLighter = Color(0xffF3F4F6); 11 | } 12 | -------------------------------------------------------------------------------- /lib/product/constants/index.dart: -------------------------------------------------------------------------------- 1 | export 'color_constants.dart'; 2 | export 'string_constants.dart'; 3 | -------------------------------------------------------------------------------- /lib/product/constants/string_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | @immutable 4 | class StringConstants { 5 | const StringConstants._(); 6 | static const String appName = 'Nuntium'; 7 | 8 | // Login 9 | static const loginWelcomeBack = 'Welcome Back 👋'; 10 | static const loginWelcomeDetail = 11 | 'I am happy to see you again. You can continue where you left off by logging in'; 12 | 13 | static const continueToApp = 'Continue to app'; 14 | 15 | // Home 16 | static const homeBrowse = 'Browse'; 17 | static const homeMessage = 18 | 'I am happy to see you again. You can continue where you left off by logging in'; 19 | 20 | static const homeTitle = 'Recommended for you'; 21 | static const homeSeeAll = 'See all'; 22 | static const homeSearchHint = 'Search'; 23 | static const addItemTitle = 'Add new item'; 24 | 25 | // Component 26 | static const String dropdownHint = 'Select Items'; 27 | static const String dropdownTitle = 'Title'; 28 | static const String buttonSave = 'Save'; 29 | } 30 | -------------------------------------------------------------------------------- /lib/product/enums/cache_items.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_firebase_full_news_app/product/initialize/app_cache.dart'; 2 | 3 | enum CacheItems { 4 | token; 5 | 6 | String get read => AppCache.instance.sharedPreferences.getString(name) ?? ''; 7 | 8 | Future write(String value) => 9 | AppCache.instance.sharedPreferences.setString(name, value); 10 | } 11 | -------------------------------------------------------------------------------- /lib/product/enums/image_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | enum IconConstants { 4 | microphone('microphone'), 5 | appIcon('app_logo'), 6 | ; 7 | 8 | final String value; 9 | // ignore: sort_constructors_first 10 | const IconConstants(this.value); 11 | 12 | String get toPng => 'assets/icon/ic_$value.png'; 13 | Image get toImage => Image.asset(toPng); 14 | } 15 | -------------------------------------------------------------------------------- /lib/product/enums/image_size.dart: -------------------------------------------------------------------------------- 1 | enum ImageSizes { 2 | high(256), 3 | normal(96); 4 | 5 | final int value; 6 | // ignore: sort_constructors_first 7 | const ImageSizes(this.value); 8 | } 9 | -------------------------------------------------------------------------------- /lib/product/enums/index.dart: -------------------------------------------------------------------------------- 1 | export 'image_constants.dart'; 2 | export 'image_size.dart'; 3 | export 'widget_size.dart'; 4 | -------------------------------------------------------------------------------- /lib/product/enums/platform_enum.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | enum PlatformEnum { 4 | android, 5 | ios; 6 | 7 | static String get versionName { 8 | if (Platform.isIOS) { 9 | return PlatformEnum.ios.name; 10 | } 11 | if (Platform.isAndroid) { 12 | return PlatformEnum.android.name; 13 | } 14 | 15 | throw Exception('Platform unused please check!'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/product/enums/widget_size.dart: -------------------------------------------------------------------------------- 1 | enum WidgetSize { 2 | buttonNormal(56), 3 | iconNormal(30); 4 | 5 | final int value; 6 | // ignore: sort_constructors_first 7 | const WidgetSize(this.value); 8 | } 9 | -------------------------------------------------------------------------------- /lib/product/initialize/app_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:responsive_framework/responsive_wrapper.dart'; 3 | 4 | class AppBuilder { 5 | AppBuilder(this.child); 6 | 7 | final Widget? child; 8 | 9 | Widget build() { 10 | return ResponsiveWrapper.builder( 11 | child, 12 | maxWidth: 1200, 13 | minWidth: 480, 14 | defaultScale: true, 15 | breakpoints: [ 16 | const ResponsiveBreakpoint.resize(480, name: MOBILE), 17 | const ResponsiveBreakpoint.autoScale(800, name: TABLET), 18 | const ResponsiveBreakpoint.resize(1200, name: DESKTOP), 19 | ], 20 | background: Container(color: const Color(0xFFF5F5F5)), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/product/initialize/app_cache.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | class AppCache { 4 | AppCache._(); 5 | 6 | static AppCache instance = AppCache._(); 7 | 8 | Future setup() async { 9 | sharedPreferences = await SharedPreferences.getInstance(); 10 | } 11 | 12 | late SharedPreferences sharedPreferences; 13 | } 14 | -------------------------------------------------------------------------------- /lib/product/initialize/app_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:kartal/kartal.dart'; 3 | 4 | @immutable 5 | class AppTheme { 6 | const AppTheme(this.context); 7 | 8 | final BuildContext context; 9 | ThemeData get theme => ThemeData.light().copyWith( 10 | outlinedButtonTheme: OutlinedButtonThemeData( 11 | style: ButtonStyle( 12 | padding: MaterialStateProperty.all( 13 | const EdgeInsets.all(16), 14 | ), 15 | textStyle: MaterialStateProperty.all( 16 | context.textTheme.headlineSmall, 17 | ), 18 | backgroundColor: MaterialStateProperty.all(Colors.blue), 19 | foregroundColor: MaterialStateProperty.all(Colors.white), 20 | ), 21 | ), 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /lib/product/initialize/application_start.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_core/firebase_core.dart'; 2 | import 'package:firebase_ui_auth/firebase_ui_auth.dart'; 3 | import 'package:firebase_ui_oauth_google/firebase_ui_oauth_google.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | import 'package:flutter_firebase_full_news_app/firebase_options.dart'; 7 | import 'package:flutter_firebase_full_news_app/product/initialize/app_cache.dart'; 8 | import 'package:kartal/kartal.dart'; 9 | 10 | @immutable 11 | class ApplicationStart { 12 | const ApplicationStart._(); 13 | static Future init() async { 14 | WidgetsFlutterBinding.ensureInitialized(); 15 | await DeviceUtility.deviceInit(); 16 | await Firebase.initializeApp( 17 | options: DefaultFirebaseOptions.currentPlatform, 18 | ); 19 | 20 | FirebaseUIAuth.configureProviders( 21 | [EmailAuthProvider(), GoogleProvider(clientId: '')], 22 | ); 23 | 24 | await AppCache.instance.setup(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/product/models/category.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'package:flutter_firebase_full_news_app/product/utility/base/base_firebase_model.dart'; 6 | 7 | @immutable 8 | class CategoryModel extends Equatable 9 | with IdModel, BaseFirebaseModel { 10 | CategoryModel({ 11 | this.detail, 12 | this.name, 13 | this.id, 14 | }); 15 | 16 | final String? detail; 17 | final String? name; 18 | @override 19 | final String? id; 20 | 21 | @override 22 | List get props => [id]; 23 | 24 | CategoryModel copyWith({ 25 | String? detail, 26 | String? name, 27 | String? id, 28 | }) { 29 | return CategoryModel( 30 | detail: detail ?? this.detail, 31 | name: name ?? this.name, 32 | id: id ?? this.id, 33 | ); 34 | } 35 | 36 | Map toJson() { 37 | return {}; 38 | } 39 | 40 | @override 41 | CategoryModel fromJson(Map json) { 42 | return CategoryModel( 43 | detail: json['detail'] as String?, 44 | name: json['name'] as String?, 45 | id: json['id'] as String?, 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/product/models/index.dart: -------------------------------------------------------------------------------- 1 | export 'news.dart'; 2 | export 'number_model.dart'; 3 | export 'recomanded.dart'; 4 | export 'tag.dart'; 5 | -------------------------------------------------------------------------------- /lib/product/models/news.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | import 'package:flutter_firebase_full_news_app/product/utility/base/base_firebase_model.dart'; 4 | 5 | class News extends Equatable with IdModel, BaseFirebaseModel { 6 | const News({ 7 | this.category, 8 | this.categoryId, 9 | this.title, 10 | this.backgroundImage, 11 | this.id, 12 | }); 13 | 14 | final String? category; 15 | final String? categoryId; 16 | final String? title; 17 | final String? backgroundImage; 18 | @override 19 | final String? id; 20 | 21 | @override 22 | List get props => [category, categoryId, title, backgroundImage, id]; 23 | 24 | News copyWith({ 25 | String? category, 26 | String? categoryId, 27 | String? title, 28 | String? backgroundImage, 29 | String? id, 30 | }) { 31 | return News( 32 | category: category ?? this.category, 33 | categoryId: categoryId ?? this.categoryId, 34 | title: title ?? this.title, 35 | backgroundImage: backgroundImage ?? this.backgroundImage, 36 | id: id ?? this.id, 37 | ); 38 | } 39 | 40 | Map toJson() { 41 | return { 42 | 'category': category, 43 | 'categoryId': categoryId, 44 | 'title': title, 45 | 'backgroundImage': backgroundImage, 46 | 'id': id, 47 | }; 48 | } 49 | 50 | @override 51 | News fromJson(Map json) { 52 | return News( 53 | category: json['category'] as String?, 54 | categoryId: json['categoryId'] as String?, 55 | title: json['title'] as String?, 56 | backgroundImage: json['backgroundImage'] as String?, 57 | id: json['id'] as String?, 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/product/models/number_model.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'package:equatable/equatable.dart'; 3 | 4 | import 'package:flutter_firebase_full_news_app/product/utility/base/base_firebase_model.dart'; 5 | 6 | class NumberModel extends Equatable 7 | with IdModel, BaseFirebaseModel { 8 | NumberModel({ 9 | this.number, 10 | }); 11 | 12 | final String? number; 13 | @override 14 | String? id = ''; 15 | 16 | NumberModel copyWith({ 17 | String? number, 18 | }) { 19 | return NumberModel( 20 | number: number ?? this.number, 21 | ); 22 | } 23 | 24 | Map toJson() { 25 | return { 26 | 'number': number, 27 | }; 28 | } 29 | 30 | @override 31 | NumberModel fromJson(Map json) { 32 | return NumberModel( 33 | number: json['number'] as String?, 34 | ); 35 | } 36 | 37 | @override 38 | List get props => [number]; 39 | } 40 | -------------------------------------------------------------------------------- /lib/product/models/recomanded.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'package:flutter_firebase_full_news_app/product/utility/base/base_firebase_model.dart'; 6 | 7 | @immutable 8 | class Recommended with EquatableMixin, BaseFirebaseModel, IdModel { 9 | const Recommended({ 10 | this.image, 11 | this.description, 12 | this.title, 13 | this.id, 14 | }); 15 | 16 | final String? image; 17 | final String? description; 18 | final String? title; 19 | @override 20 | final String? id; 21 | 22 | @override 23 | List get props => [image, description, title, id]; 24 | 25 | Recommended copyWith({ 26 | String? image, 27 | String? description, 28 | String? title, 29 | String? id, 30 | }) { 31 | return Recommended( 32 | image: image ?? this.image, 33 | description: description ?? this.description, 34 | title: title ?? this.title, 35 | id: id ?? this.id, 36 | ); 37 | } 38 | 39 | Map toJson() { 40 | return { 41 | 'image': image, 42 | 'description': description, 43 | 'title': title, 44 | }; 45 | } 46 | 47 | @override 48 | Recommended fromJson(Map json) { 49 | return Recommended( 50 | image: json['image'] as String?, 51 | description: json['description'] as String?, 52 | title: json['title'] as String?, 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/product/models/tag.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'package:flutter_firebase_full_news_app/product/utility/base/base_firebase_model.dart'; 5 | 6 | @immutable 7 | class Tag with EquatableMixin, IdModel, BaseFirebaseModel { 8 | const Tag({ 9 | this.name, 10 | this.active, 11 | this.id, 12 | }); 13 | 14 | final String? name; 15 | final bool? active; 16 | @override 17 | final String? id; 18 | 19 | @override 20 | List get props => [name, active]; 21 | 22 | Tag copyWith({ 23 | String? name, 24 | bool? active, 25 | }) { 26 | return Tag( 27 | name: name ?? this.name, 28 | active: active ?? this.active, 29 | ); 30 | } 31 | 32 | Map toJson() { 33 | return { 34 | 'name': name, 35 | 'active': active, 36 | }; 37 | } 38 | 39 | @override 40 | Tag fromJson(Map json) { 41 | return Tag( 42 | name: json['name'] as String?, 43 | active: json['active'] as bool?, 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/product/services/firebase_service.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/lib/product/services/firebase_service.dart -------------------------------------------------------------------------------- /lib/product/utility/base/base_firebase_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter_firebase_full_news_app/product/utility/exception/custom_exception.dart'; 3 | 4 | abstract class IdModel { 5 | String? get id; 6 | } 7 | 8 | abstract class BaseFirebaseModel { 9 | T fromJson(Map json); 10 | 11 | T fromFirebase(DocumentSnapshot> snapshot) { 12 | final value = snapshot.data(); 13 | if (value == null) { 14 | throw FirebaseCustomException('$snapshot data is null'); 15 | } 16 | // fixme 17 | value.addEntries([MapEntry('id', snapshot.id)]); 18 | return fromJson(value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/product/utility/exception/custom_exception.dart: -------------------------------------------------------------------------------- 1 | class FirebaseCustomException implements Exception { 2 | FirebaseCustomException(this.description); 3 | 4 | final String description; 5 | @override 6 | String toString() { 7 | return '$this $description'; 8 | } 9 | } 10 | 11 | class ItemCreateException implements Exception { 12 | ItemCreateException(this.description); 13 | 14 | final String description; 15 | @override 16 | String toString() { 17 | return '$this $description'; 18 | } 19 | } 20 | 21 | class VersionCustomException implements Exception { 22 | VersionCustomException(this.description); 23 | 24 | final String description; 25 | @override 26 | String toString() { 27 | return '$this $description'; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/product/utility/firebase/firebase_collections.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | 3 | enum FirebaseCollections { 4 | news, 5 | tag, 6 | recommended, 7 | version, 8 | category; 9 | 10 | CollectionReference get reference => 11 | FirebaseFirestore.instance.collection(name); 12 | } 13 | -------------------------------------------------------------------------------- /lib/product/utility/firebase/firebase_utility.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_firebase_full_news_app/product/utility/base/base_firebase_model.dart'; 2 | import 'package:flutter_firebase_full_news_app/product/utility/firebase/firebase_collections.dart'; 3 | 4 | mixin FirebaseUtility { 5 | Future?> fetchList>( 6 | R data, 7 | FirebaseCollections collections, 8 | ) async { 9 | final newsCollectionReference = collections.reference; 10 | final response = await newsCollectionReference.withConverter( 11 | fromFirestore: (snapshot, options) { 12 | return data.fromFirebase(snapshot); 13 | }, 14 | toFirestore: (value, options) { 15 | return {}; 16 | }, 17 | ).get(); 18 | 19 | if (response.docs.isNotEmpty) { 20 | final values = response.docs.map((e) => e.data()).toList(); 21 | return values; 22 | } 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/product/utility/image/pick_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:image_picker/image_picker.dart'; 2 | 3 | class PickImage { 4 | final _picker = ImagePicker(); 5 | 6 | Future pickImageFromGallery() async { 7 | // Pick an image 8 | final image = await _picker.pickImage(source: ImageSource.gallery); 9 | return image; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/product/utility/version_manager.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'package:flutter_firebase_full_news_app/product/utility/exception/custom_exception.dart'; 3 | 4 | class VersionManager { 5 | VersionManager({ 6 | required this.deviceValue, 7 | required this.databaseValue, 8 | }); 9 | 10 | final String deviceValue; 11 | final String databaseValue; 12 | 13 | bool isNeedUpdate() { 14 | final deviceNumberSplit = deviceValue.split('.').join(); 15 | final databaseNumberSplit = databaseValue.split('.').join(); 16 | 17 | final deviceNumber = int.tryParse(deviceNumberSplit); 18 | final databaseNumber = int.tryParse(databaseNumberSplit); 19 | 20 | if (deviceNumber == null || databaseNumber == null) { 21 | throw VersionCustomException( 22 | '$deviceValue or $databaseValue is not valid for parse', 23 | ); 24 | } 25 | 26 | return deviceNumber < databaseNumber; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/product/widget/card/home_news_card.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_firebase_full_news_app/product/constants/color_constants.dart'; 3 | import 'package:flutter_firebase_full_news_app/product/enums/index.dart'; 4 | import 'package:flutter_firebase_full_news_app/product/models/news.dart'; 5 | import 'package:flutter_firebase_full_news_app/product/widget/text/sub_title_text.dart'; 6 | import 'package:kartal/kartal.dart'; 7 | 8 | class HomeNewsCard extends StatelessWidget { 9 | const HomeNewsCard({ 10 | required this.newsItem, 11 | super.key, 12 | }); 13 | 14 | final News? newsItem; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | if (newsItem == null) return const SizedBox.shrink(); 19 | return Stack( 20 | children: [ 21 | Padding( 22 | padding: context.onlyRightPaddingNormal, 23 | child: Image.network( 24 | newsItem!.backgroundImage ?? '', 25 | errorBuilder: (context, error, stackTrace) => const Placeholder(), 26 | ), 27 | ), 28 | Positioned.fill( 29 | child: Padding( 30 | padding: context.paddingLow, 31 | child: Column( 32 | crossAxisAlignment: CrossAxisAlignment.end, 33 | children: [ 34 | IconButton( 35 | onPressed: () {}, 36 | icon: Icon( 37 | Icons.bookmark_outline, 38 | color: ColorConstants.white, 39 | size: WidgetSize.iconNormal.value.toDouble(), 40 | ), 41 | ), 42 | const Spacer(), 43 | Padding( 44 | padding: context.paddingLow, 45 | child: Column( 46 | crossAxisAlignment: CrossAxisAlignment.start, 47 | children: [ 48 | SubTitleText( 49 | value: newsItem!.category ?? '', 50 | color: ColorConstants.grayLighter, 51 | ), 52 | Text( 53 | newsItem!.title ?? '', 54 | style: context.textTheme.headlineSmall?.copyWith( 55 | color: ColorConstants.white, 56 | ), 57 | ), 58 | ], 59 | ), 60 | ) 61 | ], 62 | ), 63 | ), 64 | ) 65 | ], 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/product/widget/card/recommended.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_firebase_full_news_app/product/enums/index.dart'; 3 | import 'package:flutter_firebase_full_news_app/product/models/recomanded.dart'; 4 | import 'package:kartal/kartal.dart'; 5 | 6 | class RecommendedCard extends StatelessWidget { 7 | const RecommendedCard({ 8 | required this.recommended, 9 | super.key, 10 | }); 11 | 12 | final Recommended recommended; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Padding( 17 | padding: context.onlyTopPaddingLow, 18 | child: Row( 19 | children: [ 20 | Image.network( 21 | recommended.image ?? '', 22 | height: ImageSizes.normal.value.toDouble(), 23 | errorBuilder: (context, error, stackTrace) => const Placeholder(), 24 | ), 25 | Expanded( 26 | child: ListTile( 27 | title: Text(recommended.title ?? ''), 28 | subtitle: Text( 29 | recommended.description ?? '', 30 | ), 31 | ), 32 | ), 33 | ], 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/product/widget/custom_button.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/lib/product/widget/custom_button.dart -------------------------------------------------------------------------------- /lib/product/widget/custom_chip.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/lib/product/widget/custom_chip.dart -------------------------------------------------------------------------------- /lib/product/widget/index.dart: -------------------------------------------------------------------------------- 1 | export 'custom_button.dart'; 2 | export 'custom_chip.dart'; 3 | -------------------------------------------------------------------------------- /lib/product/widget/text/sub_title_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:kartal/kartal.dart'; 3 | 4 | class SubTitleText extends StatelessWidget { 5 | const SubTitleText({super.key, required this.value, this.color}); 6 | final String value; 7 | final Color? color; 8 | @override 9 | Widget build(BuildContext context) { 10 | return Text( 11 | value, 12 | style: context.textTheme.titleMedium?.copyWith( 13 | color: color, 14 | ), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/product/widget/text/title_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:kartal/kartal.dart'; 3 | 4 | class TitleText extends StatelessWidget { 5 | const TitleText({ 6 | required this.value, 7 | super.key, 8 | }); 9 | final String value; 10 | @override 11 | Widget build(BuildContext context) { 12 | return Text( 13 | value, 14 | style: context.textTheme.headlineMedium?.copyWith( 15 | fontWeight: FontWeight.bold, 16 | ), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/product/widget/text/wavy_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_text_kit/animated_text_kit.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_firebase_full_news_app/product/constants/color_constants.dart'; 4 | import 'package:kartal/kartal.dart'; 5 | 6 | class WavyBoldText extends StatelessWidget { 7 | const WavyBoldText({ 8 | required this.title, 9 | super.key, 10 | }); 11 | final String title; 12 | @override 13 | Widget build(BuildContext context) { 14 | return AnimatedTextKit( 15 | repeatForever: true, 16 | animatedTexts: [ 17 | WavyAnimatedText( 18 | title, 19 | textStyle: context.textTheme.headlineSmall?.copyWith( 20 | color: ColorConstants.white, 21 | fontWeight: FontWeight.bold, 22 | ), 23 | ), 24 | ], 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "flutter_firebase_full_news_app") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.flutter_firebase_full_news_app") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) desktop_webview_auth_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopWebviewAuthPlugin"); 15 | desktop_webview_auth_plugin_register_with_registrar(desktop_webview_auth_registrar); 16 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 18 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | desktop_webview_auth 7 | url_launcher_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "flutter_firebase_full_news_app"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "flutter_firebase_full_news_app"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import cloud_firestore 9 | import desktop_webview_auth 10 | import device_info_plus 11 | import firebase_auth 12 | import firebase_core 13 | import firebase_storage 14 | import package_info_plus 15 | import path_provider_foundation 16 | import share_plus 17 | import shared_preferences_foundation 18 | import url_launcher_macos 19 | 20 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 21 | FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) 22 | DesktopWebviewAuthPlugin.register(with: registry.registrar(forPlugin: "DesktopWebviewAuthPlugin")) 23 | DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) 24 | FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) 25 | FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) 26 | FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin")) 27 | FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) 28 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 29 | SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin")) 30 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 31 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 32 | } 33 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; 13 | buildPhases = ( 14 | 33CC111E2044C6BF0003C045 /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | ); 18 | name = "Flutter Assemble"; 19 | productName = FLX; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 25 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 26 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 27 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 28 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 29 | 67C960C1CDC0F39CF592365A /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2331C33555C45DEFC7C84DC8 /* GoogleService-Info.plist */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 33CC10E52044A3C60003C045 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 33CC111A2044C6BA0003C045; 38 | remoteInfo = FLX; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXCopyFilesBuildPhase section */ 43 | 33CC110E2044A8840003C045 /* Bundle Framework */ = { 44 | isa = PBXCopyFilesBuildPhase; 45 | buildActionMask = 2147483647; 46 | dstPath = ""; 47 | dstSubfolderSpec = 10; 48 | files = ( 49 | ); 50 | name = "Bundle Framework"; 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXCopyFilesBuildPhase section */ 54 | 55 | /* Begin PBXFileReference section */ 56 | 2331C33555C45DEFC7C84DC8 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 57 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 58 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 59 | 33CC10ED2044A3C60003C045 /* flutter_firebase_full_news_app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = flutter_firebase_full_news_app.app; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 61 | 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 62 | 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 63 | 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; 64 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; 65 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 66 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 67 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; 68 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 69 | 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 70 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 71 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 72 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; 73 | /* End PBXFileReference section */ 74 | 75 | /* Begin PBXFrameworksBuildPhase section */ 76 | 33CC10EA2044A3C60003C045 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 33BA886A226E78AF003329D5 /* Configs */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */, 90 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 91 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 92 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, 93 | ); 94 | path = Configs; 95 | sourceTree = ""; 96 | }; 97 | 33CC10E42044A3C60003C045 = { 98 | isa = PBXGroup; 99 | children = ( 100 | 33FAB671232836740065AC1E /* Runner */, 101 | 33CEB47122A05771004F2AC0 /* Flutter */, 102 | 33CC10EE2044A3C60003C045 /* Products */, 103 | D73912EC22F37F3D000D13A0 /* Frameworks */, 104 | 2331C33555C45DEFC7C84DC8 /* GoogleService-Info.plist */, 105 | ); 106 | sourceTree = ""; 107 | }; 108 | 33CC10EE2044A3C60003C045 /* Products */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 33CC10ED2044A3C60003C045 /* flutter_firebase_full_news_app.app */, 112 | ); 113 | name = Products; 114 | sourceTree = ""; 115 | }; 116 | 33CC11242044D66E0003C045 /* Resources */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 33CC10F22044A3C60003C045 /* Assets.xcassets */, 120 | 33CC10F42044A3C60003C045 /* MainMenu.xib */, 121 | 33CC10F72044A3C60003C045 /* Info.plist */, 122 | ); 123 | name = Resources; 124 | path = ..; 125 | sourceTree = ""; 126 | }; 127 | 33CEB47122A05771004F2AC0 /* Flutter */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 131 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 132 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 133 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 134 | ); 135 | path = Flutter; 136 | sourceTree = ""; 137 | }; 138 | 33FAB671232836740065AC1E /* Runner */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 142 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 143 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */, 144 | 33E51914231749380026EE4D /* Release.entitlements */, 145 | 33CC11242044D66E0003C045 /* Resources */, 146 | 33BA886A226E78AF003329D5 /* Configs */, 147 | ); 148 | path = Runner; 149 | sourceTree = ""; 150 | }; 151 | D73912EC22F37F3D000D13A0 /* Frameworks */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | ); 155 | name = Frameworks; 156 | sourceTree = ""; 157 | }; 158 | /* End PBXGroup section */ 159 | 160 | /* Begin PBXNativeTarget section */ 161 | 33CC10EC2044A3C60003C045 /* Runner */ = { 162 | isa = PBXNativeTarget; 163 | buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; 164 | buildPhases = ( 165 | 33CC10E92044A3C60003C045 /* Sources */, 166 | 33CC10EA2044A3C60003C045 /* Frameworks */, 167 | 33CC10EB2044A3C60003C045 /* Resources */, 168 | 33CC110E2044A8840003C045 /* Bundle Framework */, 169 | 3399D490228B24CF009A79C7 /* ShellScript */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | 33CC11202044C79F0003C045 /* PBXTargetDependency */, 175 | ); 176 | name = Runner; 177 | productName = Runner; 178 | productReference = 33CC10ED2044A3C60003C045 /* flutter_firebase_full_news_app.app */; 179 | productType = "com.apple.product-type.application"; 180 | }; 181 | /* End PBXNativeTarget section */ 182 | 183 | /* Begin PBXProject section */ 184 | 33CC10E52044A3C60003C045 /* Project object */ = { 185 | isa = PBXProject; 186 | attributes = { 187 | LastSwiftUpdateCheck = 0920; 188 | LastUpgradeCheck = 1300; 189 | ORGANIZATIONNAME = ""; 190 | TargetAttributes = { 191 | 33CC10EC2044A3C60003C045 = { 192 | CreatedOnToolsVersion = 9.2; 193 | LastSwiftMigration = 1100; 194 | ProvisioningStyle = Automatic; 195 | SystemCapabilities = { 196 | com.apple.Sandbox = { 197 | enabled = 1; 198 | }; 199 | }; 200 | }; 201 | 33CC111A2044C6BA0003C045 = { 202 | CreatedOnToolsVersion = 9.2; 203 | ProvisioningStyle = Manual; 204 | }; 205 | }; 206 | }; 207 | buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; 208 | compatibilityVersion = "Xcode 9.3"; 209 | developmentRegion = en; 210 | hasScannedForEncodings = 0; 211 | knownRegions = ( 212 | en, 213 | Base, 214 | ); 215 | mainGroup = 33CC10E42044A3C60003C045; 216 | productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; 217 | projectDirPath = ""; 218 | projectRoot = ""; 219 | targets = ( 220 | 33CC10EC2044A3C60003C045 /* Runner */, 221 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */, 222 | ); 223 | }; 224 | /* End PBXProject section */ 225 | 226 | /* Begin PBXResourcesBuildPhase section */ 227 | 33CC10EB2044A3C60003C045 /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 232 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, 233 | 67C960C1CDC0F39CF592365A /* GoogleService-Info.plist in Resources */, 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | }; 237 | /* End PBXResourcesBuildPhase section */ 238 | 239 | /* Begin PBXShellScriptBuildPhase section */ 240 | 3399D490228B24CF009A79C7 /* ShellScript */ = { 241 | isa = PBXShellScriptBuildPhase; 242 | alwaysOutOfDate = 1; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | inputFileListPaths = ( 247 | ); 248 | inputPaths = ( 249 | ); 250 | outputFileListPaths = ( 251 | ); 252 | outputPaths = ( 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | shellPath = /bin/sh; 256 | shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; 257 | }; 258 | 33CC111E2044C6BF0003C045 /* ShellScript */ = { 259 | isa = PBXShellScriptBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | ); 263 | inputFileListPaths = ( 264 | Flutter/ephemeral/FlutterInputs.xcfilelist, 265 | ); 266 | inputPaths = ( 267 | Flutter/ephemeral/tripwire, 268 | ); 269 | outputFileListPaths = ( 270 | Flutter/ephemeral/FlutterOutputs.xcfilelist, 271 | ); 272 | outputPaths = ( 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | shellPath = /bin/sh; 276 | shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; 277 | }; 278 | /* End PBXShellScriptBuildPhase section */ 279 | 280 | /* Begin PBXSourcesBuildPhase section */ 281 | 33CC10E92044A3C60003C045 /* Sources */ = { 282 | isa = PBXSourcesBuildPhase; 283 | buildActionMask = 2147483647; 284 | files = ( 285 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 286 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 287 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | }; 291 | /* End PBXSourcesBuildPhase section */ 292 | 293 | /* Begin PBXTargetDependency section */ 294 | 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { 295 | isa = PBXTargetDependency; 296 | target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; 297 | targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; 298 | }; 299 | /* End PBXTargetDependency section */ 300 | 301 | /* Begin PBXVariantGroup section */ 302 | 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { 303 | isa = PBXVariantGroup; 304 | children = ( 305 | 33CC10F52044A3C60003C045 /* Base */, 306 | ); 307 | name = MainMenu.xib; 308 | path = Runner; 309 | sourceTree = ""; 310 | }; 311 | /* End PBXVariantGroup section */ 312 | 313 | /* Begin XCBuildConfiguration section */ 314 | 338D0CE9231458BD00FA5F75 /* Profile */ = { 315 | isa = XCBuildConfiguration; 316 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 317 | buildSettings = { 318 | ALWAYS_SEARCH_USER_PATHS = NO; 319 | CLANG_ANALYZER_NONNULL = YES; 320 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 326 | CLANG_WARN_BOOL_CONVERSION = YES; 327 | CLANG_WARN_CONSTANT_CONVERSION = YES; 328 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 329 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 330 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 331 | CLANG_WARN_EMPTY_BODY = YES; 332 | CLANG_WARN_ENUM_CONVERSION = YES; 333 | CLANG_WARN_INFINITE_RECURSION = YES; 334 | CLANG_WARN_INT_CONVERSION = YES; 335 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 339 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 340 | CODE_SIGN_IDENTITY = "-"; 341 | COPY_PHASE_STRIP = NO; 342 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 343 | ENABLE_NS_ASSERTIONS = NO; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | GCC_C_LANGUAGE_STANDARD = gnu11; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | MACOSX_DEPLOYMENT_TARGET = 10.14; 353 | MTL_ENABLE_DEBUG_INFO = NO; 354 | SDKROOT = macosx; 355 | SWIFT_COMPILATION_MODE = wholemodule; 356 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 357 | }; 358 | name = Profile; 359 | }; 360 | 338D0CEA231458BD00FA5F75 /* Profile */ = { 361 | isa = XCBuildConfiguration; 362 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 363 | buildSettings = { 364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 365 | CLANG_ENABLE_MODULES = YES; 366 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 367 | CODE_SIGN_STYLE = Automatic; 368 | COMBINE_HIDPI_IMAGES = YES; 369 | INFOPLIST_FILE = Runner/Info.plist; 370 | LD_RUNPATH_SEARCH_PATHS = ( 371 | "$(inherited)", 372 | "@executable_path/../Frameworks", 373 | ); 374 | PROVISIONING_PROFILE_SPECIFIER = ""; 375 | SWIFT_VERSION = 5.0; 376 | }; 377 | name = Profile; 378 | }; 379 | 338D0CEB231458BD00FA5F75 /* Profile */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | CODE_SIGN_STYLE = Manual; 383 | PRODUCT_NAME = "$(TARGET_NAME)"; 384 | }; 385 | name = Profile; 386 | }; 387 | 33CC10F92044A3C60003C045 /* Debug */ = { 388 | isa = XCBuildConfiguration; 389 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_CONSTANT_CONVERSION = YES; 401 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 411 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 412 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 413 | CODE_SIGN_IDENTITY = "-"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = dwarf; 416 | ENABLE_STRICT_OBJC_MSGSEND = YES; 417 | ENABLE_TESTABILITY = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu11; 419 | GCC_DYNAMIC_NO_PIC = NO; 420 | GCC_NO_COMMON_BLOCKS = YES; 421 | GCC_OPTIMIZATION_LEVEL = 0; 422 | GCC_PREPROCESSOR_DEFINITIONS = ( 423 | "DEBUG=1", 424 | "$(inherited)", 425 | ); 426 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 427 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 428 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 429 | GCC_WARN_UNUSED_FUNCTION = YES; 430 | GCC_WARN_UNUSED_VARIABLE = YES; 431 | MACOSX_DEPLOYMENT_TARGET = 10.14; 432 | MTL_ENABLE_DEBUG_INFO = YES; 433 | ONLY_ACTIVE_ARCH = YES; 434 | SDKROOT = macosx; 435 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 436 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 437 | }; 438 | name = Debug; 439 | }; 440 | 33CC10FA2044A3C60003C045 /* Release */ = { 441 | isa = XCBuildConfiguration; 442 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 443 | buildSettings = { 444 | ALWAYS_SEARCH_USER_PATHS = NO; 445 | CLANG_ANALYZER_NONNULL = YES; 446 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 447 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 448 | CLANG_CXX_LIBRARY = "libc++"; 449 | CLANG_ENABLE_MODULES = YES; 450 | CLANG_ENABLE_OBJC_ARC = YES; 451 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 452 | CLANG_WARN_BOOL_CONVERSION = YES; 453 | CLANG_WARN_CONSTANT_CONVERSION = YES; 454 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 455 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 456 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 457 | CLANG_WARN_EMPTY_BODY = YES; 458 | CLANG_WARN_ENUM_CONVERSION = YES; 459 | CLANG_WARN_INFINITE_RECURSION = YES; 460 | CLANG_WARN_INT_CONVERSION = YES; 461 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 462 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 463 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 464 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 465 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 466 | CODE_SIGN_IDENTITY = "-"; 467 | COPY_PHASE_STRIP = NO; 468 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 469 | ENABLE_NS_ASSERTIONS = NO; 470 | ENABLE_STRICT_OBJC_MSGSEND = YES; 471 | GCC_C_LANGUAGE_STANDARD = gnu11; 472 | GCC_NO_COMMON_BLOCKS = YES; 473 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 474 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 475 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 476 | GCC_WARN_UNUSED_FUNCTION = YES; 477 | GCC_WARN_UNUSED_VARIABLE = YES; 478 | MACOSX_DEPLOYMENT_TARGET = 10.14; 479 | MTL_ENABLE_DEBUG_INFO = NO; 480 | SDKROOT = macosx; 481 | SWIFT_COMPILATION_MODE = wholemodule; 482 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 483 | }; 484 | name = Release; 485 | }; 486 | 33CC10FC2044A3C60003C045 /* Debug */ = { 487 | isa = XCBuildConfiguration; 488 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 489 | buildSettings = { 490 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 491 | CLANG_ENABLE_MODULES = YES; 492 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 493 | CODE_SIGN_STYLE = Automatic; 494 | COMBINE_HIDPI_IMAGES = YES; 495 | INFOPLIST_FILE = Runner/Info.plist; 496 | LD_RUNPATH_SEARCH_PATHS = ( 497 | "$(inherited)", 498 | "@executable_path/../Frameworks", 499 | ); 500 | PROVISIONING_PROFILE_SPECIFIER = ""; 501 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 502 | SWIFT_VERSION = 5.0; 503 | }; 504 | name = Debug; 505 | }; 506 | 33CC10FD2044A3C60003C045 /* Release */ = { 507 | isa = XCBuildConfiguration; 508 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 509 | buildSettings = { 510 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 511 | CLANG_ENABLE_MODULES = YES; 512 | CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; 513 | CODE_SIGN_STYLE = Automatic; 514 | COMBINE_HIDPI_IMAGES = YES; 515 | INFOPLIST_FILE = Runner/Info.plist; 516 | LD_RUNPATH_SEARCH_PATHS = ( 517 | "$(inherited)", 518 | "@executable_path/../Frameworks", 519 | ); 520 | PROVISIONING_PROFILE_SPECIFIER = ""; 521 | SWIFT_VERSION = 5.0; 522 | }; 523 | name = Release; 524 | }; 525 | 33CC111C2044C6BA0003C045 /* Debug */ = { 526 | isa = XCBuildConfiguration; 527 | buildSettings = { 528 | CODE_SIGN_STYLE = Manual; 529 | PRODUCT_NAME = "$(TARGET_NAME)"; 530 | }; 531 | name = Debug; 532 | }; 533 | 33CC111D2044C6BA0003C045 /* Release */ = { 534 | isa = XCBuildConfiguration; 535 | buildSettings = { 536 | CODE_SIGN_STYLE = Automatic; 537 | PRODUCT_NAME = "$(TARGET_NAME)"; 538 | }; 539 | name = Release; 540 | }; 541 | /* End XCBuildConfiguration section */ 542 | 543 | /* Begin XCConfigurationList section */ 544 | 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { 545 | isa = XCConfigurationList; 546 | buildConfigurations = ( 547 | 33CC10F92044A3C60003C045 /* Debug */, 548 | 33CC10FA2044A3C60003C045 /* Release */, 549 | 338D0CE9231458BD00FA5F75 /* Profile */, 550 | ); 551 | defaultConfigurationIsVisible = 0; 552 | defaultConfigurationName = Release; 553 | }; 554 | 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | 33CC10FC2044A3C60003C045 /* Debug */, 558 | 33CC10FD2044A3C60003C045 /* Release */, 559 | 338D0CEA231458BD00FA5F75 /* Profile */, 560 | ); 561 | defaultConfigurationIsVisible = 0; 562 | defaultConfigurationName = Release; 563 | }; 564 | 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { 565 | isa = XCConfigurationList; 566 | buildConfigurations = ( 567 | 33CC111C2044C6BA0003C045 /* Debug */, 568 | 33CC111D2044C6BA0003C045 /* Release */, 569 | 338D0CEB231458BD00FA5F75 /* Profile */, 570 | ); 571 | defaultConfigurationIsVisible = 0; 572 | defaultConfigurationName = Release; 573 | }; 574 | /* End XCConfigurationList section */ 575 | }; 576 | rootObject = 33CC10E52044A3C60003C045 /* Project object */; 577 | } 578 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = flutter_firebase_full_news_app 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterFirebaseFullNewsApp 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/firebase_app_id_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_generated_by": "FlutterFire CLI", 3 | "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", 4 | "GOOGLE_APP_ID": "1:340466855888:ios:607a41b574212bd1ca53d5", 5 | "FIREBASE_PROJECT_ID": "flutter-full-news", 6 | "GCM_SENDER_ID": "340466855888" 7 | } -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_firebase_full_news_app 2 | description: A new Flutter project. 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.0+1 20 | 21 | environment: 22 | sdk: ">=2.19.2 <3.0.0" 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | 34 | cupertino_icons: ^1.0.2 35 | 36 | # Core 37 | flutter_riverpod: ^2.2.0 38 | kartal: ^2.8.0 39 | equatable: ^2.0.5 40 | responsive_framework: ^0.2.0 41 | responsive_builder: ^0.6.3 42 | 43 | #Firebase 44 | cloud_firestore: ^4.4.3 45 | firebase_core: ^2.7.1 46 | firebase_auth: ^4.2.9 47 | firebase_auth_web: ^5.2.9 48 | firebase_ui_auth: ^1.1.15 49 | firebase_ui_oauth_google: ^1.0.22 50 | firebase_storage: ^11.0.15 51 | 52 | shared_preferences: ^2.0.18 53 | 54 | # Utility 55 | animated_text_kit: ^4.2.2 56 | image_picker: ^0.8.7 57 | 58 | dev_dependencies: 59 | flutter_test: 60 | sdk: flutter 61 | very_good_analysis: ^4.0.0+1 62 | 63 | # The "flutter_lints" package below contains a set of recommended lints to 64 | # encourage good coding practices. The lint set provided by the package is 65 | # activated in the `analysis_options.yaml` file located at the root of your 66 | # package. See that file for information about deactivating specific lint 67 | # rules and activating additional ones. 68 | flutter_lints: ^2.0.0 69 | 70 | # For information on the generic Dart part of this file, see the 71 | # following page: https://dart.dev/tools/pub/pubspec 72 | 73 | # The following section is specific to Flutter packages. 74 | flutter: 75 | # The following line ensures that the Material Icons font is 76 | # included with your application, so that you can use the icons in 77 | # the material Icons class. 78 | uses-material-design: true 79 | 80 | # To add assets to your application, add an assets section, like this: 81 | assets: 82 | - assets/icon/ 83 | 84 | # An image asset can refer to one or more resolution-specific "variants", see 85 | # https://flutter.dev/assets-and-images/#resolution-aware 86 | 87 | # For details regarding adding assets from package dependencies, see 88 | # https://flutter.dev/assets-and-images/#from-packages 89 | 90 | # To add custom fonts to your application, add a fonts section here, 91 | # in this "flutter" section. Each entry in this list should have a 92 | # "family" key with the font family name, and a "fonts" key with a 93 | # list giving the asset and other descriptors for the font. For 94 | # example: 95 | # fonts: 96 | # - family: Schyler 97 | # fonts: 98 | # - asset: fonts/Schyler-Regular.ttf 99 | # - asset: fonts/Schyler-Italic.ttf 100 | # style: italic 101 | # - family: Trajan Pro 102 | # fonts: 103 | # - asset: fonts/TrajanPro.ttf 104 | # - asset: fonts/TrajanPro_Bold.ttf 105 | # weight: 700 106 | # 107 | # For details regarding fonts from package dependencies, 108 | # see https://flutter.dev/custom-fonts/#from-packages 109 | -------------------------------------------------------------------------------- /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 in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_firebase_full_news_app/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | flutter_firebase_full_news_app 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_firebase_full_news_app", 3 | "short_name": "flutter_firebase_full_news_app", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(flutter_firebase_full_news_app LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "flutter_firebase_full_news_app") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | void RegisterPlugins(flutter::PluginRegistry* registry) { 14 | DesktopWebviewAuthPluginRegisterWithRegistrar( 15 | registry->GetRegistrarForPlugin("DesktopWebviewAuthPlugin")); 16 | SharePlusWindowsPluginCApiRegisterWithRegistrar( 17 | registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); 18 | UrlLauncherWindowsRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 20 | } 21 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | desktop_webview_auth 7 | share_plus 8 | url_launcher_windows 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "flutter_firebase_full_news_app" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "flutter_firebase_full_news_app" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "flutter_firebase_full_news_app.exe" "\0" 98 | VALUE "ProductName", "flutter_firebase_full_news_app" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | return true; 35 | } 36 | 37 | void FlutterWindow::OnDestroy() { 38 | if (flutter_controller_) { 39 | flutter_controller_ = nullptr; 40 | } 41 | 42 | Win32Window::OnDestroy(); 43 | } 44 | 45 | LRESULT 46 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 47 | WPARAM const wparam, 48 | LPARAM const lparam) noexcept { 49 | // Give Flutter, including plugins, an opportunity to handle window messages. 50 | if (flutter_controller_) { 51 | std::optional result = 52 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 53 | lparam); 54 | if (result) { 55 | return *result; 56 | } 57 | } 58 | 59 | switch (message) { 60 | case WM_FONTCHANGE: 61 | flutter_controller_->engine()->ReloadSystemFonts(); 62 | break; 63 | } 64 | 65 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 66 | } 67 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"flutter_firebase_full_news_app", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VB10/flutter_firebase_full_news_app/4d22813784b033bf186473e3e3c435ab532a040c/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responsponds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------