Skip to content

GoldenOwlAsia/mobile-flutter-template

Repository files navigation

screenshot

Flutter Boilerplate

Fork this project then start you project with a lot of stuck prepare

Base project made with much: . Contains Bloc, Route, and much more!

Table of contents

Prerequisites

How to Use

Run this template

  1. Download or clone this repo by using the link below:

    https://github.com/GoldenOwlAsia/mobile-flutter-template.git
    
  2. Go to project root and execute the following command in console to get the required dependencies:

    flutter pub get
    
  3. Now run the generator

    flutter packages pub run build_runner build
    
  4. To run staging project

    flutter run --flavor staging --target lib/main_staging.dart
    
  5. To run production project

    flutter run --flavor production --target lib/main_production.dart
    

Use this template to create your project

  1. Download or clone this repo by using the link below:

    https://github.com/GoldenOwlAsia/mobile-flutter-template.git
    
  2. Go to project root and execute the following command in console to update this project config

    sudo sh ./customizer.sh your.package.name
  • Remove git, update readme
  • Change your bundle-id
  1. Change your app builder id (iOS & Android)
  • Replace/Update your firebase config as your project.
    • Android staging: android/app/src/staging/google-services.json
    • Android production: android/app/src/production/google-services.json
    • iOS staging: ios/config/GoogleService-Info.plist
    • iOS production: ios/config/GoogleService-Info.plist
    • Update firebase_options_prod.dart
    • Update firebase_options_stg.dart
    • Update REVERSED_CLIENT_ID on file info.plist
  1. Update Firebase config - by run command

    flutterfire config \
      --project={YOUR_FIREBASE_ID_PROJECT} \
      --out={part to save firebase_options.dart} \
      --ios-bundle-id={BUNDLE_ID_APP} \
      --android-app-id={APP_ID}
    

    -> Read More here

  2. Try to run this code

Code Conventions

  • analysis_options.yaml

  • About code analytics flutter

    In Flutter, Modularization will be done at a file level. While building widgets, we have to make sure they stay independent and re-usable as maximum. Ideally, widgets should be easily extractable into an independent project.

  • Must know

    • Model name start with M: MUser, MProduct, MGroup...
    • Common widget start with X: XButton, XText, XAppbar... - There widget under folder lib/widgets/
    • App Constants class or service start with Add: AppStyles, AppColor, AppRouter, AppCoordinator,.. and UserPrefs

Dependencies

Helper

  • logger: Small, easy to use and extensible logger which prints beautiful logs.

  • url_launcher: A Flutter plugin for launching a URL in the mobile platform. Supports iOS, Android, web, Windows, macOS, and Linux.

  • auto_route: Auto route generator, Manager router

  • get_it: This is a simple Service Locator

  • intl: This package provides internationalization and localization facilities, including message translation, plurals and genders, date/number formatting and parsing, and bidirectional text.

  • shared_preferences: Flutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.

  • package_info_plus: This Flutter plugin provides an API for querying information about an application package.

  • device_info_plus: Get current device information from within the Flutter application.

  • permission_handler: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

HTTP, API

  • http: A composable, Future-based library for making HTTP requests.

Flutter Fire

The official Firebase plugins for Flutter. sign_in, analytics, crashlytics, storage, firestore

State Management

State Management is still the hottest topic in Flutter Community. There are tons of choices available and it’s super intimidating for a beginner to choose one. Also, all of them have their pros and cons. So, what’s the best approach

A recommended approach

Flutter Gen

  • flutter_gen: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.

Localization

Widget

Image

Code structure

Here is the core folder structure which flutter provides.

flutter-app/
|- android
|- ios
|- web
|- lib
|- modules
|- test

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

lib/
|- packages/
|- src/
  |- data/
  |- services/
  |- feature/
    |- dashboard/
      |- widget/
      |- controller
      |- dashboard_screen.dart
    |- home/
    |- login/
  |- plugins/
  |- routing/
|- widgets/
  |- button/
  |- image/
  |- view/
|- main.dart
|- modules

Navigation Stack

Wiki

Checkout wiki for more info

Screenshot

Account Profile Login