diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 03a5efa..2dd8a4f 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -61,7 +61,7 @@ jobs: flutter_version: '2.10.3' - target: ios host: macos-latest - flutter_version: '3.0.5' + flutter_version: '3.3.0' - target: android-arm32 host: ubuntu-latest flutter_version: '2.10.5' @@ -73,13 +73,13 @@ jobs: flutter_version: '2.10.5' - target: android-arm32 host: ubuntu-latest - flutter_version: '3.0.5' + flutter_version: '3.3.0' - target: android-arm64 host: ubuntu-latest - flutter_version: '3.0.5' + flutter_version: '3.3.0' - target: android-x86_64 host: ubuntu-latest - flutter_version: '3.0.5' + flutter_version: '3.3.0' runs-on: ${{ matrix.config.host }} @@ -158,6 +158,24 @@ jobs: path: /opt/hostedtoolcache/flutter key: ${{ runner.os }}-flutter + - name: Cache Flutter dependencies (Mac host) + if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'ios' || matrix.config.target == 'macos' ) + uses: actions/cache@v3 + with: + path: /Users/runner/hostedtoolcache/flutter + key: ${{ runner.os }}-flutter + + - name: Cache Gradle dependencies (Android) + if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' ) + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Setup java (Android) if: steps.check_asset.outputs.skip_build != 'true' && ( matrix.config.target == 'android-arm32' || matrix.config.target == 'android-arm64' || matrix.config.target == 'android-x86_64' ) uses: actions/setup-java@v3 diff --git a/ci/version.code.txt b/ci/version.code.txt index 4279ff2..341724d 100644 --- a/ci/version.code.txt +++ b/ci/version.code.txt @@ -1 +1 @@ -v1.5.9 \ No newline at end of file +v1.5.10 diff --git a/ci/version.info.txt b/ci/version.info.txt index 2aae3a6..0fd1f68 100644 --- a/ci/version.info.txt +++ b/ci/version.info.txt @@ -1,6 +1,6 @@ -v1.5.9 -- [x] 下载漫画中显示评论区(设置中寻找) +v1.5.10 -v1.5.8 -- [x] 解决历史记录图片不刷新的问题 -- [x] 增加退出是增加提示的选项(设置中寻找) +- [x] 升级flutter到3.3.0 +- [x] 可以设置分类列数 +- [x] 升级提示 +- [x] 静态加载动画 diff --git a/lib/basic/config/CategoriesColumnCount.dart b/lib/basic/config/CategoriesColumnCount.dart new file mode 100644 index 0000000..6b57dfb --- /dev/null +++ b/lib/basic/config/CategoriesColumnCount.dart @@ -0,0 +1,47 @@ +/// 多线程下载并发数 + +import 'package:event/event.dart'; +import 'package:flutter/material.dart'; +import 'package:pikapika/basic/Common.dart'; +import 'package:pikapika/basic/Method.dart'; + +String _propertyName = "categoriesColumnCount"; +late int categoriesColumnCount; + +Event categoriesColumnCountEvent = Event(); + +Future initCategoriesColumnCount() async { + categoriesColumnCount = + int.parse(await method.loadProperty(_propertyName, "0")); +} + +Widget categoriesColumnCountSetting() { + return StatefulBuilder( + builder: (BuildContext context, void Function(void Function()) setState) { + return ListTile( + title: const Text( + "首页分类列数", + ), + subtitle: Text("$categoriesColumnCount"), + onTap: () async { + int? value = await chooseMapDialog( + context, + { + "自动": 0, + "2": 2, + "3": 3, + "4": 4, + "5": 5, + }, + "选择首页分类列数"); + if (value != null) { + await method.saveProperty(_propertyName, "$categoriesColumnCount"); + categoriesColumnCount = value; + setState(() {}); + categoriesColumnCountEvent.broadcast(); + } + }, + ); + }, + ); +} diff --git a/lib/screens/CategoriesScreen.dart b/lib/screens/CategoriesScreen.dart index 0e7f64c..865c9c2 100644 --- a/lib/screens/CategoriesScreen.dart +++ b/lib/screens/CategoriesScreen.dart @@ -11,6 +11,7 @@ import 'package:pikapika/screens/RankingsScreen.dart'; import 'package:pikapika/screens/SearchScreen.dart'; import 'package:pikapika/screens/components/ContentError.dart'; import 'package:pikapika/basic/Method.dart'; +import '../basic/config/CategoriesColumnCount.dart'; import 'ComicsScreen.dart'; import 'GamesScreen.dart'; import 'RandomComicsScreen.dart'; @@ -73,12 +74,14 @@ class _CategoriesScreenState extends State { @override void initState() { shadowCategoriesEvent.subscribe(_onShadowChange); + categoriesColumnCountEvent.subscribe(_setState); super.initState(); } @override void dispose() { shadowCategoriesEvent.unsubscribe(_onShadowChange); + categoriesColumnCountEvent.unsubscribe(_setState); super.dispose(); } @@ -86,6 +89,10 @@ class _CategoriesScreenState extends State { _reloadCategories(); } + _setState(_) { + setState(() {}); + } + @override Widget build(BuildContext context) { var theme = Theme.of(context); @@ -140,11 +147,22 @@ class _CategoriesScreenState extends State { } List _buildCategories(List cList) { - var size = MediaQuery.of(context).size; - var min = size.width < size.height ? size.width : size.height; - var blockSize = min / 3; - var imageSize = blockSize - 15; - var imageRs = imageSize / 10; + late double blockSize; + late double imageSize; + late double imageRs; + + if (categoriesColumnCount == 0) { + var size = MediaQuery.of(context).size; + var min = size.width < size.height ? size.width : size.height; + blockSize = min / 3; + } else { + var size = MediaQuery.of(context).size; + var min = size.width; + blockSize = min / categoriesColumnCount; + } + + imageSize = blockSize - 15; + imageRs = imageSize / 10; List list = []; diff --git a/lib/screens/SettingsScreen.dart b/lib/screens/SettingsScreen.dart index dad262d..8eb6e72 100644 --- a/lib/screens/SettingsScreen.dart +++ b/lib/screens/SettingsScreen.dart @@ -33,6 +33,7 @@ import 'package:pikapika/screens/components/NetworkSetting.dart'; import 'package:pikapika/screens/components/RightClickPop.dart'; import '../basic/config/Authentication.dart'; +import '../basic/config/CategoriesColumnCount.dart'; import '../basic/config/UsingRightClickPop.dart'; import '../basic/config/WillPopNotice.dart'; import 'CleanScreen.dart'; @@ -90,6 +91,7 @@ class SettingsScreen extends StatelessWidget { keyboardControllerSetting(), noAnimationSetting(), iconLoadingSetting(), + categoriesColumnCountSetting(), const Divider(), fullScreenUISetting(), willPopNoticeSetting(), diff --git a/pubspec.yaml b/pubspec.yaml index 0308ef9..86faefc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.5.8+4 +version: 1.5.10+5 environment: sdk: ">=2.12.0 <3.0.0"