Skip to content

Commit 388d682

Browse files
committed
v5.7.1 - updates
1 parent ed1de12 commit 388d682

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

LabelStoreMax/lib/resources/pages/account_detail.dart

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
1818
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
1919
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
2020
import 'package:nylo_framework/nylo_framework.dart';
21+
import 'package:wp_json_api/exceptions/invalid_user_token_exception.dart';
2122
import 'package:wp_json_api/models/responses/wc_customer_info_response.dart';
2223
import '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

Comments
 (0)