Skip to content

Commit

Permalink
Add pack generation
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Apr 23, 2024
1 parent f166521 commit 2a12f9a
Show file tree
Hide file tree
Showing 12 changed files with 382 additions and 314 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
flutter clean
flutter pub get
flutter doctor -v
- name: Build nessesary files
working-directory: /
run: |
dart run tools/generate.dart
- name: Import files
if: ${{ github.event_name != 'pull_request' }}
env:
Expand Down Expand Up @@ -107,6 +111,10 @@ jobs:
flutter clean
flutter pub get
flutter doctor -v
- name: Build nessesary files
working-directory: /
run: |
dart run tools/generate.dart
- name: 🏭 Build nightly
if: ${{ github.ref != 'refs/tags/stable' && (github.event_name != 'release' || github.event.prerelease) }}
run: |
Expand Down Expand Up @@ -186,6 +194,10 @@ jobs:
flutter clean
flutter pub get
flutter doctor -v
- name: Build nessesary files
working-directory: /
run: |
dart run tools/generate.dart
- name: 🏭 Build nightly
if: ${{ github.ref != 'refs/tags/stable' && (github.event_name != 'release' || github.event.prerelease) }}
run: |
Expand Down Expand Up @@ -297,6 +309,10 @@ jobs:
flutter clean
flutter pub get
flutter doctor -v
- name: Build nessesary files
working-directory: /
run: |
dart run tools/generate.dart
- name: 🏭 Build nightly
if: ${{ github.ref != 'refs/tags/stable' && (github.event_name != 'release' || github.event.prerelease) }}
run: |
Expand Down Expand Up @@ -364,6 +380,10 @@ jobs:
flutter clean
flutter pub get
flutter doctor -v
- name: Build nessesary files
working-directory: /
run: |
dart run tools/generate.dart
- name: 🏭 Build
run: |
flutter build macos -v --release
Expand Down Expand Up @@ -414,6 +434,10 @@ jobs:
flutter clean
flutter pub get
flutter doctor -v
- name: Build nessesary files
working-directory: /
run: |
dart run tools/generate.dart
- name: 🏭 Build
run: |
flutter build ios --release --no-codesign -v
Expand Down
3 changes: 3 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@
*.png~
*.tiled-session
/node_modules

# Runtime related
assets/pack.qka
8 changes: 7 additions & 1 deletion app/lib/models/pack.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:convert';
import 'dart:typed_data';

import 'package:archive/archive.dart';
import 'package:flutter/services.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:qeck/models/deck.dart';
import 'package:qeck/models/meta.dart';
Expand All @@ -18,6 +18,12 @@ class PackData {

PackData(this.archive);

factory PackData.fromData(Uint8List data) {
return PackData(ZipDecoder().decodeBytes(data));
}
static Future<PackData?> getCorePack() async => PackData.fromData(
(await rootBundle.load('assets/pack.qka')).buffer.asUint8List());

Uint8List? getAsset(String path) => archive.findFile(path)?.content;

PackMetadata? getMetadata() {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ FlexSchemeColor getFlexThemeColor(String name, bool dark) {
}

List<String> getThemes() {
return FlexColor.schemesList.map((e) => e.name).toList();
return ['classic', ...FlexColor.schemesList.map((e) => e.name)];
}
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"keywords": [],
"author": "",
"license": "ISC",
"packageManager": "[email protected].2",
"packageManager": "[email protected].5",
"dependencies": {
"tile-extruder": "^2.1.0"
}
Expand Down
4 changes: 2 additions & 2 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -733,10 +733,10 @@ packages:
dependency: transitive
description:
name: pointycastle
sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333"
sha256: "79fbafed02cfdbe85ef3fd06c7f4bc2cbcba0177e61b765264853d4253b21744"
url: "https://pub.dev"
source: hosted
version: "3.8.0"
version: "3.9.0"
pool:
dependency: transitive
description:
Expand Down
5 changes: 3 additions & 2 deletions docs/community/downloads/build-your-own.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ sidebar_position: 1
1. Install git and flutter (beta)
2. Clone the repository
3. Navigate to the app directory
4. Use the flutter tool to compile the application
4. Run `dart run tools/generate.dart` to generate the necessary files
5. Use the flutter tool to compile the application
* `flutter build apk`
* `flutter build appbundle`
* `flutter build web`
* `flutter build linux`
* `flutter build windows`
5. The compiled files are in the build directory
6. The compiled files are in the build directory
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"@docusaurus/preset-classic": "3.2.1",
"@docusaurus/theme-common": "3.2.1",
"@mdx-js/react": "^3.0.1",
"@swc/core": "^1.4.16",
"@swc/core": "^1.4.17",
"animate.css": "^4.1.1",
"clsx": "^2.1.0",
"clsx": "^2.1.1",
"node-fetch": "^3.3.2",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
Expand All @@ -47,7 +47,7 @@
"last 1 safari version"
]
},
"packageManager": "[email protected].2",
"packageManager": "[email protected].5",
"devDependencies": {
"@docusaurus/module-type-aliases": "3.2.1",
"@docusaurus/tsconfig": "3.2.1",
Expand Down
Loading

0 comments on commit 2a12f9a

Please sign in to comment.