From 255cd62f7801fe7a7cd376e51cf6b48ee56500c5 Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Mon, 27 Dec 2021 18:24:19 +0530 Subject: [PATCH 1/9] added github ci actions --- .github/workflows/flutter-ci.yml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/flutter-ci.yml diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml new file mode 100644 index 00000000..72a3eb76 --- /dev/null +++ b/.github/workflows/flutter-ci.yml @@ -0,0 +1,49 @@ +name: Flutter CI + +on: + push: + branches: [master, development] + pull_request: + branches: [master, development] + +jobs: + test: + strategy: + matrix: + platform: [windows-latest] + runs-on: ${{matrix.platform}} + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 + with: + java-version: "12.x" + - uses: subosito/flutter-action@v1 + with: + flutter-version: '2.5.0' + - run: flutter pub get + - run: flutter format --set-exit-if-changed . + - run: flutter analyze . + - run: flutter test + + build: + strategy: + matrix: + platform: [windows-latest] + runs-on: ${{matrix.platform}} + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 + with: + java-version: "12.x" + - uses: subosito/flutter-action@v1 + with: + flutter-version: '2.5.0' + - run: flutter pub get + - run: flutter format --set-exit-if-changed . + - run: flutter analyze . + - run: flutter test + - run: flutter build apk + - uses: actions/upload-artifact@v1 + with: + name: release-apk + path: build/app/outputs/apk/release/app-release.apk From f85bbf9e5038bf65cc8b2ff05393e2cefefeca0d Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Tue, 28 Dec 2021 00:20:29 +0530 Subject: [PATCH 2/9] required changes --- .github/workflows/flutter-ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml index 72a3eb76..93e02176 100644 --- a/.github/workflows/flutter-ci.yml +++ b/.github/workflows/flutter-ci.yml @@ -10,7 +10,7 @@ jobs: test: strategy: matrix: - platform: [windows-latest] + platform: [windows-latest, ubuntu-latest, macos-latest] runs-on: ${{matrix.platform}} steps: - uses: actions/checkout@v1 @@ -23,12 +23,12 @@ jobs: - run: flutter pub get - run: flutter format --set-exit-if-changed . - run: flutter analyze . - - run: flutter test + # - run: flutter test build: strategy: matrix: - platform: [windows-latest] + platform: [windows-latest, macos-latest, ubuntu-latest] runs-on: ${{matrix.platform}} steps: - uses: actions/checkout@v1 @@ -41,9 +41,9 @@ jobs: - run: flutter pub get - run: flutter format --set-exit-if-changed . - run: flutter analyze . - - run: flutter test - - run: flutter build apk - - uses: actions/upload-artifact@v1 - with: - name: release-apk - path: build/app/outputs/apk/release/app-release.apk + # - run: flutter test + # - run: flutter build apk + # - uses: actions/upload-artifact@v1 + # with: + # name: release-apk + # path: build/app/outputs/apk/release/app-release.apk From a73df140563a81413d3f30239fcfd42e716c68d4 Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Tue, 28 Dec 2021 13:50:44 +0530 Subject: [PATCH 3/9] Update README.md --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3d0fd868..608edaac 100755 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ +[! [CI](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/) + # Beacon ## About the Project -This project is a flutter build native interface to ease the group travelling (or hiking). By using this, the group leader would be able to share his location with the entire crew, and in case if someone loses contact with the group, he can quickly get in the right place by following the beacon. +This project is a flutter build native interface to ease the group travelling (or hiking). By using this, the group leader would be able to share his location with the entire crew, and in case if someone loses contact with the group, he can quickly get in the right place by following the beacon. ## Getting Started @@ -28,7 +30,7 @@ beacon/lib/ ├── components/ # Shared Components such as dialog boxes, button, and other shared widgets ├── enums/ # enum files | └── view_state.dart # defines view states i.e Idle, Busy, Error -├── models/ # model classes: beacon, location, landmark, user +├── models/ # model classes: beacon, location, landmark, user ├── queries/ # includes all graphql query strings ├── services/ # services | ├── database_mutation_function.dart/ # Graphql Queries implementations @@ -36,7 +38,7 @@ beacon/lib/ | └── ... # all config files ├── utilities/ # Utilities that includes constants file ├── views/ # Views/UI layer -| ├── auth_screen.dart +| ├── auth_screen.dart | ├── base_view.dart | ├── hike_screen.dart | ├── home.dart @@ -51,7 +53,7 @@ beacon/lib/ -## Contributing +## Contributing Whether you have some feauture requests/ideas, code improvements, refactoring, performance improvements, help is always Welcome. The more is done, better it gets. @@ -63,4 +65,4 @@ If you found any bugs, consider opening an [issue](https://github.com/CCExtracto We would love to hear from you! You may join gsoc-beacon channel of CCExtractor community through slack: -[![Slack](https://img.shields.io/badge/chat-on_slack-purple.svg?style=for-the-badge&logo=slack)](https://ccextractor.org/public/general/support/) \ No newline at end of file +[![Slack](https://img.shields.io/badge/chat-on_slack-purple.svg?style=for-the-badge&logo=slack)](https://ccextractor.org/public/general/support/) From 8d52cc3c621875139a448e8808fcb921d90f589d Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Tue, 28 Dec 2021 13:53:15 +0530 Subject: [PATCH 4/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 608edaac..8343d10b 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[! [CI](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/) +[![CI](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/) # Beacon From 9c65949644823777e2b46c57997a6f4a986917c6 Mon Sep 17 00:00:00 2001 From: Nishtha Bodani Date: Tue, 28 Dec 2021 14:11:51 +0530 Subject: [PATCH 5/9] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 8343d10b..dadaa743 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -[![CI](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/) - # Beacon +[![CI](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/) ## About the Project From 23628d5d36b0a660dd16755c8074a3ba0b2b50bb Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Tue, 28 Dec 2021 14:25:32 +0530 Subject: [PATCH 6/9] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 4b7d8eef..6abdd877 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![CI](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/) # Beacon [![CI](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/badge.svg)](https://github.com/devansh12b2/beacon/actions/workflows/flutter-ci.yml/) From 3134b0660b0c4dcc5376b8423c616a3635cbb319 Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Tue, 28 Dec 2021 14:48:36 +0530 Subject: [PATCH 7/9] Update shared_preference_service.dart --- lib/services/shared_preference_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/shared_preference_service.dart b/lib/services/shared_preference_service.dart index 53431a38..82700564 100644 --- a/lib/services/shared_preference_service.dart +++ b/lib/services/shared_preference_service.dart @@ -22,4 +22,4 @@ class SharedPreferenceService { Future get token async => _prefs.getString('token'); } -SharedPreferenceService sharedPreferenceService = SharedPreferenceService(); \ No newline at end of file +SharedPreferenceService sharedPreferenceService = SharedPreferenceService(); From 52ef23f32723544d1294c90245c6691600602da1 Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Tue, 28 Dec 2021 17:20:10 +0530 Subject: [PATCH 8/9] Now if duration is 0:00:00 it will show error --- lib/components/create_join_dialog.dart | 11 +++++------ lib/services/validators.dart | 7 +++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/components/create_join_dialog.dart b/lib/components/create_join_dialog.dart index 9415ca87..d16af026 100644 --- a/lib/components/create_join_dialog.dart +++ b/lib/components/create_join_dialog.dart @@ -6,7 +6,6 @@ import 'package:beacon/utilities/constants.dart'; import 'package:beacon/view_model/home_view_model.dart'; import 'package:duration_picker/duration_picker.dart'; import 'package:flutter/material.dart'; -import 'package:duration_picker/duration_picker.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; class CreateJoinBeaconDialog { @@ -77,13 +76,13 @@ class CreateJoinBeaconDialog { .toString() .substring(0, 8); }, - validator: (value) { - if (value.startsWith("0:00:00")) - return "Enter valid duration"; - return null; - }, + validator: (value) => + Validator.validateDuration( + value.toString()), decoration: InputDecoration( alignLabelWithHint: true, + errorStyle: + TextStyle(color: Colors.red[800]), floatingLabelBehavior: FloatingLabelBehavior.always, labelText: 'Duration', diff --git a/lib/services/validators.dart b/lib/services/validators.dart index bb141d8f..253e86f1 100644 --- a/lib/services/validators.dart +++ b/lib/services/validators.dart @@ -55,4 +55,11 @@ class Validator { } return null; } + + static String validateDuration(String duration) { + if (duration.startsWith("0:00:00.")) { + return "Duration cannot be $duration"; + } + return null; + } } From b9fc9d79f231514e0d069f01359afb6e22765f9f Mon Sep 17 00:00:00 2001 From: Devansh Mishra <79010144+devansh12b2@users.noreply.github.com> Date: Wed, 29 Dec 2021 11:12:35 +0530 Subject: [PATCH 9/9] unused imports removed --- lib/router.dart | 1 - lib/services/navigation_service.dart | 1 - lib/views/auth_screen.dart | 1 - lib/views/hike_screen.dart | 1 - 4 files changed, 4 deletions(-) diff --git a/lib/router.dart b/lib/router.dart index 27fd3c01..29f97362 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -1,5 +1,4 @@ import 'package:beacon/splash_screen.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:beacon/utilities/constants.dart'; import 'package:beacon/views/auth_screen.dart'; diff --git a/lib/services/navigation_service.dart b/lib/services/navigation_service.dart index 938b7936..f0400af4 100644 --- a/lib/services/navigation_service.dart +++ b/lib/services/navigation_service.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class NavigationService { diff --git a/lib/views/auth_screen.dart b/lib/views/auth_screen.dart index 3288491c..a7d529b5 100644 --- a/lib/views/auth_screen.dart +++ b/lib/views/auth_screen.dart @@ -5,7 +5,6 @@ import 'package:beacon/utilities/indication_painter.dart'; import 'package:beacon/view_model/auth_screen_model.dart'; import 'package:beacon/views/base_view.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; class AuthScreen extends StatefulWidget { const AuthScreen({Key key}) : super(key: key); diff --git a/lib/views/hike_screen.dart b/lib/views/hike_screen.dart index ad61d78e..6f4962f6 100644 --- a/lib/views/hike_screen.dart +++ b/lib/views/hike_screen.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:beacon/components/hike_button.dart'; import 'package:beacon/queries/beacon.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter/material.dart'; import 'package:flutter_config/flutter_config.dart'; import 'package:fluttertoast/fluttertoast.dart';