This document provides a comprehensive guide to set up the Flutter frontend for the Ell-ena project. Follow these steps to get your frontend up and running and connected to the Supabase backend.
- Prerequisites
- Installing Flutter SDK
- Setting Up an IDE
- Setting Up Emulators/Simulators
- Cloning and Setting Up the Ell-ena Project
- Connecting to the Supabase Backend
- Running the Application
- Troubleshooting
Before you begin, ensure you have the following:
- Operating System: Windows 10 or later (64-bit) / macOS 10.14 or later
- Disk Space: At least 2.5 GB of free space
- RAM: Minimum 4 GB (8 GB recommended)
- Tools:
- Windows: PowerShell 5.0 or later, Git for Windows
- macOS: bash, curl, git 2.x, mkdir, rm, unzip, which
-
Download Flutter SDK:
- Visit the Flutter Windows Installation page.
- Download the latest stable release of the Flutter SDK.
-
Extract the SDK:
- Create a folder where you want to install Flutter (e.g.,
C:\src\flutter). - Extract the downloaded zip file into this folder.
- Avoid paths that require elevated privileges (e.g.,
C:\Program Files\).
- Create a folder where you want to install Flutter (e.g.,
-
Update System PATH:
- Add Flutter to your PATH environment variable:
- Press
Win + Sand type "environment variables" - Click on "Edit the system environment variables"
- Click on "Environment Variables" button
- Under "System variables", find and select the "Path" variable, then click "Edit"
- Click "New" and add the path to
flutter\bin(e.g.,C:\src\flutter\bin) - Click "OK" on all dialogs to save the changes
- Press
- Add Flutter to your PATH environment variable:
-
Verify Installation:
- Open a new Command Prompt window and run:
flutter --version- Then run the Flutter doctor command to check for any dependencies you need to install:
flutter doctor- Follow any instructions provided by the Flutter doctor to complete the setup.
-
Download Flutter SDK:
- Visit the Flutter macOS Installation page.
- Download the latest stable release of the Flutter SDK.
-
Extract the SDK:
- Open Terminal and navigate to the desired location (e.g., your home directory):
cd ~/development
- Extract the downloaded file:
unzip ~/Downloads/flutter_macos_*.zip
-
Update System PATH:
- Add Flutter to your PATH:
export PATH="$PATH:$HOME/development/flutter/bin"
- To make this change permanent, add the above line to your shell profile file:
echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.zshrc
- If you're using Bash, use
~/.bash_profileinstead of~/.zshrc. - Restart your terminal or run
source ~/.zshrc(orsource ~/.bash_profile) to apply the changes.
-
Install Xcode (for iOS development):
- Install Xcode from the Mac App Store.
- Open Xcode and accept the license agreement.
- Install the Xcode command-line tools:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch
-
Install CocoaPods:
- CocoaPods is required for iOS development:
sudo gem install cocoapods
-
Verify Installation:
- Open Terminal and run:
flutter --version flutter doctor
- Follow any instructions provided by the Flutter doctor to complete the setup.
You can use either Visual Studio Code (VS Code) or Android Studio for Flutter development.
-
Install VS Code:
- Download and install Visual Studio Code.
-
Install Flutter and Dart Extensions:
- Open VS Code.
- Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X).
- Search for "Flutter" and install the official Flutter extension.
- This will automatically install the Dart extension as well.
-
Verify Setup:
- Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).
- Type "Flutter: New Project" to verify that the Flutter extension is working.
-
Install Android Studio:
- Download and install Android Studio.
-
Install Flutter and Dart Plugins:
- Open Android Studio.
- Go to Preferences/Settings > Plugins.
- Search for "Flutter" and install the plugin.
- This will automatically install the Dart plugin as well.
- Restart Android Studio when prompted.
-
Verify Setup:
- Open Android Studio.
- Click on "Start a new Flutter project" to verify that the Flutter plugin is working.
-
Install Android SDK:
- If you installed Android Studio, you already have the Android SDK.
- Otherwise, you can install it separately using the Android SDK Command-line Tools.
-
Create an Android Virtual Device (AVD):
- Open Android Studio.
- Click on "Configure" > "AVD Manager".
- Click on "Create Virtual Device".
- Select a device definition (e.g., Pixel 4) and click "Next".
- Select a system image (preferably the latest stable Android version) and click "Next".
- Give your AVD a name and click "Finish".
-
Start the Emulator:
- In Android Studio, click on the AVD Manager and start your emulator.
- Alternatively, you can start it from the command line:
flutter emulators --launch <emulator_id>- To list available emulators:
flutter emulators
-
Install Xcode:
- Ensure Xcode is installed as described in the Flutter installation steps.
-
Open the Simulator:
- Run the following command in Terminal:
open -a Simulator
- Alternatively, you can use Flutter to launch the simulator:
flutter emulators --launch apple_ios_simulator
-
Select Device Type:
- In the Simulator, go to File > Open Simulator and select the desired device.
-
Clone the Repository:
- Open your terminal or command prompt.
- Navigate to the directory where you want to store the project.
- Clone the repository:
git clone <repository-url> cd Ell-ena -
Install Dependencies:
- Run the following command to get all the required packages:
flutter pub get -
Set Up Environment Variables:
- Copy the
.env.examplefile to create a new.envfile:
cp .env.example .env- Update the
.envfile with your Supabase credentials (as described in the BACKEND.md guide):
SUPABASE_URL=<YOUR_SUPABASE_URL> SUPABASE_ANON_KEY=<YOUR_SUPABASE_ANON_KEY> GEMINI_API_KEY=<YOUR_GEMINI_API_KEY> VEXA_API_KEY=<YOUR_VEXA_API_KEY> - Copy the
The Ell-ena project is already configured to connect to Supabase. The connection is established in the lib/services/supabase_service.dart file.
-
Ensure Backend is Set Up:
- Make sure you have completed all the steps in the BACKEND.md guide.
- Your Supabase project should be up and running with all the required tables and functions.
-
Configure Environment Variables:
- Ensure your
.envfile contains the correct Supabase URL and anon key. - These values can be found in your Supabase dashboard under Settings > API.
- Ensure your
-
Initialize Supabase:
- The project already initializes Supabase in the
main.dartfile through theSupabaseService().initialize()method. - This method loads the environment variables and sets up the Supabase client.
- The project already initializes Supabase in the
-
Check Available Devices:
- Run the following command to see all available devices:
flutter devices -
Run the App:
- To run on all connected devices:
flutter run- To run on a specific device:
flutter run -d <device-id>- To run in release mode (for better performance):
flutter run --release -
Debug Mode Features:
- While the app is running in debug mode, you can:
- Press
rto hot-reload the app (apply code changes without restarting). - Press
Rto hot-restart the app (completely restart the app). - Press
qto quit the app. - Press
vto print the Flutter framework version.
- Press
- While the app is running in debug mode, you can:
-
Create a Keystore:
- If you don't have a keystore, create one:
keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key -
Configure Signing:
- Create a file at
android/key.propertieswith the following content:
storePassword=<password> keyPassword=<password> keyAlias=key storeFile=<path-to-keystore>- Update the
android/app/build.gradlefile to use these signing configurations.
- Create a file at
-
Build the APK:
flutter build apk --release- The APK will be available at
build/app/outputs/flutter-apk/app-release.apk.
- The APK will be available at
-
Build App Bundle:
flutter build appbundle --release- The bundle will be available at
build/app/outputs/bundle/release/app-release.aab.
- The bundle will be available at
-
Update iOS Bundle Identifier:
- Open
ios/Runner.xcworkspacein Xcode. - Select the Runner project in the navigator, then select the Runner target.
- In the General tab, update the Bundle Identifier to a unique identifier.
- Open
-
Set Up Signing:
- In the Signing & Capabilities tab, select your team and set up signing.
-
Build the App:
flutter build ios --release -
Archive and Upload:
- Open the project in Xcode:
open ios/Runner.xcworkspace- Select Product > Archive to create an archive.
- Use the Xcode Organizer to validate and upload your app to the App Store.
-
Flutter Doctor Warnings:
- Run
flutter doctor -vfor detailed information about issues. - Follow the recommendations to resolve each issue.
- Run
-
Dependency Issues:
- If you encounter package conflicts, try:
flutter clean flutter pub get -
Build Errors:
- For Android build issues, check your Android SDK installation and ensure you have the required build tools.
- For iOS build issues, ensure Xcode is properly installed and you have the necessary signing certificates.
-
Supabase Connection Issues:
- Verify your Supabase URL and anon key in the
.envfile. - Check if your Supabase project is up and running.
- Ensure your database tables and functions are properly set up as described in BACKEND.md.
- Verify your Supabase URL and anon key in the
-
Permission Issues:
- The app requires certain permissions (e.g., microphone access for speech-to-text). Ensure these permissions are granted in the device settings.
If you encounter issues not covered in this guide:
- Check the Flutter Documentation
- Visit the Supabase Documentation
- Join the Ell-ena Discord channel for community support
- Open an issue on the project's GitHub repository
This guide should help you set up the Ell-ena frontend and connect it to the Supabase backend. For more detailed information about specific features or customizations, please refer to the project documentation or contact the development team.