commit
2d8a480e25
@ -1,9 +1,10 @@
|
|||||||
## [5.7.1] - 2022-02-07
|
## [5.7.1] - 2022-02-07
|
||||||
|
|
||||||
* Refactor account order detail page
|
* Refactor account order detail page
|
||||||
* Fix continuous loading if users has no orders
|
* Fix continuous loading if a user has no orders
|
||||||
* New styling for tabs in the account order detail page
|
* New styling for tabs in the account order detail page
|
||||||
* Small refactor to controller loading
|
* Small refactor to controller loading
|
||||||
|
* Handle invalid tokens on the account page
|
||||||
* Pubspec.yaml dependency updates
|
* Pubspec.yaml dependency updates
|
||||||
|
|
||||||
## [5.7.0] - 2022-01-29
|
## [5.7.0] - 2022-01-29
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import 'package:flutter_app/resources/widgets/app_loader_widget.dart';
|
|||||||
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
|
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
|
||||||
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
|
import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
|
||||||
import 'package:nylo_framework/nylo_framework.dart';
|
import 'package:nylo_framework/nylo_framework.dart';
|
||||||
|
import 'package:wp_json_api/exceptions/invalid_user_token_exception.dart';
|
||||||
import 'package:wp_json_api/models/responses/wc_customer_info_response.dart';
|
import 'package:wp_json_api/models/responses/wc_customer_info_response.dart';
|
||||||
import 'package:wp_json_api/wp_json_api.dart';
|
import 'package:wp_json_api/wp_json_api.dart';
|
||||||
|
|
||||||
@ -49,6 +50,14 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
|||||||
try {
|
try {
|
||||||
wcCustomerInfoResponse = await WPJsonAPI.instance
|
wcCustomerInfoResponse = await WPJsonAPI.instance
|
||||||
.api((request) => request.wcCustomerInfo(userToken));
|
.api((request) => request.wcCustomerInfo(userToken));
|
||||||
|
} on InvalidUserTokenException catch (_) {
|
||||||
|
showToastNotification(
|
||||||
|
context,
|
||||||
|
title: trans("Oops!"),
|
||||||
|
description: trans("Something went wrong"),
|
||||||
|
style: ToastNotificationStyleType.DANGER,
|
||||||
|
);
|
||||||
|
await authLogout(context);
|
||||||
} on Exception catch (_) {
|
} on Exception catch (_) {
|
||||||
showToastNotification(
|
showToastNotification(
|
||||||
context,
|
context,
|
||||||
@ -89,7 +98,17 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
|||||||
if (activeBody == null) {
|
if (activeBody == null) {
|
||||||
return SizedBox.shrink();
|
return SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
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(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: widget.showLeadingBackButton
|
leading: widget.showLeadingBackButton
|
||||||
@ -123,13 +142,9 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(top: 10),
|
margin: EdgeInsets.only(top: 10),
|
||||||
child: CircleAvatar(
|
child: userAvatar != null ? CircleAvatar(
|
||||||
backgroundImage: NetworkImage(
|
backgroundImage: NetworkImage(userAvatar),
|
||||||
_wcCustomerInfoResponse != null
|
) : Icon(Icons.account_circle_rounded, size: 65,),
|
||||||
? _wcCustomerInfoResponse.data.avatar
|
|
||||||
: "",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
height: 90,
|
height: 90,
|
||||||
width: 90,
|
width: 90,
|
||||||
),
|
),
|
||||||
@ -146,18 +161,13 @@ class _AccountDetailPageState extends State<AccountDetailPage>
|
|||||||
MainAxisAlignment.spaceAround,
|
MainAxisAlignment.spaceAround,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
(_wcCustomerInfoResponse == null
|
[
|
||||||
? ""
|
userFirstName,
|
||||||
: [
|
userLastName
|
||||||
_wcCustomerInfoResponse
|
].where((t) =>
|
||||||
.data.firstName,
|
(t != null || t != ""))
|
||||||
_wcCustomerInfoResponse
|
.toList()
|
||||||
.data.lastName
|
.join(" "),
|
||||||
]
|
|
||||||
.where((t) =>
|
|
||||||
(t != null || t != ""))
|
|
||||||
.toList()
|
|
||||||
.join(" ")),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user