FiTrack Logo

Codemagic build status

codecov

FiTrack - Get Fit With Friends - Documentation

This page explains technical background of the app and can be used by other developers for contributing to the project. The project uses the programming language Dart and uses the Flutter cross-platform framework by Google. Best practices like seperation of concerns, splitting the application into multiple layers and using advanced state management with the BLoC pattern are used.


Table of content


Pre-requisites


Installation Guide

  1. Make sure you got a functional flutter installation by running
    flutter doctor
  2. Clone the master (or any other) branch by running
    git clone https://github.com/mobileappdevhm20/team-project-team_7.git
  3. Install the project dependencies by running
    flutter pub get
    1. Debug on your own device or a running simulator by running
      flutter run or
    2. Build a release by running either
      flutter build apk or flutter build ios

Dependencies

Dependencies (compilation dependencies)

These dependencies are required for application to compile. They are part of the created .apk/.ipa file.

Dev-Dependencies (only needed while developing)

These dependencies will not be included in the final product and just help the developers to develop faster and better.


Project structure

The used architecure inside FiTrack


Architecture

Repository and Blocs

The app makes heavy use of Repositories and BLOCs. To access those there is a MultiRepositoryProvider and MultiBlocProvider in the main.dart. These Repositories and BLOCs can then be accessed in the whole widget tree.

    MultiRepositoryProvider(
        providers: [
          //global repositories
          RepositoryProvider(create: (context) => UserRepository()),
          RepositoryProvider(
            create: (context) => WorkoutRepository(),
          ),
        ],
        child: MultiBlocProvider(
          providers: [
            //global blocs
            BlocProvider<AuthenticationBloc>(create: (context) {
              return AuthenticationBloc(
                userRepository: RepositoryProvider.of<UserRepository>(context),
              )..add(AppStarted());
            }),
            BlocProvider<WorkoutBloc>(
              create: (context) => WorkoutBloc(),
            ),
            BlocProvider<WorkoutDBBloc>(
                create: (context) => WorkoutDBBloc(
                    workoutRepository:
                        RepositoryProvider.of<WorkoutRepository>(context))),
          ],
          child: const FiTrackApp(),
        ),

Login and Signup

For User Authentication Firebase with the firebase_auth plugin is used. The communication to firebase is done with the repository lib/repositories/user_repository.dart.

The app uses BLOCs to communicate with the repository. There is a:

There is a seperate screen each for login and signup which communicate with the appropiate BLOCs.

Fitrack Scaffold

Most pages are created with this Scaffold (lib/components/custom_scaffold.dart). It customises the look of the appbar and includes a buttom navigation bar with a floating action button. What parts are shown can be controlled with booleans.

Homescreen

For now this screen only displays a random quote from quotes package. The idea was to show the recent events, news and milestones of you and your friends here.

Tracking

The tracking is done with background_location package. The first time the app is used the user is asked for gps-permission. The ui communicates with the location-service via the workout_bloc.dart.

Tracking Summary

When the user is finished with tracking he is redirected to a tracking summary screen. Here he has the option to save his workout. To do this the UI communicates with the workout_db_bloc.dart. The BLOC then communicates with the workout_repository.dart which uses firebases Cloud-Firestore to save the Workout online and per user.

There is also a share feature and the option to not save.

Past Workouts

This view uses a StreamBuilder to create a listview with all workouts for the current user. For simplicity the view uses the workout_repository.dart directly and not with a bloc.

Authors & Acknowledgement

This project was created in Flutter as a part of a University project. In the course, Mobile Application Development (in German ‘Mobile Anwendungen’) at Munich University of Applied Sciences.

Developers: