Skip to content

Commit 3827337

Browse files
committed
feat:upgrade lib & fix for suggestion
1 parent 9fbcb09 commit 3827337

22 files changed

+97
-75
lines changed

lib/api/qiniu_api.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ class QiniuApi {
144144
/// 七牛管理验签拦截器
145145
class QiniuInterceptor extends InterceptorsWrapper {
146146
@override
147-
Future onRequest(RequestOptions options) async {
147+
Future onRequest(
148+
RequestOptions options,
149+
RequestInterceptorHandler handler,
150+
) async {
148151
if (options.path.contains(QiniuApi.BASE_URL)) {
149152
String ak = '${options.extra[QiniuApi.accessKey]}';
150153
String sk = '${options.extra[QiniuApi.secretKey]}';

lib/api/tcyun_api.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ class TcyunApi {
8888
/// TcYun验签拦截器
8989
class TcyunInterceptor extends InterceptorsWrapper {
9090
@override
91-
Future onRequest(RequestOptions options) async {
91+
Future onRequest(
92+
RequestOptions options,
93+
RequestInterceptorHandler handler,
94+
) async {
9295
if (options.path.contains(TcyunApi.BASE_URL)) {
9396
/// 生成 KeyTime
9497
var keytime = TcyunApi.buildKeyTime();

lib/api/upyun_api.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ class UpyunApi {
6868

6969
class UpyunInterceptor extends InterceptorsWrapper {
7070
@override
71-
Future onRequest(RequestOptions options) async {
71+
Future onRequest(
72+
RequestOptions options,
73+
RequestInterceptorHandler handler,
74+
) async {
7275
if (options.path.contains(UpyunApi.BASE_URL.replaceFirst('http://', ''))) {
7376
/// 请求方式,如:GET、POST、PUT、HEAD 等
7477
String method = options.method.toUpperCase();

lib/utils/image_preview.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:io';
22
import 'dart:math';
33

44
import 'package:extended_image/extended_image.dart';
5+
import 'package:flutter/cupertino.dart';
56
import 'package:flutter/material.dart';
67
import 'package:flutter/services.dart';
78
import 'package:flutter_picgo/model/uploaded.dart';
@@ -17,8 +18,8 @@ class ImagePreviewUtils {
1718
Navigator.push(
1819
context,
1920
Platform.isAndroid
20-
? TransparentMaterialPageRoute(builder: (_) => page)
21-
: TransparentCupertinoPageRoute(builder: (_) => page),
21+
? MaterialPageRoute(builder: (_) => page)
22+
: CupertinoPageRoute(builder: (_) => page),
2223
);
2324
}
2425

@@ -30,8 +31,8 @@ class ImagePreviewUtils {
3031
Navigator.push(
3132
context,
3233
Platform.isAndroid
33-
? TransparentMaterialPageRoute(builder: (_) => page)
34-
: TransparentCupertinoPageRoute(builder: (_) => page));
34+
? MaterialPageRoute(builder: (_) => page)
35+
: CupertinoPageRoute(builder: (_) => page));
3536
}
3637
}
3738

lib/utils/permission.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class PermissionUtils {
2121
title: Text('警告'),
2222
content: Text(text),
2323
actions: <Widget>[
24-
FlatButton(
24+
TextButton(
2525
child: Text('去设置'),
2626
onPressed: () {
2727
openAppSettings();

lib/utils/strategy/impl/gitee_image_upload.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class GiteeImageUpload implements ImageUploadStrategy {
7777
await ImageUploadUtils.saveUploadedItem(uploadedItem);
7878
return uploadedItem;
7979
} on DioError catch (e) {
80-
if (e.type == DioErrorType.RESPONSE &&
80+
if (e.type == DioErrorType.response &&
8181
e.error.toString().indexOf('400') > 0) {
8282
throw GiteeError(error: '文件已存在!');
8383
} else {

lib/utils/strategy/impl/github_image_upload.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class GithubImageUpload implements ImageUploadStrategy {
6464
throw GithubError(error: '读取配置文件错误!请重试');
6565
}
6666
} on DioError catch (e) {
67-
if (e.type == DioErrorType.RESPONSE &&
67+
if (e.type == DioErrorType.response &&
6868
e.error.toString().indexOf('422') > 0) {
6969
throw GithubError(error: '文件已存在!');
7070
} else {

lib/utils/strategy/impl/qiniu_image_upload.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ class QiniuImageUpload extends ImageUploadStrategy {
3131
}
3232
return uploaded;
3333
} on DioError catch (e) {
34-
if (e.type == DioErrorType.RESPONSE &&
34+
if (e.type == DioErrorType.response &&
3535
e.error.toString().indexOf('400') > 0) {
3636
throw QiniuError(error: '400 请求报文格式错误');
37-
} else if (e.type == DioErrorType.RESPONSE &&
37+
} else if (e.type == DioErrorType.response &&
3838
e.error.toString().indexOf('401') > 0) {
3939
throw QiniuError(error: '401 管理凭证无效');
40-
} else if (e.type == DioErrorType.RESPONSE &&
40+
} else if (e.type == DioErrorType.response &&
4141
e.error.toString().indexOf('599') > 0) {
4242
throw QiniuError(error: '599 服务端操作失败');
43-
} else if (e.type == DioErrorType.RESPONSE &&
43+
} else if (e.type == DioErrorType.response &&
4444
e.error.toString().indexOf('612') > 0) {
4545
throw QiniuError(error: '612 待删除资源不存在');
4646
} else {
@@ -88,16 +88,16 @@ class QiniuImageUpload extends ImageUploadStrategy {
8888
await ImageUploadUtils.saveUploadedItem(uploadedItem);
8989
return uploadedItem;
9090
} on DioError catch (e) {
91-
if (e.type == DioErrorType.RESPONSE &&
91+
if (e.type == DioErrorType.response &&
9292
e.error.toString().indexOf('400') > 0) {
9393
throw QiniuError(error: '400 请求报文格式错误');
94-
} else if (e.type == DioErrorType.RESPONSE &&
94+
} else if (e.type == DioErrorType.response &&
9595
e.error.toString().indexOf('401') > 0) {
9696
throw QiniuError(error: '401 管理凭证无效');
97-
} else if (e.type == DioErrorType.RESPONSE &&
97+
} else if (e.type == DioErrorType.response &&
9898
e.error.toString().indexOf('599') > 0) {
9999
throw QiniuError(error: '599 服务端操作失败');
100-
} else if (e.type == DioErrorType.RESPONSE &&
100+
} else if (e.type == DioErrorType.response &&
101101
e.error.toString().indexOf('612') > 0) {
102102
throw QiniuError(error: '612 待删除资源不存在');
103103
} else {

lib/views/404.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ class PageNotFound extends StatelessWidget {
1010
),
1111
body: Container(
1212
child: Center(
13-
child: OutlineButton(
14-
color: Colors.blue,
13+
child: OutlinedButton(
14+
style: ButtonStyle(
15+
side:
16+
MaterialStateProperty.all(BorderSide(color: Colors.blue))),
1517
child: Text('关闭'),
1618
onPressed: () {
1719
Application.router.pop(context);

lib/views/album_page/album_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class _AlbumPageState extends State<AlbumPage> implements AlbumPageContract {
215215
title: Text('确定删除吗'),
216216
content: Text('删除后无法恢复'),
217217
actions: <Widget>[
218-
FlatButton(
218+
TextButton(
219219
child: Text('确定'),
220220
onPressed: () {
221221
Navigator.pop(context);

0 commit comments

Comments
 (0)