Fix build script for flutter
This commit is contained in:
parent
774da7ad6c
commit
fcc2384a5e
@ -24,7 +24,7 @@ Alternatively, open the repository URL in `Android Studio` to clone it directly.
|
||||
## 🛠️ Development Guide
|
||||
|
||||
1. **Configure Appwrite**
|
||||
Navigate to `lib/data/repository/appwrite_repository.dart` and update the values to match your
|
||||
Copy `.env.example` to `.env` and update the values to match your
|
||||
Appwrite project credentials.
|
||||
|
||||
2. **Customize as Needed**
|
||||
@ -32,8 +32,7 @@ Alternatively, open the repository URL in `Android Studio` to clone it directly.
|
||||
integrations as per your needs.
|
||||
|
||||
3. **Run the App**
|
||||
Select a target device (emulator or a connected physical device) in `Android Studio`, and
|
||||
click **Run** to start the app.
|
||||
Run by executing `./build.sh {device-name}` like `./build.sh chrome`
|
||||
|
||||
---
|
||||
|
||||
|
||||
27
build.sh
27
build.sh
@ -10,20 +10,27 @@ if [ ! -f .env ]; then
|
||||
fi
|
||||
|
||||
# Read .env file and convert it to --dart-define arguments
|
||||
ARGS=""
|
||||
ARGS=()
|
||||
while IFS='=' read -r key value || [ -n "$key" ]; do
|
||||
# Ignore empty lines and comments
|
||||
if [[ -n "$key" && ! "$key" =~ ^# ]]; then
|
||||
ARGS+=" --dart-define=${key}=\"${value}\""
|
||||
ARGS+=("--dart-define=${key}=${value}")
|
||||
fi
|
||||
done < .env
|
||||
|
||||
# Build Flutter web
|
||||
eval flutter build web "$ARGS"
|
||||
|
||||
# If --preview flag is provided, run a local preview server
|
||||
if [ "$1" == "--preview" ]; then
|
||||
echo "Starting preview server at http://localhost:3000..."
|
||||
cd build/web || exit 1
|
||||
python3 -m http.server 3000
|
||||
# Check if device parameter is provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ./build.sh <device_id_or_name>"
|
||||
echo "Example: ./build.sh chrome"
|
||||
echo "Example: ./build.sh 'iPhone 15'"
|
||||
echo ""
|
||||
echo "Available devices:"
|
||||
flutter devices
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DEVICE_NAME="$1"
|
||||
|
||||
# Run Flutter app on specified device
|
||||
echo "Running Flutter app on device: $DEVICE_NAME"
|
||||
flutter run -d "$DEVICE_NAME" "${ARGS[@]}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user