Skip to content

iamthejahid/flutter_template-riverpod-hive-go_router-quickstarter

Repository files navigation

Flutter-template-riverpod-go_router-hive

Description 📜

This project follows a specific structure and template for Flutter app creation. It's based on a template that originally utilized a robust CLI, following a block architecture. However, I adapted it to use Riverpod, making significant modifications to align it with Riverpod's principles. Additionally, the template includes numerous predefined widgets, which I customize based on project requirements. I adhere to Andrea's "Feature-first" approach, with my own modifications. I don't rely on Riverpod code generation and instead heavily utilize StateNotifier over other notifiers. So, happy coding to me!

Folder Structure 📁

.
├── .DS_Store
├── .dart_tool
│   ├── .DS_Store
│   ├── dartpad
│   ├── extension_discovery
│   ├── flutter_build
│   ├── flutter_gen
│   ├── package_config.json
│   ├── package_config_subset
│   └── version
├── .env
├── .env-example.txt
├── .flutter-plugins
├── .flutter-plugins-dependencies
├── .github
│   ├── PULL_REQUEST_TEMPLATE.md
│   ├── cspell.json
│   ├── dependabot.yaml
│   └── workflows
├── .gitignore
├── .vscode
│   ├── extensions.json
│   └── launch.json
├── README.md
├── analysis_options.yaml
├── android
│   ├── .DS_Store
│   ├── .gitignore
│   ├── .gradle
│   ├── app
│   ├── build.gradle
│   ├── gradle
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── local.properties
│   └── settings.gradle
├── assets
├── build
│   ├── .DS_Store
│   ├── .last_build_id
│   ├── 38042a41806411273a1a36c629ba9713.cache.dill.track.dill
│   ├── 39f4bf50ad275767c79aa66def67de4c
│   ├── 8f66b8507f29113a13ef8e9654d2db8a
│   ├── app
│   ├── flutter_image_compress_common
│   ├── flutter_plugin_android_lifecycle
│   ├── fluttertoast
│   ├── image_picker_android
│   ├── location
│   ├── path_provider_android
│   ├── sqflite
│   └── url_launcher_android
├── coverage_badge.svg
├── ios
│   ├── .DS_Store
│   ├── .gitignore
│   ├── Flutter
│   ├── Podfile
│   ├── Runner
│   ├── Runner.xcodeproj
│   ├── Runner.xcworkspace
│   └── RunnerTests
├── l10n.yaml
├── lib
│   ├── .DS_Store
│   ├── app
│   ├── bootstrap.dart
│   ├── core
│   ├── features
│   ├── l10n
│   ├── main_development.dart
│   ├── main_production.dart
│   └── main_staging.dart
├── packages
│   ├── .DS_Store
│   ├── app_ui
│   └── app_utils
├── pubspec.lock
├── pubspec.yaml
├── test
├── web
│   ├── favicon.png
│   ├── icons
│   ├── index.html
│   └── manifest.json
└── windows
    ├── .DS_Store
    ├── .gitignore
    ├── CMakeLists.txt
    ├── flutter
    └── runner

Getting Started 🚀

coverage

style: very good analysis

License: MIT

Generated by the Very Good CLI 🤖

A Very Good Project created by Very Good CLI.


This project contains 3 flavors:

  • development

  • staging

  • production

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

# 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

*this app works on iOS, Android, Web, and Windows.

Building-apk ⚙️

# Development

$  flutter build apk  --flavor  development  --target  lib/main_development.dart

  

# Staging

$  flutter build apk  --flavor  staging  --target  lib/main_staging.dart

  

# Production

$  flutter build apk  --flavor  production  --target  lib/main_production.dart

Running Tests 🧪

To run all unit and widget 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",

"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:your_project/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.

...

  

<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",

"counterAppBarTitle": "Counter",

"@counterAppBarTitle": {

"description": "Text shown in the AppBar of the Counter Page"

}

}

app_es.arb


{

"@@locale": "es",

"counterAppBarTitle": "Contador",

"@counterAppBarTitle": {

"description": "Texto mostrado en la AppBar de la página del contador"

}

}

Generating Translations

To use the latest translations changes, you will need to generate them:

  1. Generate localizations for the current project:
flutter  gen-l10n  --arb-dir="lib/l10n/arb"

Alternatively, run flutter run and code generation will take place automatically.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published