├── .gitignore
├── .metadata
├── LICENSE
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── tarekalabd
│ │ │ │ ├── flutter_steps_tracker
│ │ │ │ └── MainActivity.kt
│ │ │ │ └── stepstracker
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v21
│ │ │ └── launch_background.xml
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-night
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ └── styles.xml
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── assets
├── images
│ ├── man-intro.jpeg
│ └── rewards.png
└── screenshots
│ ├── 1.png
│ ├── 2-1.PNG
│ ├── 2.PNG
│ ├── 3-1.PNG
│ ├── 3.PNG
│ ├── 4-1.PNG
│ ├── 4.PNG
│ ├── 5-1.PNG
│ └── 5.PNG
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── core
│ ├── data
│ │ ├── data_sources
│ │ │ ├── cache_helper.dart
│ │ │ ├── data_sources_body.dart
│ │ │ └── database.dart
│ │ ├── error
│ │ │ ├── exceptions
│ │ │ │ ├── application_exception.dart
│ │ │ │ ├── firebase_auth_exception_app.dart
│ │ │ │ └── firebase_auth_exception_app.freezed.dart
│ │ │ └── failures
│ │ │ │ ├── application_failure.dart
│ │ │ │ ├── firebase_auth_failure.dart
│ │ │ │ └── firebase_auth_failure.freezed.dart
│ │ ├── models
│ │ │ ├── steps_and_points_model.dart
│ │ │ └── user_model.dart
│ │ └── services
│ │ │ └── firestore_services.dart
│ ├── domain
│ │ └── use_cases
│ │ │ └── use_case.dart
│ └── presentation
│ │ ├── pages
│ │ └── landing_page.dart
│ │ └── widgets
│ │ ├── android_dialog.dart
│ │ ├── ios_dialog.dart
│ │ ├── show_alert_dialog.dart
│ │ └── show_exception_alert_dialog.dart
├── di
│ ├── app_module.dart
│ ├── injection_container.config.dart
│ └── injection_container.dart
├── features
│ ├── bottom_navbar
│ │ ├── data
│ │ │ ├── mappers
│ │ │ │ └── user_model_to_entity_mapper.dart
│ │ │ ├── models
│ │ │ │ ├── exchange_history_model.dart
│ │ │ │ └── reward_model.dart
│ │ │ └── repositories
│ │ │ │ └── bottom_navbar_repository_impl.dart
│ │ ├── domain
│ │ │ ├── entities
│ │ │ │ └── leaderboard_item_entity.dart
│ │ │ ├── repositories
│ │ │ │ └── bottom_navbar_repository.dart
│ │ │ └── use_cases
│ │ │ │ ├── earn_reward_use_case.dart
│ │ │ │ ├── get_exchanges_history_use_case.dart
│ │ │ │ ├── get_rewards_use_case.dart
│ │ │ │ ├── get_user_data_use_case.dart
│ │ │ │ ├── get_users_use_case.dart
│ │ │ │ ├── set_exchange_history_use_case.dart
│ │ │ │ └── set_steps_and_points_use_case.dart
│ │ └── presentation
│ │ │ ├── manager
│ │ │ ├── exchanges_history
│ │ │ │ ├── exchanges_history_cubit.dart
│ │ │ │ ├── exchanges_history_state.dart
│ │ │ │ └── exchanges_history_state.freezed.dart
│ │ │ ├── home
│ │ │ │ ├── home_cubit.dart
│ │ │ │ ├── home_state.dart
│ │ │ │ └── home_state.freezed.dart
│ │ │ ├── leaderboard
│ │ │ │ ├── leaderboard_cubit.dart
│ │ │ │ ├── leaderboard_state.dart
│ │ │ │ └── leaderboard_state.freezed.dart
│ │ │ └── rewards
│ │ │ │ ├── rewards_cubit.dart
│ │ │ │ ├── rewards_state.dart
│ │ │ │ └── rewards_state.freezed.dart
│ │ │ ├── pages
│ │ │ ├── bottom_navbar.dart
│ │ │ ├── exchanges_page.dart
│ │ │ ├── home_page.dart
│ │ │ ├── leaderboard_page.dart
│ │ │ └── rewards_page.dart
│ │ │ └── widgets
│ │ │ ├── ad_area.dart
│ │ │ ├── app_bar_area.dart
│ │ │ ├── exchanges_item.dart
│ │ │ ├── get_radial_gauge.dart
│ │ │ ├── health_points_and_calories.dart
│ │ │ ├── health_points_and_calories_item.dart
│ │ │ ├── leaderboard_item.dart
│ │ │ ├── leaderboard_top_item.dart
│ │ │ └── rewards_item.dart
│ └── intro
│ │ ├── data
│ │ ├── data_sources
│ │ │ ├── auth_local_data_source.dart
│ │ │ └── auth_remote_data_source.dart
│ │ ├── mappers
│ │ │ └── user_entity_to_model_mapper.dart
│ │ ├── repositories
│ │ │ └── auth_repository_impl.dart
│ │ └── services
│ │ │ └── auth_services.dart
│ │ ├── domain
│ │ ├── entities
│ │ │ └── user_entity.dart
│ │ ├── repositories
│ │ │ └── auth_repository.dart
│ │ └── use_cases
│ │ │ ├── auth_status_use_case.dart
│ │ │ └── sign_in_anonymously_use_case.dart
│ │ └── presentation
│ │ ├── manager
│ │ ├── auth_actions
│ │ │ ├── auth_cubit.dart
│ │ │ ├── auth_state.dart
│ │ │ └── auth_state.freezed.dart
│ │ └── auth_status
│ │ │ ├── auth_status_cubit.dart
│ │ │ ├── auth_status_state.dart
│ │ │ └── auth_status_state.freezed.dart
│ │ └── pages
│ │ └── intro_page.dart
├── generated
│ ├── intl
│ │ ├── messages_all.dart
│ │ ├── messages_ar.dart
│ │ └── messages_en.dart
│ └── l10n.dart
├── l10n
│ ├── intl_ar.arb
│ └── intl_en.arb
├── main.dart
└── utilities
│ ├── constants
│ ├── api_path.dart
│ ├── app_colors.dart
│ ├── assets.dart
│ ├── enums.dart
│ └── key_constants.dart
│ ├── locale
│ ├── cubit
│ │ ├── utility_cubit.dart
│ │ ├── utility_state.dart
│ │ └── utility_state.freezed.dart
│ └── theme_data.dart
│ └── routes
│ ├── router.dart
│ └── routes.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── widget_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: cd41fdd495f6944ecd3506c21e94c6567b073278
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
17 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
18 | - platform: android
19 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
20 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
21 | - platform: ios
22 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
23 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
24 | - platform: linux
25 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
26 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
27 | - platform: macos
28 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
29 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
30 | - platform: web
31 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
32 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
33 | - platform: windows
34 | create_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
35 | base_revision: cd41fdd495f6944ecd3506c21e94c6567b073278
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Flutter Steps Tracker
2 |
3 | It's an open source project for the steps tracking (Pedometer) built with Flutter and integrated with Firebase as the initial backend service.
4 |
5 | Some of the features should have been in the server-side using cloud functions, but there were some problems with that and it will be available soon with some configuration instructions to work on one server.
6 |
7 | So you may find some workarounds that will be more accurate and better after adding the server-side functions.
8 |
9 | ## Quick Start 🚀
10 |
11 | ## Feature Set ✨
12 |
13 | * [x] Free & Open Source
14 | * [x] Cross Platform App (Android - IOS)
15 | * [x] Usable and user-friendly interface
16 | * [x] Proper architecture for the code, Clean Architecture
17 | * [x] Authentication Anonymously with Firebase
18 | * [x] Recording the users data in Firestore Database
19 | * [x] Tracking the user footsteps and update them in real-time manner while the app is in the foreground
20 | * [x] For every 100 steps, a function adds 5 points to the health points of the user
21 | * [x] Showing a visual feedback to the user (now it's simple, Snackbar) to notice the users that they gain extra points
22 | * [x] Catalog of rewards, so you can pick a reward you like
23 | * [x] Rewards are paid with the health points, just scan the QR code (now it's dummy) and confirm if you have enough number of points
24 | * [x] History that lists all the exchanges to health points and the rewards taken
25 | * [x] Leaderboard page where you can see your ranking between all the users
26 | * [x] Multilingual, supports both Arabic and English
27 | * [x] Multi themes, supports the light and dark theme
28 |
29 | ## Future Steps ✨
30 |
31 | * [ ] Refactor some of the colors, methods, cubits, repos and some files in the architecture
32 | * [ ] Daily steps (The Pedometer plugin basically calculates the total steps not daily)
33 | * [ ] Customized Goals
34 | * [ ] Build a good UI for the empty states (one empty state)
35 | * [ ] Integrate with the cloud functions and make the app more accurate
36 | * [ ] Update the visual feedback after the user gains extra points
37 | * [ ] Make the app works on the background
38 | * [ ] Enable push notifications
39 | * [ ] Sends notifications as the visual feedback for gaining more points (Background)
40 | * [ ] CI/CD for reviewing the pull requests
41 | * [ ] Publish the app to Google Play Store
42 |
43 | ## Screenshots :camera:
44 |
45 |
46 |
47 | | Home | Exchanges | Rewards | Leaderboard |
48 | |:----------|:----------|:----------|:----------|
49 | |
|
|
|
|
50 | |
|
|
|
|
51 |
52 | ## Documentation 📝
53 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 | **/google-services.json
15 |
--------------------------------------------------------------------------------
/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 plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 | apply plugin: 'com.google.gms.google-services'
28 |
29 | android {
30 | compileSdkVersion flutter.compileSdkVersion
31 | ndkVersion flutter.ndkVersion
32 |
33 | compileOptions {
34 | sourceCompatibility JavaVersion.VERSION_1_8
35 | targetCompatibility JavaVersion.VERSION_1_8
36 | }
37 |
38 | kotlinOptions {
39 | jvmTarget = '1.8'
40 | }
41 |
42 | sourceSets {
43 | main.java.srcDirs += 'src/main/kotlin'
44 | }
45 |
46 | defaultConfig {
47 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
48 | applicationId "com.tarekalabd.stepstracker"
49 | // You can update the following values to match your application needs.
50 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
51 | minSdkVersion 21
52 | targetSdkVersion flutter.targetSdkVersion
53 | versionCode flutterVersionCode.toInteger()
54 | versionName flutterVersionName
55 | }
56 |
57 | buildTypes {
58 | release {
59 | // TODO: Add your own signing config for the release build.
60 | // Signing with the debug keys for now, so `flutter run --release` works.
61 | signingConfig signingConfigs.debug
62 | }
63 | }
64 | }
65 |
66 | flutter {
67 | source '../..'
68 | }
69 |
70 | dependencies {
71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72 | // Import the Firebase BoM
73 | implementation platform('com.google.firebase:firebase-bom:30.1.0')
74 |
75 |
76 | // Add the dependency for the Firebase SDK for Google Analytics
77 | // When using the BoM, don't specify versions in Firebase dependencies
78 | implementation 'com.google.firebase:firebase-analytics'
79 | }
80 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
16 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
31 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/tarekalabd/flutter_steps_tracker/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.tarekalabd.flutter_steps_tracker
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/tarekalabd/stepstracker/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.tarekalabd.stepstracker
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | classpath 'com.google.gms:google-services:4.3.10'
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | google()
18 | mavenCentral()
19 | }
20 | }
21 |
22 | rootProject.buildDir = '../build'
23 | subprojects {
24 | project.buildDir = "${rootProject.buildDir}/${project.name}"
25 | }
26 | subprojects {
27 | project.evaluationDependsOn(':app')
28 | }
29 |
30 | task clean(type: Delete) {
31 | delete rootProject.buildDir
32 | }
33 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/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-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/assets/images/man-intro.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/images/man-intro.jpeg
--------------------------------------------------------------------------------
/assets/images/rewards.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/images/rewards.png
--------------------------------------------------------------------------------
/assets/screenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/1.png
--------------------------------------------------------------------------------
/assets/screenshots/2-1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/2-1.PNG
--------------------------------------------------------------------------------
/assets/screenshots/2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/2.PNG
--------------------------------------------------------------------------------
/assets/screenshots/3-1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/3-1.PNG
--------------------------------------------------------------------------------
/assets/screenshots/3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/3.PNG
--------------------------------------------------------------------------------
/assets/screenshots/4-1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/4-1.PNG
--------------------------------------------------------------------------------
/assets/screenshots/4.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/4.PNG
--------------------------------------------------------------------------------
/assets/screenshots/5-1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/5-1.PNG
--------------------------------------------------------------------------------
/assets/screenshots/5.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/assets/screenshots/5.PNG
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 | Runner/GoogleService-Info.plist
30 |
31 | # Exceptions to above rules.
32 | !default.mode1v3
33 | !default.mode2v3
34 | !default.pbxuser
35 | !default.perspectivev3
36 |
--------------------------------------------------------------------------------
/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 | 9.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/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/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TarekAlabd/Flutter-Steps-Tracker/4e9156419bdef84964231b56fc5e283808ee53e9/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CADisableMinimumFrameDurationOnPhone
6 |
7 | CFBundleDevelopmentRegion
8 | $(DEVELOPMENT_LANGUAGE)
9 | CFBundleDisplayName
10 | Flutter Steps Tracker
11 | CFBundleExecutable
12 | $(EXECUTABLE_NAME)
13 | CFBundleIdentifier
14 | $(PRODUCT_BUNDLE_IDENTIFIER)
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | flutter_steps_tracker
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | $(FLUTTER_BUILD_NAME)
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | $(FLUTTER_BUILD_NUMBER)
27 | LSRequiresIPhoneOS
28 |
29 | NSMotionUsageDescription
30 | This application tracks your steps
31 | UIBackgroundModes
32 |
33 | processing
34 |
35 | UILaunchStoryboardName
36 | LaunchScreen
37 | UIMainStoryboardFile
38 | Main
39 | UISupportedInterfaceOrientations
40 |
41 | UIInterfaceOrientationPortrait
42 |
43 | UISupportedInterfaceOrientations~ipad
44 |
45 | UIInterfaceOrientationPortrait
46 | UIInterfaceOrientationPortraitUpsideDown
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 | UIViewControllerBasedStatusBarAppearance
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/core/data/data_sources/cache_helper.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:injectable/injectable.dart';
4 | import 'package:shared_preferences/shared_preferences.dart';
5 |
6 | abstract class CacheHelper {
7 | Future get(String key);
8 |
9 | Future has(String key);
10 |
11 | Future put(String key, dynamic value);
12 |
13 | Future clear(String key);
14 | }
15 |
16 | @Singleton(as: CacheHelper)
17 | class CacheHelperImpl extends CacheHelper {
18 | final SharedPreferences _sharedPreferences;
19 |
20 | CacheHelperImpl(this._sharedPreferences);
21 |
22 | @override
23 | Future has(String key) async {
24 | final bool f = await _basicErrorHandling(() async {
25 | return _sharedPreferences.containsKey(key) &&
26 | _sharedPreferences.getString(key) != null &&
27 | _sharedPreferences.getString(key)!.isNotEmpty;
28 | });
29 | return f;
30 | }
31 |
32 | @override
33 | Future clear(String key) async {
34 | final bool f = await _basicErrorHandling(() async {
35 | return await _sharedPreferences.remove(key);
36 | });
37 | return f;
38 | }
39 |
40 | @override
41 | Future get(String key) async {
42 | final f = await _basicErrorHandling(() async {
43 | if (await has(key)) {
44 | return await jsonDecode(_sharedPreferences.getString(key)!);
45 | }
46 | return null;
47 | });
48 | return f;
49 | }
50 |
51 | @override
52 | Future put(String key, dynamic value) async {
53 | final bool f = await _basicErrorHandling(() async {
54 | // ignore: unnecessary_await_in_return
55 | return await _sharedPreferences.setString(key, jsonEncode(value));
56 | });
57 | return f;
58 | }
59 | }
60 |
61 | extension on CacheHelper {
62 | Future _basicErrorHandling(Future Function() onSuccess) async {
63 | try {
64 | final f = await onSuccess();
65 | return f;
66 | } catch (e) {
67 | rethrow;
68 | // throw ClientException.cacheError(message: e.toString());
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/lib/core/data/data_sources/data_sources_body.dart:
--------------------------------------------------------------------------------
1 | import 'dart:developer';
2 |
3 | import 'package:firebase_core/firebase_core.dart';
4 | import 'package:flutter/foundation.dart';
5 | import 'package:flutter_steps_tracker/core/data/error/exceptions/application_exception.dart';
6 | import 'package:logging/logging.dart';
7 |
8 | Future returnOrThrow(Future Function() fun) async {
9 | try {
10 | return await fun();
11 | } on FirebaseException catch (e) {
12 | firebaseErrorDecoder(e);
13 | } on Exception catch (e, s) {
14 | if (kDebugMode) {
15 | log("DataSourceError:\n $e", level: Level.SEVERE.value, stackTrace: s);
16 | }
17 | throw GenericApplicationException(message: 'Something went wrong!');
18 | } catch (e, s) {
19 | if (kDebugMode) {
20 | log("DataSourceError:\n $e", level: Level.SEVERE.value, stackTrace: s);
21 | }
22 | throw GenericApplicationException(message: 'Something went wrong!');
23 | }
24 | throw GenericApplicationException(message: 'Something went wrong!');
25 | }
26 |
--------------------------------------------------------------------------------
/lib/core/data/data_sources/database.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_steps_tracker/core/data/models/steps_and_points_model.dart';
2 | import 'package:flutter_steps_tracker/core/data/models/user_model.dart';
3 | import 'package:flutter_steps_tracker/core/data/services/firestore_services.dart';
4 | import 'package:flutter_steps_tracker/features/bottom_navbar/data/models/exchange_history_model.dart';
5 | import 'package:flutter_steps_tracker/features/bottom_navbar/data/models/reward_model.dart';
6 | import 'package:flutter_steps_tracker/utilities/constants/api_path.dart';
7 | import 'package:injectable/injectable.dart';
8 | import 'package:intl/intl.dart';
9 |
10 | abstract class Database {
11 | Future setUserData(UserModel user);
12 |
13 | Future setExchangeHistory(
14 | ExchangeHistoryModel history,
15 | String uid,
16 | );
17 |
18 | Future setDailySteps(
19 | StepsAndPointsModel stepsAndPoints,
20 | String uid,
21 | );
22 |
23 | Future setRewardOrder(
24 | RewardModel reward,
25 | String uid,
26 | );
27 |
28 | Stream getUserStream(String uid);
29 |
30 | Stream> rewardsStream();
31 |
32 | Stream> usersStream();
33 |
34 | Stream> myRewardsStream(String uid);
35 |
36 | Stream> dailyPointsStream(
37 | String uid,
38 | String currentId,
39 | );
40 |
41 | Stream> exchangeHistoryStream(String uid);
42 | }
43 |
44 | String documentIdFromLocalGenerator() => DateTime.now().toIso8601String();
45 |
46 | String documentIdForDailyUse() => DateFormat.yMMMMd().format(DateTime.now());
47 |
48 | @Singleton(as: Database)
49 | class FireStoreDatabase implements Database {
50 | final _service = FirestoreService.instance;
51 |
52 | @override
53 | Future setUserData(UserModel user) async {
54 | await _service.setData(
55 | path: APIPath.user(user.uid),
56 | data: user.toMap(),
57 | );
58 | }
59 |
60 | @override
61 | Future setExchangeHistory(
62 | ExchangeHistoryModel history,
63 | String uid,
64 | ) async {
65 | await _service.setData(
66 | path: APIPath.exchangeHistory(uid, history.id),
67 | data: history.toMap(),
68 | );
69 | }
70 |
71 | @override
72 | Stream> rewardsStream() => _service.collectionStream(
73 | path: APIPath.rewards(),
74 | builder: (data, documentId) => RewardModel.fromMap(data, documentId),
75 | );
76 |
77 | @override
78 | Stream> exchangeHistoryStream(String uid) =>
79 | _service.collectionStream(
80 | path: APIPath.exchangesHistory(uid),
81 | builder: (data, documentId) =>
82 | ExchangeHistoryModel.fromMap(data, documentId),
83 | );
84 |
85 | @override
86 | Stream> dailyPointsStream(
87 | String uid,
88 | String currentId,
89 | ) =>
90 | _service.collectionStream(
91 | path: APIPath.dailyStepsAndPointsStream(uid),
92 | builder: (data, documentId) =>
93 | StepsAndPointsModel.fromMap(data, documentId),
94 | queryBuilder: (query) => query.where(
95 | 'id',
96 | isNotEqualTo: currentId,
97 | ),
98 | );
99 |
100 | @override
101 | Future setDailySteps(
102 | StepsAndPointsModel stepsAndPoints, String uid) async =>
103 | _service.setData(
104 | path: APIPath.setDailyStepsAndPoints(uid, stepsAndPoints.id),
105 | data: stepsAndPoints.toMap(),
106 | );
107 |
108 | @override
109 | Future setRewardOrder(RewardModel reward, String uid) async =>
110 | _service.setData(
111 | path: APIPath.setMyReward(uid, reward.id),
112 | data: reward.toMap(),
113 | );
114 |
115 | @override
116 | Stream> myRewardsStream(String uid) =>
117 | _service.collectionStream(
118 | path: APIPath.myRewards(uid),
119 | builder: (data, documentId) => RewardModel.fromMap(data, documentId),
120 | );
121 |
122 | @override
123 | Stream> usersStream() => _service.collectionStream(
124 | path: APIPath.users(),
125 | builder: (data, documentId) => UserModel.fromMap(data, documentId),
126 | );
127 |
128 | @override
129 | Stream getUserStream(String uid) => _service.documentStream(
130 | path: APIPath.user(uid),
131 | builder: (data, documentId) => UserModel.fromMap(data, documentId),
132 | );
133 | }
134 |
--------------------------------------------------------------------------------
/lib/core/data/error/exceptions/application_exception.dart:
--------------------------------------------------------------------------------
1 | import 'package:firebase_auth/firebase_auth.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter_steps_tracker/core/data/error/exceptions/firebase_auth_exception_app.dart';
4 |
5 | abstract class ApplicationException implements Exception {}
6 |
7 | class GenericApplicationException extends ApplicationException {
8 | final String message;
9 |
10 | GenericApplicationException({required this.message});
11 | }
12 |
13 | void firebaseErrorDecoder(FirebaseException e) {
14 | debugPrint(e.toString());
15 | if (e is FirebaseAuthException) {
16 | decodeAuthException(e);
17 | } else {
18 | // TODO: Now it will be a general exception but after that,
19 | // we can detect the other firebase exceptions, client errors..
20 | throw GenericApplicationException(message: 'Something went wrong!');
21 | }
22 | }
23 |
24 | void decodeAuthException(FirebaseAuthException e) {
25 | // We need just the anonymous one for now, but for more
26 | // we will create enum with the types
27 | if (e.code == 'auth/operation-not-allowed') {
28 | throw FirebaseAuthExceptionApp.operationNotAllowed(
29 | message: 'Something went wrong, please contact the support!',
30 | );
31 | } else {
32 | throw GenericApplicationException(message: 'Something went wrong!');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/core/data/error/exceptions/firebase_auth_exception_app.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_steps_tracker/core/data/error/exceptions/application_exception.dart';
2 | import 'package:freezed_annotation/freezed_annotation.dart';
3 |
4 | part 'firebase_auth_exception_app.freezed.dart';
5 |
6 | @freezed
7 | @Implements()
8 | abstract class FirebaseAuthExceptionApp extends ApplicationException
9 | with _$FirebaseAuthExceptionApp {
10 | factory FirebaseAuthExceptionApp.operationNotAllowed(
11 | {required String message}) = OperationNotAllowed;
12 | }
13 |
--------------------------------------------------------------------------------
/lib/core/data/error/failures/application_failure.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_steps_tracker/core/data/error/exceptions/application_exception.dart';
2 | import 'package:flutter_steps_tracker/core/data/error/exceptions/firebase_auth_exception_app.dart';
3 | import 'package:flutter_steps_tracker/core/data/error/failures/firebase_auth_failure.dart';
4 |
5 | abstract class Failure {}
6 |
7 | /// Can be used when the list of exceptions is exhausted.
8 | /// Also, It maps to [GenericApplicationException].
9 | class GenericFailure extends Failure {
10 | final String message;
11 |
12 | GenericFailure({required this.message});
13 | }
14 |
15 | Failure firebaseExceptionsDecoder(ApplicationException e) {
16 | if (e is FirebaseAuthExceptionApp) {
17 | return e.when(
18 | operationNotAllowed: (msg) =>
19 | FirebaseAuthFailure.operationNotAllowed(message: msg),
20 | );
21 | } else {
22 | return GenericFailure(message: 'Something went wrong!');
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib/core/data/error/failures/firebase_auth_failure.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_steps_tracker/core/data/error/failures/application_failure.dart';
2 | import 'package:freezed_annotation/freezed_annotation.dart';
3 |
4 | part 'firebase_auth_failure.freezed.dart';
5 |
6 | @freezed
7 | @Implements()
8 | abstract class FirebaseAuthFailure extends Failure with _$FirebaseAuthFailure {
9 | const factory FirebaseAuthFailure.operationNotAllowed(
10 | {required String message}) = OperationNotAllowed;
11 | }
12 |
--------------------------------------------------------------------------------
/lib/core/data/error/failures/firebase_auth_failure.freezed.dart:
--------------------------------------------------------------------------------
1 | // coverage:ignore-file
2 | // GENERATED CODE - DO NOT MODIFY BY HAND
3 | // ignore_for_file: type=lint
4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
5 |
6 | part of 'firebase_auth_failure.dart';
7 |
8 | // **************************************************************************
9 | // FreezedGenerator
10 | // **************************************************************************
11 |
12 | T _$identity(T value) => value;
13 |
14 | final _privateConstructorUsedError = UnsupportedError(
15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
16 |
17 | /// @nodoc
18 | mixin _$FirebaseAuthFailure {
19 | String get message => throw _privateConstructorUsedError;
20 | @optionalTypeArgs
21 | TResult when({
22 | required TResult Function(String message) operationNotAllowed,
23 | }) =>
24 | throw _privateConstructorUsedError;
25 | @optionalTypeArgs
26 | TResult? whenOrNull({
27 | TResult Function(String message)? operationNotAllowed,
28 | }) =>
29 | throw _privateConstructorUsedError;
30 | @optionalTypeArgs
31 | TResult maybeWhen({
32 | TResult Function(String message)? operationNotAllowed,
33 | required TResult orElse(),
34 | }) =>
35 | throw _privateConstructorUsedError;
36 | @optionalTypeArgs
37 | TResult map({
38 | required TResult Function(OperationNotAllowed value) operationNotAllowed,
39 | }) =>
40 | throw _privateConstructorUsedError;
41 | @optionalTypeArgs
42 | TResult? mapOrNull({
43 | TResult Function(OperationNotAllowed value)? operationNotAllowed,
44 | }) =>
45 | throw _privateConstructorUsedError;
46 | @optionalTypeArgs
47 | TResult maybeMap({
48 | TResult Function(OperationNotAllowed value)? operationNotAllowed,
49 | required TResult orElse(),
50 | }) =>
51 | throw _privateConstructorUsedError;
52 |
53 | @JsonKey(ignore: true)
54 | $FirebaseAuthFailureCopyWith get copyWith =>
55 | throw _privateConstructorUsedError;
56 | }
57 |
58 | /// @nodoc
59 | abstract class $FirebaseAuthFailureCopyWith<$Res> {
60 | factory $FirebaseAuthFailureCopyWith(
61 | FirebaseAuthFailure value, $Res Function(FirebaseAuthFailure) then) =
62 | _$FirebaseAuthFailureCopyWithImpl<$Res>;
63 | $Res call({String message});
64 | }
65 |
66 | /// @nodoc
67 | class _$FirebaseAuthFailureCopyWithImpl<$Res>
68 | implements $FirebaseAuthFailureCopyWith<$Res> {
69 | _$FirebaseAuthFailureCopyWithImpl(this._value, this._then);
70 |
71 | final FirebaseAuthFailure _value;
72 | // ignore: unused_field
73 | final $Res Function(FirebaseAuthFailure) _then;
74 |
75 | @override
76 | $Res call({
77 | Object? message = freezed,
78 | }) {
79 | return _then(_value.copyWith(
80 | message: message == freezed
81 | ? _value.message
82 | : message // ignore: cast_nullable_to_non_nullable
83 | as String,
84 | ));
85 | }
86 | }
87 |
88 | /// @nodoc
89 | abstract class _$$OperationNotAllowedCopyWith<$Res>
90 | implements $FirebaseAuthFailureCopyWith<$Res> {
91 | factory _$$OperationNotAllowedCopyWith(_$OperationNotAllowed value,
92 | $Res Function(_$OperationNotAllowed) then) =
93 | __$$OperationNotAllowedCopyWithImpl<$Res>;
94 | @override
95 | $Res call({String message});
96 | }
97 |
98 | /// @nodoc
99 | class __$$OperationNotAllowedCopyWithImpl<$Res>
100 | extends _$FirebaseAuthFailureCopyWithImpl<$Res>
101 | implements _$$OperationNotAllowedCopyWith<$Res> {
102 | __$$OperationNotAllowedCopyWithImpl(
103 | _$OperationNotAllowed _value, $Res Function(_$OperationNotAllowed) _then)
104 | : super(_value, (v) => _then(v as _$OperationNotAllowed));
105 |
106 | @override
107 | _$OperationNotAllowed get _value => super._value as _$OperationNotAllowed;
108 |
109 | @override
110 | $Res call({
111 | Object? message = freezed,
112 | }) {
113 | return _then(_$OperationNotAllowed(
114 | message: message == freezed
115 | ? _value.message
116 | : message // ignore: cast_nullable_to_non_nullable
117 | as String,
118 | ));
119 | }
120 | }
121 |
122 | /// @nodoc
123 |
124 | class _$OperationNotAllowed implements OperationNotAllowed {
125 | const _$OperationNotAllowed({required this.message});
126 |
127 | @override
128 | final String message;
129 |
130 | @override
131 | String toString() {
132 | return 'FirebaseAuthFailure.operationNotAllowed(message: $message)';
133 | }
134 |
135 | @override
136 | bool operator ==(dynamic other) {
137 | return identical(this, other) ||
138 | (other.runtimeType == runtimeType &&
139 | other is _$OperationNotAllowed &&
140 | const DeepCollectionEquality().equals(other.message, message));
141 | }
142 |
143 | @override
144 | int get hashCode =>
145 | Object.hash(runtimeType, const DeepCollectionEquality().hash(message));
146 |
147 | @JsonKey(ignore: true)
148 | @override
149 | _$$OperationNotAllowedCopyWith<_$OperationNotAllowed> get copyWith =>
150 | __$$OperationNotAllowedCopyWithImpl<_$OperationNotAllowed>(
151 | this, _$identity);
152 |
153 | @override
154 | @optionalTypeArgs
155 | TResult when({
156 | required TResult Function(String message) operationNotAllowed,
157 | }) {
158 | return operationNotAllowed(message);
159 | }
160 |
161 | @override
162 | @optionalTypeArgs
163 | TResult? whenOrNull({
164 | TResult Function(String message)? operationNotAllowed,
165 | }) {
166 | return operationNotAllowed?.call(message);
167 | }
168 |
169 | @override
170 | @optionalTypeArgs
171 | TResult maybeWhen({
172 | TResult Function(String message)? operationNotAllowed,
173 | required TResult orElse(),
174 | }) {
175 | if (operationNotAllowed != null) {
176 | return operationNotAllowed(message);
177 | }
178 | return orElse();
179 | }
180 |
181 | @override
182 | @optionalTypeArgs
183 | TResult map({
184 | required TResult Function(OperationNotAllowed value) operationNotAllowed,
185 | }) {
186 | return operationNotAllowed(this);
187 | }
188 |
189 | @override
190 | @optionalTypeArgs
191 | TResult? mapOrNull({
192 | TResult Function(OperationNotAllowed value)? operationNotAllowed,
193 | }) {
194 | return operationNotAllowed?.call(this);
195 | }
196 |
197 | @override
198 | @optionalTypeArgs
199 | TResult maybeMap({
200 | TResult Function(OperationNotAllowed value)? operationNotAllowed,
201 | required TResult orElse(),
202 | }) {
203 | if (operationNotAllowed != null) {
204 | return operationNotAllowed(this);
205 | }
206 | return orElse();
207 | }
208 | }
209 |
210 | abstract class OperationNotAllowed implements FirebaseAuthFailure {
211 | const factory OperationNotAllowed({required final String message}) =
212 | _$OperationNotAllowed;
213 |
214 | @override
215 | String get message => throw _privateConstructorUsedError;
216 | @override
217 | @JsonKey(ignore: true)
218 | _$$OperationNotAllowedCopyWith<_$OperationNotAllowed> get copyWith =>
219 | throw _privateConstructorUsedError;
220 | }
221 |
--------------------------------------------------------------------------------
/lib/core/data/models/steps_and_points_model.dart:
--------------------------------------------------------------------------------
1 | class StepsAndPointsModel {
2 | final String id;
3 | final int steps;
4 | final int points;
5 |
6 | const StepsAndPointsModel({
7 | required this.id,
8 | required this.steps,
9 | required this.points,
10 | });
11 |
12 | Map toMap() {
13 | return {
14 | 'id': id,
15 | 'steps': steps,
16 | 'points': points,
17 | };
18 | }
19 |
20 | factory StepsAndPointsModel.fromMap(
21 | Map map,
22 | String documentId,
23 | ) {
24 | return StepsAndPointsModel(
25 | id: documentId,
26 | steps: map['steps'] as int,
27 | points: map['points'] as int,
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/core/data/models/user_model.dart:
--------------------------------------------------------------------------------
1 | class UserModel {
2 | final String uid;
3 | final String name;
4 | final int totalSteps;
5 | final int totalCalories;
6 | final int healthPoints;
7 |
8 | UserModel({
9 | required this.uid,
10 | required this.name,
11 | this.totalSteps = 0,
12 | this.totalCalories = 0,
13 | this.healthPoints = 0,
14 | });
15 |
16 | factory UserModel.fromMap(
17 | Map map,
18 | String documentId,
19 | ) {
20 | return UserModel(
21 | uid: documentId,
22 | name: map['name'] as String,
23 | totalSteps: map['totalSteps'] as int,
24 | totalCalories: map['totalCalories'] as int,
25 | healthPoints: map['healthPoints'] as int,
26 | );
27 | }
28 |
29 | Map toMap() {
30 | return {
31 | 'uid': uid,
32 | 'name': name,
33 | 'totalSteps': totalSteps,
34 | 'totalCalories': totalCalories,
35 | 'healthPoints': healthPoints,
36 | };
37 | }
38 |
39 | UserModel copyWith({
40 | String? uid,
41 | String? name,
42 | int? totalSteps,
43 | int? totalCalories,
44 | int? healthPoints,
45 | }) {
46 | return UserModel(
47 | uid: uid ?? this.uid,
48 | name: name ?? this.name,
49 | totalSteps: totalSteps ?? this.totalSteps,
50 | totalCalories: totalCalories ?? this.totalCalories,
51 | healthPoints: healthPoints ?? this.healthPoints,
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/lib/core/data/services/firestore_services.dart:
--------------------------------------------------------------------------------
1 | import 'package:cloud_firestore/cloud_firestore.dart';
2 | import 'package:flutter/foundation.dart';
3 |
4 | class FirestoreService {
5 | FirestoreService._();
6 |
7 | static final instance = FirestoreService._();
8 |
9 | Stream> collectionStream(
10 | {required String path,
11 | required T Function(Map data, String documentId) builder,
12 | Query Function(Query query)? queryBuilder,
13 | int Function(T lhs, T rhs)? sort}) {
14 | Query query = FirebaseFirestore.instance.collection(path);
15 | if (queryBuilder != null) query = queryBuilder(query);
16 | final Stream snapshots = query.snapshots();
17 | return snapshots.map((snapshot) {
18 | final result = snapshot.docs
19 | .map(
20 | (snapshot) => builder(snapshot.data() as Map, snapshot.id),
21 | )
22 | .where((value) => value != null)
23 | .toList();
24 | if (sort != null) result.sort(sort);
25 |
26 | return result;
27 | });
28 | }
29 |
30 | Future deleteData({required String path}) async {
31 | final reference = FirebaseFirestore.instance.doc(path);
32 | debugPrint('delete: $path');
33 | await reference.delete();
34 | }
35 |
36 | Future setData(
37 | {required String path, required Map data}) async {
38 | final reference = FirebaseFirestore.instance.doc(path);
39 | debugPrint('$path:$data');
40 | await reference.set(data);
41 | }
42 |
43 | Stream documentStream(
44 | {required String path,
45 | required T Function(Map data, String documentId) builder}) {
46 | final DocumentReference reference = FirebaseFirestore.instance.doc(path);
47 | final Stream snapshots = reference.snapshots();
48 | return snapshots
49 | .map((snapshot) => builder(snapshot.data() as Map, snapshot.id));
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/lib/core/domain/use_cases/use_case.dart:
--------------------------------------------------------------------------------
1 | abstract class UseCase {
2 | Type call(Params params);
3 | }
4 |
5 | class NoParams {}
6 |
--------------------------------------------------------------------------------
/lib/core/presentation/pages/landing_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_bloc/flutter_bloc.dart';
3 | import 'package:flutter_steps_tracker/features/bottom_navbar/presentation/pages/bottom_navbar.dart';
4 | import 'package:flutter_steps_tracker/features/intro/presentation/manager/auth_status/auth_status_cubit.dart';
5 | import 'package:flutter_steps_tracker/features/intro/presentation/manager/auth_status/auth_status_state.dart';
6 | import 'package:flutter_steps_tracker/features/intro/presentation/pages/intro_page.dart';
7 |
8 | class LandingPage extends StatelessWidget {
9 | const LandingPage({Key? key}) : super(key: key);
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | return BlocConsumer(
14 | bloc: BlocProvider.of(context),
15 | listener: (context, state) {
16 | if (state is Authenticated) {
17 | const BottomNavbar();
18 | } else {
19 | const IntroPage();
20 | }
21 | },
22 | buildWhen: (previousState, currentState) => previousState != currentState,
23 | builder: (context, state) {
24 | return state.maybeWhen(
25 | authenticated: () => const BottomNavbar(),
26 | unAuthenticated: () => const IntroPage(),
27 | orElse: () => const SizedBox.shrink(),
28 | );
29 | },
30 | );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lib/core/presentation/widgets/android_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class AndroidDialog extends StatelessWidget {
4 | final String title;
5 | final Widget? contentWidget;
6 | final String? content;
7 | final String? cancelActionText;
8 | final VoidCallback? defaultAction;
9 | final String defaultActionText;
10 | final bool isLoading;
11 |
12 | const AndroidDialog({
13 | Key? key,
14 | required this.title,
15 | this.contentWidget,
16 | this.content,
17 | this.cancelActionText,
18 | this.defaultAction,
19 | required this.defaultActionText,
20 | this.isLoading = false,
21 | }) : super(key: key);
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | return AlertDialog(
26 | title: Text(title),
27 | content: contentWidget == null && content != null
28 | ? Text(content!)
29 | : contentWidget,
30 | actions: [
31 | if (cancelActionText != null)
32 | TextButton(
33 | child: Text(cancelActionText!),
34 | onPressed: () => Navigator.of(context).pop(false),
35 | ),
36 | TextButton(
37 | onPressed: defaultAction ?? () => Navigator.of(context).pop(true),
38 | child: !isLoading
39 | ? Text(defaultActionText)
40 | : const CircularProgressIndicator(),
41 | ),
42 | ],
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/core/presentation/widgets/ios_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | class IosDialog extends StatelessWidget {
5 | final String title;
6 | final Widget? contentWidget;
7 | final String? content;
8 | final String? cancelActionText;
9 | final VoidCallback? defaultAction;
10 | final String defaultActionText;
11 | final bool isLoading;
12 |
13 | const IosDialog({
14 | Key? key,
15 | required this.title,
16 | this.contentWidget,
17 | this.content,
18 | this.cancelActionText,
19 | this.defaultAction,
20 | required this.defaultActionText,
21 | this.isLoading = false,
22 | }) : super(key: key);
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | return CupertinoAlertDialog(
27 | title: Text(title),
28 | content: contentWidget == null && content != null
29 | ? Text(content!)
30 | : contentWidget,
31 | actions: [
32 | if (cancelActionText != null)
33 | CupertinoDialogAction(
34 | child: Text(cancelActionText!),
35 | onPressed: () => Navigator.of(context).pop(false),
36 | ),
37 | CupertinoDialogAction(
38 | onPressed: defaultAction ?? () => Navigator.of(context).pop(true),
39 | child: !isLoading
40 | ? Text(defaultActionText)
41 | : const CircularProgressIndicator(),
42 | ),
43 | ],
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/core/presentation/widgets/show_alert_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_bloc/flutter_bloc.dart';
6 | import 'package:flutter_steps_tracker/core/presentation/widgets/android_dialog.dart';
7 | import 'package:flutter_steps_tracker/core/presentation/widgets/ios_dialog.dart';
8 | import 'package:flutter_steps_tracker/features/bottom_navbar/presentation/manager/rewards/rewards_cubit.dart';
9 | import 'package:flutter_steps_tracker/features/bottom_navbar/presentation/manager/rewards/rewards_state.dart';
10 |
11 | /// TODO: We need to refactor this especially this cubit
12 | Future showAlertDialog(
13 | BuildContext context, {
14 | required String title,
15 | String? content,
16 | Widget? contentWidget,
17 | String? cancelActionText,
18 | required String defaultActionText,
19 | VoidCallback? defaultAction,
20 | RewardsCubit? cubit,
21 | }) {
22 | if (!Platform.isIOS) {
23 | return showDialog(
24 | context: context,
25 | builder: (context) => cubit == null
26 | ? AndroidDialog(
27 | title: title,
28 | defaultActionText: defaultActionText,
29 | content: content,
30 | contentWidget: contentWidget,
31 | cancelActionText: cancelActionText,
32 | defaultAction: defaultAction,
33 | )
34 | : BlocConsumer(
35 | bloc: cubit,
36 | listener: (context, state) {
37 | state.maybeWhen(
38 | earnLoaded: () {
39 | Navigator.of(context).pop();
40 | },
41 | orElse: () {},
42 | );
43 | },
44 | builder: (context, state) {
45 | return state.maybeWhen(
46 | earnLoading: () => AndroidDialog(
47 | title: title,
48 | defaultActionText: defaultActionText,
49 | content: content,
50 | contentWidget: contentWidget,
51 | cancelActionText: cancelActionText,
52 | defaultAction: defaultAction,
53 | isLoading: true,
54 | ),
55 | orElse: () => AndroidDialog(
56 | title: title,
57 | defaultActionText: defaultActionText,
58 | content: content,
59 | contentWidget: contentWidget,
60 | cancelActionText: cancelActionText,
61 | defaultAction: defaultAction,
62 | ),
63 | );
64 | },
65 | ),
66 | );
67 | }
68 | return showCupertinoDialog(
69 | context: context,
70 | builder: (context) => cubit == null
71 | ? IosDialog(
72 | title: title,
73 | defaultActionText: defaultActionText,
74 | content: content,
75 | contentWidget: contentWidget,
76 | cancelActionText: cancelActionText,
77 | defaultAction: defaultAction,
78 | )
79 | : BlocConsumer(
80 | bloc: cubit,
81 | listener: (context, state) {
82 | state.maybeWhen(
83 | earnLoaded: () {
84 | Navigator.of(context).pop();
85 | },
86 | orElse: () {},
87 | );
88 | },
89 | builder: (context, state) {
90 | return state.maybeWhen(
91 | earnLoading: () => IosDialog(
92 | title: title,
93 | defaultActionText: defaultActionText,
94 | content: content,
95 | contentWidget: contentWidget,
96 | cancelActionText: cancelActionText,
97 | defaultAction: defaultAction,
98 | isLoading: true,
99 | ),
100 | orElse: () => IosDialog(
101 | title: title,
102 | defaultActionText: defaultActionText,
103 | content: content,
104 | contentWidget: contentWidget,
105 | cancelActionText: cancelActionText,
106 | defaultAction: defaultAction,
107 | ),
108 | );
109 | },
110 | ),
111 | );
112 | }
113 |
--------------------------------------------------------------------------------
/lib/core/presentation/widgets/show_exception_alert_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:firebase_core/firebase_core.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:flutter_steps_tracker/core/presentation/widgets/show_alert_dialog.dart';
4 |
5 | Future showExceptionAlertDialog(
6 | BuildContext context, {
7 | required String title,
8 | required Exception exception,
9 | }) =>
10 | showAlertDialog(
11 | context,
12 | title: title,
13 | content: _message(exception),
14 | defaultActionText: 'OK',
15 | );
16 |
17 | String _message(Exception exception) {
18 | if (exception is FirebaseException) {
19 | return exception.message!;
20 | }
21 | return exception.toString();
22 | }
23 |
--------------------------------------------------------------------------------
/lib/di/app_module.dart:
--------------------------------------------------------------------------------
1 | import 'package:injectable/injectable.dart';
2 | import 'package:shared_preferences/shared_preferences.dart';
3 |
4 | @module
5 | abstract class AppModule {
6 | @preResolve
7 | Future get prefs => SharedPreferences.getInstance();
8 | }
9 |
--------------------------------------------------------------------------------
/lib/di/injection_container.config.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | // **************************************************************************
4 | // InjectableConfigGenerator
5 | // **************************************************************************
6 |
7 | import 'package:get_it/get_it.dart' as _i1;
8 | import 'package:injectable/injectable.dart' as _i2;
9 | import 'package:shared_preferences/shared_preferences.dart' as _i6;
10 |
11 | import '../core/data/data_sources/cache_helper.dart' as _i14;
12 | import '../core/data/data_sources/database.dart' as _i5;
13 | import '../features/bottom_navbar/data/repositories/bottom_navbar_repository_impl.dart'
14 | as _i13;
15 | import '../features/bottom_navbar/domain/repositories/bottom_navbar_repository.dart'
16 | as _i12;
17 | import '../features/bottom_navbar/domain/use_cases/earn_reward_use_case.dart'
18 | as _i15;
19 | import '../features/bottom_navbar/domain/use_cases/get_exchanges_history_use_case.dart'
20 | as _i16;
21 | import '../features/bottom_navbar/domain/use_cases/get_rewards_use_case.dart'
22 | as _i17;
23 | import '../features/bottom_navbar/domain/use_cases/get_user_data_use_case.dart'
24 | as _i18;
25 | import '../features/bottom_navbar/domain/use_cases/get_users_use_case.dart'
26 | as _i19;
27 | import '../features/bottom_navbar/domain/use_cases/set_exchange_history_use_case.dart'
28 | as _i22;
29 | import '../features/bottom_navbar/domain/use_cases/set_steps_and_points_use_case.dart'
30 | as _i23;
31 | import '../features/bottom_navbar/presentation/manager/exchanges_history/exchanges_history_cubit.dart'
32 | as _i27;
33 | import '../features/bottom_navbar/presentation/manager/home/home_cubit.dart'
34 | as _i28;
35 | import '../features/bottom_navbar/presentation/manager/leaderboard/leaderboard_cubit.dart'
36 | as _i20;
37 | import '../features/bottom_navbar/presentation/manager/rewards/rewards_cubit.dart'
38 | as _i21;
39 | import '../features/intro/data/data_sources/auth_local_data_source.dart' as _i8;
40 | import '../features/intro/data/data_sources/auth_remote_data_source.dart'
41 | as _i4;
42 | import '../features/intro/data/repositories/auth_repository_impl.dart' as _i10;
43 | import '../features/intro/data/services/auth_services.dart' as _i3;
44 | import '../features/intro/domain/repositories/auth_repository.dart' as _i9;
45 | import '../features/intro/domain/use_cases/auth_status_use_case.dart' as _i11;
46 | import '../features/intro/domain/use_cases/sign_in_anonymously_use_case.dart'
47 | as _i24;
48 | import '../features/intro/presentation/manager/auth_actions/auth_cubit.dart'
49 | as _i25;
50 | import '../features/intro/presentation/manager/auth_status/auth_status_cubit.dart'
51 | as _i26;
52 | import '../utilities/locale/cubit/utility_cubit.dart' as _i7;
53 | import 'app_module.dart' as _i29; // ignore_for_file: unnecessary_lambdas
54 |
55 | // ignore_for_file: lines_longer_than_80_chars
56 | /// initializes the registration of provided dependencies inside of [GetIt]
57 | Future<_i1.GetIt> $initGetIt(_i1.GetIt get,
58 | {String? environment, _i2.EnvironmentFilter? environmentFilter}) async {
59 | final gh = _i2.GetItHelper(get, environment, environmentFilter);
60 | final appModule = _$AppModule();
61 | gh.singleton<_i3.AuthBase>(_i3.Auth());
62 | gh.singleton<_i4.AuthRemoteDataSource>(
63 | _i4.AuthRemoteDataSourceImpl(authBase: get<_i3.AuthBase>()));
64 | gh.singleton<_i5.Database>(_i5.FireStoreDatabase());
65 | await gh.factoryAsync<_i6.SharedPreferences>(() => appModule.prefs,
66 | preResolve: true);
67 | gh.factory<_i7.UtilityCubit>(() => _i7.UtilityCubit());
68 | gh.singleton<_i8.AuthLocalDataSource>(
69 | _i8.AuthLocalDataSourceImpl(get<_i6.SharedPreferences>()));
70 | gh.singleton<_i9.AuthRepository>(_i10.AuthRepositoryImpl(
71 | get<_i4.AuthRemoteDataSource>(),
72 | get<_i8.AuthLocalDataSource>(),
73 | get<_i5.Database>()));
74 | gh.factory<_i11.AuthStatusUseCase>(
75 | () => _i11.AuthStatusUseCase(get<_i9.AuthRepository>()));
76 | gh.singleton<_i12.BottomNavbarRepository>(_i13.BottomNavbarRepositoryImpl(
77 | get<_i5.Database>(), get<_i8.AuthLocalDataSource>()));
78 | gh.singleton<_i14.CacheHelper>(
79 | _i14.CacheHelperImpl(get<_i6.SharedPreferences>()));
80 | gh.factory<_i15.EarnARewardUseCase>(
81 | () => _i15.EarnARewardUseCase(get<_i12.BottomNavbarRepository>()));
82 | gh.factory<_i16.GetHistoryExchangesUseCase>(() =>
83 | _i16.GetHistoryExchangesUseCase(get<_i12.BottomNavbarRepository>()));
84 | gh.factory<_i17.GetRewardsUseCase>(
85 | () => _i17.GetRewardsUseCase(get<_i12.BottomNavbarRepository>()));
86 | gh.factory<_i18.GetUserDataUseCase>(
87 | () => _i18.GetUserDataUseCase(get<_i12.BottomNavbarRepository>()));
88 | gh.factory<_i19.GetUsersUseCase>(
89 | () => _i19.GetUsersUseCase(get<_i12.BottomNavbarRepository>()));
90 | gh.factory<_i20.LeaderboardCubit>(
91 | () => _i20.LeaderboardCubit(get<_i19.GetUsersUseCase>()));
92 | gh.factory<_i21.RewardsCubit>(() => _i21.RewardsCubit(
93 | get<_i17.GetRewardsUseCase>(),
94 | get<_i18.GetUserDataUseCase>(),
95 | get<_i15.EarnARewardUseCase>()));
96 | gh.factory<_i22.SetExchangeHistoryUseCase>(
97 | () => _i22.SetExchangeHistoryUseCase(get<_i12.BottomNavbarRepository>()));
98 | gh.factory<_i23.SetStepsAndPointsUseCase>(
99 | () => _i23.SetStepsAndPointsUseCase(get<_i12.BottomNavbarRepository>()));
100 | gh.factory<_i24.SignInAnonymouslyUseCase>(() =>
101 | _i24.SignInAnonymouslyUseCase(authRepository: get<_i9.AuthRepository>()));
102 | gh.singleton<_i25.AuthCubit>(
103 | _i25.AuthCubit(get<_i24.SignInAnonymouslyUseCase>()));
104 | gh.singleton<_i26.AuthStatusCubit>(
105 | _i26.AuthStatusCubit(get<_i11.AuthStatusUseCase>()));
106 | gh.factory<_i27.ExchangesHistoryCubit>(
107 | () => _i27.ExchangesHistoryCubit(get<_i16.GetHistoryExchangesUseCase>()));
108 | gh.factory<_i28.HomeCubit>(() => _i28.HomeCubit(
109 | get<_i22.SetExchangeHistoryUseCase>(),
110 | get<_i23.SetStepsAndPointsUseCase>(),
111 | get<_i18.GetUserDataUseCase>()));
112 | return get;
113 | }
114 |
115 | class _$AppModule extends _i29.AppModule {}
116 |
--------------------------------------------------------------------------------
/lib/di/injection_container.dart:
--------------------------------------------------------------------------------
1 | import 'package:get_it/get_it.dart';
2 | import 'package:injectable/injectable.dart';
3 |
4 | import 'injection_container.config.dart';
5 |
6 | GetIt getIt = GetIt.instance;
7 |
8 | @injectableInit
9 | Future configure() async => $initGetIt(getIt);
10 |
--------------------------------------------------------------------------------
/lib/features/bottom_navbar/data/mappers/user_model_to_entity_mapper.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_steps_tracker/core/data/models/user_model.dart';
2 | import 'package:flutter_steps_tracker/features/bottom_navbar/domain/entities/leaderboard_item_entity.dart';
3 |
4 | extension UserModelToMapper on List {
5 | List toEntity() => map((e) => LeaderboardItemEntity(
6 | uid: e.uid,
7 | name: e.name,
8 | stepsNumber: e.totalSteps,
9 | order: 0,
10 | healthPoints: e.healthPoints,
11 | )).toList();
12 | }
13 |
--------------------------------------------------------------------------------
/lib/features/bottom_navbar/data/models/exchange_history_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:equatable/equatable.dart';
2 |
3 | // TODO: We will use this model as an entity too just for simplicity now
4 | class ExchangeHistoryModel extends Equatable {
5 | final String id;
6 | final String title;
7 | final String date;
8 | final int points;
9 |
10 | const ExchangeHistoryModel({
11 | required this.id,
12 | required this.title,
13 | required this.date,
14 | required this.points,
15 | });
16 |
17 | Map toMap() {
18 | return {
19 | 'id': id,
20 | 'title': title,
21 | 'date': date,
22 | 'points': points,
23 | };
24 | }
25 |
26 | factory ExchangeHistoryModel.fromMap(
27 | Map map,
28 | String documentId,
29 | ) {
30 | return ExchangeHistoryModel(
31 | id: documentId,
32 | title: map['title'] as String,
33 | date: map['date'] as String,
34 | points: map['points'] as int,
35 | );
36 | }
37 |
38 | @override
39 | List