A random Coffee images app built with Flutter for VeryGoodVentures
To run the desired project either use the launch configuration in VSCode/Android Studio or use the following commands:
$ flutter run
or
$ flutter -d your_device_id run
*Very Good Coffee works on iOS and Android devices.
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
NOTE: To run all unit and widget tests of a package, use the same command from inside that package or use the Test Explorer of Visual Studio Code to run all test at once
This project is setup to translate all string content and adjust layouts to match expectations for a user's device locale.
This project generates localized messages based on arb files found in the lib/l10n/arb
directory.
To add new strings to the project, add an entry to the app_en.arb
file. Each entry requires:
- A key-value pair -- the key should be a short camelCase name for the string, and the value is the string itself.
- A matching dictionary entry to provide some flavor text in the form of a description comment.
A complete entry in the English file for a new string looks like this:
-- app_en.arb --
{
"sampleKey": "Very Good Coffee",
"@sampleKey": {
"description": "The title of the application"
}
}
-- app_es.arb --
{
"sampleKey": "Un muy buen café",
"@sampleKey": {
"description": "El título de la aplicación"
}
}
Each additional locale must be added to the supportedLocales
property when configuring the top level MaterialApp
.
To retrieve strings in code, we need to import the generated AppLocalizations
class for compiler-safe references.
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Then, given a BuildContext context
, localized string values are retrieved in one line using the string key you specified in app_en.arb
and any other language file:
final localizedString = AppLocalizations.of(context).stringKey
- Flutter 3.3.3
- Editor: VS Code
- Editor Extensions:
- Format Rules:
- Editor: Detect Indentation: true
- Editor: Format On Save: true
- Dart: Line Length: 80
The primary UI state management pattern employed within this application is the BLoC Pattern.
The project is structured by grouping files around specific features.
Built by Pablo Tortosa