From 7365e6425a4a09f827bf9c315c96ad869fe2e0bd Mon Sep 17 00:00:00 2001 From: rich Date: Sun, 28 Apr 2019 20:37:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E4=B8=AA=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- lib/http_log_widget.dart | 14 +++++--------- lib/request_log_widget.dart | 9 +++++---- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 4133768..8998738 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ dio网络请求日志插件 dio_log: git: url: ssh://git@gitlabssh.office.tengyue360.com:8042/cuidong/dio_log.git - ref: v1.0.1 + ref: v1.0.0 ### 设置dio拦截器 dio.interceptors.add(HttpLogInterceptor()); ### 打开log日志列表 diff --git a/lib/http_log_widget.dart b/lib/http_log_widget.dart index c7aed90..a91251a 100644 --- a/lib/http_log_widget.dart +++ b/lib/http_log_widget.dart @@ -38,15 +38,11 @@ class _HttpLogWidgetState extends State Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Hero( - tag: widget - .httpLog.options.queryParameters[HttpLogInterceptor.reqTimeKey], - child: Text( - widget.httpLog.options.path, - style: TextStyle( - fontSize: 16.0, - color: Color(0xFF4a4a4a), - ), + title: Text( + widget.httpLog.options.path, + style: TextStyle( + fontSize: 16.0, + color: Color(0xFF4a4a4a), ), ), backgroundColor: Colors.white, diff --git a/lib/request_log_widget.dart b/lib/request_log_widget.dart index 99e3ad9..79a977e 100644 --- a/lib/request_log_widget.dart +++ b/lib/request_log_widget.dart @@ -41,17 +41,18 @@ class _RequestLogWidgetState extends State { options.queryParameters[HttpLogInterceptor.reqTimeKey])); ///格式化返回时间 - if (options.queryParameters[HttpLogInterceptor.resTimeKey] == null) { + var resTime = options.queryParameters[HttpLogInterceptor.resTimeKey]; + if (resTime == null) { reqFail = true; + resTime = 0; } var responseTime = reqFail ? '请求失败' - : _getTimeStr(DateTime.fromMillisecondsSinceEpoch( - options.queryParameters[HttpLogInterceptor.resTimeKey] ?? 0)); + : _getTimeStr(DateTime.fromMillisecondsSinceEpoch(resTime)); ///计算请求耗时 var duration = - '${options.queryParameters[HttpLogInterceptor.resTimeKey] ?? 0 - options.queryParameters[HttpLogInterceptor.reqTimeKey]}ms'; + '${resTime - options.queryParameters[HttpLogInterceptor.reqTimeKey]}ms'; if (reqFail) { duration = '遥遥无期'; }