2020-10-11 02:17:23 +06:30
|
|
|
import 'package:fcs/domain/entities/user.dart';
|
|
|
|
|
import 'package:fcs/domain/vo/privilege.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/localization/transalation.dart';
|
2020-10-08 15:54:43 +06:30
|
|
|
import 'package:fcs/pages/delivery_address/delivery_address_list.dart';
|
2025-03-21 18:19:52 +06:30
|
|
|
import 'package:fcs/pages/delivery_address/delivery_address_row.dart';
|
2020-10-08 15:54:43 +06:30
|
|
|
import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/main/model/language_model.dart';
|
|
|
|
|
import 'package:fcs/pages/main/model/main_model.dart';
|
2020-10-11 02:17:23 +06:30
|
|
|
import 'package:fcs/pages/main/util.dart';
|
|
|
|
|
import 'package:fcs/pages/profile/profile_currency_edit.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/profile/profile_edit.dart';
|
2020-10-11 02:17:23 +06:30
|
|
|
import 'package:fcs/pages/staff/model/staff_model.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/widgets/display_text.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/fcs_id_icon.dart';
|
2024-01-25 17:40:35 +06:30
|
|
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
2024-02-14 16:54:38 +06:30
|
|
|
import 'package:fcs/pages/widgets/local_text.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/widgets/progress.dart';
|
2020-09-12 03:34:52 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-08-30 21:26:37 +06:30
|
|
|
import 'package:flutter/material.dart';
|
2020-09-13 21:49:39 +06:30
|
|
|
import 'package:flutter/services.dart';
|
2020-08-30 21:26:37 +06:30
|
|
|
import 'package:provider/provider.dart';
|
2021-09-10 16:48:21 +06:30
|
|
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
2020-05-29 07:45:27 +06:30
|
|
|
|
2020-09-13 21:49:39 +06:30
|
|
|
import '../../helpers/theme.dart';
|
2021-10-11 17:09:47 +06:30
|
|
|
import 'package:collection/collection.dart';
|
2020-05-29 07:45:27 +06:30
|
|
|
|
2024-03-05 17:09:04 +06:30
|
|
|
import 'account_delection_page.dart';
|
2025-01-14 17:10:10 +06:30
|
|
|
import 'add_recovery_email.dart';
|
|
|
|
|
import 'change_phone_number.dart';
|
2024-03-05 17:09:04 +06:30
|
|
|
|
2025-03-12 17:49:27 +06:30
|
|
|
typedef ProfileCallback = void Function();
|
2020-05-29 07:45:27 +06:30
|
|
|
|
|
|
|
|
class Profile extends StatefulWidget {
|
2025-03-12 17:49:27 +06:30
|
|
|
const Profile({super.key});
|
|
|
|
|
|
2020-05-29 07:45:27 +06:30
|
|
|
@override
|
|
|
|
|
_ProfileState createState() => _ProfileState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ProfileState extends State<Profile> {
|
2024-01-09 13:11:22 +06:30
|
|
|
GlobalKey<ScaffoldMessengerState> key = GlobalKey<ScaffoldMessengerState>();
|
2020-05-29 07:45:27 +06:30
|
|
|
bool _isLoading = false;
|
2021-09-10 16:48:21 +06:30
|
|
|
String? selectedLanguage;
|
2020-05-29 07:45:27 +06:30
|
|
|
TextEditingController bizNameController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
static final List<String> languagesList = Translation().supportedLanguages;
|
|
|
|
|
static final List<String> languageCodesList =
|
|
|
|
|
Translation().supportedLanguagesCodes;
|
|
|
|
|
|
|
|
|
|
final Map<dynamic, dynamic> languagesMap = {
|
|
|
|
|
languagesList[0]: languageCodesList[0],
|
|
|
|
|
languagesList[1]: languageCodesList[1],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
buildLanguage(LanguageModel languageModel) async {
|
|
|
|
|
var lan = await languageModel.load();
|
2025-03-12 17:49:27 +06:30
|
|
|
if (selectedLanguage != lan) {
|
2020-05-29 07:45:27 +06:30
|
|
|
setState(() {
|
2025-03-12 17:49:27 +06:30
|
|
|
selectedLanguage = lan;
|
2020-05-29 07:45:27 +06:30
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-08 15:54:43 +06:30
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-29 07:45:27 +06:30
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
MainModel mainModel = Provider.of<MainModel>(context);
|
2024-02-14 16:54:38 +06:30
|
|
|
LanguageModel languageModel = Provider.of<LanguageModel>(context);
|
2020-09-16 02:29:50 +06:30
|
|
|
if (mainModel.user == null) {
|
|
|
|
|
return Container();
|
|
|
|
|
}
|
2025-01-14 17:10:10 +06:30
|
|
|
User user = mainModel.user!;
|
|
|
|
|
|
2024-02-14 16:54:38 +06:30
|
|
|
buildLanguage(languageModel);
|
2025-01-14 17:10:10 +06:30
|
|
|
var deliveryAddressModel = Provider.of<DeliveryAddressModel>(context);
|
2020-10-11 02:17:23 +06:30
|
|
|
|
2025-03-21 18:19:52 +06:30
|
|
|
final currencyBox = settingRow(
|
|
|
|
|
context,
|
|
|
|
|
label: 'profile.currency',
|
|
|
|
|
iconData: FontAwesome5Solid.money_bill_wave,
|
|
|
|
|
text: user.preferCurrency ?? "",
|
|
|
|
|
onTap: () {
|
|
|
|
|
_editCurrency();
|
|
|
|
|
},
|
2020-10-11 02:17:23 +06:30
|
|
|
);
|
2025-01-14 17:10:10 +06:30
|
|
|
|
2025-03-21 18:19:52 +06:30
|
|
|
final fcsIDBox = Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: DisplayText(
|
|
|
|
|
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"), user.fcsID ?? ""),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
2024-03-05 16:29:35 +06:30
|
|
|
);
|
2020-06-24 16:06:40 +06:30
|
|
|
|
2025-03-21 18:19:52 +06:30
|
|
|
final usaShippingAddressBox = Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: DisplayText(
|
|
|
|
|
text: mainModel.setting!.usaAddress ?? "",
|
|
|
|
|
labelTextKey: "profile.usa.shipping.address",
|
|
|
|
|
iconData: Icons.location_on,
|
|
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
2025-03-21 18:19:52 +06:30
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.content_copy, color: Colors.grey),
|
|
|
|
|
onPressed: () => _copy(
|
|
|
|
|
getLocalString(context, "profile.usa.shipping.address"),
|
|
|
|
|
mainModel.setting!.usaAddress ?? ""),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
2020-09-13 21:49:39 +06:30
|
|
|
);
|
2020-10-08 15:54:43 +06:30
|
|
|
|
2025-03-21 18:19:52 +06:30
|
|
|
final logoutbutton = Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
|
|
|
child: fcsButton(context, getLocalString(context, "profile.logout"),
|
|
|
|
|
callack: mainModel.isPinLogin
|
|
|
|
|
? null
|
|
|
|
|
: () {
|
|
|
|
|
showConfirmDialog(context, "profile.logout.confirm",
|
|
|
|
|
() async {
|
|
|
|
|
await _logout();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
iconData: Icons.exit_to_app),
|
2020-05-29 07:45:27 +06:30
|
|
|
);
|
|
|
|
|
|
2025-03-21 18:19:52 +06:30
|
|
|
final recoveryEmailBox = settingRow(
|
|
|
|
|
context,
|
|
|
|
|
label: 'profile.recovery.email',
|
|
|
|
|
iconData: Icons.email_outlined,
|
|
|
|
|
text: user.recoveryEmail,
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute(
|
|
|
|
|
builder: (context) => AddRecoveryEmail(user: user)));
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final phoneNumberBox = settingRow(
|
|
|
|
|
context,
|
|
|
|
|
label: 'profile.change.phone',
|
|
|
|
|
iconData: Icons.phone,
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.of(context, rootNavigator: true).push(CupertinoPageRoute(
|
|
|
|
|
builder: (context) => ChangePhoneNumber(user: user)));
|
|
|
|
|
},
|
2025-01-14 17:10:10 +06:30
|
|
|
);
|
2025-03-06 17:59:15 +06:30
|
|
|
|
|
|
|
|
final titleBox = Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
2025-03-21 18:19:52 +06:30
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
user.name ?? "",
|
|
|
|
|
style: TextStyle(fontSize: 18, color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 5),
|
|
|
|
|
InkResponse(
|
|
|
|
|
radius: 20,
|
|
|
|
|
onTap: _editName,
|
|
|
|
|
child: Icon(Icons.edit, color: Colors.grey, size: 23))
|
|
|
|
|
],
|
|
|
|
|
),
|
2025-03-06 17:59:15 +06:30
|
|
|
const SizedBox(height: 1),
|
|
|
|
|
Text(
|
|
|
|
|
user.phone,
|
|
|
|
|
style: TextStyle(fontSize: 15, color: labelColor),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
2025-03-21 18:19:52 +06:30
|
|
|
final deleteAccountBox = settingRow(
|
|
|
|
|
context,
|
|
|
|
|
label: 'profile.delete.title',
|
|
|
|
|
iconData: MaterialCommunityIcons.account_remove,
|
|
|
|
|
onTap: () {
|
|
|
|
|
_editDelete();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final deliverAddressBox = Padding(
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 5),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
settingRow(
|
|
|
|
|
context,
|
|
|
|
|
label: 'profile.default.delivery.address',
|
|
|
|
|
iconData: MaterialCommunityIcons.truck_fast,
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
CupertinoPageRoute(
|
|
|
|
|
builder: (context) => DeliveryAddressList()));
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 35),
|
|
|
|
|
child: DeliveryAddressRow(
|
|
|
|
|
key: ValueKey(deliveryAddressModel.defalutAddress.id),
|
|
|
|
|
deliveryAddress: deliveryAddressModel.defalutAddress),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2020-05-29 07:45:27 +06:30
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
2020-09-13 21:49:39 +06:30
|
|
|
key: key,
|
2024-01-25 17:40:35 +06:30
|
|
|
appBar: LocalAppBar(
|
2025-03-21 18:19:52 +06:30
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
labelColor: primaryColor,
|
|
|
|
|
arrowColor: primaryColor,
|
|
|
|
|
titleWidget: titleBox),
|
|
|
|
|
body: ListView(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
const SizedBox(height: 5),
|
|
|
|
|
fcsIDBox,
|
|
|
|
|
usaShippingAddressBox,
|
|
|
|
|
currencyBox,
|
|
|
|
|
deliverAddressBox,
|
|
|
|
|
// recoveryEmailBox,
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.symmetric(horizontal: 100,),
|
|
|
|
|
// child: Divider(thickness: 2),
|
|
|
|
|
// ),
|
|
|
|
|
// phoneNumberBox,
|
|
|
|
|
buildLanguageWidget(
|
|
|
|
|
context: context,
|
|
|
|
|
text: "profile.language",
|
|
|
|
|
iconData: Icons.language,
|
|
|
|
|
isEng: languageModel.isEng,
|
|
|
|
|
),
|
|
|
|
|
deleteAccountBox,
|
|
|
|
|
// Padding(
|
|
|
|
|
// padding: const EdgeInsets.symmetric(horizontal: 100,),
|
|
|
|
|
// child: Divider(thickness: 2),
|
|
|
|
|
// ),
|
|
|
|
|
getPrivilegeBox(context),
|
|
|
|
|
SizedBox(height: 15),
|
|
|
|
|
logoutbutton,
|
|
|
|
|
SizedBox(height: 30)
|
|
|
|
|
],
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-14 16:54:38 +06:30
|
|
|
Widget buildLanguageWidget(
|
|
|
|
|
{required String text,
|
|
|
|
|
required BuildContext context,
|
|
|
|
|
IconData? iconData,
|
|
|
|
|
required bool isEng}) {
|
2025-03-21 18:19:52 +06:30
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Icon(iconData, color: primaryColor),
|
|
|
|
|
const SizedBox(width: 15),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: LocalText(
|
|
|
|
|
context,
|
|
|
|
|
text,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
color: Colors.black54,
|
|
|
|
|
),
|
2024-02-14 16:54:38 +06:30
|
|
|
),
|
2025-03-21 18:19:52 +06:30
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
isEng
|
|
|
|
|
? Image.asset(
|
|
|
|
|
'icons/flags/png100px/us.png',
|
|
|
|
|
package: 'country_icons',
|
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
|
width: 25,
|
|
|
|
|
)
|
|
|
|
|
: Image.asset(
|
|
|
|
|
'icons/flags/png100px/mm.png',
|
|
|
|
|
package: 'country_icons',
|
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
|
width: 25,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
padding: const EdgeInsets.only(left: 15),
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
value: selectedLanguage,
|
|
|
|
|
underline: const SizedBox(),
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
items: languagesList
|
|
|
|
|
.map<DropdownMenuItem<String>>((String value) {
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
value: value,
|
|
|
|
|
child: Text(
|
|
|
|
|
value,
|
|
|
|
|
style: const TextStyle(fontSize: 14),
|
|
|
|
|
));
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: _selectedDropdown)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
2024-02-14 16:54:38 +06:30
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_selectedDropdown(selected) {
|
|
|
|
|
var languageModel = Provider.of<LanguageModel>(context, listen: false);
|
|
|
|
|
languageModel.saveLanguage(selected);
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedLanguage = selected;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-29 07:45:27 +06:30
|
|
|
Widget getPrivilegeBox(BuildContext context) {
|
2021-09-10 16:48:21 +06:30
|
|
|
User? user = Provider.of<MainModel>(context, listen: false).user;
|
2020-10-11 02:17:23 +06:30
|
|
|
List<Privilege> _privileges =
|
|
|
|
|
Provider.of<StaffModel>(context, listen: false).privileges;
|
2020-05-29 15:53:37 +06:30
|
|
|
|
2020-10-11 02:17:23 +06:30
|
|
|
if (user == null || user.isCustomer()) return Container();
|
2021-10-11 17:09:47 +06:30
|
|
|
|
2020-10-11 02:17:23 +06:30
|
|
|
List<Privilege> privileges = [];
|
2025-03-06 17:59:15 +06:30
|
|
|
for (var e in user.privileges) {
|
2021-10-11 17:09:47 +06:30
|
|
|
Privilege? p = _privileges.firstWhereOrNull((p) => p.id == e);
|
|
|
|
|
|
2020-10-11 02:17:23 +06:30
|
|
|
if (p != null) {
|
|
|
|
|
privileges.add(p);
|
|
|
|
|
}
|
2025-03-06 17:59:15 +06:30
|
|
|
}
|
2020-10-11 02:17:23 +06:30
|
|
|
|
2025-01-14 17:10:10 +06:30
|
|
|
return privileges.isEmpty
|
|
|
|
|
? const SizedBox()
|
2025-03-21 18:19:52 +06:30
|
|
|
: Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
|
child: 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)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
2025-01-14 17:10:10 +06:30
|
|
|
);
|
2020-05-29 07:45:27 +06:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Widget> getRowPrivilegeWidget(List<Privilege> privileges) {
|
|
|
|
|
return privileges.map((p) {
|
|
|
|
|
return Container(
|
2020-10-11 02:17:23 +06:30
|
|
|
padding: EdgeInsets.all(3.0),
|
2020-05-29 07:45:27 +06:30
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
2020-10-11 02:17:23 +06:30
|
|
|
Icon(
|
|
|
|
|
p.iconData,
|
|
|
|
|
color: Colors.black38,
|
|
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
SizedBox(
|
2020-10-11 02:17:23 +06:30
|
|
|
width: 10,
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
2020-10-11 02:17:23 +06:30
|
|
|
Flexible(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text("${p.name}",
|
|
|
|
|
style: TextStyle(
|
2025-03-21 18:19:52 +06:30
|
|
|
fontSize: 15.0,
|
2025-03-06 17:59:15 +06:30
|
|
|
fontStyle: FontStyle.normal,
|
2025-03-21 18:19:52 +06:30
|
|
|
color: Colors.black)),
|
2020-10-11 02:17:23 +06:30
|
|
|
Text(
|
|
|
|
|
"${p.desc}",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14.0,
|
|
|
|
|
fontStyle: FontStyle.normal,
|
|
|
|
|
color: Colors.black38),
|
|
|
|
|
),
|
|
|
|
|
],
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}).toList();
|
|
|
|
|
}
|
2020-09-13 21:49:39 +06:30
|
|
|
|
|
|
|
|
_copy(String title, String data) {
|
|
|
|
|
Clipboard.setData(ClipboardData(text: data));
|
|
|
|
|
_showToast(title);
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-11 02:17:23 +06:30
|
|
|
_showToast(String title) {
|
2024-10-04 13:55:59 +06:30
|
|
|
ScaffoldMessengerState? scaffold = key.currentState;
|
|
|
|
|
|
2025-03-06 17:59:15 +06:30
|
|
|
scaffold ??= ScaffoldMessenger.of(context);
|
2025-01-14 17:10:10 +06:30
|
|
|
|
2020-09-13 21:49:39 +06:30
|
|
|
scaffold.showSnackBar(
|
|
|
|
|
SnackBar(
|
|
|
|
|
content: Text('copied "$title" data to clipboard'),
|
|
|
|
|
backgroundColor: secondaryColor,
|
|
|
|
|
duration: Duration(seconds: 1),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-03-05 17:09:04 +06:30
|
|
|
|
|
|
|
|
_editDelete() {
|
|
|
|
|
Navigator.of(context).push<void>(CupertinoPageRoute(
|
|
|
|
|
builder: (context) => AccountDelectionPage(
|
|
|
|
|
onlogout: () {
|
|
|
|
|
_logout();
|
|
|
|
|
},
|
|
|
|
|
)));
|
2024-03-05 16:29:35 +06:30
|
|
|
}
|
2024-03-05 17:09:04 +06:30
|
|
|
|
2020-09-13 21:49:39 +06:30
|
|
|
_editName() {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.push<void>(CupertinoPageRoute(builder: (context) => ProfileEdit()));
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-11 02:17:23 +06:30
|
|
|
_editCurrency() {
|
|
|
|
|
Navigator.of(context).push<void>(
|
|
|
|
|
CupertinoPageRoute(builder: (context) => ProfileCurrencyEdit()));
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-05 17:09:04 +06:30
|
|
|
_logout() async {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isLoading = true;
|
2020-09-13 21:49:39 +06:30
|
|
|
});
|
2024-03-05 17:09:04 +06:30
|
|
|
try {
|
|
|
|
|
await context.read<MainModel>().signout();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
} finally {
|
|
|
|
|
Future.delayed(Duration(seconds: 1), () {
|
|
|
|
|
if (mounted) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pushNamedAndRemoveUntil("/welcome", ModalRoute.withName('/welcome'));
|
|
|
|
|
}
|
2020-09-13 21:49:39 +06:30
|
|
|
}
|
2020-05-29 07:45:27 +06:30
|
|
|
}
|