-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8234f59
commit 11e6d3c
Showing
3 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# FlutterFlow Linux Unofficial Alpha | ||
|
||
Welcome to the unofficial alpha version of FlutterFlow for Linux. This project aims to facilitate Flutter developers working on Linux to seamlessly integrate FlutterFlow into their development workflow. This tool automates the process of exporting code from FlutterFlow and running it on your connected device. | ||
|
||
## Setup | ||
|
||
Before you begin, ensure your environment is ready: | ||
|
||
- FlutterFlow CLI must be installed on your system. If you haven't done so, you can install it from [FlutterFlow CLI on pub.dev](https://pub.dev/packages/flutterflow_cli). | ||
- Your phone must be connected to your computer via USB. Ensure that your device is in "Developer mode" and that USB debugging is enabled. | ||
|
||
## Installation | ||
|
||
Follow these steps to get started with the FlutterFlow Linux tool: | ||
|
||
1. **Download the script**: Download `ff-run.sh` from this repository. | ||
2. **Set executable permissions**: You need to make the script executable. Open a terminal in the directory where ff-run.sh is located and run: | ||
```bash | ||
chmod +x ff-run.sh | ||
``` | ||
3. Configure your token: Open `ff-run.sh` in your favorite text editor and replace `[TOKEN]` with your FlutterFlow API token. | ||
|
||
## Usage | ||
|
||
To use the tool, open a terminal in the directory containing ff-run.sh and follow these instructions: | ||
|
||
- **First Run**: If you are running the app for the first time or if the app is not currently running on your phone, execute the script with the `false` flag. Replace `[PROJECT-ID]` with your actual FlutterFlow project ID. | ||
```bash | ||
./ff-run.sh [PROJECT-ID] false | ||
``` | ||
This command will export the project from FlutterFlow, install it on your connected device, and launch the app. | ||
|
||
- **Subsequent Runs**: If your app is already running on your phone and you want to update the code without restarting the app, use the `true` flag. This tells the script that `flutter run` is already executing, and it will only export and update the code without re-launching the app. | ||
```bash | ||
./ff-run.sh [PROJECT-ID] true | ||
``` | ||
Please note that this tool is in its alpha stage and is unofficial. Feedback and contributions are welcome to improve its functionality and coverage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# Version 0.1 | ||
# Made by https://www.youtube.com/@flutterflowexpert/ | ||
|
||
# The project ID is passed as the first command-line argument | ||
project_id=$1 | ||
# The status of flutter run (true/false) is passed as the second command-line argument | ||
is_flutter_running=$2 | ||
|
||
if [ -z "$project_id" ]; then | ||
echo "You must provide a project ID as the first parameter." | ||
exit 1 | ||
fi | ||
|
||
if [ "$is_flutter_running" = "true" ]; then | ||
echo "Flutter is reported to be running. Only executing FlutterFlow export-code..." | ||
flutterflow export-code --project $project_id --dest "ff-app" --token [TOKEN] | ||
else | ||
# Initialize a flag to indicate that prerequisites are met | ||
prerequisites_met=true | ||
|
||
# Check if FlutterFlow CLI is installed | ||
if flutterflow | grep -q 'Token$'; then | ||
echo "FF CLI is installed" | ||
else | ||
echo "First, you need to install FlutterFlow CLI - https://pub.dev/packages/flutterflow_cli" | ||
prerequisites_met=false | ||
fi | ||
|
||
# Check for connected devices via adb | ||
if adb devices | grep -q 'device$'; then | ||
echo "Device connected." | ||
else | ||
echo "Connect your phone with your computer using USB." | ||
prerequisites_met=false | ||
fi | ||
|
||
echo "Prerequisites Met: $prerequisites_met" | ||
# Assuming prerequisites_met is a string 'true' or 'false' | ||
if [ "$prerequisites_met" = "true" ]; then | ||
echo "Attempting to export code with FlutterFlow CLI..." | ||
flutterflow export-code --project $project_id --dest "ff-app" --token [TOKEN] | ||
|
||
# Assuming 'ff-app' directory is successfully created | ||
cd ff-app || { echo "Failed to change directory to ff-app"; exit 1; } | ||
echo "Current directory after moving to 'ff-app': $(pwd)" | ||
|
||
# Find the name of the only directory created by FlutterFlow | ||
project_dir_name=$(find . -maxdepth 1 -type d ! -path . | head -n 1 | cut -c 3-) | ||
echo "Found project directory name: '$project_dir_name'" | ||
|
||
if [ -n "$project_dir_name" ] && [ -d "$project_dir_name" ]; then | ||
echo "Changing directory to '$project_dir_name'..." | ||
cd "$project_dir_name" || { echo "Failed to change directory to '$project_dir_name'"; exit 1; } | ||
echo "Current directory: $(pwd)" | ||
flutter run | ||
else | ||
echo "The expected project directory does not exist." | ||
fi | ||
else | ||
echo "Prerequisites not met, skipping FlutterFlow export-code command." | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters