Giter VIP home page Giter VIP logo

flutter_template's Introduction

Flutter Template

coverage style: very good analysis

What to accomplish

  1. has tests
  2. basic auth flow
  3. riverpod as state provider
  4. logging (sentry)
  5. navigation (I used Beamer last time but might be something better out now)
  6. basic dashboard screen display user information
  7. basic settings screen to modify user profile.
  8. built in responsiveness
  9. built in flavors (dev,staging,prod)

Top TODOs

  1. make api call using dio and cache response using dio cacher
  2. run web integration tests in github actions

DONE

  1. full test suite running in github actions
  2. logging with sentry monitoring
  3. riverpod
  4. Flavors configured
  5. built in responsiveness
  6. full CI lint/unit/integration
  7. Pre-Push githook to force lint before pushing
  8. setup login flow

Getting Started ๐Ÿš€

First step

Setup your backend to login a user. On login the path needs to be be /callback?state=6meYRKLtQMSGctx2UXsxCd4L the state is your api token. I logout using the api part of my backend /api/v1/auth in this call i delete the users token. Soon ill add a refresh token endpoint.

I separated the WebAppAuthenticator so you can easily replace with your solution.

Second step

Run dart pub global activate derry This will allow you to run commands defined in derry.yaml like derry lint Support for running integration tests with flavors is added flutter/flutter#89045 If you are on master you can run derry test_all or derry e2e_iphone

To run unit tests derry unit_test

This project contains 3 flavors:

  • development
  • staging
  • production

To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands:

# Development
$ flutter run --flavor development --target lib/main_development.dart

# Staging
$ flutter run --flavor staging --target lib/main_staging.dart

# Production
$ flutter run --flavor production --target lib/main_production.dart

*Flutter Template works on iOS, Android, and Web.


Running in Docker

Start local emulator

  1. install android studio and set up a emulator
  2. ln -s ~/Library/Android/sdk/tools/emulator /usr/local/bin/emulator
  3. emulator -list-avds should list out your installed devices
  4. export the paths
export ANDROID_SDK=$HOME/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH

  1. run emulator -avd $(emulator -list-avds) to open the emulator.
  2. adb tcpip 5555 After doing all the setup above you only need to run this command from here on out.

Setup

  1. Download Visual Studio
  2. Install Docker Plugin
  3. Install Remote Development Plugin
  4. Optional Download Docker Desktop

Once you have installed all of these, open Visual Studio and open this project. Visual Studio will auto detect the Dockerfile and build it for you as well as copy the project files in the docker container using settings from the devcontainer.json file. If you have a andriod emulator open and have typed adb tcpip 5555 into your terminal the device should show up in the docker container type adb devices to make sure if not follow the steps below

For Web

In Docker

  1. Run sh flutter-web.sh

For Android:

  1. Open up an android emulator / or plugin your device
  2. type adb devices and make sure the device shows if it doesnt kill and restart your server adb kill-server & adb start-server
  3. in your terminal type adb tcpip 5555

In the docker continer:

  1. Run adb connect host.docker.internal:5555
  2. clilck allow permission on the andriod
  3. sh flutter-android-emulator.sh

Errors: If you get The message received from the daemon indicates that the daemon has disappeared. When trying to launch on android increase your docker memory to 4 gigs. Do this by going to the docker app -> preferences -> resourses

Running Tests ๐Ÿงช

To run all unit and widget tests use the following command:

$ derry test_all
$ derry e2e
$ derry unit

To view the generated coverage report you can use lcov.

# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
$ open coverage/index.html

flutter_template's People

Contributors

jeremiahlukus avatar victoreronmosele avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.