Skip to content

Commit

Permalink
♻️ flutter3
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Aug 19, 2024
1 parent 5438f1c commit 17e2f27
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 15 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/CategoriesScreen.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -32,7 +32,7 @@ class CategoriesScreen extends StatefulWidget {
}

class _CategoriesScreenState extends State<CategoriesScreen> {
late final SearchBar _searchBar = SearchBar(
late final fsb.SearchBar _searchBar = fsb.SearchBar(
hintText: '搜索',
inBar: false,
setState: setState,
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/ComicsScreen.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -39,7 +39,7 @@ class ComicsScreen extends StatefulWidget {

class _ComicsScreenState extends State<ComicsScreen> {
late final _comicListController = ComicListController();
late final SearchBar _categorySearchBar = SearchBar(
late final fsb.SearchBar _categorySearchBar = fsb.SearchBar(
hintText: '搜索分类 - ${categoryTitle(widget.category)}',
inBar: false,
setState: setState,
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/DownloadListScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -29,7 +29,7 @@ class _DownloadListScreenState extends State<DownloadListScreen> {
bool _selecting = false;
List<String> _selectingList = [];

late final SearchBar _searchBar = SearchBar(
late final fsb.SearchBar _searchBar = fsb.SearchBar(
hintText: '搜索下载',
inBar: false,
setState: setState,
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/SearchScreen.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -32,7 +32,7 @@ class _SearchScreenState extends State<SearchScreen> {
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,
Expand Down
10 changes: 6 additions & 4 deletions lib/screens/components/Images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class ResourceFileImageProvider

Future<ui.Codec> _loadAsync(ResourceFileImageProvider key) async {
assert(key == this);
return PaintingBinding.instance!
.instantiateImageCodec(await File(path).readAsBytes());
return PaintingBinding.instance!.instantiateImageCodec(
await File(path).readAsBytes(),
);
}

@override
Expand Down Expand Up @@ -132,8 +133,9 @@ class ResourceRemoteImageProvider
Future<ui.Codec> _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
Expand Down

0 comments on commit 17e2f27

Please sign in to comment.