An application that imitates ecommerce.
The assets directory houses images, fonts, and any other files you want to
include with your application.
The assets/images directory contains resolution-aware images.
We use flutter_gen to generate asset classes like Assets and FontFamily. This helps us avoid commiting typos when writing an asset file name and to access additional properities like height of images.
The configuration for this tool is already on your pubspec. Also the flutter_gen_runner is packed, so your asset classes are generated when you run:
dart run build_runner build --delete-conflicting-outputsThen, to reference the asset you can call:
Assets.images.noScopeLogo.image(height: 42),*Note: Remember to add your asset directories to your pubspec too.
This project relies on flutter_localizations and follows the official internationalization guide for Flutter.
It generates localized messages based on arb files found in the lib/src/l10n directory.
- To add a new localizable string, open the
app_en.arbfile atlib/l10n/arb/app_en.arb.
{
"@@locale": "en",
"hello": "Hello!",
"@hello": {
"description": "Hello message"
}
}
- Then add a new key/value and description.
{
"@@locale": "en",
"hello": "Hello!",
"@hello": {
"description": "Hello message"
},
"goodbye": "Good-bye!",
"@goodbye": {
"description": "Good-bye message"
}
}
- Use the new string.
import 'package:crypto_stats/l10n/l10n.dart';
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return Text(l10n.hello);
}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>
...To support additional languages, please visit the tutorial on Internationalizing Flutter apps.
- For each supported locale, add a new ARB file in
lib/l10n/arb.
├── l10n
│ ├── arb
│ │ ├── app_en.arb
│ │ └── app_es.arb
- Add the translated strings to each
.arbfile:
app_en.arb
{
"@@locale": "en",
"hello": "Hello!",
"@hello": {
"description": "Hello message"
}
}
app_es.arb
{
"@@locale": "es",
"hello": "¡Hola!",
"@hello": {
"description": "Mensaje de hola"
}
}