add update phone number and recovery email
This commit is contained in:
@@ -25,6 +25,8 @@ import '../../helpers/theme.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
import 'account_delection_page.dart';
|
||||
import 'add_recovery_email.dart';
|
||||
import 'change_phone_number.dart';
|
||||
|
||||
typedef void ProfileCallback();
|
||||
|
||||
@@ -69,44 +71,70 @@ class _ProfileState extends State<Profile> {
|
||||
if (mainModel.user == null) {
|
||||
return Container();
|
||||
}
|
||||
User user = mainModel.user!;
|
||||
|
||||
buildLanguage(languageModel);
|
||||
DeliveryAddressModel deliveryAddressModel =
|
||||
Provider.of<DeliveryAddressModel>(context);
|
||||
var deliveryAddressModel = Provider.of<DeliveryAddressModel>(context);
|
||||
|
||||
final namebox = DisplayText(
|
||||
text: "${mainModel.user!.name ?? ''}" +
|
||||
" (${mainModel.user!.status ?? ''})",
|
||||
text: "${user.name ?? ''}" + " (${user.status ?? ''})",
|
||||
labelTextKey: "profile.name",
|
||||
iconData: Icons.person,
|
||||
);
|
||||
final currencyBox = DisplayText(
|
||||
text: mainModel.user!.preferCurrency ?? "",
|
||||
labelTextKey: "profile.currency",
|
||||
iconData: FontAwesome5Regular.money_bill_alt,
|
||||
|
||||
final currencyBox = Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: user.preferCurrency ?? "",
|
||||
labelTextKey: "profile.currency",
|
||||
iconData: FontAwesome5Regular.money_bill_alt,
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.edit, color: Colors.grey),
|
||||
onPressed: _editCurrency),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
final deleteAccountBox = DisplayText(
|
||||
labelTextKey: "profile.delete.title",
|
||||
iconData: MaterialCommunityIcons.account_remove,
|
||||
);
|
||||
|
||||
final phonenumberbox = DisplayText(
|
||||
text: mainModel.user!.phone,
|
||||
labelTextKey: "profile.phone",
|
||||
iconData: Icons.phone,
|
||||
final phonenumberBox = Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: user.phone,
|
||||
labelTextKey: "profile.phone",
|
||||
iconData: Icons.phone),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: Colors.grey),
|
||||
onPressed: () {
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => ChangePhoneNumber(user: user)));
|
||||
})
|
||||
],
|
||||
);
|
||||
|
||||
final fcsIDBox = Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: mainModel.user!.fcsID ?? "",
|
||||
text: user.fcsID ?? "",
|
||||
labelTextKey: "customer.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.content_copy, color: Colors.grey),
|
||||
onPressed: () => _copy(getLocalString(context, "customer.fcs.id"),
|
||||
mainModel.user!.fcsID ?? ""),
|
||||
onPressed: () => _copy(
|
||||
getLocalString(context, "customer.fcs.id"), user.fcsID ?? ""),
|
||||
)
|
||||
],
|
||||
);
|
||||
@@ -141,6 +169,22 @@ class _ProfileState extends State<Profile> {
|
||||
},
|
||||
iconData: Icons.exit_to_app);
|
||||
|
||||
final emailBox = Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: user.recoveryEmail,
|
||||
labelTextKey: "profile.recovery.email",
|
||||
iconData: Icons.email_outlined,
|
||||
),
|
||||
),
|
||||
IconButton(icon: Icon(Icons.edit, color: Colors.grey), onPressed: () {
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => AddRecoveryEmail(user: user)));
|
||||
})
|
||||
],
|
||||
);
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -165,20 +209,11 @@ class _ProfileState extends State<Profile> {
|
||||
)
|
||||
],
|
||||
),
|
||||
phonenumberbox,
|
||||
phonenumberBox,
|
||||
fcsIDBox,
|
||||
usaShippingAddressBox,
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(child: currencyBox),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 0),
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.edit, color: Colors.grey),
|
||||
onPressed: _editCurrency),
|
||||
)
|
||||
],
|
||||
),
|
||||
currencyBox,
|
||||
emailBox,
|
||||
DefaultDeliveryAddress(
|
||||
labelKey: "profile.default.delivery.address",
|
||||
deliveryAddress: deliveryAddressModel.defalutAddress,
|
||||
@@ -298,20 +333,22 @@ class _ProfileState extends State<Profile> {
|
||||
}
|
||||
});
|
||||
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
DisplayText(
|
||||
labelTextKey: "profile.privileges",
|
||||
iconData: MaterialCommunityIcons.clipboard_check_outline,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 30.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: getRowPrivilegeWidget(privileges)),
|
||||
)
|
||||
],
|
||||
);
|
||||
return privileges.isEmpty
|
||||
? const SizedBox()
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
DisplayText(
|
||||
labelTextKey: "profile.privileges",
|
||||
iconData: MaterialCommunityIcons.clipboard_check_outline,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 30.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: getRowPrivilegeWidget(privileges)),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> getRowPrivilegeWidget(List<Privilege> privileges) {
|
||||
@@ -365,7 +402,7 @@ class _ProfileState extends State<Profile> {
|
||||
if (scaffold == null) {
|
||||
scaffold = ScaffoldMessenger.of(context);
|
||||
}
|
||||
|
||||
|
||||
scaffold.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('copied "$title" data to clipboard'),
|
||||
|
||||
Reference in New Issue
Block a user