A project created in flutter using Android Studio, coded in Dart.

Related tags

Templates purematch
Overview

Pure Match App

A project created in flutter using Android Studio, coded in Dart. Currently only Android and iOS is supported, but we want to enable web in the future (using Flutter). Clone the appropriate branches mentioned below:

  • For iOS: URL (name)
  • For Android: URL (name)
  • For Web: (Not yet developed)

Getting Started

Pure Match started with various devs without a standard of code or documentation. Therefore, this documentation aims to fill in the gaps of the non-standard organization of files in our library and project. This ReadMe is an ongoing reshaping of a template ReadMe. Anything below the line of "-"s is still to be customized to the Pure Match project.

How to Use

Step 1:

Download or clone this repo by using the link below:

Insert URL of main repo here.

Step 2:

Go to project root and execute the following command in console to get the required dependencies:

flutter pub get 

Template needs updating below this line: DO NOT USE


Step 3:

This project uses inject library that works with code generation, execute the following command to generate files:

flutter packages pub run build_runner build --delete-conflicting-outputs

or watch command in order to keep the source code synced automatically:

flutter packages pub run build_runner watch

Hide Generated Files

In-order to hide generated files, navigate to Android Studio -> Preferences -> Editor -> File Types and paste the below lines under ignore files and folders section:

*.inject.summary;*.inject.dart;*.g.dart;

In Visual Studio Code, navigate to Preferences -> Settings and search for Files:Exclude. Add the following patterns:

