@@ -98,9 +98,16 @@ class _AccountDetailPageState extends State<AccountDetailPage>
9898 if (activeBody == null ) {
9999 return SizedBox .shrink ();
100100 }
101- if (_wcCustomerInfoResponse != null ) {
102- print ('here' );
103- print (_wcCustomerInfoResponse.data.avatar);
101+ String userAvatar;
102+ String userFirstName = "" ;
103+ String userLastName = "" ;
104+ if (_wcCustomerInfoResponse != null && _wcCustomerInfoResponse.data != null ) {
105+ userAvatar = _wcCustomerInfoResponse.data.avatar;
106+
107+ userFirstName = _wcCustomerInfoResponse
108+ .data.firstName;
109+ userLastName = _wcCustomerInfoResponse
110+ .data.lastName;
104111 }
105112 return Scaffold (
106113 appBar: AppBar (
@@ -135,10 +142,8 @@ class _AccountDetailPageState extends State<AccountDetailPage>
135142 children: < Widget > [
136143 Container (
137144 margin: EdgeInsets .only (top: 10 ),
138- child: _wcCustomerInfoResponse != null ? CircleAvatar (
139- backgroundImage: NetworkImage (
140- _wcCustomerInfoResponse.data.avatar,
141- ),
145+ child: userAvatar != null ? CircleAvatar (
146+ backgroundImage: NetworkImage (userAvatar),
142147 ) : Icon (Icons .account_circle_rounded, size: 65 ,),
143148 height: 90 ,
144149 width: 90 ,
@@ -156,18 +161,13 @@ class _AccountDetailPageState extends State<AccountDetailPage>
156161 MainAxisAlignment .spaceAround,
157162 children: < Widget > [
158163 Text (
159- (_wcCustomerInfoResponse == null
160- ? ""
161- : [
162- _wcCustomerInfoResponse
163- .data.firstName,
164- _wcCustomerInfoResponse
165- .data.lastName
166- ]
167- .where ((t) =>
168- (t != null || t != "" ))
169- .toList ()
170- .join (" " )),
164+ [
165+ userFirstName,
166+ userLastName
167+ ].where ((t) =>
168+ (t != null || t != "" ))
169+ .toList ()
170+ .join (" " ),
171171 style: TextStyle (
172172 fontSize: 20 ,
173173 fontWeight: FontWeight .w600,
0 commit comments