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);

lib/views/manage_page/gitee_page/gitee_repo_page.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ class _GiteeRepoPageState extends BaseLoadingPageState<GiteeRepoPage>
9292
child: Column(
9393
mainAxisAlignment: MainAxisAlignment.center,
9494
children: <Widget>[
95-
RaisedButton(
96-
color: Theme.of(context).accentColor,
97-
textColor: Colors.white,
95+
ElevatedButton(
96+
style: ButtonStyle(
97+
foregroundColor: MaterialStateProperty.all(Colors.white),
98+
backgroundColor:
99+
MaterialStateProperty.all(Theme.of(context).accentColor)),
98100
child: Text('刷新'),
99101
onPressed: () {
100102
setState(() {
@@ -164,7 +166,7 @@ class _GiteeRepoPageState extends BaseLoadingPageState<GiteeRepoPage>
164166
title: Text('确定删除吗'),
165167
content: Text('删除后无法恢复'),
166168
actions: <Widget>[
167-
FlatButton(
169+
TextButton(
168170
child: Text('确定'),
169171
onPressed: () {
170172
Navigator.pop(context, true);

lib/views/manage_page/github_page/github_repo_page.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ class _GithubRepoPageState extends BaseLoadingPageState<GithubRepoPage>
9292
child: Column(
9393
mainAxisAlignment: MainAxisAlignment.center,
9494
children: <Widget>[
95-
RaisedButton(
96-
color: Theme.of(context).accentColor,
97-
textColor: Colors.white,
95+
ElevatedButton(
96+
style: ButtonStyle(
97+
foregroundColor: MaterialStateProperty.all(Colors.white),
98+
backgroundColor:
99+
MaterialStateProperty.all(Theme.of(context).accentColor)),
98100
child: Text('刷新'),
99101
onPressed: () {
100102
setState(() {
@@ -164,7 +166,7 @@ class _GithubRepoPageState extends BaseLoadingPageState<GithubRepoPage>
164166
title: Text('确定删除吗'),
165167
content: Text('删除后无法恢复'),
166168
actions: <Widget>[
167-
FlatButton(
169+
TextButton(
168170
child: Text('确定'),
169171
onPressed: () {
170172
Navigator.pop(context, true);

lib/views/manage_page/lsky_page/lsky_repo_page.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ class _LskyRepoPageState extends BaseLoadingPageState<LskyRepoPage>
4747
child: Column(
4848
mainAxisAlignment: MainAxisAlignment.center,
4949
children: <Widget>[
50-
RaisedButton(
51-
color: Theme.of(context).accentColor,
52-
textColor: Colors.white,
50+
ElevatedButton(
51+
style: ButtonStyle(
52+
foregroundColor: MaterialStateProperty.all(Colors.white),
53+
backgroundColor:
54+
MaterialStateProperty.all(Theme.of(context).accentColor)),
5355
child: Text('刷新'),
5456
onPressed: () {
5557
setState(() {
@@ -136,7 +138,7 @@ class _LskyRepoPageState extends BaseLoadingPageState<LskyRepoPage>
136138
title: Text('确定删除吗'),
137139
content: Text('删除后无法恢复'),
138140
actions: <Widget>[
139-
FlatButton(
141+
TextButton(
140142
child: Text('确定'),
141143
onPressed: () {
142144
Navigator.pop(context, true);

lib/views/manage_page/qiniu_page/qiniu_repo_page.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ class _QiniuRepoPageState extends BaseLoadingPageState<QiniuRepoPage>
5252
child: Column(
5353
mainAxisAlignment: MainAxisAlignment.center,
5454
children: <Widget>[
55-
RaisedButton(
56-
color: Theme.of(context).accentColor,
57-
textColor: Colors.white,
55+
ElevatedButton(
56+
style: ButtonStyle(
57+
foregroundColor: MaterialStateProperty.all(Colors.white),
58+
backgroundColor:
59+
MaterialStateProperty.all(Theme.of(context).accentColor)),
5860
child: Text('刷新'),
5961
onPressed: () {
6062
setState(() {
@@ -121,7 +123,7 @@ class _QiniuRepoPageState extends BaseLoadingPageState<QiniuRepoPage>
121123
title: Text('确定删除吗'),
122124
content: Text('删除后无法恢复'),
123125
actions: <Widget>[
124-
FlatButton(
126+
TextButton(
125127
child: Text('确定'),
126128
onPressed: () {
127129
Navigator.pop(context, true);

lib/views/manage_page/smms_page/smms_repo_page.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ class _SMMSRepoPageState extends BaseLoadingPageState<SMMSRepoPage>
120120
child: Column(
121121
mainAxisAlignment: MainAxisAlignment.center,
122122
children: <Widget>[
123-
RaisedButton(
124-
color: Theme.of(context).accentColor,
125-
textColor: Colors.white,
123+
ElevatedButton(
124+
style: ButtonStyle(
125+
foregroundColor: MaterialStateProperty.all(Colors.white),
126+
backgroundColor:
127+
MaterialStateProperty.all(Theme.of(context).accentColor)),
126128
child: Text('刷新'),
127129
onPressed: () {
128130
setState(() {
@@ -181,7 +183,7 @@ class _SMMSRepoPageState extends BaseLoadingPageState<SMMSRepoPage>
181183
title: Text('确定删除吗'),
182184
content: Text('删除后无法恢复'),
183185
actions: <Widget>[
184-
FlatButton(
186+
TextButton(
185187
child: Text('确定'),
186188
onPressed: () {
187189
Navigator.pop(context, true);

lib/views/pb_setting_page/base_pb_page_state.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ abstract class BasePBSettingPageState<T extends StatefulWidget>
5050
child: Row(
5151
children: <Widget>[
5252
Expanded(
53-
child: RaisedButton(
54-
color: Theme.of(context).accentColor,
55-
textColor: Colors.white,
53+
child: ElevatedButton(
54+
style: ButtonStyle(
55+
foregroundColor:
56+
MaterialStateProperty.all(Colors.white),
57+
backgroundColor: MaterialStateProperty.all(
58+
Theme.of(context).accentColor)),
5659
child: Text('保存'),
5760
onPressed: () {
5861
if (validate) {
@@ -63,9 +66,12 @@ abstract class BasePBSettingPageState<T extends StatefulWidget>
6366
),
6467
SizedBox(width: 5.0),
6568
Expanded(
66-
child: RaisedButton(
67-
color: Colors.greenAccent,
68-
textColor: Colors.white,
69+
child: ElevatedButton(
70+
style: ButtonStyle(
71+
foregroundColor:
72+
MaterialStateProperty.all(Colors.white),
73+
backgroundColor:
74+
MaterialStateProperty.all(Colors.greenAccent)),
6975
child: Text('设为默认图床'),
7076
onPressed: () {
7177
if (validate) {

lib/views/pb_setting_page/pb_setting_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class _PBSettingPageState extends State<PBSettingPage>
5050
'在PC端已经配置好的用户可以使用PicGo新版的生成图床配置二维码功能。\n\n' +
5151
'然后使用Flutter-PicGo直接扫描即可进行配置转换。'),
5252
actions: <Widget>[
53-
FlatButton(
53+
TextButton(
5454
child: Text('已了解,去扫描'),
5555
onPressed: () {
5656
Navigator.pop(context);

lib/views/upload_page/handle_upload_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class _HandleUploadPageState extends State<HandleUploadPage> {
154154
),
155155
),
156156
actions: <Widget>[
157-
FlatButton(
157+
TextButton(
158158
child: Text('确定'),
159159
onPressed: () {
160160
Navigator.pop(context);

pubspec.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,22 @@ environment:
2323
dependencies:
2424
flutter:
2525
sdk: flutter
26-
shared_preferences: ^0.5.12+4
27-
dio: ^3.0.9
28-
package_info: ^0.4.1
26+
shared_preferences: ^2.0.5
27+
dio: ^4.0.0
28+
package_info: ^2.0.0
2929
sqflite: ^1.3.2+1
30-
fluro: ^1.7.7
30+
fluro: ^2.0.3
3131
toast: ^0.1.5
3232
json_serializable: ^3.3.0
3333
url_launcher: ^5.7.10
3434
permission_handler: ^5.0.1
3535
barcode_scan: ^3.0.1
36-
provider: ^4.1.3
37-
crypto: ^2.1.4
36+
provider: ^5.0.0
37+
crypto: ^3.0.1
3838
flutter_local_notifications: ^3.0.1+4
39-
pull_to_refresh: ^1.6.2
40-
characters: ^1.0.0
41-
wechat_assets_picker: ^4.2.2
42-
extended_image: ^1.5.0
39+
pull_to_refresh: ^1.6.5
40+
wechat_assets_picker: ^5.1.3
41+
extended_image: ^4.0.1
4342

4443

4544
# The following adds the Cupertino Icons font to your application.

test/api/aliyun_api_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ main() {
1717
var sign = AliyunApi.buildSignature('LTAIsXml0iczvY0J',
1818
'yw8eO9Fa9Py2GAPRGG8N3GPKCeKCXl', 'PUT', 'zjyzy', 'test.txt');
1919
try {
20-
Response res = await NetUtils.getInstance().put(
20+
await NetUtils.getInstance().put(
2121
'https://zjyzy.oss-cn-shenzhen.aliyuncs.com/test.txt',
2222
options: Options(headers: {
2323
'Authorization': sign,
2424
'Date': HttpDate.format(new DateTime.now()),
2525
}, contentType: 'application/x-www-form-urlencoded'),
2626
);
27-
} on DioError catch (e) {}
27+
} on DioError catch (_) {}
2828
});
2929

3030
test('测试FormData提交图片', () async {
@@ -43,7 +43,7 @@ main() {
4343
var sign = hmacsha1.convert(utf8.encode(originSign));
4444
var encodeSign = base64.encode(sign.bytes);
4545
try {
46-
Response res = await NetUtils.getInstance().post(
46+
await NetUtils.getInstance().post(
4747
'https://zjyzy.oss-cn-shenzhen.aliyuncs.com',
4848
data: FormData.fromMap({
4949
'key': 'logo.png',
@@ -53,6 +53,6 @@ main() {
5353
'file': await MultipartFile.fromFile(pathname, filename: 'logo.png')
5454
}),
5555
options: Options(contentType: Headers.formUrlEncodedContentType));
56-
} on DioError catch (e) {}
56+
} on DioError catch (_) {}
5757
});
5858
}

0 commit comments

Comments
 (0)