@@ -18,6 +18,7 @@ import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
1818import 'package:flutter_app/resources/widgets/safearea_widget.dart' ;
1919import 'package:flutter_app/resources/widgets/woosignal_ui.dart' ;
2020import 'package:nylo_framework/nylo_framework.dart' ;
21+ import 'package:wp_json_api/exceptions/invalid_user_token_exception.dart' ;
2122import 'package:wp_json_api/models/responses/wc_customer_info_response.dart' ;
2223import 'package:wp_json_api/wp_json_api.dart' ;
2324
@@ -49,6 +50,14 @@ class _AccountDetailPageState extends State<AccountDetailPage>
4950 try {
5051 wcCustomerInfoResponse = await WPJsonAPI .instance
5152 .api ((request) => request.wcCustomerInfo (userToken));
53+ } on InvalidUserTokenException catch (_) {
54+ showToastNotification (
55+ context,
56+ title: trans ("Oops!" ),
57+ description: trans ("Something went wrong" ),
58+ style: ToastNotificationStyleType .DANGER ,
59+ );
60+ await authLogout (context);
5261 } on Exception catch (_) {
5362 showToastNotification (
5463 context,
@@ -89,7 +98,10 @@ class _AccountDetailPageState extends State<AccountDetailPage>
8998 if (activeBody == null ) {
9099 return SizedBox .shrink ();
91100 }
92-
101+ if (_wcCustomerInfoResponse != null ) {
102+ print ('here' );
103+ print (_wcCustomerInfoResponse.data.avatar);
104+ }
93105 return Scaffold (
94106 appBar: AppBar (
95107 leading: widget.showLeadingBackButton
@@ -123,13 +135,11 @@ class _AccountDetailPageState extends State<AccountDetailPage>
123135 children: < Widget > [
124136 Container (
125137 margin: EdgeInsets .only (top: 10 ),
126- child: CircleAvatar (
138+ child: _wcCustomerInfoResponse != null ? CircleAvatar (
127139 backgroundImage: NetworkImage (
128- _wcCustomerInfoResponse != null
129- ? _wcCustomerInfoResponse.data.avatar
130- : "" ,
140+ _wcCustomerInfoResponse.data.avatar,
131141 ),
132- ),
142+ ) : Icon ( Icons .account_circle_rounded, size : 65 ,) ,
133143 height: 90 ,
134144 width: 90 ,
135145 ),
0 commit comments