Skip to content

Commit b6c21a2

Browse files
committed
Enhance Linux desktop support by adding setup script and updating pubspec.yaml for platform specifications. Modify CI workflow to create Linux project files during build process.
1 parent b594a53 commit b6c21a2

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/flutter-ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
3939
- run: flutter config --enable-linux-desktop
4040
- run: flutter pub get
41+
- name: Create Linux project files
42+
run: |
43+
# Create Linux desktop project
44+
mkdir -p linux/runner
45+
flutter create --platforms=linux .
4146
# Use continue-on-error to prevent the workflow from failing due to file_picker warnings
4247
- name: Build Linux app
4348
run: flutter build linux --no-tree-shake-icons

pubspec.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ dev_dependencies:
2929
build_runner: ^2.4.7
3030

3131
flutter:
32-
uses-material-design: true
32+
uses-material-design: true
33+
platforms:
34+
android:
35+
ios:
36+
linux:
37+
macos:
38+
web:
39+
windows:
3340

3441
# Override file_picker for desktop platforms to fix warnings
3542
dependency_overrides:

setup_linux.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Script to setup Linux desktop support for Flutter
4+
5+
# Enable Linux desktop
6+
flutter config --enable-linux-desktop
7+
8+
# Make sure required packages are installed
9+
which apt-get > /dev/null && {
10+
echo "Installing Linux dependencies with apt-get..."
11+
sudo apt-get update
12+
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
13+
}
14+
15+
# Create Linux desktop files if they don't exist
16+
if [ ! -d "linux" ]; then
17+
echo "Creating Linux desktop project files..."
18+
flutter create --platforms=linux .
19+
fi
20+
21+
echo "Linux desktop setup complete!"

0 commit comments

Comments
 (0)