一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

photobooth:实践指南

时间:2026-09-10 17:38:01 编辑:袖梨 来源:一聚教程网

真正理解photobooth,要从它处理的任务开始:Google I/O 2021 Photo Booth 使用 Flutter 和 Firebase 构建。把它放到日常自动化流程中,最容易暴露的是输入边界、依赖和失败处理如果不清楚就很难稳定复用,不能只看演示是否顺利。与其反复读介绍,不如用一项范围明确的真实任务完成最小试跑,再依据配置时间、输出质量、异常信息和维护痕迹做取舍。我会把它列入愿意先做小范围验证并复查原始文档的团队的候选清单,而不是仅凭项目介绍直接纳入生产。

I/O 照相亭

[![io_photobooth][build_status_badge]][workflow_link]

![style: very good analysis][very_good_analysis_badge] [![License: MIT][license_badge]][license_link]

A Photo Booth built with Flutter and Firebase for Google I/O 2021.

Try it now and learn about how it's made.

Built by Very Good Ventures in partnership with Google

Created using Very Good CLI

Getting Started

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

$ flutter run -d chrome

*I/O Photo Booth works on Web.

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

使用翻译

该项目依赖于 flutter_localizations 并遵循 Flutter 官方国际化指南。

添加字符串

  1. 要添加新的本地化字符串,请打开位于 lib/l10n/arb/app_en.arbapp_en.arb 文件。
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    }
}
  1. 然后添加新的key/value和描述
{
    "@@locale": "en",
    "counterAppBarTitle": "Counter",
    "@counterAppBarTitle": {
        "description": "Text shown in the AppBar of the Counter Page"
    },
    "helloWorld": "Hello World",
    "@helloWorld": {
        "description": "Hello World Text"
    }
}
  1. 使用新字符串
import 'package:io_photobooth/l10n/l10n.dart';

@override
Widget build(BuildContext context) {
  final l10n = context.l10n;
  return Text(l10n.helloWorld);
}

添加翻译

  1. 对于每个受支持的区域设置,在 lib/l10n/arb 中添加新的 ARB 文件。
├── l10n
│   ├── arb
│   │   ├── app_en.arb
│   │   └── app_es.arb
  1. 将翻译后的字符串添加到每个 .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"
    }
}

热门栏目