|
1 | | -# Example |
2 | | - |
3 | | -![coverage][coverage_badge] |
4 | | -[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link] |
5 | | -[![License: MIT][license_badge]][license_link] |
6 | | - |
7 | | -Generated by the [Very Good CLI][very_good_cli_link] 🤖 |
8 | | - |
9 | | -A Very Good Project created by Very Good CLI. |
10 | | - |
11 | | ---- |
12 | | - |
13 | | -## Getting Started 🚀 |
14 | | - |
15 | | -This project contains 3 flavors: |
16 | | - |
17 | | -- development |
18 | | -- staging |
19 | | -- production |
20 | | - |
21 | | -To run the desired flavor either use the launch configuration in VSCode/Android Studio or use the following commands: |
22 | | - |
23 | | -```sh |
24 | | -# Development |
25 | | -$ flutter run --flavor development --target lib/main_development.dart |
26 | | - |
27 | | -# Staging |
28 | | -$ flutter run --flavor staging --target lib/main_staging.dart |
29 | | - |
30 | | -# Production |
31 | | -$ flutter run --flavor production --target lib/main_production.dart |
32 | | -``` |
33 | | - |
34 | | -_\*Example works on iOS, Android, Web, and Windows._ |
35 | | - |
36 | | ---- |
37 | | - |
38 | | -## Running Tests 🧪 |
39 | | - |
40 | | -To run all unit and widget tests use the following command: |
41 | | - |
42 | | -```sh |
43 | | -$ flutter test --coverage --test-randomize-ordering-seed random |
44 | | -``` |
45 | | - |
46 | | -To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov). |
47 | | - |
48 | | -```sh |
49 | | -# Generate Coverage Report |
50 | | -$ genhtml coverage/lcov.info -o coverage/ |
51 | | - |
52 | | -# Open Coverage Report |
53 | | -$ open coverage/index.html |
54 | | -``` |
55 | | - |
56 | | ---- |
57 | | - |
58 | | -## Working with Translations 🌐 |
59 | | - |
60 | | -This project relies on [flutter_localizations][flutter_localizations_link] and follows the [official internationalization guide for Flutter][internationalization_link]. |
61 | | - |
62 | | -### Adding Strings |
63 | | - |
64 | | -1. To add a new localizable string, open the `app_en.arb` file at `lib/l10n/arb/app_en.arb`. |
65 | | - |
66 | | -```arb |
67 | | -{ |
68 | | - "@@locale": "en", |
69 | | - "counterAppBarTitle": "Counter", |
70 | | - "@counterAppBarTitle": { |
71 | | - "description": "Text shown in the AppBar of the Counter Page" |
72 | | - } |
73 | | -} |
74 | | -``` |
75 | | - |
76 | | -2. Then add a new key/value and description |
77 | | - |
78 | | -```arb |
79 | | -{ |
80 | | - "@@locale": "en", |
81 | | - "counterAppBarTitle": "Counter", |
82 | | - "@counterAppBarTitle": { |
83 | | - "description": "Text shown in the AppBar of the Counter Page" |
84 | | - }, |
85 | | - "helloWorld": "Hello World", |
86 | | - "@helloWorld": { |
87 | | - "description": "Hello World Text" |
88 | | - } |
89 | | -} |
90 | | -``` |
91 | | - |
92 | | -3. Use the new string |
| 1 | +# Fretboard Example |
93 | 2 |
|
94 | 3 | ```dart |
95 | | -import 'package:example/l10n/l10n.dart'; |
96 | | -
|
97 | | -@override |
98 | | -Widget build(BuildContext context) { |
99 | | - final l10n = context.l10n; |
100 | | - return Text(l10n.helloWorld); |
| 4 | +class SongPage extends StatelessWidget { |
| 5 | + const SongPage({super.key}); |
| 6 | +
|
| 7 | + @override |
| 8 | + Widget build(BuildContext context) { |
| 9 | + return const Scaffold( |
| 10 | + body: Center( |
| 11 | + /// The `Fretboard` widget will resize itself according |
| 12 | + /// to the given size and notes matrix. |
| 13 | + child: Fretboard( |
| 14 | + size: Size(400, 240), |
| 15 | + theme: FretboardTheme( |
| 16 | + tonicColor: Color.fromARGB(255, 208, 83, 74), |
| 17 | + noteColor: Color.fromARGB(255, 69, 140, 198), |
| 18 | + fretColor: Colors.black, |
| 19 | + stringColor: Colors.grey, |
| 20 | + ), |
| 21 | + notesMatrix: [ |
| 22 | + ['', 'o', '', '', 'o', ''], |
| 23 | + ['', 'o', '', '', 'o', ''], |
| 24 | + ['', 'o', '', 'o', '', ''], |
| 25 | + ['', 'o', '', '0', '', ''], |
| 26 | + ['', 'o', '', '', 'o', ''], |
| 27 | + ['', '0', '', '', 'o', ''], |
| 28 | + ], |
| 29 | + ), |
| 30 | + ), |
| 31 | + ); |
| 32 | + } |
101 | 33 | } |
102 | | -``` |
103 | | - |
104 | | -### Adding Supported Locales |
105 | | - |
106 | | -Update the `CFBundleLocalizations` array in the `Info.plist` at `ios/Runner/Info.plist` to include the new locale. |
107 | | - |
108 | | -```xml |
109 | | - ... |
110 | | - |
111 | | - <key>CFBundleLocalizations</key> |
112 | | - <array> |
113 | | - <string>en</string> |
114 | | - <string>es</string> |
115 | | - </array> |
116 | | - |
117 | | - ... |
118 | | -``` |
119 | | - |
120 | | -### Adding Translations |
121 | | - |
122 | | -1. For each supported locale, add a new ARB file in `lib/l10n/arb`. |
123 | | - |
124 | | -``` |
125 | | -├── l10n |
126 | | -│ ├── arb |
127 | | -│ │ ├── app_en.arb |
128 | | -│ │ └── app_es.arb |
129 | | -``` |
130 | | - |
131 | | -2. Add the translated strings to each `.arb` file: |
132 | | - |
133 | | -`app_en.arb` |
134 | | - |
135 | | -```arb |
136 | | -{ |
137 | | - "@@locale": "en", |
138 | | - "counterAppBarTitle": "Counter", |
139 | | - "@counterAppBarTitle": { |
140 | | - "description": "Text shown in the AppBar of the Counter Page" |
141 | | - } |
142 | | -} |
143 | | -``` |
144 | | - |
145 | | -`app_es.arb` |
146 | | - |
147 | | -```arb |
148 | | -{ |
149 | | - "@@locale": "es", |
150 | | - "counterAppBarTitle": "Contador", |
151 | | - "@counterAppBarTitle": { |
152 | | - "description": "Texto mostrado en la AppBar de la página del contador" |
153 | | - } |
154 | | -} |
155 | | -``` |
156 | | - |
157 | | -[coverage_badge]: coverage_badge.svg |
158 | | -[flutter_localizations_link]: https://api.flutter.dev/flutter/flutter_localizations/flutter_localizations-library.html |
159 | | -[internationalization_link]: https://flutter.dev/docs/development/accessibility-and-localization/internationalization |
160 | | -[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg |
161 | | -[license_link]: https://opensource.org/licenses/MIT |
162 | | -[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg |
163 | | -[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis |
164 | | -[very_good_cli_link]: https://github.com/VeryGoodOpenSource/very_good_cli |
| 34 | +``` |
0 commit comments