项目作者: devayansarkar

项目描述 :
Flutter boiler plate app with BLoC architecture, authentication, navigation, Lottie animation and internationalisation
高级语言: Dart
项目地址: git://github.com/devayansarkar/flutter-bloc-authentication-navigation.git
创建时间: 2020-06-22T15:29:12Z
项目社区:https://github.com/devayansarkar/flutter-bloc-authentication-navigation

开源协议:MIT License

下载


Flutter boiler plate project

A new Flutter project.

Features

  • Authentication with Firebase
  • BLoC architecture
  • Internationalization
  • Environmnetalized application
  • Navigation

Running the app.

The application is environmentalized.

All the values that can be different per envionment are housed in environment.dart

Currently, there are three environments added, development and production.

Get Firebase configuration for iOS and Android.

Follow this guide and get credentials for Android and iOS.

  • Change the package of the project from com.flutter.mobile to your.package.com
  • Change the name of the application from flutter_mobile_application to your_application_name
  • Create a Firebase project in console.
  • Add android and ios apps
  • Replace google-services.json present in /android/app/google-services.json with the one you created
  • Replace GoogleService-Info.plist present in /ios/Runner/GoogleService-Info.plist with the one you created
  • Once replaced, build the app and the app should be able to interact with Firebase.

Running the app locally

Make sure everything is installed by running flutter doctor

  • Run an emulator
  • Run flutter run lib/main_developement.dart. This will run the app with developement env variables.

Flutter VSCode Plugins to make life easier

  • Flutter
  • Awesome Flutter Snippets
  • Flutter Intl

You can add confugurations in the run section for the various evironments:

  1. {
  2. "configurations": [
  3. {
  4. "name": "Dev",
  5. "type": "dart",
  6. "request": "launch",
  7. "program": "lib/main_development.dart"
  8. },
  9. {
  10. "name": "Prod",
  11. "type": "dart",
  12. "request": "launch",
  13. "program": "lib/main_production.dart"
  14. }
  15. ]
  16. }

Application model

json_serializable and json_annotation is used to generate code for JSON serialization and deserialization.

*.g.dart file is generate per model class that has all the generated code.

Generating serialization and deserialization code

  • Add a model under a models folder in a feature package.
  • annotate with json_annotations as shown in this example
  • Run flutter pub run build_runner build. The generated files will be placed in the same folder as the original model.
  • DO NOT EDIT the *.g.dart files manually. Any subsequent build will replace the manually edited files.

    You might see some errors but it can be ignored.

    Application content

    Default language, en is already added.

intl_utils is used to generate contents for the app.

Content is generated from intl_<lang>.arb files in l10n.

Content classes are generates in compile time and used to refer the content strings. A generated folder contains all the content.

Generating content from *.arb

To generate content

  • Add intl_<lang>.arb under l10n folder.
  • Run flutter pub run intl_utils:generate to generate content classes for the languages.
  • Make sure to add the files in vcs
  • DO NOT EDIT the content files manually. Any subsequent build will replace the manually edited files.

Running a release

To run a release of development version of the app

  1. flutter clean
  2. flutter build apk --release lib/main_development.dart

To run a release of production version of the app

  1. flutter clean
  2. flutter build apk --release lib/main_production.dart

Folder structure

  1. .
  2. ├── assets
  3. └── images
  4. └── lib
  5. ├── app
  6. ├── common
  7. ├── bloc
  8. └── connectivity
  9. ├── constants
  10. ├── network
  11. ├── routes
  12. ├── styles
  13. └── widgets
  14. ├── features
  15. ├── authentication
  16. ├── bloc
  17. └── repository
  18. ├── landing
  19. └── ui
  20. ├── main
  21. ├── bloc
  22. ├── models
  23. ├── pages
  24. ├── account
  25. ├── bloc
  26. ├── repositories
  27. └── ui
  28. └── widgets
  29. ├── feed
  30. └── ui
  31. ├── home
  32. └── ui
  33. └── notification
  34. └── ui
  35. ├── repositories
  36. └── ui
  37. └── widgets
  38. ├── signin
  39. ├── bloc
  40. ├── respositories
  41. └── ui
  42. └── widgets
  43. └── signup
  44. ├── bloc
  45. ├── respositories
  46. └── ui
  47. └── widgets
  48. ├── generated
  49. └── intl
  50. └── l10n

Screenshots