Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,22 @@ on:
permissions:
contents: write

env:
FLUTTER_VERSION: 3.38.9

jobs:
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Cache Pub dependencies
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }}
pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}

- name: Cache Gradle packages
uses: actions/cache@v4
Expand All @@ -41,9 +40,9 @@ jobs:
uses: actions/cache@v4
with:
path: .dart_tool/build
key: ${{ runner.os }}-build-runner-${{ hashFiles('lib/**/*.dart', 'pubspec.lock') }}
key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }}
restore-keys: |
${{ runner.os }}-build-runner-
${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-

- name: Decode keystore
if: env.KEYSTORE_BASE64 != ''
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@ name: Build iOS
on:
workflow_dispatch:

env:
FLUTTER_VERSION: 3.38.9

jobs:
build-ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }}
pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}

- name: Cache Pub dependencies
- name: Cache build_runner
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
path: .dart_tool/build
key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-

- name: Install dependencies
run: flutter pub get
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Build Linux
on:
workflow_dispatch:

env:
FLUTTER_VERSION: 3.38.9

jobs:
build-linux:
runs-on: ubuntu-latest
Expand All @@ -15,17 +18,21 @@ jobs:
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev

- uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }}
pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}

- name: Cache Pub dependencies
- name: Cache build_runner
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
path: .dart_tool/build
key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-

- name: Install dependencies
run: flutter pub get
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@ name: Build macOS
on:
workflow_dispatch:

env:
FLUTTER_VERSION: 3.38.9

jobs:
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }}
pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}

- name: Cache Pub dependencies
- name: Cache build_runner
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
path: .dart_tool/build
key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-

- name: Install dependencies
run: flutter pub get
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@ name: Build Web
on:
workflow_dispatch:

env:
FLUTTER_VERSION: 3.38.9

jobs:
build-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }}
pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}

- name: Cache Pub dependencies
- name: Cache build_runner
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
path: .dart_tool/build
key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-

- name: Install dependencies
run: flutter pub get
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@ name: Build Windows
on:
workflow_dispatch:

env:
FLUTTER_VERSION: 3.38.9

jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }}
pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}

- name: Cache Pub dependencies
- name: Cache build_runner
uses: actions/cache@v4
with:
path: ~\AppData\Local\Pub\Cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
path: .dart_tool/build
key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-

- name: Install dependencies
run: flutter pub get
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: PR Checks

on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review

permissions:
contents: read

env:
FLUTTER_VERSION: 3.38.9

concurrency:
group: pr-checks-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
pr-checks:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: subosito/flutter-action@v2
id: flutter-action
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }}
pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }}

- name: Cache build_runner
uses: actions/cache@v4
with:
path: .dart_tool/build
key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }}
restore-keys: |
${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-

- name: Install dependencies
run: flutter pub get

- name: Snapshot workspace status
shell: bash
run: git status --short --untracked-files=all > /tmp/pre_codegen_status.txt

- name: Verify generated files
run: dart run build_runner build --delete-conflicting-outputs

- name: Fail if generated files changed
shell: bash
run: |
before_status="$(cat /tmp/pre_codegen_status.txt)"
after_status="$(git status --short --untracked-files=all)"

if [[ "$before_status" != "$after_status" ]]; then
echo "Workspace status before code generation:"
printf '%s\n' "$before_status"
echo "Workspace status after code generation:"
printf '%s\n' "$after_status"
echo "::error::Generated files are not up to date. Run build_runner and commit the updated files."
exit 1
fi

- name: Static analysis
run: flutter analyze

- name: Run tests
run: flutter test
11 changes: 7 additions & 4 deletions lib/features/discover/pages/discover_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,18 @@ class _RandomSongsSectionState extends ConsumerState<RandomSongsSection> {
? songs.length
: (songs.length > 6 ? 6 : songs.length);

// 根据屏幕宽度计算列数:手机2列,平板及以上3列
final screenWidth = MediaQuery.of(context).size.width;
final crossAxisCount = screenWidth >= 600 ? 3 : 2;

return Column(
children: [
GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 350,
mainAxisExtent:
64, // Fixed height instead of scaling based on width
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount,
mainAxisExtent: 64,
crossAxisSpacing: 12,
mainAxisSpacing: 8,
),
Expand Down
Loading
Loading