项目作者: flutter

项目描述 :
Google I/O 2021 Photo Booth built with Flutter and Firebase
高级语言: Dart
项目地址: git://github.com/flutter/photobooth.git
创建时间: 2021-03-09T21:22:38Z
项目社区:https://github.com/flutter/photobooth

开源协议:MIT License

下载


I/O Photo Booth

Photo Booth Header

io_photobooth
coverage
style: very good analysis
License: MIT

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:

  1. $ flutter run -d chrome

*I/O Photo Booth works on Web.


Running Tests 🧪

To run all unit and widget tests use the following command:

  1. $ flutter test --coverage --test-randomize-ordering-seed random

To view the generated coverage report you can use lcov.

  1. # Generate Coverage Report
  2. $ genhtml coverage/lcov.info -o coverage/
  3. # Open Coverage Report
  4. $ open coverage/index.html

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.
  1. {
  2. "@@locale": "en",
  3. "counterAppBarTitle": "Counter",
  4. "@counterAppBarTitle": {
  5. "description": "Text shown in the AppBar of the Counter Page"
  6. }
  7. }
  1. Then add a new key/value and description
  1. {
  2. "@@locale": "en",
  3. "counterAppBarTitle": "Counter",
  4. "@counterAppBarTitle": {
  5. "description": "Text shown in the AppBar of the Counter Page"
  6. },
  7. "helloWorld": "Hello World",
  8. "@helloWorld": {
  9. "description": "Hello World Text"
  10. }
  11. }
  1. Use the new string
  1. import 'package:io_photobooth/l10n/l10n.dart';
  2. @override
  3. Widget build(BuildContext context) {
  4. final l10n = context.l10n;
  5. return Text(l10n.helloWorld);
  6. }

Adding Translations

  1. For each supported locale, add a new ARB file in lib/l10n/arb.
  1. ├── l10n
  2. ├── arb
  3. ├── app_en.arb
  4. └── app_es.arb
  1. Add the translated strings to each .arb file:

app_en.arb

  1. {
  2. "@@locale": "en",
  3. "counterAppBarTitle": "Counter",
  4. "@counterAppBarTitle": {
  5. "description": "Text shown in the AppBar of the Counter Page"
  6. }
  7. }

app_es.arb

  1. {
  2. "@@locale": "es",
  3. "counterAppBarTitle": "Contador",
  4. "@counterAppBarTitle": {
  5. "description": "Texto mostrado en la AppBar de la página del contador"
  6. }
  7. }