├── android ├── gradle.properties ├── app │ ├── src │ │ └── main │ │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_launcher_background.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_launcher_background.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_launcher_background.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_launcher_background.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_launcher_background.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ └── ic_launcher.xml │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── novum │ │ │ │ └── MainActivity.java │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── assets ├── icons │ ├── icon-710.png │ ├── icon-background.png │ └── icon-foreground.png ├── fonts │ ├── Eczar-Regular.ttf │ ├── Eczar-SemiBold.ttf │ ├── LibreFranklin-Bold.ttf │ ├── LibreFranklin-Light.ttf │ ├── LibreFranklin-Medium.ttf │ └── LibreFranklin-Regular.ttf └── screenshots │ └── screens.png ├── lib ├── main.dart └── src │ ├── ui │ ├── theme │ │ ├── colors.dart │ │ └── theme.dart │ ├── components │ │ ├── logo.dart │ │ ├── fade_route.dart │ │ ├── image_placeholder.dart │ │ ├── stock_data_header.dart │ │ ├── skeleton_frame.dart │ │ ├── article_list.dart │ │ ├── navigation_drawer.dart │ │ ├── article_tile.dart │ │ ├── novum_app_bar.dart │ │ └── iex_stock_data.dart │ └── screens │ │ ├── search.dart │ │ ├── auth.dart │ │ ├── stock_settings.dart │ │ ├── browse.dart │ │ └── article.dart │ ├── secrets │ └── news_api_key.dart │ ├── blocs │ ├── auth_bloc.dart │ ├── article_collection_bloc.dart │ └── iex_bloc.dart │ ├── resources │ ├── shared_preferences_provider.dart │ ├── news_api_provider.dart │ ├── repository.dart │ └── iex_api_provider.dart │ ├── models │ ├── symbol_model.dart │ ├── article_collection_model.dart │ ├── article_model.dart │ └── chart_model.dart │ └── app.dart ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ ├── flutter_export_environment.sh │ └── AppFrameworkInfo.plist ├── Runner │ ├── AppDelegate.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── main.m │ ├── AppDelegate.m │ ├── Info.plist │ └── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj └── Podfile ├── .metadata ├── README.md ├── LICENSE ├── CHANGELOG.md ├── .gitignore ├── test └── article_test.dart └── pubspec.yaml /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /assets/icons/icon-710.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/icons/icon-710.png -------------------------------------------------------------------------------- /assets/fonts/Eczar-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/fonts/Eczar-Regular.ttf -------------------------------------------------------------------------------- /assets/screenshots/screens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/screenshots/screens.png -------------------------------------------------------------------------------- /assets/fonts/Eczar-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/fonts/Eczar-SemiBold.ttf -------------------------------------------------------------------------------- /assets/icons/icon-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/icons/icon-background.png -------------------------------------------------------------------------------- /assets/icons/icon-foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/icons/icon-foreground.png -------------------------------------------------------------------------------- /assets/fonts/LibreFranklin-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/fonts/LibreFranklin-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/LibreFranklin-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/fonts/LibreFranklin-Light.ttf -------------------------------------------------------------------------------- /assets/fonts/LibreFranklin-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/fonts/LibreFranklin-Medium.ttf -------------------------------------------------------------------------------- /assets/fonts/LibreFranklin-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/assets/fonts/LibreFranklin-Regular.ttf -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import './src/app.dart'; 3 | 4 | void main() => runApp(NovumApp()); -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/src/ui/theme/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | const kNovumWhite = Color(0xFFFFFFFF); 4 | const kNovumPurple = Color(0xFF6B38FB); -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-hdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-mdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Salby/novum/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /lib/src/secrets/news_api_key.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | 4 | /// Returns the user's 'newsapi.org' API key stored in 5 | /// shared preferences. 6 | Future kNewsApiKey() async { 7 | SharedPreferences prefs = await SharedPreferences.getInstance(); 8 | return prefs.getString('news_api_key'); 9 | } -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/novum/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.novum; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=/Users/sanderlarsen/flutter" 4 | export "FLUTTER_APPLICATION_PATH=/Users/sanderlarsen/Projects/novum" 5 | export "FLUTTER_TARGET=/Users/sanderlarsen/Projects/novum/lib/main.dart" 6 | export "FLUTTER_BUILD_DIR=build" 7 | export "SYMROOT=${SOURCE_ROOT}/../build/ios" 8 | export "FLUTTER_FRAMEWORK_DIR=/Users/sanderlarsen/flutter/bin/cache/artifacts/engine/ios" 9 | export "FLUTTER_BUILD_NAME=1.0.3" 10 | export "FLUTTER_BUILD_NUMBER=2" 11 | export "TRACK_WIDGET_CREATION=true" 12 | -------------------------------------------------------------------------------- /lib/src/ui/components/logo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Logo extends StatelessWidget { 4 | Logo.full({ 5 | this.title = 'Novum', 6 | }) : fontSize = 24.0; 7 | Logo.compact({ 8 | this.title: 'N', 9 | }) : fontSize = 26.0; 10 | Logo.large({ 11 | this.title: 'Novum', 12 | }) : fontSize = 34.0; 13 | 14 | final String title; 15 | final double fontSize; 16 | 17 | Widget build(BuildContext context) { 18 | return Text( 19 | title, 20 | style: Theme.of(context).textTheme.display1.copyWith( 21 | fontSize: fontSize, 22 | ), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/blocs/auth_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import '../secrets/news_api_key.dart'; 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | 5 | class AuthBloc { 6 | 7 | final StreamController _key = StreamController(); 8 | 9 | Stream get key => _key.stream; 10 | 11 | getKey() async { 12 | final String key = await kNewsApiKey(); 13 | _key.sink.add(key); 14 | } 15 | setKey(String key) async { 16 | SharedPreferences prefs = await SharedPreferences.getInstance(); 17 | await prefs.setString('news_api_key', key); 18 | _key.sink.add(key); 19 | } 20 | 21 | dispose() { 22 | _key.close(); 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /lib/src/resources/shared_preferences_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | 4 | class SharedPreferencesProvider { 5 | 6 | Future> getSymbols() async { 7 | SharedPreferences prefs = await SharedPreferences.getInstance(); 8 | return prefs.getStringList('symbols'); 9 | } 10 | 11 | Future setSymbols({List symbols = const ['AAPL', 'FB', 'GOOG']}) async { 12 | if (symbols == null) 13 | return false; 14 | SharedPreferences prefs = await SharedPreferences.getInstance(); 15 | await prefs.setStringList('symbols', symbols); 16 | return true; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | -------------------------------------------------------------------------------- /lib/src/ui/components/fade_route.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class FadeRoute extends PageRouteBuilder { 4 | 5 | FadeRoute(this.widget, {this.duration = const Duration(milliseconds: 200)}) : super( 6 | pageBuilder: (BuildContext context, Animation animation, secondaryAnimation) { 7 | return widget; 8 | }, 9 | transitionsBuilder: (BuildContext context, Animation animation, secondaryAnimation, Widget child) { 10 | return FadeTransition( 11 | opacity: animation, 12 | child: child, 13 | ); 14 | }, 15 | transitionDuration: duration, 16 | ); 17 | 18 | final Widget widget; 19 | final Duration duration; 20 | 21 | } -------------------------------------------------------------------------------- /lib/src/models/symbol_model.dart: -------------------------------------------------------------------------------- 1 | class SymbolModel { 2 | 3 | SymbolModel.fromJson(Map parsedJson) : 4 | symbol = parsedJson['symbol'], 5 | companyName = parsedJson['companyName'], 6 | sector = parsedJson['sector'], 7 | extendedChange = _toDouble(parsedJson['extendedChange']), 8 | latestPrice = _toDouble(parsedJson['latestPrice']); 9 | 10 | final String symbol; 11 | final String companyName; 12 | final String sector; 13 | final double extendedChange; 14 | final double latestPrice; 15 | 16 | static double _toDouble(dynamic number) { 17 | if (number is int) { 18 | return number.toDouble(); 19 | } else { 20 | return number; 21 | } 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /lib/src/models/article_collection_model.dart: -------------------------------------------------------------------------------- 1 | import './article_model.dart'; 2 | 3 | class ArticleCollectionModel { 4 | 5 | ArticleCollectionModel.fromJson(Map parsedJson) : 6 | status = parsedJson['status'], 7 | results = parsedJson['results'], 8 | articles = _buildArticleModelList(parsedJson['articles']); 9 | 10 | final String status; 11 | final int results; 12 | final List articles; 13 | 14 | static List _buildArticleModelList(List articles) { 15 | List temp = []; 16 | for (Map _article in articles) { 17 | final ArticleModel article = ArticleModel.fromJson(_article); 18 | temp.add(article); 19 | } 20 | return temp; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Novum 2 | 3 | [![Build Status](https://app.bitrise.io/app/34764c3d71b0a714/status.svg?token=OdLV2tTyjxIVR6jdp_mgYw)](https://app.bitrise.io/app/34764c3d71b0a714) 4 | 5 | ![Screenshots](./assets/screenshots/screens.png) 6 | 7 | Novum is a news app built with Flutter and inspired by [Fortnightly](https://material.io/design/material-studies/fortnightly.html). 8 | 9 | Novum is powered by [newsapi.org](https://newsapi.org) for news articles and [iextrading.com](https://iextrading.com/developer) for stock data. 10 | 11 | ## Features 12 | 13 | - Browse and search articles from many sources, made possible by the [newsapi.org API](https://newsapi.org). 14 | - Read previews and share articles. 15 | 16 | ## Contributing 17 | 18 | You are very welcome to contribute to Novum with bug reports, code, or just spelling mistakes. I appreciate every contribution :raised_hands: 19 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/src/models/article_model.dart: -------------------------------------------------------------------------------- 1 | class ArticleModel { 2 | 3 | ArticleModel.fromJson(Map parsedJson) : 4 | author = parsedJson['author'], 5 | title = parsedJson['title'], 6 | description = parsedJson['description'], 7 | source = parsedJson['source']['name'], 8 | url = parsedJson['url'], 9 | imageUrl = parsedJson['urlToImage'], 10 | published = _parsedDate(parsedJson['publishedAt']), 11 | content = parsedJson['content']; 12 | 13 | final String author; 14 | final String title; 15 | final String description; 16 | final String source; 17 | final String url; 18 | final String imageUrl; 19 | final DateTime published; 20 | final String content; 21 | 22 | static DateTime _parsedDate(String timestamp) { 23 | DateTime parsed; 24 | try { 25 | parsed = DateTime.parse(timestamp); 26 | } catch(e) { 27 | parsed = DateTime.now(); 28 | } 29 | return parsed; 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /lib/src/ui/components/image_placeholder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ImagePlaceholder extends StatelessWidget { 4 | 5 | ImagePlaceholder(this.text, { 6 | this.width, 7 | this.height, 8 | }); 9 | 10 | final String text; 11 | final double width; 12 | final double height; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Container( 17 | width: width, 18 | height: height, 19 | alignment: Alignment.center, 20 | decoration: BoxDecoration( 21 | gradient: LinearGradient( 22 | begin: Alignment.topLeft, 23 | end: Alignment.bottomRight, 24 | stops: [0.0, 1.0], 25 | colors: [ 26 | Theme.of(context).accentColor, 27 | Theme.of(context).accentColor.withOpacity(0.3), 28 | ], 29 | ), 30 | ), 31 | child: Text(text, style: TextStyle( 32 | color: Colors.white, 33 | fontWeight: FontWeight.w500, 34 | )), 35 | ); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /lib/src/resources/news_api_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import '../secrets/news_api_key.dart'; 3 | import '../models/article_collection_model.dart'; 4 | import 'package:newsapi_client/newsapi_client.dart'; 5 | 6 | class NewsApiProvider { 7 | 8 | /// Makes a request to the given [Endpoint]. 9 | Future request(Endpoint endpoint) async { 10 | final apiKey = await kNewsApiKey(); 11 | final client = NewsapiClient(apiKey); 12 | final response = await client.request(endpoint); 13 | return ArticleCollectionModel.fromJson(response); 14 | } 15 | 16 | /// Checks if the given API key is valid. 17 | /// 18 | /// Makes a request to 'top-headlines'. If an error 19 | /// is returned the API key is deemed not valid. 20 | Future test(String apiKey) async { 21 | final client = NewsapiClient(apiKey); 22 | try { 23 | await client.request(TopHeadlines( 24 | country: Countries.unitedStatesOfAmerica, 25 | )); 26 | return true; 27 | } catch(e) { 28 | return false; 29 | } 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /lib/src/blocs/article_collection_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import '../resources/repository.dart'; 3 | import '../models/article_collection_model.dart'; 4 | import 'package:newsapi_client/newsapi_client.dart'; 5 | 6 | class ArticleCollectionBloc { 7 | 8 | final _repository = Repository(); 9 | 10 | final StreamController _articles = StreamController(); 11 | 12 | Stream get articles => _articles.stream; 13 | 14 | requestArticles(TopHeadlines endpoint) async { 15 | ArticleCollectionModel articleCollection = await _repository.newsApiRequest(endpoint); 16 | _articles.sink.add(articleCollection); 17 | } 18 | searchArticles(String query) async { 19 | final DateTime now = DateTime.now(); 20 | ArticleCollectionModel articleCollection = await _repository.newsApiRequest(Everything( 21 | query: query, 22 | from: now.subtract(Duration(days: 14)), 23 | to: now, 24 | )); 25 | _articles.sink.add(articleCollection); 26 | } 27 | 28 | dispose() { 29 | _articles.close(); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Sander Dalby Larsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/src/resources/repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import './news_api_provider.dart'; 3 | import './iex_api_provider.dart'; 4 | import './shared_preferences_provider.dart'; 5 | import '../models/article_collection_model.dart'; 6 | import '../models/symbol_model.dart'; 7 | import '../models/chart_model.dart'; 8 | import 'package:newsapi_client/newsapi_client.dart'; 9 | 10 | class Repository { 11 | 12 | final newsApiProvider = NewsApiProvider(); 13 | final iexApiProvider = IexApiProvider(); 14 | final sharedPreferencesProvider = SharedPreferencesProvider(); 15 | 16 | /// Returns a collection of [ArticleModel]s from the 17 | /// given endpoint. 18 | Future newsApiRequest(Endpoint endpoint) async { 19 | final response = await newsApiProvider.request(endpoint); 20 | return response; 21 | } 22 | 23 | /// Returns the stored stock symbols. 24 | Future> iexApiSymbols() async { 25 | final response = await iexApiProvider.symbols(); 26 | return response; 27 | } 28 | /// Returns a [ChartModel] of the given symbol. 29 | Future iexApiChart(SymbolModel symbol) async { 30 | final response = await iexApiProvider.chart(symbol); 31 | return response; 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /lib/src/models/chart_model.dart: -------------------------------------------------------------------------------- 1 | import './symbol_model.dart'; 2 | 3 | class ChartModel { 4 | 5 | ChartModel({ 6 | this.symbol, 7 | this.chart, 8 | this.from, 9 | this.to, 10 | }); 11 | 12 | ChartModel.fromJson(SymbolModel symbolModel, List parsedJson) : 13 | symbol = symbolModel, 14 | chart = _buildChart(parsedJson), 15 | from = parsedJson[0]['label'], 16 | to = parsedJson[parsedJson.length - 1]['label']; 17 | 18 | final SymbolModel symbol; 19 | final Map chart; 20 | final String from; 21 | final String to; 22 | 23 | static Map _buildChart(List parsedJson) { 24 | Map chart = {}; 25 | for (Map json in parsedJson) { 26 | 27 | /// Merge date and time information into a [DateTime] object. 28 | final dateTime = DateTime.parse(json['date']); 29 | 30 | if (json['volume'] is String) { 31 | json['volume'] = double.tryParse(json['volume']); 32 | } else if (json['volume'] is int) { 33 | json['volume'] = json['volume'].toDouble(); 34 | } 35 | 36 | /// Add key-value pair to [chart]. 37 | chart[dateTime] = json['volume']; 38 | } 39 | return chart; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /lib/src/blocs/iex_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import '../resources/repository.dart'; 3 | import '../models/symbol_model.dart'; 4 | import '../models/chart_model.dart'; 5 | 6 | class IexBloc { 7 | final _repository = Repository(); 8 | 9 | SymbolModel activeSymbol; 10 | 11 | final StreamController> _symbols = StreamController(); 12 | final StreamController _chart = StreamController(); 13 | 14 | Stream> get symbols => _symbols.stream; 15 | Stream get chart => _chart.stream; 16 | 17 | requestSymbols() async { 18 | List symbolList = []; 19 | try { 20 | symbolList = await _repository.iexApiSymbols(); 21 | } catch (e) { 22 | // Couldn't find symbols. 23 | print('Could\'t find symbols: $e'); 24 | } 25 | _symbols.sink.add(symbolList); 26 | } 27 | 28 | requestChart(SymbolModel symbol) async { 29 | ChartModel chart = await _repository.iexApiChart(symbol); 30 | _chart.sink.add(chart); 31 | activeSymbol = symbol; 32 | } 33 | 34 | setSymbols(List symbols) async { 35 | await _repository.sharedPreferencesProvider.setSymbols(symbols: symbols); 36 | } 37 | 38 | dispose() { 39 | _symbols.close(); 40 | _chart.close(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/src/ui/components/stock_data_header.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../models/chart_model.dart'; 3 | 4 | class StockDataHeader extends StatelessWidget { 5 | 6 | StockDataHeader({ 7 | @required this.chart, 8 | this.action, 9 | }); 10 | 11 | final ChartModel chart; 12 | final Widget action; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Padding( 17 | padding: EdgeInsets.symmetric(horizontal: 20.0), 18 | child: Row( 19 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 20 | children: [ 21 | 22 | // Title. 23 | Row( 24 | children: [ 25 | Text( 26 | 'Stocks ', 27 | style: Theme.of(context).textTheme.headline, 28 | ), 29 | Text( 30 | '• ${chart.from} - ${chart.to}', 31 | style: Theme.of(context).textTheme.headline.copyWith( 32 | fontFamily: 'Libre Franklin', 33 | fontSize: 18.0, 34 | color: Colors.black54, 35 | height: 0.8, 36 | ), 37 | ), 38 | ], 39 | ), 40 | 41 | // Settings. 42 | action, 43 | 44 | ], 45 | ), 46 | ); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /lib/src/ui/components/skeleton_frame.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SkeletonFrame extends StatefulWidget { 4 | 5 | SkeletonFrame({ 6 | this.width, 7 | this.height, 8 | }); 9 | 10 | final double width; 11 | final double height; 12 | 13 | @override 14 | _SkeletonFrameState createState() => _SkeletonFrameState(); 15 | 16 | } 17 | 18 | class _SkeletonFrameState extends State with SingleTickerProviderStateMixin { 19 | 20 | AnimationController controller; 21 | Animation animation; 22 | 23 | void initState() { 24 | super.initState(); 25 | controller = AnimationController( 26 | duration: Duration(milliseconds: 1000), 27 | vsync: this, 28 | ); 29 | animation = Tween( 30 | begin: 1.0, 31 | end: 0.2, 32 | ).animate(controller) 33 | ..addListener(() { setState(() {}); }) 34 | ..addStatusListener((status) { 35 | if (status == AnimationStatus.completed) { 36 | controller.reverse(); 37 | } else if (status == AnimationStatus.dismissed) { 38 | controller.forward(); 39 | } 40 | }); 41 | controller.forward(); 42 | } 43 | 44 | Widget build(BuildContext context) { 45 | return Opacity( 46 | opacity: animation.value, 47 | child: Container( 48 | width: widget.width, 49 | height: widget.height, 50 | color: Colors.black26, 51 | ), 52 | ); 53 | } 54 | 55 | void dispose() { 56 | controller.dispose(); 57 | super.dispose(); 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [Unreleased] 4 | 5 | ### Added 6 | - Added authentication screen where you have to provide you [newsapi.org](https://newsapi.org) API key. 7 | - Added stock settings screen where you can choose what symbols to follow. 8 | - Added `width` and `height` properties to `ImagePlaceholder`. 9 | 10 | ### Changed 11 | - Changed symbol volume chart to show data from more days instead of just showing the values from the current day. 12 | 13 | ### Fixed 14 | - Fixed standard iOS and android icon. 15 | - Fixed adaptive icon being slightly blurry. 16 | - Auth screen now always validates the stored API key, in case it has been disabled. 17 | 18 | ## 1.0.3 - 2019-02-12 19 | 20 | ### Added 21 | - Added screenshots to README.md. 22 | - Added stock data on the front-page screen provided by [iextrading.com](https://iextrading.com/developer). 23 | - Added launcher icons. 24 | 25 | ## 1.0.2 - 2019-02-08 26 | 27 | ### Added 28 | - Added new test for the article-screen. 29 | - Added a 'Read More' button for category screens that increase the number of articles displayed on the screen. 30 | 31 | ### Changed 32 | - Changed the shape of the article-screen `_BottomSheet` to be completely rectangular. 33 | - The article-screen now uses the `ImagePlaceholder` widget instead of an empty container. 34 | - Implemented the `newsapi_client` package instead of the custom http solution in `NewsApiProvider`. 35 | - Changed the way requests are made to `NewsApiProvider` to make it more flexible to use from the front-end. 36 | 37 | ### Fixed 38 | - Fixed `ArticleList.skeleton()` displaying error. 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | novum 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/src/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import './ui/theme/theme.dart'; 4 | import './ui/screens/browse.dart'; 5 | import './ui/screens/search.dart'; 6 | import './ui/screens/auth.dart'; 7 | import 'package:flutter_villains/villain.dart'; 8 | import 'package:newsapi_client/newsapi_client.dart'; 9 | 10 | final SystemUiOverlayStyle uiStyle = SystemUiOverlayStyle( 11 | statusBarIconBrightness: Brightness.dark, 12 | statusBarColor: Colors.grey[100], 13 | systemNavigationBarColor: Colors.white, 14 | systemNavigationBarIconBrightness: Brightness.dark, 15 | systemNavigationBarDividerColor: Colors.black26, 16 | ); 17 | 18 | class NovumApp extends StatelessWidget { 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | SystemChrome.setSystemUIOverlayStyle(uiStyle); 23 | return MaterialApp( 24 | navigatorObservers: [VillainTransitionObserver()], 25 | debugShowCheckedModeBanner: false, 26 | theme: kNovumTheme, 27 | title: 'Novum', 28 | home: Auth(), 29 | routes: { 30 | '/home': (context) => Browse(title: 'Front page'), 31 | '/search': (context) => Search(), 32 | '/business': (context) => Browse(title: 'Business', category: Categories.business), 33 | '/entertainment': (context) => Browse(title: 'Entertainment', category: Categories.entertainment), 34 | '/health': (context) => Browse(title: 'Health', category: Categories.health), 35 | '/science': (context) => Browse(title: 'Science', category: Categories.business), 36 | '/sports': (context) => Browse(title: 'Sports', category: Categories.sports), 37 | '/technology': (context) => Browse(title: 'Technology', category: Categories.technology), 38 | }, 39 | ); 40 | 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /lib/src/resources/iex_api_provider.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import './shared_preferences_provider.dart'; 4 | import '../models/symbol_model.dart'; 5 | import '../models/chart_model.dart'; 6 | import 'package:http/http.dart'; 7 | 8 | class IexApiProvider { 9 | 10 | final String urlPrefix = 'https://api.iextrading.com/1.0'; 11 | final client = Client(); 12 | final sharedPreferencesProvider = SharedPreferencesProvider(); 13 | 14 | /// Returns a list of [SymbolModel]s from the three 15 | /// symbols stored in shared preferences. 16 | Future> symbols() async { 17 | List symbols = await sharedPreferencesProvider.getSymbols(); 18 | if (symbols == null) { 19 | await sharedPreferencesProvider.setSymbols(); 20 | symbols = await sharedPreferencesProvider.getSymbols(); 21 | } 22 | final response = await client.get(urlPrefix + '/stock/market/batch?symbols=${symbols[0]},${symbols[1]},${symbols[2]}&types=quote'); 23 | final Map parsedJson = _handleResponse(response); 24 | List symbolList = []; 25 | for (Map value in parsedJson.values) { 26 | symbolList.add(SymbolModel.fromJson(value['quote'])); 27 | } 28 | return symbolList; 29 | } 30 | 31 | /// Returns the current [ChartModel] of a [SymbolModel]. 32 | Future chart(SymbolModel symbol) async { 33 | final response = await client.get(urlPrefix + '/stock/${symbol.symbol}/chart/'); 34 | List parsedJson = json.decode(response.body); 35 | return ChartModel.fromJson(symbol, parsedJson); 36 | } 37 | 38 | Map _handleResponse(Response response) { 39 | if (response.statusCode == 200) { 40 | return json.decode(response.body); 41 | } else { 42 | throw Exception('Failed to load data.'); 43 | } 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /test/article_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:novum/src/ui/screens/article.dart'; 4 | import 'package:novum/src/models/article_model.dart'; 5 | 6 | void main() { 7 | 8 | Map articleJson; 9 | 10 | setUpAll(() { 11 | articleJson = { 12 | 'author': 'John Doe', 13 | 'title': 'This is a fake article', 14 | 'description': 'Lorem ipsum.', 15 | 'source': { 16 | 'name': 'example.com', 17 | }, 18 | 'url': 'https://example.com', 19 | 'urlToImage': null, 20 | 'publishedAt': '2019-09-09', 21 | 'content': 'Lorem ipsum.', 22 | }; 23 | }); 24 | 25 | group('Missing parts of the article.', () { 26 | 27 | testWidgets('Article screen displays image placeholder if image is missing.', (WidgetTester tester) async { 28 | final fakeArticle = ArticleModel.fromJson(articleJson); 29 | await tester.pumpWidget(MaterialApp(home: Article(fakeArticle))); 30 | expect(find.text('No image'), findsOneWidget); 31 | }); 32 | 33 | testWidgets('Article-screen displays title placeholder if title is missing.', (WidgetTester tester) async { 34 | final tempArticleJson = articleJson; 35 | tempArticleJson['title'] = null; 36 | final fakeArticle = ArticleModel.fromJson(tempArticleJson); 37 | await tester.pumpWidget(MaterialApp(home: Article(fakeArticle))); 38 | expect(find.text('(No title)'), findsOneWidget); 39 | }); 40 | 41 | }); 42 | 43 | testWidgets('Article-screen handles category correctly', (WidgetTester tester) async { 44 | final fakeArticle = ArticleModel.fromJson(articleJson); 45 | await tester.pumpWidget(MaterialApp( 46 | home: Article(fakeArticle, category: 'lasagna'), 47 | )); 48 | expect(find.text('LASAGNA'), findsOneWidget); 49 | }); 50 | 51 | } -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.novum" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /lib/src/ui/components/article_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../models/article_model.dart'; 3 | import './article_tile.dart'; 4 | import './skeleton_frame.dart'; 5 | 6 | class ArticleList extends StatelessWidget { 7 | 8 | ArticleList(this.articles, { 9 | this.expandFirst: true, 10 | this.itemCount, 11 | this.padding: const EdgeInsets.symmetric(vertical: 20.0), 12 | }) : assert(articles != null); 13 | 14 | ArticleList.skeleton({ 15 | this.expandFirst: true, 16 | this.itemCount, 17 | this.padding: const EdgeInsets.symmetric(vertical: 20.0), 18 | }) : articles = null; 19 | 20 | final List articles; 21 | final bool expandFirst; 22 | final int itemCount; 23 | final EdgeInsetsGeometry padding; 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | final bool skeleton = articles == null; 28 | return ListView.separated( 29 | shrinkWrap: true, 30 | physics: ClampingScrollPhysics(), 31 | itemCount: skeleton 32 | ? itemCount ?? 4 33 | : itemCount ?? articles.length, 34 | padding: padding, 35 | separatorBuilder: (BuildContext context, int index) { 36 | return Padding( 37 | padding: EdgeInsets.symmetric(horizontal: 20.0), 38 | child: Divider(), 39 | ); 40 | }, 41 | itemBuilder: (BuildContext context, int index) { 42 | if (skeleton) { 43 | // Return skeleton tile. 44 | return ArticleTile( 45 | title: index == 0 46 | ? SkeletonFrame(width: 300.0, height: 16.0) 47 | : Column( 48 | mainAxisSize: MainAxisSize.min, 49 | crossAxisAlignment: CrossAxisAlignment.start, 50 | children: [ 51 | SkeletonFrame(width: 300.0, height: 16.0), 52 | SizedBox(height: 4.0), 53 | SkeletonFrame(width: 150.0, height: 16.0), 54 | ], 55 | ), 56 | published: SkeletonFrame(width: 36.0, height: 16.0), 57 | thumbnail: Container(width: 100.0, height: 100.0), 58 | expanded: expandFirst && index == 0, 59 | ); 60 | } else { 61 | // Return regular tile with content. 62 | return ArticleTile.fromArticleModel( 63 | articles[index], 64 | context, 65 | expanded: expandFirst && index == 0, 66 | ); 67 | } 68 | }, 69 | ); 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /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/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 37 | # referring to absolute paths on developers' machines. 38 | system('rm -rf .symlinks') 39 | system('mkdir -p .symlinks/plugins') 40 | 41 | # Flutter Pods 42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 43 | if generated_xcode_build_settings.empty? 44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first." 45 | end 46 | generated_xcode_build_settings.map { |p| 47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 48 | symlink = File.join('.symlinks', 'flutter') 49 | File.symlink(File.dirname(p[:path]), symlink) 50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 51 | end 52 | } 53 | 54 | # Plugin Pods 55 | plugin_pods = parse_KV_file('../.flutter-plugins') 56 | plugin_pods.map { |p| 57 | symlink = File.join('.symlinks', 'plugins', p[:name]) 58 | File.symlink(p[:path], symlink) 59 | pod p[:name], :path => File.join(symlink, 'ios') 60 | } 61 | end 62 | 63 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. 64 | install! 'cocoapods', :disable_input_output_paths => true 65 | 66 | post_install do |installer| 67 | installer.pods_project.targets.each do |target| 68 | target.build_configurations.each do |config| 69 | config.build_settings['ENABLE_BITCODE'] = 'NO' 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /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.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: novum 2 | description: A news app built with flutter. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.3+2 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | 19 | # The following adds the Cupertino Icons font to your application. 20 | # Use with the CupertinoIcons class for iOS style icons. 21 | cupertino_icons: ^0.1.2 22 | http: ^0.12.0 23 | transparent_image: ^0.1.0 24 | flutter_villains: ^1.2.0 25 | share: ^0.5.3 26 | flutter_custom_tabs: ^0.4.0 27 | newsapi_client: ^0.2.5+1 28 | flutter_sparkline: ^0.1.0 29 | shared_preferences: ^0.5.1 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | flutter_launcher_icons: ^0.7.0 35 | 36 | flutter_icons: 37 | image_path: assets/icons/icon-710.png 38 | android: true 39 | ios: true 40 | adaptive_icon_background: assets/icons/icon-background.png 41 | adaptive_icon_foreground: assets/icons/icon-foreground.png 42 | 43 | # For information on the generic Dart part of this file, see the 44 | # following page: https://www.dartlang.org/tools/pub/pubspec 45 | 46 | # The following section is specific to Flutter. 47 | flutter: 48 | 49 | # The following line ensures that the Material Icons font is 50 | # included with your application, so that you can use the icons in 51 | # the material Icons class. 52 | uses-material-design: true 53 | 54 | # To add assets to your application, add an assets section, like this: 55 | # assets: 56 | # - images/a_dot_burr.jpeg 57 | # - images/a_dot_ham.jpeg 58 | 59 | # An image asset can refer to one or more resolution-specific "variants", see 60 | # https://flutter.io/assets-and-images/#resolution-aware. 61 | 62 | # For details regarding adding assets from package dependencies, see 63 | # https://flutter.io/assets-and-images/#from-packages 64 | 65 | # To add custom fonts to your application, add a fonts section here, 66 | # in this "flutter" section. Each entry in this list should have a 67 | # "family" key with the font family name, and a "fonts" key with a 68 | # list giving the asset and other descriptors for the font. For 69 | # example: 70 | # fonts: 71 | # - family: Schyler 72 | # fonts: 73 | # - asset: fonts/Schyler-Regular.ttf 74 | # - asset: fonts/Schyler-Italic.ttf 75 | # style: italic 76 | # - family: Trajan Pro 77 | # fonts: 78 | # - asset: fonts/TrajanPro.ttf 79 | # - asset: fonts/TrajanPro_Bold.ttf 80 | # weight: 700 81 | # 82 | # For details regarding fonts from package dependencies, 83 | # see https://flutter.io/custom-fonts/#from-packages 84 | 85 | fonts: 86 | - family: Eczar 87 | fonts: 88 | - asset: assets/fonts/Eczar-Regular.ttf 89 | weight: 400 90 | - asset: assets/fonts/Eczar-SemiBold.ttf 91 | weight: 600 92 | - family: Libre Franklin 93 | fonts: 94 | - asset: assets/fonts/LibreFranklin-Light.ttf 95 | weight: 300 96 | - asset: assets/fonts/LibreFranklin-Regular.ttf 97 | weight: 400 98 | - asset: assets/fonts/LibreFranklin-Medium.ttf 99 | weight: 500 100 | - asset: assets/fonts/LibreFranklin-Bold.ttf 101 | weight: 700 102 | -------------------------------------------------------------------------------- /lib/src/ui/components/navigation_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import './logo.dart'; 3 | 4 | class NavigationDrawer extends StatelessWidget { 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return Drawer( 9 | 10 | child: SafeArea( 11 | child: Column( 12 | children: [ 13 | 14 | // Header with logo and close button. 15 | DrawerHeader(), 16 | 17 | // Drawer navigatio items. 18 | DrawerItem(title: 'Front page', route: '/home'), 19 | DrawerItem(title: 'Business', route: '/business'), 20 | DrawerItem(title: 'Entertainment', route: '/entertainment'), 21 | DrawerItem(title: 'Health', route: '/health'), 22 | DrawerItem(title: 'Science', route: '/science'), 23 | DrawerItem(title: 'Sports', route: '/sports'), 24 | DrawerItem(title: 'Technology', route: '/technology'), 25 | 26 | Spacer(), 27 | 28 | ListTile( 29 | contentPadding: EdgeInsets.only(left: 34.0), 30 | title: Row( 31 | children: [ 32 | Text('Powered by ', style: TextStyle( 33 | fontFamily: 'Libre Franklin', 34 | fontSize: 14.0, 35 | height: 0.8, 36 | color: Colors.black54, 37 | )), 38 | Text('NewsApi.org', style: TextStyle( 39 | fontFamily: 'Eczar', 40 | fontSize: 14.0, 41 | )), 42 | ], 43 | ), 44 | ), 45 | 46 | ], 47 | ), 48 | ), 49 | ); 50 | } 51 | 52 | } 53 | 54 | class DrawerHeader extends StatelessWidget { 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return ListTile( 59 | contentPadding: EdgeInsets.only(bottom: 20.0, left: 16.0), 60 | title: Logo.large(), 61 | leading: IconButton( 62 | color: Colors.black87, 63 | icon: Icon(Icons.close, semanticLabel: 'Close'), 64 | onPressed: () => Navigator.pop(context), 65 | tooltip: 'Close', 66 | ), 67 | ); 68 | } 69 | 70 | } 71 | 72 | class DrawerItem extends StatelessWidget { 73 | 74 | DrawerItem({ 75 | @required this.title, 76 | @required this.route, 77 | }) : assert(title != null), 78 | assert(route != null); 79 | 80 | final String title; 81 | final String route; 82 | 83 | @override 84 | Widget build(BuildContext context) { 85 | bool currentRoute = _isCurrentRoute(context, route); 86 | return ListTile( 87 | enabled: !currentRoute, 88 | contentPadding: EdgeInsets.only(left: 34.0, right: 34.0), 89 | title: Text( 90 | title, 91 | style: Theme.of(context).textTheme.subtitle.copyWith( 92 | color: currentRoute 93 | ? Colors.black54 94 | : Colors.black87, 95 | fontSize: 16.0, 96 | fontWeight: FontWeight.w700, 97 | ), 98 | ), 99 | trailing: currentRoute 100 | ? Icon( 101 | Icons.fiber_manual_record, 102 | color: Colors.black38, 103 | size: 12.0, 104 | ) 105 | : null, 106 | onTap: () => Navigator.of(context).pushReplacementNamed(route), 107 | ); 108 | } 109 | 110 | bool _isCurrentRoute(BuildContext context, String routeName) { 111 | bool isCurrentRoute; 112 | Navigator.popUntil(context, (route) { 113 | isCurrentRoute = route.settings.name == routeName; 114 | return true; 115 | }); 116 | return isCurrentRoute; 117 | } 118 | 119 | } -------------------------------------------------------------------------------- /lib/src/ui/theme/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import './colors.dart'; 3 | 4 | ThemeData kNovumTheme = _buildNovumTheme(); 5 | 6 | ThemeData _buildNovumTheme() { 7 | 8 | final base = ThemeData.light(); 9 | 10 | return base.copyWith( 11 | 12 | brightness: Brightness.light, 13 | 14 | primaryColor: kNovumWhite, 15 | primaryColorBrightness: Brightness.light, 16 | accentColor: kNovumPurple, 17 | accentColorBrightness: Brightness.dark, 18 | 19 | scaffoldBackgroundColor: kNovumWhite, 20 | 21 | dividerColor: Colors.black26, 22 | 23 | splashColor: Colors.black12, 24 | highlightColor: Colors.black12, 25 | 26 | textTheme: _buildTextTheme(base.textTheme), 27 | primaryTextTheme: _buildTextTheme(base.primaryTextTheme), 28 | accentTextTheme: _buildTextTheme(base.accentTextTheme), 29 | 30 | iconTheme: base.iconTheme.copyWith( 31 | color: Colors.black87, 32 | ), 33 | primaryIconTheme: base.primaryIconTheme.copyWith( 34 | color: Colors.black87, 35 | ), 36 | accentIconTheme: base.accentIconTheme.copyWith( 37 | color: kNovumPurple, 38 | ), 39 | 40 | buttonTheme: base.buttonTheme.copyWith( 41 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.zero), 42 | ), 43 | 44 | cursorColor: kNovumPurple, 45 | inputDecorationTheme: InputDecorationTheme( 46 | border: UnderlineInputBorder(borderSide: BorderSide( 47 | width: 1.0, 48 | color: Colors.black26, 49 | )), 50 | focusedBorder: UnderlineInputBorder(borderSide: BorderSide( 51 | width: 1.0, 52 | color: Colors.black26, 53 | )), 54 | hasFloatingPlaceholder: false, 55 | ), 56 | 57 | dialogBackgroundColor: Colors.white, 58 | dialogTheme: DialogTheme( 59 | shape: RoundedRectangleBorder( 60 | borderRadius: BorderRadius.zero, 61 | ), 62 | ), 63 | 64 | ); 65 | 66 | } 67 | 68 | TextTheme _buildTextTheme(TextTheme base) { 69 | 70 | return base.copyWith( 71 | 72 | display4: base.display4.copyWith( 73 | fontFamily: 'Eczar', 74 | fontWeight: FontWeight.w600, 75 | ), 76 | display3: base.display3.copyWith( 77 | fontFamily: 'Libre Franklin', 78 | fontWeight: FontWeight.w300, 79 | ), 80 | display2: base.display2.copyWith( 81 | fontFamily: 'Libre Franklin', 82 | fontWeight: FontWeight.w500, 83 | ), 84 | display1: base.display1.copyWith( 85 | fontFamily: 'Eczar', 86 | fontWeight: FontWeight.w600, 87 | ), 88 | 89 | headline: base.headline.copyWith( 90 | fontFamily: 'Eczar', 91 | fontWeight: FontWeight.w600, 92 | ), 93 | 94 | subtitle: base.subtitle.copyWith( 95 | fontFamily: 'Libre Franklin', 96 | fontWeight: FontWeight.w500, 97 | ), 98 | 99 | body1: base.body1.copyWith( 100 | fontFamily: 'Libre Franklin', 101 | fontWeight: FontWeight.w400, 102 | fontSize: 14.0, 103 | ), 104 | body2: base.body2.copyWith( 105 | fontFamily: 'Eczar', 106 | fontWeight: FontWeight.w400, 107 | fontSize: 16.0, 108 | ), 109 | 110 | button: base.button.copyWith( 111 | fontFamily: 'Libre Franklin', 112 | fontWeight: FontWeight.w700, 113 | ), 114 | 115 | caption: base.caption.copyWith( 116 | fontFamily: 'Eczar', 117 | fontWeight: FontWeight.w400, 118 | fontSize: 12.0, 119 | ), 120 | 121 | overline: base.overline.copyWith( 122 | fontFamily: 'Libre Franklin', 123 | fontWeight: FontWeight.w700, 124 | fontSize: 10.0, 125 | ), 126 | 127 | ).apply( 128 | 129 | displayColor: Colors.black87, 130 | bodyColor: Colors.black87, 131 | 132 | ); 133 | 134 | } -------------------------------------------------------------------------------- /lib/src/ui/screens/search.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import '../../models/article_collection_model.dart'; 4 | import '../../blocs/article_collection_bloc.dart'; 5 | import '../components/article_list.dart'; 6 | import '../components/logo.dart'; 7 | 8 | class Search extends StatefulWidget { 9 | 10 | @override 11 | SearchState createState() => SearchState(); 12 | 13 | } 14 | 15 | class SearchState extends State { 16 | 17 | final textController = TextEditingController(); 18 | 19 | /// Create new instance of [ArticleCollectionBloc] that is only used 20 | /// in search to avoid changing the content of the browse screens. 21 | final searchBloc = ArticleCollectionBloc(); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | body: CustomScrollView( 27 | slivers: [ 28 | 29 | SliverAppBar( 30 | brightness: Theme.of(context).brightness, 31 | centerTitle: true, 32 | floating: true, 33 | pinned: true, 34 | title: Logo.full(), 35 | leading: IconButton( 36 | icon: Icon(Icons.close), 37 | onPressed: () => Navigator.pop(context), 38 | ), 39 | // App bar bottom containing search field. 40 | bottom: PreferredSize( 41 | preferredSize: Size(double.infinity, 73.0), 42 | child: Container( 43 | alignment: Alignment.center, 44 | padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 16.0), 45 | child: _SearchField( 46 | controller: textController, 47 | onChanged: (value) => _handleChange(value), 48 | ), 49 | ), 50 | ), 51 | ), 52 | 53 | // List of search results. 54 | SliverList( 55 | delegate: SliverChildListDelegate([ 56 | _Results(bloc: searchBloc, controller: textController), 57 | ]), 58 | ), 59 | 60 | ], 61 | ), 62 | ); 63 | } 64 | 65 | void _handleChange(String value) async { 66 | if (value.isNotEmpty) { 67 | final String query = value; 68 | await Future.delayed(Duration(milliseconds: 500)); 69 | if (query == textController.value.text) { 70 | searchBloc.searchArticles(query); 71 | } 72 | } 73 | } 74 | 75 | } 76 | 77 | class _SearchField extends StatelessWidget { 78 | 79 | _SearchField({ 80 | @required this.controller, 81 | this.onChanged, 82 | }); 83 | 84 | final TextEditingController controller; 85 | final Function onChanged; 86 | 87 | @override 88 | Widget build(BuildContext context) { 89 | return TextField( 90 | autofocus: true, 91 | style: Theme.of(context).textTheme.body1.copyWith( 92 | fontSize: 24.0, 93 | ), 94 | decoration: InputDecoration( 95 | hintText: 'Search', 96 | ), 97 | controller: controller, 98 | onChanged: (value) => onChanged(value), 99 | ); 100 | } 101 | 102 | } 103 | 104 | /// Builds list of search results from [bloc.articles]. 105 | class _Results extends StatelessWidget { 106 | 107 | _Results({ 108 | @required this.controller, 109 | @required this.bloc, 110 | }); 111 | 112 | final TextEditingController controller; 113 | final ArticleCollectionBloc bloc; 114 | 115 | @override 116 | Widget build(BuildContext context) { 117 | final padding = EdgeInsets.symmetric(vertical: 20.0); 118 | return StreamBuilder( 119 | stream: bloc.articles, 120 | builder: (BuildContext context, AsyncSnapshot snapshot) { 121 | if (snapshot.hasData) { 122 | // Build list of search results. 123 | return ArticleList( 124 | snapshot.data.articles, 125 | expandFirst: false, 126 | padding: padding 127 | ); 128 | } 129 | // Return placeholder skeleton. 130 | if (controller.value.text.isNotEmpty) { 131 | return ArticleList.skeleton(expandFirst: false); 132 | } 133 | // Show empty container if there is no current query. 134 | return Container(padding: padding); 135 | }, 136 | ); 137 | } 138 | 139 | } -------------------------------------------------------------------------------- /lib/src/ui/screens/auth.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import '../../blocs/auth_bloc.dart'; 4 | import '../../resources/repository.dart'; 5 | 6 | class Auth extends StatelessWidget { 7 | 8 | final bloc = AuthBloc(); 9 | final _repository = Repository(); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Scaffold( 14 | body: SafeArea( 15 | child: StreamBuilder( 16 | stream: bloc.key, 17 | builder: (BuildContext context, AsyncSnapshot snapshot) { 18 | 19 | if (snapshot.hasData && snapshot.data.isNotEmpty) { 20 | validate(context, snapshot.data); 21 | return Container( 22 | alignment: Alignment.center, 23 | child: CircularProgressIndicator(), 24 | ); 25 | } 26 | bloc.getKey(); 27 | return _AuthForm( 28 | onTap: (String key) => validate(context, key), 29 | ); 30 | 31 | }, 32 | ), 33 | ), 34 | ); 35 | } 36 | 37 | Future validate(BuildContext context, String key) async { 38 | key = key.trim(); 39 | final bool valid = await _repository.newsApiProvider.test(key); 40 | if (valid) { 41 | // Navigate to the home screen if the API key is 42 | // valid. 43 | await bloc.setKey(key); 44 | await Future.delayed(Duration(milliseconds: 300)); 45 | Navigator.of(context).pushReplacementNamed('/home'); 46 | } else { 47 | // Show an error if the API key isn't valid. 48 | await bloc.setKey(''); 49 | showDialog( 50 | context: context, 51 | barrierDismissible: false, 52 | builder: (BuildContext context) { 53 | return AlertDialog( 54 | title: Text('Invalid API key'), 55 | content: Text('The API key you have provided is not valid. You can get a valid API key from newsapi.org'), 56 | actions: [ 57 | FlatButton( 58 | textColor: Theme.of(context).accentColor, 59 | child: Text('OK'), 60 | onPressed: () => Navigator.pop(context), 61 | ), 62 | ], 63 | ); 64 | }, 65 | ); 66 | } 67 | } 68 | 69 | /// Shows the home screen. 70 | void authenticated(BuildContext context) async { 71 | await Future.delayed(Duration(milliseconds: 300)); 72 | Navigator.pushReplacementNamed(context, '/home'); 73 | } 74 | 75 | } 76 | 77 | class _AuthForm extends StatefulWidget { 78 | 79 | _AuthForm({ 80 | this.onTap, 81 | }); 82 | 83 | final Function onTap; 84 | 85 | @override 86 | _AuthFormState createState() => _AuthFormState(); 87 | 88 | } 89 | 90 | class _AuthFormState extends State<_AuthForm> { 91 | 92 | final textController = TextEditingController(); 93 | 94 | @override 95 | Widget build(BuildContext context) { 96 | return Column( 97 | mainAxisSize: MainAxisSize.max, 98 | mainAxisAlignment: MainAxisAlignment.center, 99 | children: [ 100 | 101 | Text( 102 | 'Welcome', 103 | style: Theme.of(context).textTheme.display1.copyWith( 104 | fontSize: Theme.of(context).textTheme.display2.fontSize, 105 | ), 106 | ), 107 | 108 | Padding( 109 | padding: EdgeInsets.symmetric(horizontal: 36.0), 110 | child: Text( 111 | 'To use Novum you must provide an API key from newsapi.org', 112 | style: Theme.of(context).textTheme.body1.copyWith( 113 | fontSize: 16.0, 114 | ), 115 | ), 116 | ), 117 | 118 | SizedBox(height: 36.0), 119 | 120 | Padding( 121 | padding: EdgeInsets.symmetric(horizontal: 36.0), 122 | child: TextFormField( 123 | decoration: InputDecoration( 124 | hintText: 'Enter API key', 125 | ), 126 | controller: textController, 127 | ), 128 | ), 129 | 130 | SizedBox(height: 56.0), 131 | 132 | RaisedButton( 133 | color: Theme.of(context).accentColor, 134 | textColor: Colors.white, 135 | child: Text('Submit'), 136 | onPressed: () => widget.onTap(textController.value.text), 137 | ), 138 | 139 | ], 140 | ); 141 | } 142 | 143 | } -------------------------------------------------------------------------------- /lib/src/ui/components/article_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../models/article_model.dart'; 3 | import './image_placeholder.dart'; 4 | import './fade_route.dart'; 5 | import '../screens/article.dart'; 6 | import 'package:transparent_image/transparent_image.dart'; 7 | 8 | class ArticleTile extends StatelessWidget { 9 | 10 | ArticleTile({ 11 | this.article, 12 | this.title, 13 | this.thumbnail, 14 | this.published, 15 | this.expanded, 16 | }); 17 | 18 | ArticleTile.fromArticleModel(ArticleModel article, BuildContext context, {bool expanded: false}) : 19 | article = article, 20 | title = Text(cleanTitle(article.title), style: Theme.of(context).textTheme.body1.copyWith( 21 | fontSize: 16.0, 22 | fontWeight: FontWeight.w500, 23 | )), 24 | thumbnail = article.imageUrl != null 25 | ? FadeInImage.memoryNetwork( 26 | image: article.imageUrl, 27 | placeholder: kTransparentImage, 28 | fit: BoxFit.cover, 29 | ) 30 | : ImagePlaceholder('No image.'), 31 | published = Text( 32 | _timestamp(article.published), 33 | style: Theme.of(context).textTheme.subtitle.copyWith( 34 | color: Colors.black54, 35 | fontSize: 14.0, 36 | ), 37 | ), 38 | expanded = expanded; 39 | 40 | final ArticleModel article; 41 | final Widget title; 42 | final Widget thumbnail; 43 | final Widget published; 44 | final bool expanded; 45 | 46 | Widget build(BuildContext context) { 47 | Route currentRoute; 48 | Navigator.popUntil(context, (route) { 49 | currentRoute = route; 50 | return true; 51 | }); 52 | final String category = currentRoute.settings.name != '/search' 53 | && currentRoute.settings.name != null 54 | ? currentRoute.settings.name.replaceAll('/', '') 55 | : null; 56 | return InkWell( 57 | onTap: () => Navigator.push(context, FadeRoute(Article(article, category: category))), 58 | child: Container( 59 | padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0), 60 | child: expanded ? _expandedTile() : _compactTile(), 61 | ), 62 | ); 63 | } 64 | 65 | Widget _expandedTile() { 66 | return Column( 67 | mainAxisSize: MainAxisSize.min, 68 | children: [ 69 | 70 | // Thumbnail. 71 | Flexible( 72 | flex: 3, 73 | child: Stack( 74 | alignment: Alignment.center, 75 | children: [ 76 | AspectRatio(aspectRatio: 4.0 / 3.0, child: Container(color: Colors.black26)), 77 | AspectRatio(aspectRatio: 4.0 / 3.0, child: thumbnail), 78 | ], 79 | ), 80 | ), 81 | 82 | // Title and timestamp. 83 | Flexible( 84 | flex: 1, 85 | child: Column( 86 | crossAxisAlignment: CrossAxisAlignment.stretch, 87 | children: [ 88 | 89 | Padding( 90 | padding: const EdgeInsets.symmetric(vertical: 8.0), 91 | child: published 92 | ), 93 | 94 | title, 95 | 96 | ], 97 | ), 98 | ), 99 | 100 | ], 101 | ); 102 | } 103 | 104 | Widget _compactTile() { 105 | return Row( 106 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 107 | children: [ 108 | 109 | Flexible( 110 | flex: 3, 111 | child: Column( 112 | crossAxisAlignment: CrossAxisAlignment.start, 113 | children: [ 114 | 115 | Padding( 116 | padding: const EdgeInsets.only(bottom: 6.0), 117 | child: published 118 | ), 119 | 120 | title, 121 | 122 | ], 123 | ), 124 | ), 125 | 126 | Flexible( 127 | flex: 1, 128 | child: Padding( 129 | padding: const EdgeInsets.only(left: 20.0), 130 | child: Stack( 131 | alignment: Alignment.center, 132 | children: [ 133 | AspectRatio(aspectRatio: 1.0 / 1.0, child: Container(color: Colors.black26)), 134 | AspectRatio(aspectRatio: 1.0 / 1.0, child: thumbnail), 135 | ], 136 | ), 137 | ), 138 | ) 139 | 140 | ], 141 | ); 142 | } 143 | 144 | static String cleanTitle(String originalTitle) { 145 | List split = originalTitle.split(' - '); 146 | return split[0]; 147 | } 148 | 149 | /// Returns the article's published date in a readable 150 | /// form. 151 | static String _timestamp(DateTime oldDate) { 152 | String timestamp; 153 | DateTime currentDate = DateTime.now(); 154 | Duration difference = currentDate.difference(oldDate); 155 | if (difference.inSeconds < 60) { 156 | timestamp = 'Now'; 157 | } else if (difference.inMinutes < 60) { 158 | timestamp = '${difference.inMinutes}M'; 159 | } else if (difference.inHours < 24) { 160 | timestamp = '${difference.inHours}H'; 161 | } else if (difference.inDays < 30) { 162 | timestamp = '${difference.inDays}D'; 163 | } 164 | return timestamp; 165 | } 166 | 167 | } -------------------------------------------------------------------------------- /lib/src/ui/screens/stock_settings.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../models/symbol_model.dart'; 3 | import '../../blocs/iex_bloc.dart'; 4 | 5 | class StockSettings extends StatelessWidget { 6 | 7 | StockSettings({ 8 | @required this.bloc, 9 | @required this.symbols, 10 | }); 11 | 12 | final List symbols; 13 | final IexBloc bloc; 14 | static GlobalKey _formKey = GlobalKey(); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Dialog( 19 | child: Container( 20 | height: 256.0, 21 | child: Column( 22 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 23 | crossAxisAlignment: CrossAxisAlignment.start, 24 | children: [ 25 | 26 | // Header. 27 | Padding( 28 | padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0), 29 | child: Text( 30 | 'Stocks to follow', 31 | style: Theme.of(context).textTheme.headline.copyWith( 32 | fontFamily: 'Libre Franklin', 33 | fontWeight: FontWeight.w700, 34 | ), 35 | ), 36 | ), 37 | 38 | // Form. 39 | _Form(formKey: _formKey, bloc: bloc, symbols: symbols), 40 | 41 | // Actions. 42 | ButtonBar( 43 | children: [ 44 | 45 | FlatButton( 46 | textColor: Theme.of(context).accentColor, 47 | highlightColor: Theme.of(context).accentColor.withOpacity(0.1), 48 | splashColor: Theme.of(context).accentColor.withOpacity(0.1), 49 | child: Text('Close'), 50 | onPressed: () => Navigator.pop(context, false), 51 | ), 52 | OutlineButton( 53 | textColor: Theme.of(context).accentColor, 54 | highlightedBorderColor: Theme.of(context).accentColor, 55 | highlightElevation: 0.0, 56 | highlightColor: Theme.of(context).accentColor.withOpacity(0.1), 57 | splashColor: Theme.of(context).accentColor.withOpacity(0.1), 58 | child: Text('Save changes'), 59 | onPressed: () => _save(context), 60 | ), 61 | 62 | ], 63 | ), 64 | 65 | ], 66 | ), 67 | ), 68 | ); 69 | } 70 | 71 | void _save(BuildContext context) { 72 | if (_formKey.currentState.validate()) { 73 | _formKey.currentState.save(); 74 | Navigator.pop(context, true); 75 | } 76 | } 77 | 78 | } 79 | 80 | class _Form extends StatefulWidget { 81 | 82 | _Form({ 83 | @required this.symbols, 84 | @required this.bloc, 85 | @required this.formKey, 86 | }); 87 | 88 | final List symbols; 89 | final IexBloc bloc; 90 | final GlobalKey formKey; 91 | 92 | @override 93 | _FormState createState() => _FormState(); 94 | 95 | } 96 | 97 | class _FormState extends State<_Form> { 98 | 99 | List _data = []; 100 | 101 | @override 102 | Widget build(BuildContext context) { 103 | return Form( 104 | key: widget.formKey, 105 | child: Row( 106 | children: [ 107 | 108 | SizedBox(width: 16.0), 109 | 110 | Flexible( 111 | flex: 1, 112 | child: TextFormField( 113 | initialValue: widget.symbols[0].symbol.toUpperCase(), 114 | validator: (value) => validator(value), 115 | decoration: InputDecoration( 116 | hintText: 'Symbol 1', 117 | ), 118 | textCapitalization: TextCapitalization.characters, 119 | onSaved: (value) { 120 | _data.add(value); 121 | }, 122 | ), 123 | ), 124 | 125 | SizedBox(width: 16.0), 126 | 127 | Flexible( 128 | flex: 1, 129 | child: TextFormField( 130 | initialValue: widget.symbols[1].symbol.toUpperCase(), 131 | validator: (value) => validator(value), 132 | decoration: InputDecoration( 133 | hintText: 'Symbol 2', 134 | ), 135 | textCapitalization: TextCapitalization.characters, 136 | onSaved: (value) { 137 | _data.add(value); 138 | }, 139 | ), 140 | ), 141 | 142 | SizedBox(width: 16.0), 143 | 144 | Flexible( 145 | flex: 1, 146 | child: TextFormField( 147 | initialValue: widget.symbols[2].symbol.toUpperCase(), 148 | validator: (value) => validator(value), 149 | decoration: InputDecoration( 150 | hintText: 'Symbol 3', 151 | ), 152 | textCapitalization: TextCapitalization.characters, 153 | onSaved: (value) async { 154 | _data.add(value); 155 | await widget.bloc.setSymbols(_data); 156 | }, 157 | ), 158 | ), 159 | 160 | SizedBox(width: 16.0), 161 | 162 | ], 163 | ), 164 | ); 165 | } 166 | 167 | String validator(String value) { 168 | if (value.isEmpty) { 169 | return 'Can\'t be empty'; 170 | } else { 171 | return null; 172 | } 173 | } 174 | 175 | } -------------------------------------------------------------------------------- /lib/src/ui/screens/browse.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:flutter/material.dart'; 3 | import '../components/navigation_drawer.dart'; 4 | import '../components/novum_app_bar.dart'; 5 | import '../components/article_list.dart'; 6 | import '../components/iex_stock_data.dart'; 7 | import '../../models/article_collection_model.dart'; 8 | import '../../blocs/article_collection_bloc.dart'; 9 | import 'package:newsapi_client/newsapi_client.dart'; 10 | 11 | class Browse extends StatefulWidget { 12 | 13 | Browse({ 14 | this.title, 15 | this.category, 16 | }); 17 | 18 | final String title; 19 | final Categories category; 20 | final bloc = ArticleCollectionBloc(); 21 | 22 | @override 23 | BrowseState createState() => BrowseState(); 24 | 25 | } 26 | 27 | class BrowseState extends State with SingleTickerProviderStateMixin { 28 | 29 | /// The [_controller] controls the state of the 30 | /// [NovumAppBar]. 31 | /// 32 | /// If [_controller.isCompleted] the app bar is 33 | /// collapsed. 34 | /// 35 | /// If [_controller.isDismissed] the app bar is 36 | /// expanded. 37 | AnimationController _controller; 38 | int _pageSize = 20; 39 | 40 | @override 41 | void initState() { 42 | super.initState(); 43 | _controller = AnimationController( 44 | duration: Duration(milliseconds: 600), 45 | vsync: this, 46 | ) 47 | ..addListener(() { setState(() {}); }) 48 | ..addStatusListener((status) { 49 | if (status == AnimationStatus.dismissed) { 50 | _controller.reset(); 51 | } 52 | }); 53 | } 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | final listPadding = const EdgeInsets.only(top: 67.0, bottom: 20.0); 58 | final Widget readMore = widget.category != null 59 | ? FlatButton( 60 | child: Text( 61 | 'Read More', 62 | style: Theme.of(context).textTheme.button.copyWith( 63 | fontSize: 18.0, 64 | ), 65 | ), 66 | onPressed: () => _moreContent(), 67 | ) 68 | : Container(); 69 | final Widget stocks = widget.category == null 70 | ? IexStockData() 71 | : Container(); 72 | 73 | return Scaffold( 74 | drawer: NavigationDrawer(), 75 | body: Stack( 76 | children: [ 77 | 78 | RefreshIndicator( 79 | displacement: 108.0, 80 | onRefresh: () => _refreshContent(), 81 | 82 | /// The NotificationListener listens for scroll updates 83 | /// and determines if the app bar should expand or collapse 84 | /// depending on the scroll direction. 85 | /// 86 | /// [_controller.reverse()] expands the app bar. 87 | /// [_controller.forward()] collapses the app bar. 88 | child: NotificationListener( 89 | onNotification: (notification) { 90 | 91 | final bool scrollingDown = 92 | notification.scrollDelta > 0 93 | && _controller.isDismissed 94 | && notification.metrics.pixels > 0.0; 95 | final bool scrollingUp = 96 | notification.scrollDelta < 0 97 | && _controller.isCompleted 98 | && notification.metrics.pixels < notification.metrics.maxScrollExtent; 99 | final bool overflowTop = 100 | notification.metrics.pixels < 1.0; 101 | 102 | if (overflowTop) { 103 | _controller.reverse(); 104 | } else if (scrollingUp) { 105 | _controller.reverse(); 106 | } else if (scrollingDown) { 107 | _controller.forward(); 108 | } 109 | }, 110 | child: ListView( 111 | children: [ 112 | 113 | /// Builds list of articles from [bloc.articles]. 114 | /// Shows skeleton-screen if stream is empty. 115 | StreamBuilder( 116 | stream: widget.bloc.articles, 117 | builder: (BuildContext context, AsyncSnapshot snapshot) { 118 | if (snapshot.hasData) { 119 | return ArticleList( 120 | snapshot.data.articles, 121 | padding: listPadding, 122 | itemCount: snapshot.data.articles.length, 123 | ); 124 | } 125 | _refreshContent(); 126 | return ArticleList.skeleton( 127 | padding: listPadding, 128 | itemCount: 5, 129 | ); 130 | } 131 | ), 132 | 133 | readMore, 134 | 135 | Divider(), 136 | 137 | stocks, 138 | 139 | ], 140 | ), 141 | ), 142 | ), 143 | 144 | /// Custom app bar 145 | /// 146 | /// Appears when [MediaQuery] is available (doesn't return 0.0). 147 | Align( 148 | alignment: Alignment.topCenter, 149 | child: MediaQuery.of(context).size.width == 0.0 150 | ? SafeArea(child: Container(width: double.infinity, height: 56.0)) 151 | : NovumAppBar( 152 | title: widget.title, 153 | context: context, 154 | controller: _controller, 155 | ), 156 | ), 157 | 158 | ], 159 | ), 160 | ); 161 | } 162 | 163 | /// Submits a new article request with an increased 164 | /// pageSize. 165 | void _moreContent({int step: 10}) { 166 | setState(() { 167 | _pageSize = _pageSize += step; 168 | }); 169 | widget.bloc.requestArticles(TopHeadlines( 170 | country: Countries.unitedStatesOfAmerica, 171 | category: widget.category, 172 | pageSize: _pageSize, 173 | )); 174 | } 175 | 176 | /// Refresh content 177 | /// 178 | /// Refreshes the [bloc.articles] stream. 179 | Future _refreshContent() async { 180 | Endpoint endpoint; 181 | if (widget.category == null) { 182 | endpoint = TopHeadlines( 183 | country: Countries.unitedStatesOfAmerica, 184 | pageSize: 5, 185 | ); 186 | } else { 187 | endpoint = TopHeadlines( 188 | country: Countries.unitedStatesOfAmerica, 189 | category: widget.category, 190 | ); 191 | } 192 | await widget.bloc.requestArticles(endpoint); 193 | return null; 194 | } 195 | 196 | @override 197 | void dispose() { 198 | _controller.dispose(); 199 | super.dispose(); 200 | } 201 | } -------------------------------------------------------------------------------- /lib/src/ui/components/novum_app_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import './logo.dart'; 3 | 4 | /// Custom appBar with expanding/collapsing animation controlled 5 | /// from an AnimationController outside the class. 6 | class NovumAppBar extends StatefulWidget { 7 | NovumAppBar({ 8 | this.title, 9 | @required this.controller, 10 | @required this.context, 11 | this.elevation, 12 | }); 13 | 14 | /// The title of the app bar. This will be hidden in favor of 15 | /// a compact logo when the app bar is collapsed. 16 | final String title; 17 | final AnimationController controller; 18 | final BuildContext context; 19 | 20 | /// The size of the shadow underneath the app bar material. 21 | /// Defaults to [4.0]. 22 | final double elevation; 23 | 24 | @override 25 | NovumAppBarState createState() => NovumAppBarState(); 26 | } 27 | 28 | class NovumAppBarState extends State 29 | with SingleTickerProviderStateMixin { 30 | Animation opacity; 31 | Animation opacity2; 32 | Animation size; 33 | Animation radius; 34 | double vwidth; 35 | 36 | @override 37 | void initState() { 38 | // Use the width of the viewport to animate the app bar. 39 | vwidth = MediaQuery.of(widget.context).size.width; 40 | super.initState(); 41 | 42 | /// First opacity animation. 43 | /// 44 | /// This animation is used to animate the opacity of 45 | /// the full-width-only widgets, like the full title 46 | /// and search button. 47 | opacity = Tween( 48 | begin: 1.0, 49 | end: 0.0, 50 | ).animate(CurvedAnimation( 51 | parent: widget.controller, 52 | curve: Interval( 53 | 0.0, 54 | 0.3, 55 | curve: Curves.easeOut, 56 | ), 57 | reverseCurve: Interval( 58 | 0.0, 59 | 0.3, 60 | curve: Curves.easeIn, 61 | ), 62 | )); 63 | 64 | /// Second opacity animation. 65 | /// 66 | /// This animation is used to animate the opacity of 67 | /// the compact-only widgets, like the small app logo. 68 | opacity2 = Tween( 69 | begin: 0.0, 70 | end: 1.0, 71 | ).animate(CurvedAnimation( 72 | parent: widget.controller, 73 | curve: Interval( 74 | 0.7, 75 | 1.0, 76 | curve: Curves.easeIn, 77 | ), 78 | reverseCurve: Interval( 79 | 0.7, 80 | 1.0, 81 | curve: Curves.easeOut, 82 | ), 83 | )); 84 | 85 | /// Size animation. 86 | /// 87 | /// This animation is used to animate the width of the appBar 88 | /// when scrolling up/down. 89 | size = Tween( 90 | begin: vwidth, 91 | end: 112.0, 92 | ).animate(CurvedAnimation( 93 | parent: widget.controller, 94 | curve: Interval( 95 | 0.3, 96 | 1.0, 97 | curve: Curves.fastOutSlowIn, 98 | ), 99 | )); 100 | 101 | /// Radius animation. 102 | /// 103 | /// This animation is used to animate the size of the cut 104 | /// in the bottom left corner of the appBar. 105 | radius = BorderRadiusTween( 106 | begin: BorderRadius.only(bottomRight: Radius.circular(0.0)), 107 | end: BorderRadius.only(bottomRight: Radius.circular(16.0)), 108 | ).animate(CurvedAnimation( 109 | parent: widget.controller, 110 | curve: Interval( 111 | 0.3, 112 | 1.0, 113 | curve: Curves.easeInOut, 114 | ), 115 | )); 116 | } 117 | 118 | @override 119 | Widget build(BuildContext context) { 120 | return Container( 121 | width: vwidth, 122 | height: kToolbarHeight + MediaQuery.of(context).padding.top, 123 | child: Stack( 124 | children: [ 125 | /// Contains the app bar material and the menu button. 126 | /// 127 | /// Has a cut shape when collapsed. 128 | Container( 129 | width: size.value, 130 | height: kToolbarHeight + MediaQuery.of(context).padding.top, 131 | child: Material( 132 | color: Theme.of(context).primaryColor, 133 | elevation: widget.elevation ?? 4.0, 134 | shape: BeveledRectangleBorder( 135 | borderRadius: radius.value, 136 | ), 137 | child: Padding( 138 | padding: 139 | EdgeInsets.only(top: MediaQuery.of(context).padding.top), 140 | child: Row( 141 | children: [ 142 | SizedBox(width: 4.0), 143 | IconButton( 144 | icon: Icon(Icons.menu), 145 | onPressed: () => Scaffold.of(context).openDrawer(), 146 | ), 147 | ], 148 | ), 149 | ), 150 | ), 151 | ), 152 | 153 | /// App logo component. 154 | /// 155 | /// This logo is hidden when the app bar is expanded. 156 | Opacity( 157 | opacity: opacity2.value, 158 | child: Align( 159 | alignment: Alignment.centerLeft, 160 | child: Container( 161 | padding: EdgeInsets.only( 162 | left: 64.0, 163 | top: MediaQuery.of(context).padding.top, 164 | ), 165 | child: Logo.compact(), 166 | ), 167 | ), 168 | ), 169 | 170 | /// Title component. 171 | /// 172 | /// The title is hidden when the app bar is collapsed. 173 | Opacity( 174 | opacity: opacity.value, 175 | child: Container( 176 | alignment: Alignment.center, 177 | padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), 178 | child: Logo.full(title: widget.title), 179 | ), 180 | ), 181 | 182 | /// Search button. 183 | /// 184 | /// This button is hidden when the app bar is collapsed. 185 | Opacity( 186 | opacity: opacity.value, 187 | child: Align( 188 | alignment: Alignment.centerRight, 189 | child: Padding( 190 | padding: EdgeInsets.only( 191 | right: 4.0, 192 | top: MediaQuery.of(context).padding.top, 193 | ), 194 | child: ClipRRect( 195 | borderRadius: BorderRadius.circular(28.0), 196 | child: Material( 197 | color: Colors.transparent, 198 | child: IconButton( 199 | icon: Icon(Icons.search), 200 | onPressed: () => Navigator.pushNamed(context, '/search'), 201 | ), 202 | ), 203 | ), 204 | ), 205 | ), 206 | ), 207 | ], 208 | ), 209 | ); 210 | } 211 | 212 | @override 213 | void dispose() { 214 | widget.controller.dispose(); 215 | super.dispose(); 216 | } 217 | } 218 | -------------------------------------------------------------------------------- /lib/src/ui/screens/article.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../models/article_model.dart'; 3 | import '../components/article_tile.dart'; 4 | import '../components/image_placeholder.dart'; 5 | import 'package:flutter_villains/villain.dart'; 6 | import 'package:transparent_image/transparent_image.dart'; 7 | import 'package:share/share.dart'; 8 | import 'package:flutter_custom_tabs/flutter_custom_tabs.dart'; 9 | 10 | class Article extends StatelessWidget { 11 | Article(this.article, {this.category}) : assert(article != null); 12 | 13 | final ArticleModel article; 14 | final String category; 15 | 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | body: Villain( 19 | villainAnimation: VillainAnimation.fromBottom( 20 | curve: Curves.fastOutSlowIn, 21 | relativeOffset: 0.05, 22 | from: Duration(milliseconds: 200), 23 | to: Duration(milliseconds: 400), 24 | ), 25 | secondaryVillainAnimation: VillainAnimation.fade(), 26 | animateExit: true, 27 | child: Stack( 28 | children: [ 29 | _Content(article, category: category ?? null), 30 | _BottomSheet(url: article.url), 31 | _Actions(actions: [ 32 | IconButton( 33 | icon: Theme.of(context).platform == TargetPlatform.iOS 34 | ? Icon(Icons.arrow_back_ios) 35 | : Icon(Icons.arrow_back), 36 | onPressed: () => Navigator.pop(context), 37 | ), 38 | ]), 39 | ], 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | 46 | class _Content extends StatelessWidget { 47 | _Content( 48 | this.article, { 49 | this.category, 50 | }) : assert(article != null); 51 | 52 | final ArticleModel article; 53 | final String category; 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | return ListView( 58 | children: [ 59 | image(), 60 | articleCategory(context), 61 | SizedBox(height: 24.0), 62 | title(context), 63 | SizedBox(height: 8.0), 64 | source(context), 65 | SizedBox(height: 20.0), 66 | preview(context), 67 | ], 68 | ); 69 | } 70 | 71 | Widget source(BuildContext context) { 72 | return Padding( 73 | padding: EdgeInsets.symmetric(horizontal: 20.0), 74 | child: Text( 75 | article.source != null 76 | ? 'Source: ${article.source}' 77 | : 'Error: No source found.', 78 | style: Theme.of(context).textTheme.body1.copyWith( 79 | fontWeight: FontWeight.w500, 80 | color: Colors.black54, 81 | ), 82 | ), 83 | ); 84 | } 85 | 86 | Widget image() { 87 | if (article.imageUrl != null) { 88 | return FadeInImage.memoryNetwork( 89 | image: article.imageUrl, 90 | placeholder: kTransparentImage, 91 | fit: BoxFit.cover, 92 | ); 93 | } else { 94 | return ImagePlaceholder( 95 | 'No image', 96 | height: 200.0, 97 | ); 98 | } 99 | } 100 | 101 | Widget preview(BuildContext context) { 102 | if (article.content != null) { 103 | return Padding( 104 | padding: EdgeInsets.symmetric(horizontal: 20.0), 105 | child: Text( 106 | article.content, 107 | style: Theme.of(context).textTheme.body1.copyWith( 108 | fontSize: 16.0, 109 | height: 1.3, 110 | ), 111 | ), 112 | ); 113 | } else { 114 | return Container(); 115 | } 116 | } 117 | 118 | Widget articleCategory(BuildContext context) { 119 | List categories = ['us']; 120 | if (category != null) { 121 | if (category == 'home') { 122 | categories.add('front page'); 123 | } else { 124 | categories.add(category); 125 | } 126 | } 127 | return Container( 128 | width: MediaQuery.of(context).size.width, 129 | height: 38.0, 130 | padding: EdgeInsets.symmetric(horizontal: 20.0), 131 | child: ListView.separated( 132 | shrinkWrap: true, 133 | scrollDirection: Axis.horizontal, 134 | itemCount: categories.length, 135 | separatorBuilder: (BuildContext context, int index) { 136 | return Text( 137 | ' ¬ ', 138 | style: Theme.of(context).textTheme.overline.copyWith( 139 | color: Colors.black54, 140 | fontSize: 13.0, 141 | height: 2.8, 142 | ), 143 | ); 144 | }, 145 | itemBuilder: (BuildContext context, int index) { 146 | return Text( 147 | categories[index].toUpperCase(), 148 | style: Theme.of(context).textTheme.overline.copyWith( 149 | fontSize: 13.0, 150 | height: 2.9, 151 | ), 152 | ); 153 | }, 154 | ), 155 | ); 156 | } 157 | 158 | Widget title(BuildContext context) { 159 | final String title = article.title != null 160 | ? ArticleTile.cleanTitle(article.title) 161 | : '(No title)'; 162 | return Padding( 163 | padding: EdgeInsets.symmetric(horizontal: 20.0), 164 | child: Text( 165 | title, 166 | style: Theme.of(context).textTheme.headline.copyWith( 167 | height: 1.0, 168 | ), 169 | ), 170 | ); 171 | } 172 | } 173 | 174 | class _BottomSheet extends StatelessWidget { 175 | _BottomSheet({ 176 | @required this.url, 177 | }) : assert(url != null); 178 | 179 | final String url; 180 | 181 | @override 182 | Widget build(BuildContext context) { 183 | return Align( 184 | alignment: Alignment.bottomCenter, 185 | child: Container( 186 | width: double.infinity, 187 | child: Material( 188 | color: Theme.of(context).cardColor, 189 | elevation: 24.0, 190 | child: SafeArea( 191 | child: Padding( 192 | padding: EdgeInsets.all(8.0), 193 | child: ButtonBar( 194 | alignment: MainAxisAlignment.center, 195 | mainAxisSize: MainAxisSize.max, 196 | children: [ 197 | FlatButton( 198 | textColor: Theme.of(context).accentColor, 199 | child: Text('Share'), 200 | onPressed: () => _share(), 201 | ), 202 | RaisedButton( 203 | color: Theme.of(context).accentColor, 204 | colorBrightness: Brightness.dark, 205 | child: Text('Full article'), 206 | onPressed: () => _launchUrl(context), 207 | ), 208 | ], 209 | ), 210 | ), 211 | ), 212 | ), 213 | ), 214 | ); 215 | } 216 | 217 | void _share() { 218 | Share.share(url); 219 | } 220 | 221 | void _launchUrl(BuildContext context) async { 222 | try { 223 | await launch( 224 | url, 225 | option: CustomTabsOption( 226 | toolbarColor: Theme.of(context).primaryColor, 227 | enableDefaultShare: true, 228 | enableUrlBarHiding: true, 229 | showPageTitle: true, 230 | animation: CustomTabsAnimation.slideIn(), 231 | ), 232 | ); 233 | } catch (e) { 234 | debugPrint(e.toString()); 235 | } 236 | } 237 | } 238 | 239 | class _Actions extends StatelessWidget { 240 | _Actions({ 241 | this.actions, 242 | }) : assert(actions != null), 243 | assert(actions.isNotEmpty); 244 | 245 | final List actions; 246 | 247 | @override 248 | Widget build(BuildContext context) { 249 | return Align( 250 | alignment: Alignment.topLeft, 251 | child: SafeArea( 252 | child: Container( 253 | width: 56.0 * actions.length, 254 | height: 56.0, 255 | child: Material( 256 | color: Theme.of(context).primaryColor, 257 | elevation: 4.0, 258 | shape: BeveledRectangleBorder( 259 | borderRadius: 260 | BorderRadius.only(bottomRight: Radius.circular(16.0)), 261 | ), 262 | child: ListView.builder( 263 | itemCount: actions.length, 264 | scrollDirection: Axis.horizontal, 265 | itemBuilder: (BuildContext context, int index) { 266 | return actions[index]; 267 | }, 268 | ), 269 | ), 270 | ), 271 | ), 272 | ); 273 | } 274 | } 275 | -------------------------------------------------------------------------------- /lib/src/ui/components/iex_stock_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../../models/symbol_model.dart'; 3 | import '../../models/chart_model.dart'; 4 | import '../../blocs/iex_bloc.dart'; 5 | import '../screens/stock_settings.dart'; 6 | import './stock_data_header.dart'; 7 | import 'package:flutter_sparkline/flutter_sparkline.dart'; 8 | import 'package:flutter_custom_tabs/flutter_custom_tabs.dart'; 9 | 10 | class IexStockData extends StatelessWidget { 11 | final bloc = IexBloc(); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | final TextStyle attributionText = 16 | Theme.of(context).textTheme.body1.copyWith( 17 | color: Colors.black54, 18 | ); 19 | final TextStyle attributionLink = 20 | Theme.of(context).textTheme.body1.copyWith( 21 | color: Theme.of(context).accentColor, 22 | fontWeight: FontWeight.w500, 23 | ); 24 | return Container( 25 | child: Column( 26 | children: [ 27 | StreamBuilder( 28 | stream: bloc.symbols, 29 | builder: (BuildContext context, 30 | AsyncSnapshot> snapshot) { 31 | if (snapshot.hasData) { 32 | if (snapshot.data.isNotEmpty) { 33 | return Column( 34 | children: [ 35 | StreamBuilder( 36 | stream: bloc.chart, 37 | builder: (BuildContext context, 38 | AsyncSnapshot secondSnapshot) { 39 | if (secondSnapshot.hasData) { 40 | if (secondSnapshot.data.chart.isNotEmpty) { 41 | return Column( 42 | children: [ 43 | StockDataHeader( 44 | chart: secondSnapshot.data, 45 | action: IconButton( 46 | icon: Icon(Icons.settings), 47 | onPressed: () async { 48 | await showDialog( 49 | context: context, 50 | builder: (BuildContext context) => 51 | StockSettings( 52 | bloc: bloc, 53 | symbols: snapshot.data, 54 | ), 55 | ).then((updateSymbols) { 56 | if (updateSymbols != null && 57 | updateSymbols) { 58 | bloc.requestSymbols(); 59 | } 60 | }); 61 | }, 62 | ), 63 | ), 64 | Container( 65 | height: 112.0, 66 | child: Sparkline( 67 | data: secondSnapshot.data.chart.values 68 | .toList(), 69 | lineColor: Theme.of(context).accentColor, 70 | ), 71 | ), 72 | ], 73 | ); 74 | } else { 75 | bloc.requestChart(snapshot.data[1]); 76 | } 77 | } 78 | bloc.requestChart(snapshot.data[0]); 79 | return Container(height: 112.0); 80 | }, 81 | ), 82 | Container( 83 | height: 124.0, 84 | padding: EdgeInsets.symmetric(vertical: 20.0), 85 | child: ListView.separated( 86 | physics: NeverScrollableScrollPhysics(), 87 | scrollDirection: Axis.horizontal, 88 | shrinkWrap: true, 89 | itemCount: 3, 90 | separatorBuilder: (BuildContext context, int index) { 91 | return Container( 92 | width: 1.0, 93 | color: Theme.of(context).dividerColor, 94 | ); 95 | }, 96 | itemBuilder: (BuildContext context, int index) { 97 | return InkWell( 98 | onTap: () { 99 | bloc.requestChart(snapshot.data[index]); 100 | bloc.requestSymbols(); 101 | }, 102 | child: _DataTile( 103 | title: snapshot.data[index].symbol, 104 | subtitle: 105 | snapshot.data[index].latestPrice.toString(), 106 | change: snapshot.data[index].extendedChange, 107 | active: 108 | snapshot.data[index] == bloc.activeSymbol, 109 | ), 110 | ); 111 | }, 112 | ), 113 | ), 114 | ], 115 | ); 116 | } else { 117 | return Container( 118 | height: 100.0, 119 | alignment: Alignment.center, 120 | child: Text('Sorry, we couldn\'t reach IEX'), 121 | ); 122 | } 123 | } else { 124 | bloc.requestSymbols(); 125 | return Container( 126 | alignment: Alignment.center, 127 | child: CircularProgressIndicator(), 128 | ); 129 | } 130 | }, 131 | ), 132 | 133 | // Include attribution to IEX for providing the data. 134 | Padding( 135 | padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 20.0), 136 | child: Row( 137 | children: [ 138 | Text('Data provided for free by ', style: attributionText), 139 | InkWell( 140 | onTap: () => 141 | _launchUrl(context, 'https://iextrading.com/developer'), 142 | child: Text('IEX', style: attributionLink), 143 | ), 144 | Text('. View ', style: attributionText), 145 | InkWell( 146 | onTap: () => _launchUrl( 147 | context, 'https://iextrading.com/api-exhibit-a/'), 148 | child: Text('IEX\'s terms of use', style: attributionLink), 149 | ), 150 | Text('.', style: attributionText), 151 | ], 152 | ), 153 | ), 154 | ], 155 | ), 156 | ); 157 | } 158 | 159 | void _launchUrl(BuildContext context, String url) async { 160 | try { 161 | await launch( 162 | url, 163 | option: CustomTabsOption( 164 | toolbarColor: Theme.of(context).primaryColor, 165 | enableDefaultShare: true, 166 | enableUrlBarHiding: true, 167 | showPageTitle: true, 168 | animation: CustomTabsAnimation.slideIn(), 169 | ), 170 | ); 171 | } catch (e) { 172 | debugPrint(e.toString()); 173 | } 174 | } 175 | } 176 | 177 | class _DataTile extends StatelessWidget { 178 | _DataTile({ 179 | this.title, 180 | this.subtitle, 181 | this.change, 182 | this.active = false, 183 | }); 184 | 185 | final String title; 186 | final String subtitle; 187 | final double change; 188 | final bool active; 189 | 190 | @override 191 | Widget build(BuildContext context) { 192 | return Container( 193 | width: MediaQuery.of(context).size.width / 3, 194 | padding: EdgeInsets.symmetric(horizontal: 20.0), 195 | child: Column( 196 | crossAxisAlignment: CrossAxisAlignment.start, 197 | children: [ 198 | Text( 199 | title, 200 | style: TextStyle( 201 | fontSize: 20.0, 202 | fontFamily: 'Libre Franklin', 203 | fontWeight: FontWeight.w700, 204 | color: active ? Theme.of(context).accentColor : Colors.black87, 205 | ), 206 | ), 207 | SizedBox(height: 4.0), 208 | Text( 209 | subtitle, 210 | style: TextStyle( 211 | fontSize: 18.0, 212 | fontFamily: 'Libre Franklin', 213 | fontWeight: FontWeight.w500, 214 | color: Colors.black54, 215 | ), 216 | ), 217 | SizedBox(height: 8.0), 218 | displayChange(context), 219 | ], 220 | ), 221 | ); 222 | } 223 | 224 | Widget displayChange(BuildContext context) { 225 | bool negative = change.toString().contains('-'); 226 | final Widget symbol = negative 227 | ? Text('- ', 228 | style: Theme.of(context).textTheme.body1.copyWith( 229 | color: Theme.of(context).accentColor, 230 | fontWeight: FontWeight.w700, 231 | )) 232 | : Text('+ ', 233 | style: Theme.of(context).textTheme.body1.copyWith( 234 | color: Colors.greenAccent[400], 235 | fontWeight: FontWeight.w700, 236 | )); 237 | return Row( 238 | mainAxisAlignment: MainAxisAlignment.start, 239 | children: [ 240 | symbol, 241 | Text( 242 | '${change.toString().replaceAll('-', '')}%', 243 | style: Theme.of(context).textTheme.body1, 244 | ), 245 | ], 246 | ); 247 | } 248 | } 249 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 5E555D46AD5B9FD07CB36E3F /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CCB2E104ECA907FB932114A /* libPods-Runner.a */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 2CCB2E104ECA907FB932114A /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 4E441A5B5771FBDD23F0DC49 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 47 | 6B16300A722B10DAA3DA444D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 48 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 49 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 50 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 51 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 52 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 53 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 54 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 56 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | E99448A81246A7D6977C1114 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 69 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 70 | 5E555D46AD5B9FD07CB36E3F /* libPods-Runner.a in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 4466AFB5D95E0996D256AD6D /* Frameworks */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 2CCB2E104ECA907FB932114A /* libPods-Runner.a */, 81 | ); 82 | name = Frameworks; 83 | sourceTree = ""; 84 | }; 85 | 9740EEB11CF90186004384FC /* Flutter */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 3B80C3931E831B6300D905FE /* App.framework */, 89 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 90 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 91 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 92 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 93 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 94 | ); 95 | name = Flutter; 96 | sourceTree = ""; 97 | }; 98 | 97C146E51CF9000F007C117D = { 99 | isa = PBXGroup; 100 | children = ( 101 | 9740EEB11CF90186004384FC /* Flutter */, 102 | 97C146F01CF9000F007C117D /* Runner */, 103 | 97C146EF1CF9000F007C117D /* Products */, 104 | D36AD392185F201ED701C1B3 /* Pods */, 105 | 4466AFB5D95E0996D256AD6D /* Frameworks */, 106 | ); 107 | sourceTree = ""; 108 | }; 109 | 97C146EF1CF9000F007C117D /* Products */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 97C146EE1CF9000F007C117D /* Runner.app */, 113 | ); 114 | name = Products; 115 | sourceTree = ""; 116 | }; 117 | 97C146F01CF9000F007C117D /* Runner */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 121 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 122 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 123 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 124 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 125 | 97C147021CF9000F007C117D /* Info.plist */, 126 | 97C146F11CF9000F007C117D /* Supporting Files */, 127 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 128 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 129 | ); 130 | path = Runner; 131 | sourceTree = ""; 132 | }; 133 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 97C146F21CF9000F007C117D /* main.m */, 137 | ); 138 | name = "Supporting Files"; 139 | sourceTree = ""; 140 | }; 141 | D36AD392185F201ED701C1B3 /* Pods */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 6B16300A722B10DAA3DA444D /* Pods-Runner.debug.xcconfig */, 145 | E99448A81246A7D6977C1114 /* Pods-Runner.release.xcconfig */, 146 | 4E441A5B5771FBDD23F0DC49 /* Pods-Runner.profile.xcconfig */, 147 | ); 148 | name = Pods; 149 | path = Pods; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | 97C146ED1CF9000F007C117D /* Runner */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 158 | buildPhases = ( 159 | 13D00A1AF545A748CF2D8EB7 /* [CP] Check Pods Manifest.lock */, 160 | 9740EEB61CF901F6004384FC /* Run Script */, 161 | 97C146EA1CF9000F007C117D /* Sources */, 162 | 97C146EB1CF9000F007C117D /* Frameworks */, 163 | 97C146EC1CF9000F007C117D /* Resources */, 164 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 165 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 166 | 6A90B5604B9A6600CA93F5CC /* [CP] Embed Pods Frameworks */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | ); 172 | name = Runner; 173 | productName = Runner; 174 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 175 | productType = "com.apple.product-type.application"; 176 | }; 177 | /* End PBXNativeTarget section */ 178 | 179 | /* Begin PBXProject section */ 180 | 97C146E61CF9000F007C117D /* Project object */ = { 181 | isa = PBXProject; 182 | attributes = { 183 | LastUpgradeCheck = 0910; 184 | ORGANIZATIONNAME = "The Chromium Authors"; 185 | TargetAttributes = { 186 | 97C146ED1CF9000F007C117D = { 187 | CreatedOnToolsVersion = 7.3.1; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 192 | compatibilityVersion = "Xcode 3.2"; 193 | developmentRegion = English; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = 97C146E51CF9000F007C117D; 200 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | 97C146ED1CF9000F007C117D /* Runner */, 205 | ); 206 | }; 207 | /* End PBXProject section */ 208 | 209 | /* Begin PBXResourcesBuildPhase section */ 210 | 97C146EC1CF9000F007C117D /* Resources */ = { 211 | isa = PBXResourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 215 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 216 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 217 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 218 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXResourcesBuildPhase section */ 223 | 224 | /* Begin PBXShellScriptBuildPhase section */ 225 | 13D00A1AF545A748CF2D8EB7 /* [CP] Check Pods Manifest.lock */ = { 226 | isa = PBXShellScriptBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | ); 230 | inputFileListPaths = ( 231 | ); 232 | inputPaths = ( 233 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 234 | "${PODS_ROOT}/Manifest.lock", 235 | ); 236 | name = "[CP] Check Pods Manifest.lock"; 237 | outputFileListPaths = ( 238 | ); 239 | outputPaths = ( 240 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | shellPath = /bin/sh; 244 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 245 | showEnvVarsInLog = 0; 246 | }; 247 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 248 | isa = PBXShellScriptBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | inputPaths = ( 253 | ); 254 | name = "Thin Binary"; 255 | outputPaths = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | shellPath = /bin/sh; 259 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 260 | }; 261 | 6A90B5604B9A6600CA93F5CC /* [CP] Embed Pods Frameworks */ = { 262 | isa = PBXShellScriptBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | ); 266 | inputPaths = ( 267 | ); 268 | name = "[CP] Embed Pods Frameworks"; 269 | outputPaths = ( 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | shellPath = /bin/sh; 273 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 274 | showEnvVarsInLog = 0; 275 | }; 276 | 9740EEB61CF901F6004384FC /* Run Script */ = { 277 | isa = PBXShellScriptBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | inputPaths = ( 282 | ); 283 | name = "Run Script"; 284 | outputPaths = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | shellPath = /bin/sh; 288 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 289 | }; 290 | /* End PBXShellScriptBuildPhase section */ 291 | 292 | /* Begin PBXSourcesBuildPhase section */ 293 | 97C146EA1CF9000F007C117D /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 298 | 97C146F31CF9000F007C117D /* main.m in Sources */, 299 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | /* End PBXSourcesBuildPhase section */ 304 | 305 | /* Begin PBXVariantGroup section */ 306 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | 97C146FB1CF9000F007C117D /* Base */, 310 | ); 311 | name = Main.storyboard; 312 | sourceTree = ""; 313 | }; 314 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 315 | isa = PBXVariantGroup; 316 | children = ( 317 | 97C147001CF9000F007C117D /* Base */, 318 | ); 319 | name = LaunchScreen.storyboard; 320 | sourceTree = ""; 321 | }; 322 | /* End PBXVariantGroup section */ 323 | 324 | /* Begin XCBuildConfiguration section */ 325 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 326 | isa = XCBuildConfiguration; 327 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 328 | buildSettings = { 329 | ALWAYS_SEARCH_USER_PATHS = NO; 330 | CLANG_ANALYZER_NONNULL = YES; 331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 332 | CLANG_CXX_LIBRARY = "libc++"; 333 | CLANG_ENABLE_MODULES = YES; 334 | CLANG_ENABLE_OBJC_ARC = YES; 335 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 336 | CLANG_WARN_BOOL_CONVERSION = YES; 337 | CLANG_WARN_COMMA = YES; 338 | CLANG_WARN_CONSTANT_CONVERSION = YES; 339 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INFINITE_RECURSION = YES; 343 | CLANG_WARN_INT_CONVERSION = YES; 344 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 345 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 347 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 348 | CLANG_WARN_STRICT_PROTOTYPES = YES; 349 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 350 | CLANG_WARN_UNREACHABLE_CODE = YES; 351 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 352 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 353 | COPY_PHASE_STRIP = NO; 354 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 355 | ENABLE_NS_ASSERTIONS = NO; 356 | ENABLE_STRICT_OBJC_MSGSEND = YES; 357 | GCC_C_LANGUAGE_STANDARD = gnu99; 358 | GCC_NO_COMMON_BLOCKS = YES; 359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 361 | GCC_WARN_UNDECLARED_SELECTOR = YES; 362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 363 | GCC_WARN_UNUSED_FUNCTION = YES; 364 | GCC_WARN_UNUSED_VARIABLE = YES; 365 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 366 | MTL_ENABLE_DEBUG_INFO = NO; 367 | SDKROOT = iphoneos; 368 | TARGETED_DEVICE_FAMILY = "1,2"; 369 | VALIDATE_PRODUCT = YES; 370 | }; 371 | name = Profile; 372 | }; 373 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 374 | isa = XCBuildConfiguration; 375 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 376 | buildSettings = { 377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 378 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 379 | DEVELOPMENT_TEAM = S8QB4VV633; 380 | ENABLE_BITCODE = NO; 381 | FRAMEWORK_SEARCH_PATHS = ( 382 | "$(inherited)", 383 | "$(PROJECT_DIR)/Flutter", 384 | ); 385 | INFOPLIST_FILE = Runner/Info.plist; 386 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 387 | LIBRARY_SEARCH_PATHS = ( 388 | "$(inherited)", 389 | "$(PROJECT_DIR)/Flutter", 390 | ); 391 | PRODUCT_BUNDLE_IDENTIFIER = com.example.novum; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | VERSIONING_SYSTEM = "apple-generic"; 394 | }; 395 | name = Profile; 396 | }; 397 | 97C147031CF9000F007C117D /* Debug */ = { 398 | isa = XCBuildConfiguration; 399 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 400 | buildSettings = { 401 | ALWAYS_SEARCH_USER_PATHS = NO; 402 | CLANG_ANALYZER_NONNULL = YES; 403 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 404 | CLANG_CXX_LIBRARY = "libc++"; 405 | CLANG_ENABLE_MODULES = YES; 406 | CLANG_ENABLE_OBJC_ARC = YES; 407 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 408 | CLANG_WARN_BOOL_CONVERSION = YES; 409 | CLANG_WARN_COMMA = YES; 410 | CLANG_WARN_CONSTANT_CONVERSION = YES; 411 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 412 | CLANG_WARN_EMPTY_BODY = YES; 413 | CLANG_WARN_ENUM_CONVERSION = YES; 414 | CLANG_WARN_INFINITE_RECURSION = YES; 415 | CLANG_WARN_INT_CONVERSION = YES; 416 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 417 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 418 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 419 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 420 | CLANG_WARN_STRICT_PROTOTYPES = YES; 421 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 422 | CLANG_WARN_UNREACHABLE_CODE = YES; 423 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 424 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 425 | COPY_PHASE_STRIP = NO; 426 | DEBUG_INFORMATION_FORMAT = dwarf; 427 | ENABLE_STRICT_OBJC_MSGSEND = YES; 428 | ENABLE_TESTABILITY = YES; 429 | GCC_C_LANGUAGE_STANDARD = gnu99; 430 | GCC_DYNAMIC_NO_PIC = NO; 431 | GCC_NO_COMMON_BLOCKS = YES; 432 | GCC_OPTIMIZATION_LEVEL = 0; 433 | GCC_PREPROCESSOR_DEFINITIONS = ( 434 | "DEBUG=1", 435 | "$(inherited)", 436 | ); 437 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 438 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 439 | GCC_WARN_UNDECLARED_SELECTOR = YES; 440 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 441 | GCC_WARN_UNUSED_FUNCTION = YES; 442 | GCC_WARN_UNUSED_VARIABLE = YES; 443 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 444 | MTL_ENABLE_DEBUG_INFO = YES; 445 | ONLY_ACTIVE_ARCH = YES; 446 | SDKROOT = iphoneos; 447 | TARGETED_DEVICE_FAMILY = "1,2"; 448 | }; 449 | name = Debug; 450 | }; 451 | 97C147041CF9000F007C117D /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 454 | buildSettings = { 455 | ALWAYS_SEARCH_USER_PATHS = NO; 456 | CLANG_ANALYZER_NONNULL = YES; 457 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 458 | CLANG_CXX_LIBRARY = "libc++"; 459 | CLANG_ENABLE_MODULES = YES; 460 | CLANG_ENABLE_OBJC_ARC = YES; 461 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 462 | CLANG_WARN_BOOL_CONVERSION = YES; 463 | CLANG_WARN_COMMA = YES; 464 | CLANG_WARN_CONSTANT_CONVERSION = YES; 465 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 466 | CLANG_WARN_EMPTY_BODY = YES; 467 | CLANG_WARN_ENUM_CONVERSION = YES; 468 | CLANG_WARN_INFINITE_RECURSION = YES; 469 | CLANG_WARN_INT_CONVERSION = YES; 470 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 471 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 472 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 473 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 474 | CLANG_WARN_STRICT_PROTOTYPES = YES; 475 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 476 | CLANG_WARN_UNREACHABLE_CODE = YES; 477 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 478 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 479 | COPY_PHASE_STRIP = NO; 480 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 481 | ENABLE_NS_ASSERTIONS = NO; 482 | ENABLE_STRICT_OBJC_MSGSEND = YES; 483 | GCC_C_LANGUAGE_STANDARD = gnu99; 484 | GCC_NO_COMMON_BLOCKS = YES; 485 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 486 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 487 | GCC_WARN_UNDECLARED_SELECTOR = YES; 488 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 489 | GCC_WARN_UNUSED_FUNCTION = YES; 490 | GCC_WARN_UNUSED_VARIABLE = YES; 491 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 492 | MTL_ENABLE_DEBUG_INFO = NO; 493 | SDKROOT = iphoneos; 494 | TARGETED_DEVICE_FAMILY = "1,2"; 495 | VALIDATE_PRODUCT = YES; 496 | }; 497 | name = Release; 498 | }; 499 | 97C147061CF9000F007C117D /* Debug */ = { 500 | isa = XCBuildConfiguration; 501 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 505 | ENABLE_BITCODE = NO; 506 | FRAMEWORK_SEARCH_PATHS = ( 507 | "$(inherited)", 508 | "$(PROJECT_DIR)/Flutter", 509 | ); 510 | INFOPLIST_FILE = Runner/Info.plist; 511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 512 | LIBRARY_SEARCH_PATHS = ( 513 | "$(inherited)", 514 | "$(PROJECT_DIR)/Flutter", 515 | ); 516 | PRODUCT_BUNDLE_IDENTIFIER = com.example.novum; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | VERSIONING_SYSTEM = "apple-generic"; 519 | }; 520 | name = Debug; 521 | }; 522 | 97C147071CF9000F007C117D /* Release */ = { 523 | isa = XCBuildConfiguration; 524 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 525 | buildSettings = { 526 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 527 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 528 | ENABLE_BITCODE = NO; 529 | FRAMEWORK_SEARCH_PATHS = ( 530 | "$(inherited)", 531 | "$(PROJECT_DIR)/Flutter", 532 | ); 533 | INFOPLIST_FILE = Runner/Info.plist; 534 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 535 | LIBRARY_SEARCH_PATHS = ( 536 | "$(inherited)", 537 | "$(PROJECT_DIR)/Flutter", 538 | ); 539 | PRODUCT_BUNDLE_IDENTIFIER = com.example.novum; 540 | PRODUCT_NAME = "$(TARGET_NAME)"; 541 | VERSIONING_SYSTEM = "apple-generic"; 542 | }; 543 | name = Release; 544 | }; 545 | /* End XCBuildConfiguration section */ 546 | 547 | /* Begin XCConfigurationList section */ 548 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 549 | isa = XCConfigurationList; 550 | buildConfigurations = ( 551 | 97C147031CF9000F007C117D /* Debug */, 552 | 97C147041CF9000F007C117D /* Release */, 553 | 249021D3217E4FDB00AE95B9 /* Profile */, 554 | ); 555 | defaultConfigurationIsVisible = 0; 556 | defaultConfigurationName = Release; 557 | }; 558 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 559 | isa = XCConfigurationList; 560 | buildConfigurations = ( 561 | 97C147061CF9000F007C117D /* Debug */, 562 | 97C147071CF9000F007C117D /* Release */, 563 | 249021D4217E4FDB00AE95B9 /* Profile */, 564 | ); 565 | defaultConfigurationIsVisible = 0; 566 | defaultConfigurationName = Release; 567 | }; 568 | /* End XCConfigurationList section */ 569 | }; 570 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 571 | } 572 | --------------------------------------------------------------------------------