**/*.inject.summary
**/*.inject.dart
**/*.g.dart

Boilerplate Features:

  • Splash
  • Login
  • Home
  • Routing
  • Theme
  • Dio
  • Database
  • MobX (to connect the reactive data of your application with the UI)
  • Provider (State Management)
  • Encryption
  • Validation
  • Code Generation
  • User Notifications
  • Logging
  • Dependency Injection
  • Dark Theme Support (new)
  • Multilingual Support (new)
  • Provider example (new)

Up-Coming Features:

  • Connectivity Support
  • Background Fetch Support

Libraries & Tools Used

Folder Structure

Here is the core folder structure which flutter provides.

flutter-app/
|- android
|- build
|- ios
|- lib
|- test

Here is the folder structure we have been using in this project

lib/
|- constants/
|- data/
|- stores/
|- ui/
|- utils/
|- widgets/
|- main.dart
|- routes.dart

Now, lets dive into the lib folder which has the main code for the application.

1- constants - All the application level constants are defined in this directory with-in their respective files. This directory contains the constants for `theme`, `dimentions`, `api endpoints`, `preferences` and `strings`.
2- data - Contains the data layer of your project, includes directories for local, network and shared pref/cache.
3- stores - Contains store(s) for state-management of your application, to connect the reactive data of your application with the UI. 
4- ui — Contains all the ui of your project, contains sub directory for each screen.
5- util — Contains the utilities/common functions of your application.
6- widgets — Contains the common widgets for your applications. For example, Button, TextField etc.
7- routes.dart — This file contains all the routes for your application.
8- main.dart - This is the starting point of the application. All the application level configurations are defined in this file i.e, theme, routes, title, orientation etc.

Constants

This directory contains all the application level constants. A separate file is created for each type as shown in example below:

constants/
|- app_theme.dart
|- dimens.dart
|- endpoints.dart
|- preferences.dart
|- strings.dart

Data

All the business logic of your application will go into this directory, it represents the data layer of your application. It is sub-divided into three directories local, network and sharedperf, each containing the domain specific logic. Since each layer exists independently, that makes it easier to unit test. The communication between UI and data layer is handled by using central repository.

data/
|- local/
    |- constants/
    |- datasources/
    |- app_database.dart
   
|- network/
    |- constants/
    |- exceptions/
    |- rest_client.dart
    
|- sharedpref
    |- constants/
    |- shared_preference_helper.dart
    
|- repository.dart

Stores

The store is where all your application state lives in flutter. The Store is basically a widget that stands at the top of the widget tree and passes it's data down using special methods. In-case of multiple stores, a separate folder for each store is created as shown in the example below:

stores/
|- login/
    |- login_store.dart
    |- form_validator.dart

UI

This directory contains all the ui of your application. Each screen is located in a separate folder making it easy to combine group of files related to that particular screen. All the screen specific widgets will be placed in widgets directory as shown in the example below:

ui/
|- login
   |- login_screen.dart
   |- widgets
      |- login_form.dart
      |- login_button.dart

Utils

Contains the common file(s) and utilities used in a project. The folder structure is as follows:

utils/
|- encryption
   |- xxtea.dart
|- date
  |- date_time.dart

Widgets

Contains the common widgets that are shared across multiple screens. For example, Button, TextField etc.

widgets/
|- app_icon_widget.dart
|- empty_app_bar.dart
|- progress_indicator.dart

Routes

This file contains all the routes for your application.

import 'package:flutter/material.dart';

import 'ui/home/home.dart';
import 'ui/login/login.dart';
import 'ui/splash/splash.dart';

class Routes {
  Routes._();

  //static variables
  static const String splash = '/splash';
  static const String login = '/login';
  static const String home = '/home';

  static final routes = <String, WidgetBuilder>{
    splash: (BuildContext context) => SplashScreen(),
    login: (BuildContext context) => LoginScreen(),
    home: (BuildContext context) => HomeScreen(),
  };
}

Main

This is the starting point of the application. All the application level configurations are defined in this file i.e, theme, routes, title, orientation etc.

import 'package:boilerplate/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'constants/app_theme.dart';
import 'constants/strings.dart';
import 'ui/splash/splash.dart';

void main() {
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
    DeviceOrientation.landscapeRight,
    DeviceOrientation.landscapeLeft,
  ]).then((_) {
    runApp(MyApp());
  });
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: Strings.appName,
      theme: themeData,
      routes: Routes.routes,
      home: SplashScreen(),
    );
  }
}

Wiki

Checkout wiki for more info

Conclusion

I will be happy to answer any questions that you may have on this approach, and if you want to lend a hand with the boilerplate then please feel free to submit an issue and/or pull request 🙂

Again to note, this is example can appear as over-architectured for what it is - but it is an example only. If you liked my work, don’t forget to star the repo to show your support.

You might also like...

A boilerplate project created in flutter using MobX and Provider.

Boilerplate Project A boilerplate project created in flutter using MobX and Provider. Boilerplate supports both web and mobile, clone the appropriate

Jan 8, 2023

BloilerplateProject - A boilerplate project created in flutter using MobX and Provider

Boilerplate Project A boilerplate project created in flutter using MobX and Prov

Oct 23, 2022

🎬 A movie catalog app for both Android & IOS ~ Flutter.io project in Dart | Dart, Bloc, Movies

Movie Catalog App 🎬 Browse through movies from the YIFY api Getting Started For help getting started with Flutter, view our online documentation. Tod

Nov 21, 2022

Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Rab Bar.

Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Rab Bar.

Gooey Tab Bar Flutter Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Tab Bar. About This component

Dec 14, 2022

We created Flappy Bird, a straightforward game based on flutter animation, from scratch using only Dart & Flutter and no third-party games or animation components.

We created Flappy Bird, a straightforward game based on flutter animation, from scratch using only Dart & Flutter and no third-party games or animation components.

Flappy-Bird Description A ridiculous game created by Flutter, all you have to do is touch the screen to make the bird leap as long as you avoid the ba

Dec 25, 2022

Weather app created using Flutter and Dart

Weather app created using Flutter and Dart

FlutterWeather FlutterWeather A simple weather App created using Flutter and Dart and using API from OpenWeatherMap Features Automatically acquire use

Dec 30, 2022

App concept created with Flutter using Dart programming language, inspired by Groceries Shopping App Interaction.

App concept created with Flutter using Dart programming language, inspired by Groceries Shopping App Interaction.

Grocery Shop Flutter App concept created with Flutter using Dart programming language, inspired by Groceries Shopping App Interaction. About The app w

Dec 9, 2022

The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion.

The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion.

Fluid Slider Flutter The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion. About The component was

Sep 30, 2022

A simple yet elegant tip calculator created using flutter framework and dart language.

CAL- TIP, A TIP CALCULATOR APPLICATION A simple yet elegant tip calculator created using flutter framework and dart language. As the name suggests, th

Dec 26, 2021
Todo is an Simple Task Management App coded using Dart which is a peogramming language for Flutter SDK(2.5) supports Null Safety 📑🚩

Todo ?? ?? ?? Introduction Todo is an Simple Task Management App coded using Dart which is a peogramming language for Flutter SDK(2.5) supports Null S

navee-ramesh 6 Nov 5, 2022
Food-app-flutter - A simple food ordering application with an admin panel coded with flutter and uses firebase as a backend

shop_ui A new Flutter project. Getting Started This project is a starting point

Ryan Egbejule-jalla 3 Oct 5, 2022
Now UI Flutter is a fully coded app template built for Flutter which will allow you to create powerful and beautiful e-commerce mobile applications

Now UI Flutter is a fully coded app template built for Flutter which will allow you to create powerful and beautiful e-commerce mobile applications. We have redesigned all the usual components to make it look like our Now UI Design, minimalistic and easy to use.

null 12 Oct 9, 2022
ui app , coded with help of codepur tut -> 30 days of flutter - this is my first app

my_shop A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Rajat 2 Apr 10, 2022
Speed Coded on Youtube

Installation flutter pub get Usage flutter run Live Demo : Flutter Book App Web Demo Try Android APK : Download From Google Drive Book App UI made w

Sanskar Tiwari 276 Dec 2, 2022
Make localizing hard-coded strings fun!

Flutter Localizer IntelliJ Plugin IntelliJ Plugin to ease the process of localizing hard coded strings in Flutter projects Installation The plugin is

Norbert Kozsir 27 Feb 25, 2022
A weather application and the location is hard-coded to fetch weather data from London.

Weather Application This project is a weather application and the location is hard-coded to fetch weather data from London. Regarding the state manage

André Nogueira 2 Jun 21, 2022
A simple PokeDex App with Modern UI created using Flutter and Dart and using API from PokeApi.

FlutterDex FlutterDex A simple PokeDex App created using Flutter and Dart and using API from PokeApi. UI Design inspired by : Home Screen Pokedex iOS

Ariz Armeidi 39 Jan 1, 2023
Flutter boilerplate - A boilerplate project created in flutter using MobX and Provider

Boilerplate Project A boilerplate project created in flutter using MobX and Prov

Wali Khan 0 Jan 22, 2022
A boilerplate project created in flutter using MobX and Provider

Boilerplate Project A boilerplate project created in flutter using MobX and Provider. Boilerplate supports both web and mobile, clone the appropriate

Mohamed Ziada 1 Jan 20, 2022