Skip to content

Commit

Permalink
Merge pull request #7 from salihgueler/starter_new_era
Browse files Browse the repository at this point in the history
amplify_starter: New Era
  • Loading branch information
salihgueler authored Feb 1, 2023
2 parents 2686a11 + 3af79b9 commit e260a79
Show file tree
Hide file tree
Showing 230 changed files with 2,381 additions and 1,121 deletions.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
Thanks for contributing!
Provide a description of your changes below and a general summary in the title
Please look at the following checklist to ensure that your PR can be accepted quickly:
-->

## Description

<!--- Describe your changes in detail -->

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "pub"
directory: "/"
schedule:
interval: "daily"
13 changes: 13 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: {{project_name.snakeCase()}}

on: [pull_request, push]

jobs:
semantic-pull-request:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1

build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
with:
flutter_channel: stable
flutter_version: 3.7.0
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# AWS Amplify Starter Project

[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)
[![Powered by Mason][mason_badge]][mason_link]

A highly opinionated AWS Amplify starter project. It will work as a Todo application.

The project uses:
- [Amplify Authenticator](https://pub.dev/packages/amplify_authenticator), for authentication
- [Amplify Datastore](https://pub.dev/packages/amplify_datastore) for saving data and real time updates
- [bloc](https://pub.dev/packages/bloc) for state management.
A highly opinionated AWS Amplify starter project. Based on Very Good Core.

## Requirements 🚀

Expand All @@ -32,7 +27,7 @@ Now generate the files.
You can either fill in the variables on your CLI:

```shell
mason make amplify_starter --project_name "AWS Amplify Todo" --project_organization "com.example"
mason make amplify_starter --project_name "AWS Amplify Starter" --project_organization "com.example"
```

**OR**
Expand All @@ -51,3 +46,5 @@ mason make amplify_starter
| `project_organization` | Organization of your project | com.example | `string` |


[mason_badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge
[mason_link]: https://github.com/felangel/mason
1 change: 0 additions & 1 deletion __brick__/{{project_name}}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ migrate_working_dir/
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions __brick__/{{project_name}}/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dart-code.dart-code",
"dart-code.flutter",
"felixangelov.bloc"
]
}
34 changes: 34 additions & 0 deletions __brick__/{{project_name}}/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch development",
"request": "launch",
"type": "dart",
"program": "lib/main_development.dart",
"args": [
"--flavor",
"development",
"--target",
"lib/main_development.dart"
]
},
{
"name": "Launch staging",
"request": "launch",
"type": "dart",
"program": "lib/main_staging.dart",
"args": ["--flavor", "staging", "--target", "lib/main_staging.dart"]
},
{
"name": "Launch production",
"request": "launch",
"type": "dart",
"program": "lib/main_production.dart",
"args": ["--flavor", "production", "--target", "lib/main_production.dart"]
}
]
}
162 changes: 150 additions & 12 deletions __brick__/{{project_name}}/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,160 @@
# {{project_name.sentenceCase()}}

[![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason)
[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link][![License: MIT][license_badge]][license_link][![Powered by Mason][mason_badge]][mason_link]

An opinionated Flutter project for starting with AWS Amplify.
An opinionated Flutter project for starting with AWS Amplify. It uses the Very Good Core project for example project setup.

The project uses:
- [Amplify Authenticator](https://pub.dev/packages/amplify_authenticator), for authentication
- [Amplify Datastore](https://pub.dev/packages/amplify_datastore) for saving data and real time updates
- [bloc](https://pub.dev/packages/bloc) for state management.
-
## Getting Started
- [Amplify Flutter](https://pub.dev/packages/amplify_flutter), for Amplify Setup

The project is structured and configured for your usage. Only thing you have to do is to change your changes to the cloud __IF__ you have not done it yet.
_For an Amplify Starter Application with a todo example, check out amplify_todo_starter brick._

```shell
amplify push
## Getting Started 🚀

This project contains 3 flavors:

- development
- staging
- production

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

```sh
# 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
```

_\*Amplify Starter Template works on iOS, Android, Web, and Windows._

---

## Running Tests 🧪

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

```sh
$ flutter test --coverage --test-randomize-ordering-seed random
```

With this command, you are pushing your changes to the cloud. These changes will take a couple of minutes so in the meantime enjoy your coffee.
To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov).

```sh
# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
$ open coverage/index.html
```

---

## Working with Translations 🌐

This project relies on [flutter_localizations][flutter_localizations_link] and follows the [official internationalization guide for Flutter][internationalization_link].

### Adding Strings

1. To add a new localizable string, open the `app_en.arb` file at `lib/l10n/arb/app_en.arb`.

```arb
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
}
}
```

2. Then add a new key/value and description

```arb
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
},
"helloWorld": "Hello World",
"@helloWorld": {
"description": "Hello World Text"
}
}
```

3. Use the new string

```dart
import 'package:{{project_name.sentenceCase()}}/l10n/l10n.dart';
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return Text(l10n.helloWorld);
}
```

### Adding Supported Locales

Update the `CFBundleLocalizations` array in the `Info.plist` at `ios/Runner/Info.plist` to include the new locale.

```xml
...

<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>

...
```

### Adding Translations

1. For each supported locale, add a new ARB file in `lib/l10n/arb`.

```
├── l10n
│ ├── arb
│ │ ├── app_en.arb
│ │ └── app_es.arb
```

2. Add the translated strings to each `.arb` file:

`app_en.arb`

```arb
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
}
}
```

`app_es.arb`

```arb
{
"@@locale": "es",
"counterAppBarTitle": "Contador",
"@counterAppBarTitle": {
"description": "Texto mostrado en la AppBar de la página del contador"
}
}
```

Once it is done, go ahead and run your application!
[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis
[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license_link]: https://opensource.org/licenses/MIT
[mason_badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge
[mason_link]: https://github.com/felangel/mason
1 change: 0 additions & 1 deletion __brick__/{{project_name}}/add_api_request.json

This file was deleted.

1 change: 0 additions & 1 deletion __brick__/{{project_name}}/add_auth_request.json

This file was deleted.

33 changes: 2 additions & 31 deletions __brick__/{{project_name}}/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

analyzer:
exclude:
- lib/models

include: package:very_good_analysis/analysis_options.3.1.0.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
public_member_api_docs: false
Loading

0 comments on commit e260a79

Please sign in to comment.