Generated by the Very Good CLI 🤖
A habit tracking app based on the Atomic Habits
-
Create a Fork
- Visit the Transform X GitHub repository, and click 'Fork'.
- Select the owner and repository name and click “Create Fork”
-
Set up the upstream branch
- Open Terminal.
- List the current configured remote repository for your fork.
$ git remote -v > origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch) > origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
- Specify a new remote upstream repository that will be synced with the fork.
git remote add upstream https://github.com/MayurSMahajan/transformX.git
- Verify the new upstream repository you've specified for your fork.
$ git remote -v > origin https://github.com/YOUR_USERNAME/transformX.git > origin https://github.com/YOUR_USERNAME/transformX.git > upstream https://github.com/MayurSMahajan/transformX.git > upstream https://github.com/MayurSMahajan/transformX.git
-
Running local project
- Begin by ensuring that the script execution policy is enabled on your Windows system. For guidance, refer Enabling Script Execution Policy.
- Install very_good_cli as a global package.
dart pub global activate very_good_cli
- After that from the root directory run
very_good packages get --recursive
- If the above command does not install all the dependencies in all your packages then you can try manually running
flutter pub get
within all your packages insidetransformx/packages
folder
-
Setting up Firebase
- Visit “Firebase” and login with your Google Account.
- Click on the "Console" button located in the top-right corner and create a new project.
- Within the project overview, choose the Flutter option.
- Install the Firebase CLI by executing the following command in your terminal:
npm install -g firebase-tools
- Install the FlutterFire CLI using the following command:
dart pub global activate flutterfire_cli
- Then login to Firebase using the following command:
firebase login
- A new Google Sign-In tab will open in your web browser.
- Select your Google account and grant the necessary permissions.
- Then, at the root of your Flutter project directory, run this command:
flutterfire configure
-
Add SHA-1 certificate fingerprint
- Open your terminal/command prompt.
- Run the following command in your VS Code terminal to generate the SHA-1 fingerprint:
./gradlew signingReport
- Look for the SHA-1 fingerprint in the output. It will be displayed along with other signing information. For example:
SHA1: 23:4E:xx:xx:xx:..
- In the project overview, select the recently created Flutter app and then go to settings.
- Scroll down to the "Your apps" section, where your Flutter app should be listed. Click on your app's platform (Android) to expand the settings.
- Under the "SHA certificate fingerprints" section, click on the "Add fingerprint" button. Enter the SHA-1 certificate fingerprint that you obtained earlier in the terminal. Click the “Save” button. (It is important to add SHA key for Google Sign In option)
-
Enable Google Sign-In and Firestore Database
Your Firebase console should look like this:
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:
# 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
*Transformx works on iOS, Android, Web, and Windows.
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
This project relies on flutter_localizations and follows the official internationalization guide for Flutter.
- To add a new localizable string, open the
app_en.arb
file atlib/l10n/arb/app_en.arb
.
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
}
}
- Then add a new key/value and description
{
"@@locale": "en",
"counterAppBarTitle": "Counter",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
},
"helloWorld": "Hello World",
"@helloWorld": {
"description": "Hello World Text"
}
}
- Use the new string
import 'package:transformx/l10n/l10n.dart';
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return Text(l10n.helloWorld);
}
Update the CFBundleLocalizations
array in the Info.plist
at ios/Runner/Info.plist
to include the new locale.
...
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>es</string>
</array>
...
- For each supported locale, add a new ARB file in
lib/l10n/arb
.
├── l10n
│ ├── arb
│ │ ├── app_en.arb
│ │ └── app_es.arb
- Add the translated strings to each
.arb
file:
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"
}
}