diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml new file mode 100644 index 000000000..3b6570c93 --- /dev/null +++ b/.github/workflows/build_windows.yml @@ -0,0 +1,110 @@ +name: Build Windows + +on: + push: + workflow_dispatch: + +jobs: + build: + name: Build Windows + runs-on: windows-latest + steps: + - name: 签出仓库 + uses: actions/checkout@v4 + + - name: 初始化 Flutter 环境 + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + architecture: x64 + + - name: 初始化 Rust 工具链 + uses: actions-rust-lang/setup-rust-toolchain@v1.10.1 + + - name: 还原依赖 + run: flutter pub get + + - name: 生成代码 + run: dart run build_runner build --delete-conflicting-outputs + + - name: 构建项目 + run: flutter build windows + + - name: 上传产物 + id: binary-artifact + uses: actions/upload-artifact@v4 + with: + name: binary + path: build/windows/x64/runner/Release/**/* + compression-level: 9 + + - name: 还原证书 + shell: pwsh + if: env.CERTIFICATE != '' + env: + CERTIFICATE: ${{ secrets.CERTIFICATE }} + run: |- + $base64File = New-TemporaryFile + $certFile = (New-TemporaryFile).FullName + '.pfx' + Out-File -InputObject $env:CERTIFICATE -LiteralPath $base64File + openssl enc -base64 -d -in $base64File.FullName -out $certFile + Write-Output "CERTIFICATE_PATH=$certFile" >> "$env:GITHUB_ENV" + + - name: 构建 MSIX + id: msix + shell: pwsh + if: env.CERTIFICATE_PATH != '' + env: + CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} + run: |- + dart run msix:create ` + --certificate-path $env:CERTIFICATE_PATH ` + --certificate-password $env:CERTIFICATE_PASSWORD ` + --build-windows false ` + --publisher (Get-PfxCertificate $env:CERTIFICATE_PATH -Password ($env:CERTIFICATE_PASSWORD | ConvertTo-SecureString -AsPlainText)).Subject + + - name: 上传 MSIX + id: msix-artifact + if: steps.msix.conclusion == 'success' + uses: actions/upload-artifact@v4 + with: + name: msix + path: build/windows/x64/runner/Release/pixez.msix + compression-level: 9 + + - name: 生成 MSIX 安装器 + id: installer + if: steps.msix.conclusion == 'success' + uses: frg2089/MsixInstaller@v1 + with: + msix: build/windows/x64/runner/Release/pixez.msix + + - name: 上传 MSIX 安装器 + id: installer-artifact + if: steps.installer.conclusion == 'success' + uses: actions/upload-artifact@v4 + with: + name: installer + path: ${{ steps.installer.outputs.path }} + compression-level: 9 + + - name: 生成校验和 + shell: pwsh + run: |- + Write-Output '### Build Success :rocket:' >> $env:GITHUB_STEP_SUMMARY + Write-Output '|File|SHA256|' >> $env:GITHUB_STEP_SUMMARY + Write-Output '|:-|:-:|' >> $env:GITHUB_STEP_SUMMARY + Write-Output "|[binary](${{ steps.binary-artifact.outputs.artifact-url }})|${{ steps.binary-artifact.outputs.artifact-digest }}|" >> $env:GITHUB_STEP_SUMMARY + + if ('${{ steps.msix-artifact.conclusion }}' -eq 'success') { + Write-Output "|[msix](${{ steps.msix-artifact.outputs.artifact-url }})|${{ steps.msix-artifact.outputs.artifact-digest }}|" >> $env:GITHUB_STEP_SUMMARY + } + + if ('${{ steps.installer-artifact.conclusion }}' -eq 'success') { + Write-Output "|[installer](${{ steps.installer-artifact.outputs.artifact-url }})|${{ steps.installer-artifact.outputs.artifact-digest }}|" >> $env:GITHUB_STEP_SUMMARY + } + + Write-Output '' >> $env:GITHUB_STEP_SUMMARY + Write-Output '### MSIX 安装教程' >> $env:GITHUB_STEP_SUMMARY + Write-Output '![image](https://github.com/Notsfsssf/pixez-flutter/assets/42184238/f1956682-f527-487d-997b-523319cd78d3)' >> $env:GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/.metadata b/.metadata index da9866e8e..53aacea55 100644 --- a/.metadata +++ b/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled. +# This file should be version controlled and should not be manually edited. version: - revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a - channel: dev + revision: "17025dd88227cd9532c33fa78f5250d548d87e9a" + channel: "stable" project_type: app @@ -13,11 +13,20 @@ project_type: app migration: platforms: - platform: root - create_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a - base_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a - - platform: ohos - create_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a - base_revision: 83f55c5e8f67fccb923968536b0bf457a8414d1a + create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + - platform: android + create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + - platform: ios + create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + - platform: macos + create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + - platform: windows + create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a + base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a # User provided section diff --git a/lib/fluent/component/pixez_button.dart b/lib/fluent/component/pixez_button.dart index e592711bf..71c3ef1cc 100644 --- a/lib/fluent/component/pixez_button.dart +++ b/lib/fluent/component/pixez_button.dart @@ -18,7 +18,7 @@ class PixEzButton extends StatelessWidget { child: ButtonTheme( data: ButtonThemeData( iconButtonStyle: ButtonStyle( - padding: ButtonState.all(EdgeInsets.zero), + padding: WidgetStateProperty.all(EdgeInsets.zero), ), ), child: IconButton( diff --git a/lib/fluent/component/search_box/pixez_search_box.dart b/lib/fluent/component/search_box/pixez_search_box.dart index e8e1f3fbe..86b95a23f 100644 --- a/lib/fluent/component/search_box/pixez_search_box.dart +++ b/lib/fluent/component/search_box/pixez_search_box.dart @@ -291,7 +291,6 @@ class _PixEzSearchBoxState extends State { ); }, ); - default: } } } diff --git a/lib/fluent/component/selectable_html.dart b/lib/fluent/component/selectable_html.dart index afe7276b9..bf9717338 100644 --- a/lib/fluent/component/selectable_html.dart +++ b/lib/fluent/component/selectable_html.dart @@ -49,7 +49,7 @@ class _SelectableHtmlState extends State { if (e.attributes.containsKey('href')) { final color = FluentTheme.of(context).accentColor; return { - 'color': '#${color.value.toRadixString(16).substring(2, 8)}' + 'color': '#${color.colorValue.toRadixString(16).substring(2, 8)}' }; } return null; diff --git a/lib/fluent/page/hello/recom/recom_spotlight_page.dart b/lib/fluent/page/hello/recom/recom_spotlight_page.dart index 78789a946..80b558dd1 100644 --- a/lib/fluent/page/hello/recom/recom_spotlight_page.dart +++ b/lib/fluent/page/hello/recom/recom_spotlight_page.dart @@ -244,9 +244,9 @@ class _RecomSpolightPageState extends State child: ButtonTheme( data: ButtonThemeData( iconButtonStyle: ButtonStyle( - padding: ButtonState.all(EdgeInsets.zero), + padding: WidgetStateProperty.all(EdgeInsets.zero), backgroundColor: - ButtonState.all(Colors.transparent), + WidgetStateProperty.all(Colors.transparent), ), ), child: PixEzButton( @@ -320,8 +320,8 @@ class _RecomSpolightPageState extends State begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - Colors.black.withOpacity(0.0), - Colors.black.withOpacity(opacity), + Colors.black.withValues(alpha: 255 * 0.0), + Colors.black.withValues(alpha: 255 * opacity), ], ), ), diff --git a/lib/fluent/page/hello/recom/recom_user_road.dart b/lib/fluent/page/hello/recom/recom_user_road.dart index b2786eecb..97b212f3a 100644 --- a/lib/fluent/page/hello/recom/recom_user_road.dart +++ b/lib/fluent/page/hello/recom/recom_user_road.dart @@ -32,7 +32,7 @@ class _RecomUserRoadState extends State { child: ButtonTheme( data: ButtonThemeData( iconButtonStyle: ButtonStyle( - padding: ButtonState.all(EdgeInsets.zero), + padding: WidgetStateProperty.all(EdgeInsets.zero), ), ), child: IconButton( diff --git a/lib/fluent/page/network/network_setting_page.dart b/lib/fluent/page/network/network_setting_page.dart index 65f517805..5cf34e59e 100644 --- a/lib/fluent/page/network/network_setting_page.dart +++ b/lib/fluent/page/network/network_setting_page.dart @@ -1,11 +1,8 @@ -import 'dart:io'; - import 'package:dio/dio.dart'; -import 'package:dio/io.dart'; import 'package:fluent_ui/fluent_ui.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; import 'package:pixez/er/hoster.dart'; +import 'package:pixez/fluent/component/pixiv_image.dart'; import 'package:pixez/i18n.dart'; import 'package:pixez/main.dart'; import 'package:pixez/network/api_client.dart'; diff --git a/lib/fluent/page/picture/illust_items_page.dart b/lib/fluent/page/picture/illust_items_page.dart index 5dae3caf3..ce6b09711 100644 --- a/lib/fluent/page/picture/illust_items_page.dart +++ b/lib/fluent/page/picture/illust_items_page.dart @@ -157,13 +157,13 @@ abstract class IllustItemsPageState extends State ), data: ButtonThemeData( iconButtonStyle: ButtonStyle( - backgroundColor: ButtonState.all( + backgroundColor: WidgetStateProperty.all( FluentTheme.of(context).inactiveBackgroundColor, ), - shadowColor: ButtonState.all( + shadowColor: WidgetStateProperty.all( FluentTheme.of(context).shadowColor, ), - shape: ButtonState.all(CircleBorder()), + shape: WidgetStateProperty.all(CircleBorder()), ), ), ), diff --git a/lib/fluent/page/report/report_items_page.dart b/lib/fluent/page/report/report_items_page.dart index 96aff300f..60ab9c6a3 100644 --- a/lib/fluent/page/report/report_items_page.dart +++ b/lib/fluent/page/report/report_items_page.dart @@ -48,7 +48,7 @@ class _ReportItemsPageState extends State { final title = items[index]; return Container( color: index == _selectItem - ? FluentTheme.of(context).accentColor.withOpacity(0.5) + ? FluentTheme.of(context).accentColor.withValues(alpha: 255 * 0.5) : Colors.transparent, child: ListTile( title: Text(title), diff --git a/lib/fluent/page/theme/theme_page.dart b/lib/fluent/page/theme/theme_page.dart index 5cbbe46c0..dc5cabda3 100644 --- a/lib/fluent/page/theme/theme_page.dart +++ b/lib/fluent/page/theme/theme_page.dart @@ -48,7 +48,7 @@ class _ColorPickPageState extends State { onPressed: () async { final TextEditingController textEditingController = TextEditingController( - text: pickerColor.value + text: pickerColor.colorValue .toString() .toLowerCase() .replaceAll('color(0xff', '') diff --git a/lib/fluent/page/user/users_page.dart b/lib/fluent/page/user/users_page.dart index 8179f5f71..0c5bbf7ff 100644 --- a/lib/fluent/page/user/users_page.dart +++ b/lib/fluent/page/user/users_page.dart @@ -19,23 +19,17 @@ import 'dart:io'; import 'package:bot_toast/bot_toast.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:dio/dio.dart'; -import 'package:dio/io.dart'; -import 'package:fluent_ui/fluent_ui.dart' hide NestedScrollView; import 'package:fluent_ui/fluent_ui.dart'; import 'package:flutter/services.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:pixez/fluent/component/context_menu.dart'; -import 'package:pixez/fluent/component/painter_avatar.dart'; -import 'package:pixez/fluent/component/pixiv_image.dart'; import 'package:pixez/component/null_hero.dart'; import 'package:pixez/document_plugin.dart'; import 'package:pixez/er/hoster.dart'; import 'package:pixez/er/leader.dart'; -import 'package:pixez/exts.dart'; -import 'package:pixez/i18n.dart'; -import 'package:pixez/main.dart'; -import 'package:pixez/models/illust.dart'; +import 'package:pixez/fluent/component/context_menu.dart'; +import 'package:pixez/fluent/component/painter_avatar.dart'; +import 'package:pixez/fluent/component/pixiv_image.dart'; import 'package:pixez/fluent/page/follow/follow_list.dart'; import 'package:pixez/fluent/page/report/report_items_page.dart'; import 'package:pixez/fluent/page/shield/shield_page.dart'; @@ -43,6 +37,9 @@ import 'package:pixez/fluent/page/user/bookmark/bookmark_page.dart'; import 'package:pixez/fluent/page/user/detail/user_detail.dart'; import 'package:pixez/fluent/page/user/works/works_page.dart'; import 'package:pixez/fluent/page/zoom/zoom_page.dart'; +import 'package:pixez/i18n.dart'; +import 'package:pixez/main.dart'; +import 'package:pixez/models/illust.dart'; import 'package:pixez/network/api_client.dart'; import 'package:pixez/page/user/user_store.dart'; import 'package:share_plus/share_plus.dart'; @@ -420,7 +417,7 @@ class _UsersPageState extends State child: Container( color: FluentTheme.of(context) .acrylicBackgroundColor - .withOpacity(.5), + .withValues(alpha: 255 * .5), ), ), ),