From 17e2f27c458dc2973e7fe42e8f872015bff0f212 Mon Sep 17 00:00:00 2001 From: niuhuan Date: Mon, 19 Aug 2024 15:09:35 +0800 Subject: [PATCH] :recycle: flutter3 --- .github/workflows/Release.yml | 38 ++++++++++++++++++++++++++--- lib/screens/CategoriesScreen.dart | 4 +-- lib/screens/ComicsScreen.dart | 4 +-- lib/screens/DownloadListScreen.dart | 4 +-- lib/screens/SearchScreen.dart | 4 +-- lib/screens/components/Images.dart | 10 +++++--- 6 files changed, 49 insertions(+), 15 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index c1c7ca62..04596437 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -67,7 +67,7 @@ jobs: flutter_version: '2.10.3' go_version: '1.17' - target: ios - host: macos-latest + host: macos-12 flutter_version: '2.10.5' go_version: '1.19' - target: ios @@ -99,6 +99,15 @@ jobs: flutter_version: '3.7.3' go_version: '1.19' + - target: android-arm64 + host: ubuntu-latest + flutter_version: '3.22.3' + go_version: '1.19' + - target: ios + host: macos-latest + flutter_version: '3.22.3' + go_version: '1.19' + runs-on: ${{ matrix.config.host }} env: @@ -256,7 +265,7 @@ jobs: cp version.code.txt ../lib/assets/version.txt - name: Upgrade deps version (flutter2 non-mac) - if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host != 'macos-latest' && startsWith(matrix.config.flutter_version, '2') + if: steps.check_asset.outputs.skip_build != 'true' && startsWith(matrix.config.host, 'macos-') == false && startsWith(matrix.config.flutter_version, '2') run: | sed -i "s/another_xlider: ^1.0.1+2/another_xlider: 1.0.1+2/g" pubspec.yaml sed -i "s/flutter_styled_toast: ^2.0.0/flutter_styled_toast: 2.0.0/g" pubspec.yaml @@ -268,7 +277,7 @@ jobs: flutter pub get - name: Upgrade deps version (flutter2 mac) - if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.host == 'macos-latest' && startsWith(matrix.config.flutter_version, '2') + if: steps.check_asset.outputs.skip_build != 'true' && startsWith(matrix.config.host, 'macos-') && startsWith(matrix.config.flutter_version, '2') run: | brew install gnu-sed gsed -i "s/another_xlider: ^1.0.1+2/another_xlider: 1.0.1+2/g" pubspec.yaml @@ -281,6 +290,29 @@ jobs: gsed -i "s/Icons.energy_savings_leaf/Icons.ad_units/g" lib/screens/SettingsScreen.dart flutter pub get + - name: Upgrade deps version (flutter2 non-mac) + if: steps.check_asset.outputs.skip_build != 'true' && startsWith(matrix.config.host, 'macos-') == false && startsWith(matrix.config.flutter_version, '3.22.3') + run: | + sed -i "s/intl: ^0.17.0/intl: ^0.19.0/g" pubspec.yaml + sed -i "s/.bodyText1/.bodyMedium/g" lib/**/*.dart + sed -i "s/ImageStreamCompleter load(/ImageStreamCompleter loadImage(/g" lib/**/*.dart + sed -i "s/DecoderCallback decode/ImageDecoderCallback decode/g" lib/**/*.dart + sed -i "s/PaintingBinding.instance\!.instantiateImageCodec/ui.instantiateImageCodec/g" lib/**/*.dart + sed -i "s/as ui show Codec/as ui/g" lib/**/*.dart + flutter pub get + + - name: Upgrade deps version (flutter2 mac) + if: steps.check_asset.outputs.skip_build != 'true' && startsWith(matrix.config.host, 'macos-') && startsWith(matrix.config.flutter_version, '3.22.3') + run: | + brew install gnu-sed + gsed -i "s/intl: ^0.17.0/intl: ^0.19.0/g" pubspec.yaml + gsed -i "s/.bodyText1/.bodyMedium/g" lib/**/*.dart + gsed -i "s/ImageStreamCompleter load(/ImageStreamCompleter loadImage(/g" lib/**/*.dart + gsed -i "s/DecoderCallback decode/ImageDecoderCallback decode/g" lib/**/*.dart + gsed -i "s/PaintingBinding.instance\!.instantiateImageCodec/ui.instantiateImageCodec/g" lib/**/*.dart + gsed -i "s/as ui show Codec/as ui/g" lib/**/*.dart + flutter pub get + - name: Build (windows) if: steps.check_asset.outputs.skip_build != 'true' && matrix.config.target == 'windows' run: | diff --git a/lib/screens/CategoriesScreen.dart b/lib/screens/CategoriesScreen.dart index ade3c74e..1a8211b8 100644 --- a/lib/screens/CategoriesScreen.dart +++ b/lib/screens/CategoriesScreen.dart @@ -1,6 +1,6 @@ import 'package:event/event.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_search_bar/flutter_search_bar.dart'; +import 'package:flutter_search_bar/flutter_search_bar.dart' as fsb; import 'package:pikapika/basic/Entities.dart'; import 'package:pikapika/basic/config/ShadowCategoriesEvent.dart'; import 'package:pikapika/basic/config/ShadowCategoriesMode.dart'; @@ -32,7 +32,7 @@ class CategoriesScreen extends StatefulWidget { } class _CategoriesScreenState extends State { - late final SearchBar _searchBar = SearchBar( + late final fsb.SearchBar _searchBar = fsb.SearchBar( hintText: '搜索', inBar: false, setState: setState, diff --git a/lib/screens/ComicsScreen.dart b/lib/screens/ComicsScreen.dart index 091e414c..aff9e54e 100644 --- a/lib/screens/ComicsScreen.dart +++ b/lib/screens/ComicsScreen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_search_bar/flutter_search_bar.dart'; +import 'package:flutter_search_bar/flutter_search_bar.dart' as fsb; import 'package:pikapika/basic/Common.dart'; import 'package:pikapika/basic/config/PagerAction.dart'; import 'package:pikapika/basic/config/ShadowCategories.dart'; @@ -39,7 +39,7 @@ class ComicsScreen extends StatefulWidget { class _ComicsScreenState extends State { late final _comicListController = ComicListController(); - late final SearchBar _categorySearchBar = SearchBar( + late final fsb.SearchBar _categorySearchBar = fsb.SearchBar( hintText: '搜索分类 - ${categoryTitle(widget.category)}', inBar: false, setState: setState, diff --git a/lib/screens/DownloadListScreen.dart b/lib/screens/DownloadListScreen.dart index da0d81dd..8c8a3ac4 100644 --- a/lib/screens/DownloadListScreen.dart +++ b/lib/screens/DownloadListScreen.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/material.dart'; -import 'package:flutter_search_bar/flutter_search_bar.dart'; +import 'package:flutter_search_bar/flutter_search_bar.dart' as fsb; import 'package:pikapika/basic/Channels.dart'; import 'package:pikapika/basic/Common.dart'; import 'package:pikapika/basic/Entities.dart'; @@ -29,7 +29,7 @@ class _DownloadListScreenState extends State { bool _selecting = false; List _selectingList = []; - late final SearchBar _searchBar = SearchBar( + late final fsb.SearchBar _searchBar = fsb.SearchBar( hintText: '搜索下载', inBar: false, setState: setState, diff --git a/lib/screens/SearchScreen.dart b/lib/screens/SearchScreen.dart index 4015cf2a..e73b39aa 100644 --- a/lib/screens/SearchScreen.dart +++ b/lib/screens/SearchScreen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter_search_bar/flutter_search_bar.dart'; +import 'package:flutter_search_bar/flutter_search_bar.dart' as fsb; import 'package:pikapika/basic/Common.dart'; import 'package:pikapika/basic/config/ShadowCategories.dart'; import 'package:pikapika/basic/store/Categories.dart'; @@ -32,7 +32,7 @@ class _SearchScreenState extends State { late final _comicListController = ComicListController(); late final TextEditingController _textEditController = TextEditingController(text: widget.keyword); - late final SearchBar _searchBar = SearchBar( + late final fsb.SearchBar _searchBar = fsb.SearchBar( hintText: '搜索 ${categoryTitle(widget.category)}', controller: _textEditController, inBar: false, diff --git a/lib/screens/components/Images.dart b/lib/screens/components/Images.dart index 89a3d4ce..54a1f715 100644 --- a/lib/screens/components/Images.dart +++ b/lib/screens/components/Images.dart @@ -38,8 +38,9 @@ class ResourceFileImageProvider Future _loadAsync(ResourceFileImageProvider key) async { assert(key == this); - return PaintingBinding.instance! - .instantiateImageCodec(await File(path).readAsBytes()); + return PaintingBinding.instance!.instantiateImageCodec( + await File(path).readAsBytes(), + ); } @override @@ -132,8 +133,9 @@ class ResourceRemoteImageProvider Future _loadAsync(ResourceRemoteImageProvider key) async { assert(key == this); var downloadTo = await method.remoteImageData(fileServer, path); - return PaintingBinding.instance! - .instantiateImageCodec(await File(downloadTo.finalPath).readAsBytes()); + return PaintingBinding.instance!.instantiateImageCodec( + await File(downloadTo.finalPath).readAsBytes(), + ); } @override