@@ -38,6 +38,9 @@ class BaseState extends DisposableState<Base> {
38
38
// 用户输入的文件名
39
39
String ? key;
40
40
41
+ // 用户输入的 mimeType
42
+ String ? mimeType;
43
+
41
44
// 用户输入的 partSize
42
45
int partSize = 4 ;
43
46
@@ -119,6 +122,7 @@ class BaseState extends DisposableState<Base> {
119
122
120
123
final putOptions = PutOptions (
121
124
key: key,
125
+ mimeType: mimeType,
122
126
partSize: partSize,
123
127
controller: putController,
124
128
);
@@ -180,7 +184,7 @@ class BaseState extends DisposableState<Base> {
180
184
}
181
185
182
186
void onSelectedFile (PlatformFile file) {
183
- printToConsole ('选中文件: ${file .path }' );
187
+ printToConsole ('选中文件: path: ${file .path }, filename: ${ file . name }, size: ${ file . size }' );
184
188
// ignore: unnecessary_null_comparison
185
189
if (file.size != null ) {
186
190
// 一般在非 web 平台上可以直接读取 size 属性
@@ -230,6 +234,18 @@ class BaseState extends DisposableState<Base> {
230
234
this .key = key;
231
235
}
232
236
237
+
238
+ void onMimeTypeChange (String mimeType) {
239
+ if (mimeType == '' ) {
240
+ printToConsole ('清除 mimeType' );
241
+ this .mimeType = null ;
242
+ return ;
243
+ }
244
+
245
+ printToConsole ('设置 mimeType: $mimeType ' );
246
+ this .mimeType = mimeType;
247
+ }
248
+
233
249
Widget get cancelButton {
234
250
if (statusValue == StorageStatus .Request ) {
235
251
return Padding (
@@ -257,6 +273,13 @@ class BaseState extends DisposableState<Base> {
257
273
label: '请输入 Key(可选)回车确认' ,
258
274
),
259
275
),
276
+ Padding (
277
+ padding: const EdgeInsets .all (8.0 ),
278
+ child: StringInput (
279
+ onMimeTypeChange,
280
+ label: '请输入 MimeType(可选)回车确认' ,
281
+ ),
282
+ ),
260
283
Padding (
261
284
padding: const EdgeInsets .all (8.0 ),
262
285
child: StringInput (
0 commit comments