tetzgabriel / very_good_coffee_app

Flutter app to display random coffee images from the internet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Very Good Coffee App

coverage style: very good analysis License: MIT

Generated by the Very Good CLI πŸ€–

A Very Good app to show you very good coffee pictures


Getting Started πŸš€

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

*Very Good Coffee App works on iOS and Android.


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

Github actions βš™οΈ

Initially, this project used VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1 as a github action, but I kept encountering problems with the unit tests of GetIt while running them with the action. So, as a temporary measure I changed it to use subosito/flutter-action@v2.


Architecture πŸ“

This app uses the layered architecture from Very Good CLI by default.
In order to develop the functions needed for the app I decided to incorporate the clean-architecture in each feature project. The folder structure follows the example:

β”œβ”€β”€ lib
β”‚   β”œβ”€β”€ {feature}
β”‚   β”‚   β”œβ”€β”€ data
β”‚   β”‚   β”‚   β”œβ”€β”€ datasources
β”‚   β”‚   β”‚   └── repositories
β”‚   β”‚   β”œβ”€β”€ domain
β”‚   β”‚   β”‚   β”œβ”€β”€ entities
β”‚   β”‚   β”‚   β”œβ”€β”€ repositories
β”‚   β”‚   β”‚   └── usecases
β”‚   β”‚   └── presentation
β”‚   β”‚   β”‚   β”œβ”€β”€ bloc
β”‚   β”‚   β”‚   β”œβ”€β”€ view
β”‚   β”‚   β”‚   └── {feature}.dart

Using the app πŸ“±

  1. To generate a coffee image all you have to do is open the app.
  2. If this image is not a very good coffee image, you can tap the Try new image button and a new one will be generated
  3. If this is a very good coffee image, you can tap the Add to favorites button and it will be saved on the favorites page.
  4. To see all your favorites coffee images, you can tap the Go to favorites button and a gallery like page will show you all the very good coffee images you saved.
Home page Favorites page
Captura de Tela 2023-02-16 aΜ€s 23 55 47 Captura de Tela 2023-02-16 aΜ€s 23 55 34

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:very_good_coffee_app/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"
    }
}

Already supported languages πŸ“–

The strings used in this app are available both in English and Spanish.

About

Flutter app to display random coffee images from the internet


Languages

Language:Dart 65.1%Language:C++ 18.5%Language:CMake 9.1%Language:HTML 4.4%Language:Ruby 1.5%Language:C 0.8%Language:Swift 0.4%Language:Kotlin 0.2%Language:Objective-C 0.0%