Skip to content

This is a Flutter project template that comes fully configured with some of the most commonly used packages and features. It's designed to help you get started with your Flutter project quickly and easily.

License

Notifications You must be signed in to change notification settings

afandos-bbm/flutter_app_empty_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌹 Flutter Project Template

VERSION Template - v0.0.1 - 18-11-2023

GitHub license

This is a Flutter project template that comes fully configured with some of the most commonly used packages and features. It's designed to help you get started with your Flutter project quickly and easily.

πŸš€ Features

  • Router for navigation. It's used to manage the routes and navigation.
  • Service Locator for dependency injection. It's used to manage the services and repositories.
  • Provider Store a MultiBlocProvider that wraps the entire app for state management of the UI.
  • Shared Preferences Service for local storage. It's used to manage the local storage.
  • Configuration Service A internal service for managing the build configuration. It's used to manage the environment variables.
  • Theme Service for managing the app theme.
  • Internationalization (i10n) support.
  • Logger Custom logger for debugging (Also observes the blocs).
  • Device Info Class for getting the device info per platform.
  • Flavors configuration for environments: development, staging and production. (IOS, Android and Web)
  • Husky for pre-commit and pre-push hooks. (Lint, Format, Tests)
  • App Bootstrap function for initializing the app that applies to all flavors.
  • Build Runner using json_serializable and freezed for generating the models and services.
  • Flutter Lint for code analysis.

πŸ“¦ Packages

Dependencies

  • flutter
  • flutter_web_plugins
  • flutter_localizations
  • cupertino_icons
  • json_annotation
  • freezed_annotation
  • get_it
  • bloc
  • bloc_concurrency
  • flutter_bloc
  • flutter_svg
  • equatable
  • shared_preferences
  • provider
  • flutter_localized_locales
  • go_router
  • intl
  • device_info_plus
  • package_info_plus

Dev Dependencies

  • flutter_test
  • bloc_test
  • flutter_lints
  • husky
  • build_runner
  • freezed
  • json_serializable
  • mocktail

πŸ“ Getting Started

  1. Clone this repository:

    git clone
  2. Install dependencies:

    flutter pub get
  3. Active the husky hooks: (Needs to be done only once after cloning)

    dart run husky install
  4. Execute the build runner to generate the models and services:

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

πŸƒβ€β™‚οΈ Running the app

You can run the app in two ways:

1. VSCode

The build runner is executed automatically when you make a hot restart by a preLaunchTask in the launch.json file. (Only for development)

The three launch configurations are:

  • Development
  • Staging
  • Production

You can change the configuration in the launch.json file.

2. Console

For the auto generate files, you must run the build runner manually You should run this anytime you make a change in the models or services.

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

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 --release

πŸ§ͺ Running Tests

To run the unit tests use the following command:

$ flutter test --coverage --test-randomize-ordering-seed random

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

🌐 Working with Translations

This project relies on flutter_localizations and follows the official internationalization guide for Flutter.

Adding Strings

  1. To add a new localizable string, open the app_en.arb file at lib/l10n/arb/app_en.arb.
{
    "@@locale": "en",
    "appName": "Template App",
    "@appName": {
        "description": "App Name"
    }
}
  1. Then add a new key/value and description
{
    "@@locale": "en",
    "appName": "Template App",
    "@appName": {
        "description": "App Name"
    }
    "helloWorld": "Hello World",
    "@helloWorld": {
       "description": "Hello World"
    }
}
  1. Use the new string
import 'package:flutter_app_empty_template/l10n/l10n.dart';

@override
Widget build(BuildContext context) {
  final l10n = context.l10n;
  return Text(l10n.helloWorld);
}

Adding Supported Locales

Update the CFBundleLocalizations array in the Info.plist at ios/Runner/Info.plist to include the new locale. (IOS)

    ...

    <key>CFBundleLocalizations</key>
	<array>
		<string>en</string>
		<string>es</string>
	</array>

    ...

Adding Translations

  1. For each supported locale, add a new ARB file in lib/l10n/arb.
β”œβ”€β”€ l10n
β”‚   β”œβ”€β”€ arb
β”‚   β”‚   β”œβ”€β”€ app_en.arb
β”‚   β”‚   └── app_es.arb
  1. Add the translated strings to each .arb file:

app_en.arb

{
    "@@locale": "en",
    "appName": "Template App",
    "@appName": {
        "description": "App Name"
    }
}

app_es.arb

{
    "@@locale": "es",
    "appName": "Plantilla de App",
    "@appName": {
       "description": "Nombre de la App"
    }
}

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This is a Flutter project template that comes fully configured with some of the most commonly used packages and features. It's designed to help you get started with your Flutter project quickly and easily.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project