diff --git a/lib/pages/sign/sign_func.dart b/lib/pages/sign/sign_func.dart index 6755fbba..5f246ecc 100644 --- a/lib/pages/sign/sign_func.dart +++ b/lib/pages/sign/sign_func.dart @@ -74,6 +74,7 @@ class SignFunc { static Future getUserInfo() async { BaseModel baseModel = await NetUtil().get(API.user.userProfile); + if (baseModel.data == null) return null; return UserInfoModel.fromJson(baseModel.data); } diff --git a/lib/utils/logger/logger_dio_success.dart b/lib/utils/logger/logger_dio_success.dart index 09adb267..8ac940f1 100644 --- a/lib/utils/logger/logger_dio_success.dart +++ b/lib/utils/logger/logger_dio_success.dart @@ -48,6 +48,32 @@ class _LoggerSuccessDetail extends StatefulWidget { } class __LoggerSuccessDetailState extends State<_LoggerSuccessDetail> { + _buildTable(Map tableData) { + return Table( + border: TableBorder( + horizontalInside: BorderSide(color: Colors.black12), + verticalInside: BorderSide(color: Colors.black12), + ), + children: [ + TableRow( + decoration: BoxDecoration(color: Colors.black12), + children: [ + 'Key'.text.make().p2(), + 'Value'.text.make().p2(), + ], + ), + ...tableData.entries.map((e) { + return TableRow( + children: [ + e.key.text.make().p2(), + e.value.toString().text.make().p2(), + ], + ); + }).toList(), + ], + ); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -67,7 +93,7 @@ class __LoggerSuccessDetailState extends State<_LoggerSuccessDetail> { ].row(), ), ListTile(title: 'headers'.text.make()), - widget.response.request?.headers.toString().text.make(), + _buildTable(widget.response.request.headers), ListTile(title: 'queryParameters'.text.make()), (widget.response.request?.queryParameters ?? '') .toString() @@ -77,7 +103,7 @@ class __LoggerSuccessDetailState extends State<_LoggerSuccessDetail> { (widget.response.request?.data ?? '').toString().text.make(), ListTile(title: 'Response'.text.bold.size(22).make()), ListTile(title: 'headers'.text.make()), - widget.response?.headers.toString().text.make(), + _buildTable(widget.response.headers.map), ListTile(title: 'data'.text.make()), (widget.response?.data ?? '').toString().text.make(), ],