From 489906343542f6a674b9adf7f612a30ceb3330e8 Mon Sep 17 00:00:00 2001 From: Smarak Das <34758667+Thesmader@users.noreply.github.com> Date: Wed, 27 Jan 2021 22:47:45 +0530 Subject: [PATCH] Implement all Feed UI components (#118) * Homepage story and schedule UI implementation. * Fixed tests for feed viewmodel. Refer feed_viewmodel_test.dart for examples on how to write unit tests for the functions that use Task to call functions from the API service. Added test for failure case in stories API call. * Implemet MM articles UI and improve test coverage. This commit adds UI implementation for MM articles, changes the story component widget to match the design spec, and adds tests for Margin, Failure. Unused code and tests related to API classes have been removed. * Feed view implemented. Feed view UI components implemented: [x] Stories [x] Schedule [x] Stories this week [x] Upcoming Events Internet permission added to AndroidManifest.xml, Story component has a border gradient now. Files for exporting the files in some folders are added to make documentation generation work correctly. * Implement suggested changes. - Deleted test/.test_coverage.dart - Use Future.wait() in FeedViewmodel.initialise(). --- elaichi/.gitignore | 2 + elaichi/android/app/build.gradle | 1 + .../android/app/src/main/AndroidManifest.xml | 1 + elaichi/android/build.gradle | 1 + elaichi/assets/icons/avenue_icons.ttf | Bin 0 -> 2680 bytes elaichi/assets/images/dsc.png | Bin 13747 -> 0 bytes elaichi/assets/translations/en.json | 3 +- elaichi/lib/app/colors.dart | 1 + elaichi/lib/app/icons.dart | 20 ++ elaichi/lib/app/locator.config.dart | 2 - elaichi/lib/app/styles.dart | 7 +- elaichi/lib/datamodels/api_models.dart | 23 +- elaichi/lib/datamodels/datamodels.dart | 6 + elaichi/lib/generated/codegen_loader.g.dart | 3 +- elaichi/lib/generated/locale_keys.g.dart | 1 + elaichi/lib/graphql/schema.graphql | 230 ++++++++++++++++++ elaichi/lib/main.dart | 2 + elaichi/lib/services/api.dart | 10 - elaichi/lib/services/fake_api.dart | 59 ----- elaichi/lib/services/feed_service.dart | 29 --- elaichi/lib/services/services.dart | 8 + elaichi/lib/ui/utils/utils.dart | 3 + elaichi/lib/ui/views/feed/feed_view.dart | 22 +- elaichi/lib/ui/views/feed/feed_viewmodel.dart | 5 +- elaichi/lib/ui/views/home/home_view.dart | 29 ++- elaichi/lib/ui/views/home/home_viewmodel.dart | 53 +--- .../ui/views/startup/startup_viewmodel.dart | 2 +- elaichi/lib/ui/widgets/appbar.dart | 9 +- elaichi/lib/ui/widgets/event_card.dart | 92 +++++++ .../ui/widgets/schedule/schedule_card.dart | 87 +++---- .../widgets/schedule/schedule_component.dart | 30 +-- elaichi/lib/ui/widgets/story/story_bar.dart | 7 +- .../lib/ui/widgets/story/story_component.dart | 54 +++- elaichi/lib/ui/widgets/this_week.dart | 93 +++++++ elaichi/lib/ui/widgets/widgets.dart | 7 + elaichi/pubspec.yaml | 13 +- elaichi/test/misc/failure_test.dart | 12 + elaichi/test/misc/margins_test.dart | 26 ++ elaichi/test/service_tests/api_test.dart | 113 +-------- elaichi/test/setup/test_helpers.dart | 12 - .../viewmodel_tests/feed_viewmodel_test.dart | 35 +++ .../viewmodel_tests/home_viewmodel_test.dart | 12 - .../startup_viewmodel_test.dart | 1 + elaichi/test/widget_tests/feed_view_test.dart | 85 +++++++ .../test/widget_tests/startup_view_test.dart | 40 ++- .../widget_tests/widgets/appbar_test.dart | 19 ++ 46 files changed, 836 insertions(+), 434 deletions(-) create mode 100644 elaichi/assets/icons/avenue_icons.ttf delete mode 100644 elaichi/assets/images/dsc.png create mode 100644 elaichi/lib/app/icons.dart create mode 100644 elaichi/lib/datamodels/datamodels.dart create mode 100644 elaichi/lib/graphql/schema.graphql delete mode 100644 elaichi/lib/services/feed_service.dart create mode 100644 elaichi/lib/services/services.dart create mode 100644 elaichi/lib/ui/utils/utils.dart create mode 100644 elaichi/lib/ui/widgets/event_card.dart create mode 100644 elaichi/lib/ui/widgets/this_week.dart create mode 100644 elaichi/lib/ui/widgets/widgets.dart create mode 100644 elaichi/test/misc/failure_test.dart create mode 100644 elaichi/test/misc/margins_test.dart create mode 100644 elaichi/test/widget_tests/feed_view_test.dart create mode 100644 elaichi/test/widget_tests/widgets/appbar_test.dart diff --git a/elaichi/.gitignore b/elaichi/.gitignore index 2d31149f..593ad30f 100644 --- a/elaichi/.gitignore +++ b/elaichi/.gitignore @@ -16,6 +16,8 @@ doc/api/ # If you don't generate coverage info locally you can remove this line. coverage/ +test/.test_coverage.dart + # Avoid committing generated Javascript files: *.dart.js *.info.json # Produced by the --dump-info flag. diff --git a/elaichi/android/app/build.gradle b/elaichi/android/app/build.gradle index c689f653..2de9cf85 100644 --- a/elaichi/android/app/build.gradle +++ b/elaichi/android/app/build.gradle @@ -24,6 +24,7 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +apply plugin: 'com.google.gms.google-services' def keyStoreProperties = new Properties() def keyStorePropertiesFile = rootProject.file('key.properties') diff --git a/elaichi/android/app/src/main/AndroidManifest.xml b/elaichi/android/app/src/main/AndroidManifest.xml index 33400217..1ddf2b0d 100644 --- a/elaichi/android/app/src/main/AndroidManifest.xml +++ b/elaichi/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ +