/MeetingRoomBooking

production app for booking meeting rooms

Primary LanguageDart

Meeting Room

This template uses flutter_bloc as state management and follows uncle bob's clean architecture.

Get Started

This project contains 3 variants:

  • development
  • staging
  • production

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

Development

flutter run  -t lib/main-development.dart --flavor development

Production

flutter run -t lib/main-production.dart --flavor production

Staging

flutter run  -t lib/main-staging.dart --flavor staging

Generate Launcher Icons

flutter pub run flutter_launcher_icons:main

Create Native Splash

flutter pub run flutter_native_splash:create

Code generation for utilities (Routes,Model,Blocs)

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

or

$ flutter pub run build_runner watch --delete-conflicting-outputs

Working with Translations 🌐

This project relies on [flutter_localizations][flutter_localizations_link] and flutter_intl and follows the [official internationalization guide for Flutter][internationalization_link].

Adding Strings

  1. To add a new localizable string, open the intl_en.arb file at lib/localization/arb/intl_en.arb.
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    }
}
  1. Then add a new key/value and description
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    },
    "helloWorld": "Hello World",
    "@helloWorld": {
        "description": "Hello World Text"
    }
}
  1. Use the new string
import 'package:meeting_room/localization/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.

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

Adding Translations

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

app_en.arb

{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    }
}

app_ne.arb

{
    "@@locale": "ne",
    "counterAppBarTitle": "Contador",
    "@counterAppBarTitle": {
        "description": "Texto mostrado en la AppBar de la pΓ‘gina del contador"
    }
}
  1. Generate localized strings
flutter pub global activate intl_utils (if not activated previously)
flutter pub global run intl_utils:generate  (this is for the first time next time it will be auto generated when we run flutter pub get or just saving pubspec.yaml)

Folder Structure

.
β”œβ”€β”€ bootstrap.dart                     # bootstrap file that contains bloc observer and dependencies initialization functions
β”œβ”€β”€ localization                       #localized strings
β”‚   β”œβ”€β”€ arb
β”‚   β”‚   └── intl_en.arb
β”‚   β”œβ”€β”€ generated
β”‚   └── l10n.dart                       # extension functions to access generated localized strings
β”œβ”€β”€ main-dev.dart                       # entrypoint for development app
β”œβ”€β”€ main-prod.dart                      # entrypoint for production app
β”œβ”€β”€ main-uat.dart                       # entrypoint for uat app
└── src                                 # source folder (all the project source files goes under this directory)
    β”œβ”€β”€ app                             # folder contains files that is accessible to all over app
    β”‚   β”œβ”€β”€ app.dart                   # index file that exports presentation/pages
    β”‚   β”œβ”€β”€ data                       # data folder contains all the files those are associated with backend and local database
    β”‚   β”‚   β”œβ”€β”€ database              # database folder contains DAOs and local database tables for respective feature
    β”‚   β”‚   β”œβ”€β”€ dtos                  # dtos contains all the files those are used to convert server response into dart class
    β”‚   β”‚   β”œβ”€β”€ graphql               # graphql contains queries and mutations files those are use to communicate GraphQl server
    β”‚   β”‚   β”œβ”€β”€ mappers               # mappers contains extension functions that maps the local database response into entity
    β”‚   β”‚   β”œβ”€β”€ repository            # repository contains the implementation of abstract class in domain/repository
    β”‚   β”‚   └── source                # source contains abstract and implementation files to communicate with server and local database
    β”‚   β”œβ”€β”€ domain                     # domain folder contains all the files that are used to communicate between data and presentation layer
    β”‚   β”‚   β”œβ”€β”€ entities              # entities are used to communicate server/local response into UI layer
    β”‚   β”‚   β”œβ”€β”€ repository            # repository contains all the abstract classes used to communicate with data layer
    β”‚   β”‚   └── usecases              # usecases are used to communicate repository and bloc classes
    β”‚   └── presentation               # presentation folder contains all the UI and BLOC related files
    β”‚       β”œβ”€β”€ blocs                  # contains all the bloc files
    β”‚       β”‚   β”œβ”€β”€ app
    β”‚       β”‚   β”‚   β”œβ”€β”€ app_cubit.dart
    β”‚       β”‚   β”‚   β”œβ”€β”€ app_cubit.freezed.dart
    β”‚       β”‚   β”‚   └── app_state.dart
    β”‚       β”‚   └── locale
    β”‚       β”‚       β”œβ”€β”€ locale_cubit.dart
    β”‚       β”‚       β”œβ”€β”€ locale_cubit.freezed.dart
    β”‚       β”‚       └── locale_state.dart
    β”‚       β”œβ”€β”€ pages                  # contains all the pages of respective feature
    β”‚       β”‚   β”œβ”€β”€ app.dart
    β”‚       β”‚   └── splash_page.dart
    β”‚       └── widgets                # contains widgets that is common on respective feature's pages
    β”‚           └── widgets.dart
    β”œβ”€β”€ core                            # core contains all the helper,utilities,constants, routing etc.
    β”‚   β”œβ”€β”€ constants                   # constants
    β”‚   β”‚   └── storage_keys.dart
    β”‚   β”œβ”€β”€ database                    # local database class
    β”‚   β”‚   β”œβ”€β”€ local_database.dart
    β”‚   β”‚   β”œβ”€β”€ local_database.g.dart
    β”‚   β”‚   β”œβ”€β”€ test_dao.dart
    β”‚   β”‚   └── test_dao.g.dart
    β”‚   β”œβ”€β”€ di                          # dependency injections
    β”‚   β”‚   β”œβ”€β”€ injector.config.dart
    β”‚   β”‚   β”œβ”€β”€ injector.dart
    β”‚   β”‚   β”œβ”€β”€ register_modules.dart
    β”‚   β”‚   └── register_network_module.dart
    β”‚   β”œβ”€β”€ errors                      # app errors and exceptions
    β”‚   β”‚   β”œβ”€β”€ api_exception.dart
    β”‚   β”‚   β”œβ”€β”€ api_exception.freezed.dart
    β”‚   β”‚   β”œβ”€β”€ app_error.dart
    β”‚   β”‚   └── app_error.freezed.dart
    β”‚   β”œβ”€β”€ extensions                  # extension functions for different class
    β”‚   β”‚   β”œβ”€β”€ context_extension.dart
    β”‚   β”‚   β”œβ”€β”€ extensions.dart
    β”‚   β”‚   β”œβ”€β”€ num_extension.dart
    β”‚   β”‚   β”œβ”€β”€ string_extension.dart
    β”‚   β”‚   └── widget_extension.dart
    β”‚   β”œβ”€β”€ form                        # form validation fields
    β”‚   β”‚   β”œβ”€β”€ field.dart
    β”‚   β”‚   └── form_mixin.dart
    β”‚   β”œβ”€β”€ helpers                     # helpers
    β”‚   β”‚   β”œβ”€β”€ assets_helper.dart
    β”‚   β”‚   └── encryption_helper.dart
    β”‚   β”œβ”€β”€ logging                     # loggers
    β”‚   β”‚   └── logger.dart
    β”‚   β”œβ”€β”€ network                     # interceptors and connection_checkers
    β”‚   β”‚   β”œβ”€β”€ auth_interceptor.dart
    β”‚   β”‚   └── network_info.dart
    β”‚   β”œβ”€β”€ routes                      # routes
    β”‚   β”‚   β”œβ”€β”€ app_router.dart
    β”‚   β”‚   β”œβ”€β”€ app_router.gr.dart
    β”‚   β”‚   └── app_routes.dart
    β”‚   β”œβ”€β”€ session                     # session implementations
    β”‚   β”‚   β”œβ”€β”€ entity
    β”‚   β”‚   β”‚   β”œβ”€β”€ session_entity.dart
    β”‚   β”‚   β”‚   └── session_entity.g.dart
    β”‚   β”‚   └── session_service.dart
    β”‚   β”œβ”€β”€ themes                      # themes, colors, typography
    β”‚   β”‚   β”œβ”€β”€ app_colors.dart
    β”‚   β”‚   β”œβ”€β”€ app_styles.dart
    β”‚   β”‚   β”œβ”€β”€ app_theme.dart
    β”‚   β”‚   └── theme.dart
    β”‚   β”œβ”€β”€ typedefs                    # typedefs
    β”‚   β”‚   └── typedefs.dart
    β”‚   β”œβ”€β”€ usecase                     # base usecase class
    β”‚   β”‚   └── usecase.dart
    β”‚   └── widgets                     # widgets those are shared across different features
    β”‚       β”œβ”€β”€ app_error_widget.dart
    β”‚       β”œβ”€β”€ network_image.dart
    β”‚       β”œβ”€β”€ svg_image.dart
    β”‚       └── widgets.dart
    └── features                        # features contains all the features following same architecture as app
        β”œβ”€β”€ auth
        β”‚   β”œβ”€β”€ auth.dart
        β”‚   β”œβ”€β”€ data
        β”‚   β”‚   β”œβ”€β”€ database
        β”‚   β”‚   β”œβ”€β”€ dtos
        β”‚   β”‚   β”œβ”€β”€ graphql
        β”‚   β”‚   β”œβ”€β”€ mappers
        β”‚   β”‚   β”œβ”€β”€ repository
        β”‚   β”‚   └── source
        β”‚   β”œβ”€β”€ domain
        β”‚   β”‚   β”œβ”€β”€ entities
        β”‚   β”‚   β”œβ”€β”€ repository
        β”‚   β”‚   └── usecases
        β”‚   └── presentation
        β”‚       β”œβ”€β”€ blocs
        β”‚       └── pages
        β”‚           └── login_page.dart
        └── dashboard
            β”œβ”€β”€ dashboard.dart
            β”œβ”€β”€ data
            β”‚   β”œβ”€β”€ database
            β”‚   β”‚   β”œβ”€β”€ daos
            β”‚   β”‚   └── tables.dart
            β”‚   β”œβ”€β”€ dtos
            β”‚   β”‚   β”œβ”€β”€ company
            β”‚   β”‚   └── launch
            β”‚   β”œβ”€β”€ graphql
            β”‚   β”‚   β”œβ”€β”€ mutations.dart
            β”‚   β”‚   └── queries.dart
            β”‚   β”œβ”€β”€ mappers
            β”‚   β”‚   └── mappers.dart
            β”‚   β”œβ”€β”€ repository
            β”‚   β”‚   └── dashboard_repository_impl.dart
            β”‚   └── source
            β”‚       β”œβ”€β”€ dashboard_local_source.dart
            β”‚       └── dashboard_remote_source.dart
            β”œβ”€β”€ domain
            β”‚   β”œβ”€β”€ entities
            β”‚   β”œβ”€β”€ repository
            β”‚   β”‚   └── dashboard_repository.dart
            β”‚   └── usecases
            └── presentation
                β”œβ”€β”€ blocs
                β”‚   β”œβ”€β”€ company
                β”‚   β”œβ”€β”€ launches
                β”‚   β”‚   β”œβ”€β”€ details
                β”‚   β”‚   β”œβ”€β”€ latest
                β”‚   β”‚   └── upcoming
                β”‚   └── vehicles
                β”‚       β”œβ”€β”€ details
                β”‚       └── list
                β”œβ”€β”€ pages
                β”‚   └── dashboard_page.dart
                └── widgets
                    └── widgets.dart

Packages used in template