App Shamo – 鞋店 (全栈 Laravel Flutter)
一个电商示例应用 – Doni Mulya Syahputra 的鞋店。欢迎并享受我的代码,为您的学习进步。对于样板代码,我使用了 Wisnu G. Saputra 的 Flutter Starter。
Flutter Starter
由 Wisnu G. Saputra 创建的 Flutter Starter 项目。
预览 ?
| Android | iOS | Web |
|---|---|---|
![]() |
![]() |
![]() |
入门?
此项目包含 3 种风味
- 开发
- 测试
- 生产
要运行所需的风味,可以使用 VSCode/Android Studio 中的启动配置,或使用以下命令
# 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
*Flutter Starter 可在 iOS、Android 和 Web 上运行。
构建应用?
要构建所需的 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
有关 release 构建,请参阅 Android 和 iOS 平台的文档。
正在运行测试?
要运行所有单元和 widget 测试,请使用以下命令
$ flutter test --coverage --test-randomize-ordering-seed random
要查看生成的覆盖率报告,您可以使用 lcov。
# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/
# Open Coverage Report
$ open coverage/index.html
正在处理翻译?
此项目依赖于 flutter_localizations 并遵循 Flutter 的官方国际化指南。
添加字符串
- 要添加新的本地化字符串,请打开位于
lib/l10n/arb/app_en.arb的app_en.arb文件。
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
}
}
- 然后添加新的键/值和描述
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
},
"helloWorld": "Hello World",
"@helloWorld": {
"description": "Hello World Text"
}
}
- 使用新字符串
import 'package:flutter_starter/l10n/l10n.dart';
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return Text(l10n.helloWorld);
}
添加支持的区域设置
更新位于 ios/Runner/Info.plist 的 Info.plist 中的 CFBundleLocalizations 数组,以包含新的区域设置。
...
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>
...
添加翻译
- 对于每个支持的区域设置,请在
lib/l10n/arb中添加一个新的 ARB 文件。
├── l10n
│ ├── arb
│ │ ├── app_en.arb
│ │ └── app_es.arb
- 将翻译后的字符串添加到每个
.arb文件中
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"
}
}
使用路由导航?
使用原子设计组件?
更多关于 **原子设计:** https://atomicdesign.bradfrost.com/
使用的包?
| 名称 | 类别 | 信息 |
|---|---|---|
| flutter_bloc | 状态管理 | – |
| bloc_concurrency | 状态管理 | – |
| dartz | 函数式编程 | – |
| equatable | 对象相等性 | – |
| get_it | 依赖注入 | – |
| go_router | 路由导航 v2 | – |
| hive | 本地数据库 | – |
| intl | 国际化与本地化 | – |
| internet_connection_checker | 实用工具 | – |
| json_annotation | 实用工具 | – |
| path_provider | 实用工具 | – |
| stream_transformer | 实用工具 | – |


