diff --git a/LabelStoreMax/lib/resources/pages/account_detail.dart b/LabelStoreMax/lib/resources/pages/account_detail.dart index f152e80..8e12f3d 100644 --- a/LabelStoreMax/lib/resources/pages/account_detail.dart +++ b/LabelStoreMax/lib/resources/pages/account_detail.dart @@ -98,9 +98,16 @@ class _AccountDetailPageState extends State if (activeBody == null) { return SizedBox.shrink(); } - if (_wcCustomerInfoResponse != null) { - print('here'); - print(_wcCustomerInfoResponse.data.avatar); + String userAvatar; + String userFirstName = ""; + String userLastName = ""; + if (_wcCustomerInfoResponse != null && _wcCustomerInfoResponse.data != null) { + userAvatar = _wcCustomerInfoResponse.data.avatar; + + userFirstName = _wcCustomerInfoResponse + .data.firstName; + userLastName = _wcCustomerInfoResponse + .data.lastName; } return Scaffold( appBar: AppBar( @@ -135,10 +142,8 @@ class _AccountDetailPageState extends State children: [ Container( margin: EdgeInsets.only(top: 10), - child: _wcCustomerInfoResponse != null ? CircleAvatar( - backgroundImage: NetworkImage( - _wcCustomerInfoResponse.data.avatar, - ), + child: userAvatar != null ? CircleAvatar( + backgroundImage: NetworkImage(userAvatar), ) : Icon(Icons.account_circle_rounded, size: 65,), height: 90, width: 90, @@ -156,18 +161,13 @@ class _AccountDetailPageState extends State MainAxisAlignment.spaceAround, children: [ Text( - (_wcCustomerInfoResponse == null - ? "" - : [ - _wcCustomerInfoResponse - .data.firstName, - _wcCustomerInfoResponse - .data.lastName - ] - .where((t) => - (t != null || t != "")) - .toList() - .join(" ")), + [ + userFirstName, + userLastName + ].where((t) => + (t != null || t != "")) + .toList() + .join(" "), style: TextStyle( fontSize: 20, fontWeight: FontWeight.w600,