Skip to content

Commit bbcd905

Browse files
author
ChenDoXiu
committed
fix image
1 parent 5de190f commit bbcd905

7 files changed

Lines changed: 286 additions & 28 deletions

File tree

.github/workflows/flutter-build.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ name: 构建发布Flutter应用
55

66
on:
77
push:
8-
paths:
9-
- "pubspec.yaml"
10-
branches:
11-
- main
8+
tags:
9+
- "*"
1210
jobs:
1311
pre-build:
1412
name: 预构建
@@ -39,7 +37,7 @@ jobs:
3937
build-apk:
4038
name: 编译android
4139
runs-on: ubuntu-latest
42-
needs: [pre-build]
40+
needs: [ pre-build ]
4341
steps:
4442
- name: 设置Flutter环境
4543
uses: subosito/flutter-action@v2
@@ -81,7 +79,7 @@ jobs:
8179
build-linux:
8280
name: 编译linux
8381
runs-on: ubuntu-latest
84-
needs: [pre-build]
82+
needs: [ pre-build ]
8583
steps:
8684
- name: 拉取代码
8785
uses: actions/checkout@v4
@@ -120,7 +118,7 @@ jobs:
120118
build-windows:
121119
name: 编译windows
122120
runs-on: windows-latest
123-
needs: [pre-build]
121+
needs: [ pre-build ]
124122
steps:
125123
- name: 拉取代码
126124
uses: actions/checkout@v4
@@ -157,7 +155,7 @@ jobs:
157155
build-macos:
158156
name: 编译macOS
159157
runs-on: macos-latest
160-
needs: [pre-build]
158+
needs: [ pre-build ]
161159
steps:
162160
- name: 拉取代码
163161
uses: actions/checkout@v4
@@ -194,7 +192,7 @@ jobs:
194192
195193
release:
196194
name: 上传包
197-
needs: [build-apk, build-linux, build-windows, build-macos, pre-build]
195+
needs: [ build-apk, build-linux, build-windows, build-macos, pre-build ]
198196
runs-on: ubuntu-latest
199197
permissions:
200198
contents: write
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
name: 构建发布Flutter应用
2+
3+
#on:
4+
# push:
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
jobs:
11+
pre-build:
12+
name: 预构建
13+
runs-on: ubuntu-latest
14+
outputs:
15+
APP_VERSION: ${{ steps.output-version.outputs.APP_VERSION }}
16+
APP_LAST_VERSION: ${{ steps.output-tag-version.outputs.APP_VERSION }}
17+
steps:
18+
- name: 拉取代码
19+
uses: actions/checkout@v3
20+
with:
21+
sparse-checkout: |
22+
pubspec.yaml
23+
sparse-checkout-cone-mode: false
24+
fetch-depth: 0
25+
- name: 读取当前版本号
26+
id: output-version
27+
run: |
28+
VERSION=`grep -iE --regexp="version: ([0-9\.+]*)" pubspec.yaml | grep -io "[0-9\.+]*"`
29+
echo "Version: $VERSION"
30+
echo "APP_VERSION=$VERSION" >> $GITHUB_OUTPUT
31+
- name: 获取最新的TAG
32+
id: output-tag-version
33+
run: |
34+
LAST_VERSION=`git tag --sort=-creatordate | head -1`
35+
echo "Version: $LAST_VERSION"
36+
echo "APP_LAST_VERSION=$LAST_VERSION" >> $GITHUB_OUTPUT
37+
build-apk:
38+
name: 编译android
39+
runs-on: ubuntu-latest
40+
needs: [ pre-build ]
41+
steps:
42+
- name: 设置Flutter环境
43+
uses: subosito/flutter-action@v2
44+
with:
45+
channel: "stable"
46+
47+
- name: 拉取代码
48+
uses: actions/checkout@v4
49+
50+
- name: 安装依赖项
51+
run: flutter pub get
52+
53+
- name: 设置java环境
54+
uses: actions/setup-java@v4
55+
with:
56+
distribution: "adopt"
57+
java-version: "21"
58+
59+
- name: 运行代码生成器
60+
run: dart run build_runner build
61+
62+
- name: 初始化签名
63+
run: |
64+
touch ./android/key.properties
65+
echo keyPassword='${{ secrets.KEYPASSWORD }}' >> ./android/key.properties
66+
echo storePassword='${{ secrets.STOREPASSWORD }}' >> ./android/key.properties
67+
echo keyAlias='${{ secrets.KEYALIAS }}' >> ./android/key.properties
68+
echo storeFile='./key.jks' >> ./android/key.properties
69+
echo ${{ secrets.KEY_STORE }} | base64 --decode > ./android/app/key.jks
70+
- name: 编译apk
71+
run: flutter build apk --split-per-abi --obfuscate --split-debug-info=build/app/outputs/symbols/release
72+
73+
- name: 上传apk到工作流程
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: build-apk
77+
path: build/app/outputs/apk/release/*
78+
79+
build-linux:
80+
name: 编译linux
81+
runs-on: ubuntu-latest
82+
needs: [ pre-build ]
83+
steps:
84+
- name: 拉取代码
85+
uses: actions/checkout@v4
86+
87+
- name: 设置Flutter环境
88+
uses: subosito/flutter-action@v2
89+
with:
90+
channel: "stable"
91+
92+
- name: 安装ninja、libgtk
93+
run: |
94+
sudo apt-get update -y
95+
sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev mpv
96+
97+
- name: 安装依赖项
98+
run: flutter pub get
99+
100+
- name: 配置桌面
101+
run: flutter config --enable-linux-desktop
102+
103+
- name: 运行代码生成器
104+
run: dart run build_runner build
105+
106+
- name: 编译linux
107+
run: flutter build linux
108+
109+
- name: 压缩生成的文件
110+
run: tar -zcvf "MoeKey-${{ needs.pre-build.outputs.APP_VERSION }}-linux-x86_64-release.tar.gz" --directory=build/linux/x64/release/bundle .
111+
112+
- name: 上传到工作流程
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: build-linux
116+
path: "MoeKey-${{ needs.pre-build.outputs.APP_VERSION }}-linux-x86_64-release.tar.gz"
117+
118+
build-windows:
119+
name: 编译windows
120+
runs-on: windows-latest
121+
needs: [ pre-build ]
122+
steps:
123+
- name: 拉取代码
124+
uses: actions/checkout@v4
125+
126+
- name: 设置Flutter环境
127+
uses: subosito/flutter-action@v2
128+
with:
129+
channel: "stable"
130+
131+
- name: 安装依赖项
132+
run: flutter pub get
133+
134+
- name: 启动windows桌面
135+
run: flutter config --enable-windows-desktop
136+
137+
- name: 运行代码生成器
138+
run: dart run build_runner build
139+
140+
- name: 编译windows
141+
run: flutter build windows
142+
143+
- name: 压缩生成的文件
144+
run: |
145+
$sourceFolder = "build\windows\x64\runner\Release"
146+
$destinationPath = "MoeKey-${{ needs.pre-build.outputs.APP_VERSION }}-windows-x86_64-release.zip"
147+
Compress-Archive -Path $sourceFolder -DestinationPath $destinationPath
148+
149+
- name: 上传到工作流程
150+
uses: actions/upload-artifact@v4
151+
with:
152+
name: build-windows
153+
path: "MoeKey-${{ needs.pre-build.outputs.APP_VERSION }}-windows-x86_64-release.zip"
154+
155+
build-macos:
156+
name: 编译macOS
157+
runs-on: macos-latest
158+
needs: [ pre-build ]
159+
steps:
160+
- name: 拉取代码
161+
uses: actions/checkout@v4
162+
163+
- name: 设置Flutter环境
164+
uses: subosito/flutter-action@v2
165+
with:
166+
channel: "stable"
167+
168+
- name: 安装依赖项
169+
run: flutter pub get
170+
171+
- name: 启动桌面
172+
run: flutter config --enable-macos-desktop
173+
174+
- name: 运行代码生成器
175+
run: dart run build_runner build
176+
177+
- name: 编译macOS
178+
run: flutter build macos
179+
180+
- name: 压缩生成的文件
181+
run: |
182+
cd build/macos/Build/Products/Release
183+
zip -rq MoeKey-${{ needs.pre-build.outputs.APP_VERSION }}-macOS-universal-release.zip MoeKey.app
184+
mv MoeKey-${{ needs.pre-build.outputs.APP_VERSION }}-macOS-universal-release.zip $GITHUB_WORKSPACE
185+
186+
- name: 上传到工作流程
187+
uses: actions/upload-artifact@v4
188+
with:
189+
name: build-macos
190+
path: |
191+
MoeKey-${{ needs.pre-build.outputs.APP_VERSION }}-macOS-universal-release.zip
192+
193+
# release:
194+
# name: 上传包
195+
# needs: [build-apk, build-linux, build-windows, build-macos, pre-build]
196+
# runs-on: ubuntu-latest
197+
# permissions:
198+
# contents: write
199+
# steps:
200+
# - name: 下载apk
201+
# uses: actions/download-artifact@v4
202+
# with:
203+
# name: build-apk
204+
# path: artifact
205+
#
206+
# - name: 下载linux
207+
# uses: actions/download-artifact@v4
208+
# with:
209+
# name: build-linux
210+
# path: artifact
211+
#
212+
# - name: 下载windows
213+
# uses: actions/download-artifact@v4
214+
# with:
215+
# name: build-windows
216+
# path: artifact
217+
#
218+
# - name: 下载macOS
219+
# uses: actions/download-artifact@v4
220+
# with:
221+
# name: build-macos
222+
# path: artifact
223+
#
224+
# - name: 创建releases
225+
# id: create_release
226+
# uses: softprops/action-gh-release@v2
227+
# with:
228+
# tag_name: ${{ needs.pre-build.outputs.APP_VERSION }}
229+
# files: ./artifact/*
230+
# body: "[CHANGELOG.md](CHANGELOG.md)"

lib/pages/settings/profile/profile.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ class SettingsProfile extends HookConsumerWidget {
2727
MkFormItem(
2828
label: "个人简介",
2929
helperText: "你可以在个人简介中包含一些#标签。",
30-
child: const MkInput(
31-
maxLines: 6,
32-
),
30+
child: const MkSelect(),
3331
),
3432
MkFormItem(
3533
label: "位置",

lib/widgets/mfm_text/mfm_text.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ _getParse({
308308
MkImage(
309309
"$loginServerUrl/avatar/@$user${host != null ? "@$host" : ""}",
310310
height: textStyle.fontSize! * 1.5,
311+
width: textStyle.fontSize! * 1.5,
311312
shape: BoxShape.circle,
312313
),
313314
Text.rich(

lib/widgets/mk_image.dart

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,16 @@ class MkImage extends StatelessWidget {
5555
if (constraints.maxWidth == double.infinity) {
5656
constraintsWidth = constraints.minWidth;
5757
}
58-
return Container(
58+
Widget child = ColoredBox(
59+
color: const Color.fromARGB(40, 0, 0, 0),
60+
);
61+
if (blurHash != null && blurHash!.isNotEmpty) {
62+
child = BlurHash(blurHash!);
63+
}
64+
return SizedBox(
5965
width: width ?? height ?? constraintsWidth,
6066
height: height ?? constraintsHeight,
61-
color: const Color.fromARGB(128, 0, 0, 0),
67+
child: child,
6268
);
6369
},
6470
);
@@ -73,20 +79,8 @@ class MkImage extends StatelessWidget {
7379
);
7480
}
7581

76-
child = AnimatedOpacity(
82+
return AnimatedSwitcher(
7783
duration: const Duration(milliseconds: 200),
78-
opacity:
79-
state.extendedImageLoadState == LoadState.completed ? 1.0 : 0.1,
80-
child: child,
81-
);
82-
83-
if (blurHash == null ||
84-
blurHash!.isEmpty ||
85-
state.extendedImageLoadState == LoadState.completed) {
86-
return child;
87-
}
88-
return BlurHash(
89-
blurHash!,
9084
child: child,
9185
);
9286
},

lib/widgets/mk_input.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,37 @@ class MkInput extends ConsumerWidget {
7979
);
8080
}
8181
}
82+
83+
class MkSelect extends HookConsumerWidget {
84+
const MkSelect({super.key});
85+
86+
@override
87+
Widget build(BuildContext context, WidgetRef ref) {
88+
var themes = ref.watch(themeColorsProvider);
89+
return Material(
90+
color: themes.panelColor,
91+
child: FormField(builder: (FormFieldState state) {
92+
return DropdownButtonFormField(
93+
decoration: inputDecoration(themes, "请选择"),
94+
style: TextStyle(fontSize: 14, color: themes.fgColor),
95+
dropdownColor: themes.panelColor,
96+
focusColor: themes.panelColor,
97+
isExpanded: true,
98+
items: const [
99+
DropdownMenuItem(
100+
child: Text("选项1"),
101+
value: "1",
102+
),
103+
DropdownMenuItem(
104+
child: Text("选项2"),
105+
value: "2",
106+
),
107+
],
108+
onChanged: (value) {
109+
state.didChange(value);
110+
},
111+
);
112+
}),
113+
);
114+
}
115+
}

0 commit comments

Comments
 (0)