A flutter based web3 voting app
Join us on
A list of current items and their progress can be found in the project boards. If you feel comfortable diving straight in, just fork the repo, and open it up in Android Studio.
We use Effective Dart to guide our coding style, so make sure you make yourself familiar. Make the contributions you want to and create a Pull Request.
If you are new to Flutter here are a few resources to get you started on your first Flutter project:
- Lab: Write your first Flutter app
- Cookbook: Useful Flutter samples
- online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Install dependencies:
sudo apt install curl
Get flutter (copy in all lines, run from home the location you want to install flutter):
git clone https://github.com/flutter/flutter.git -b stable && \
echo '#Add Flutter to PATH' >> $HOME/.bashrc && \
echo 'export PATH="$PATH:'$(pwd)'/flutter/bin"' >> $HOME/.bashrc && \
export PATH="$PATH:$(pwd)/flutter/bin" && \
echo "Check the flutter is in path" && \
echo $PATH && \
flutter precache && \
echo "Check your dependencies:" && \
flutter doctor
Download and install Android Studio and install the Flutter plugin:
Run flutter doctor
again to check dependencies.
- You must run
flutter pub run build_runner build --delete-conflicting-outputs
to generate necessary files.- You should probably have
flutter pub run build_runner watch --delete-conflicting-outputs
running while you develop- You should use the scripts (or contribute new scripts) in
./tool/
instead of coming back to the readme to find the commands.
- You should use the scripts (or contribute new scripts) in
- You should probably have
flutter pub get
for dependencies (make sure to use the newest stable version of flutter possible)flutter run
to run -- or just use the debug button in android-studio / vs-code.
The app frontend is built with Flutter using the Dart Programming Language. This repo will focus entirely on this part of the project.
This section assumes you have basic understanding of Flutter. If you are new to Flutter see the bottom of the repo for resources.
The app uses a Provider Architecture for state management. It is structured so data flows to only the views that need it. The apps structure was inspired by this Filledstacks guide. If you are new to flutter and plan on contributing we highly recommend you check out this tutorial.
The idea behind the directory architecture is to abstract the logic away from the UI. This allows for more maintainable code and extensibility. Simply as is sounds, any app logic goes into the Core any UI goes into the UI.
High level Architecture Points
- Each view will have it's own model that extends the ChangeNotifier.
- Notify listeners for a view will ONLY BE CALLED when the View's state changes.
- Each view only has 2 states. Idle and Busy. Any other piece of UI contained in a view, that requires logic and state / UI updates will have it's own model associated with it. This way the main view only paints when the main view state changes.
- Providers will NOT be passed in through app level global provider, unless it's required by more than 1 view in the app architecture (Users information).
- Models will ONLY request data from Services and reduce state from that DATA. Nothing else.
hivedb, API interaction & local storage
- The app uses Hivedb to store the API, blockchain data and user preferences locally. This allows for faster app performance & cheaper API hosting costs. If you are planning on contributing to the core, you must read the Hive docs to understand how it works.
- On startup the app calls the API and blockchain endpoints and stores the data in Hive models with custom adaptors (read here).
- All static data in the UI is called from Hive and not from API directly.
- Total votes is still called directly on the models currently
All app logic is contained in this directory.
- models - Contains all the data models
- services - Contains the dedicated files that will handle actual app logic
- viewmodels - Contains the Provider models for each of the Widget views
- enums - Storing any reusable enums
Any UI element or styling feature is contained here. Avoid using app logic in this folder or any descendant.
- views - Contains any full screen that is used in the app
- widgets - Contains any reusable widgets.
- All issues view - List of issues generated, sortable by date, popularity, controversiality(?)
- All bills view - List of bills sortable by house, date, progress
- Bill page with voting option - Full description/links and voting buttons
- Login Page - email - password
- Results Page - List of horizontal bar graphs - 1 for each electorate
- Verification/Settings Page - AEC details, electorate details, representatives and voting patterns, join Flux button, link settings (google/FB/Insta)