|
|
|
|
@ -9,10 +9,15 @@ import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/user.dart';
|
|
|
|
|
import 'package:test_sa/models/user_rota_model.dart';
|
|
|
|
|
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_dashed_button.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:test_sa/views/pages/user/update_user_contact_info_bottomsheet.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../new_views/app_style/app_color.dart';
|
|
|
|
|
@ -51,129 +56,272 @@ class _ProfilePageState extends State<ProfilePage> {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
key: _scaffoldKey,
|
|
|
|
|
appBar: DefaultAppBar(title: context.translation.myProfile),
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Consumer<UserProvider>(builder: (context, snapshot, _) {
|
|
|
|
|
return Stack(
|
|
|
|
|
alignment: Alignment.bottomRight,
|
|
|
|
|
children: [
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
radius: 45,
|
|
|
|
|
backgroundColor: const Color(0xFFE4E5E6),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(1), // Border radius
|
|
|
|
|
child: ClipOval(
|
|
|
|
|
child: snapshot.profileImage != null
|
|
|
|
|
? Image.file(snapshot.profileImage!)
|
|
|
|
|
: (snapshot.user!.profilePhotoName?.isNotEmpty ?? false)
|
|
|
|
|
? Image.network(snapshot.user!.profilePhotoName!)
|
|
|
|
|
: const Icon(
|
|
|
|
|
Icons.person,
|
|
|
|
|
size: 50,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
ListView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Consumer<UserProvider>(builder: (context, snapshot, _) {
|
|
|
|
|
return Stack(
|
|
|
|
|
alignment: Alignment.bottomRight,
|
|
|
|
|
children: [
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
radius: 45,
|
|
|
|
|
backgroundColor: const Color(0xFFE4E5E6),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(1), // Border radius
|
|
|
|
|
child: ClipOval(
|
|
|
|
|
child: snapshot.profileImage != null
|
|
|
|
|
? Image.file(snapshot.profileImage!)
|
|
|
|
|
: (snapshot.user!.profilePhotoName?.isNotEmpty ?? false)
|
|
|
|
|
? Image.network(snapshot.user!.profilePhotoName!)
|
|
|
|
|
: const Icon(
|
|
|
|
|
Icons.person,
|
|
|
|
|
size: 50,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
CircleAvatar(
|
|
|
|
|
radius: 14,
|
|
|
|
|
backgroundColor: AppColor.primary70,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(1), // Border radius
|
|
|
|
|
child: snapshot.isLoading
|
|
|
|
|
? const SizedBox(height: 16, width: 16, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
|
|
|
|
|
: const Icon(Icons.upload, size: 16, color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
).onPress(snapshot.isLoading
|
|
|
|
|
? null
|
|
|
|
|
: () async {
|
|
|
|
|
final pickedFile = await ImagePicker().pickImage(source: ImageSource.gallery, imageQuality: 70, maxWidth: 800, maxHeight: 800);
|
|
|
|
|
// CircleAvatar(
|
|
|
|
|
// radius: 14,
|
|
|
|
|
// backgroundColor: AppColor.primary70,
|
|
|
|
|
// child: Padding(
|
|
|
|
|
// padding: const EdgeInsets.all(1), // Border radius
|
|
|
|
|
// child: snapshot.isLoading
|
|
|
|
|
// ? const SizedBox(height: 16, width: 16, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2))
|
|
|
|
|
// : const Icon(Icons.upload, size: 16, color: Colors.white),
|
|
|
|
|
// ),
|
|
|
|
|
// ).onPress(snapshot.isLoading
|
|
|
|
|
// ? null
|
|
|
|
|
// : () async {
|
|
|
|
|
// final pickedFile = await ImagePicker().pickImage(source: ImageSource.gallery, imageQuality: 70, maxWidth: 800, maxHeight: 800);
|
|
|
|
|
//
|
|
|
|
|
// if (pickedFile != null) {
|
|
|
|
|
// CroppedFile? croppedFile = await ImageCropper().cropImage(
|
|
|
|
|
// sourcePath: pickedFile.path,
|
|
|
|
|
// aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
|
|
|
|
|
// uiSettings: [
|
|
|
|
|
// AndroidUiSettings(
|
|
|
|
|
// toolbarTitle: 'ATOMS',
|
|
|
|
|
// toolbarColor: Colors.white,
|
|
|
|
|
// toolbarWidgetColor: color,
|
|
|
|
|
// initAspectRatio: CropAspectRatioPreset.square,
|
|
|
|
|
// lockAspectRatio: false,
|
|
|
|
|
// ),
|
|
|
|
|
// IOSUiSettings(title: 'ATOMS'),
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// if (croppedFile != null) {
|
|
|
|
|
// await snapshot.uploadProfileImage(_user.userID!, File(croppedFile.path));
|
|
|
|
|
// Provider.of<SettingProvider>(context, listen: false).setUser(_userProvider.user!);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
8.height,
|
|
|
|
|
(_user.username ?? "").heading3(context).custom(fontWeight: FontWeight.w600, color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.email}: ${_user.email ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.phoneNumber}: ${_user.phoneNumber ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.extensionNo}: ${_user.extensionNo ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
// if ((_user.phoneNumber ?? "").isNotEmpty) ...[
|
|
|
|
|
// const Divider().defaultStyle(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// (_user.phoneNumber??"").heading5(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// ],
|
|
|
|
|
// if ((_user.extensionNo ?? "").isNotEmpty) ...[
|
|
|
|
|
// const Divider().defaultStyle(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// _user.extensionNo!.heading5(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// ],
|
|
|
|
|
if ((_user.departmentName?.length ?? 0) > 0) const Divider().defaultStyle(context),
|
|
|
|
|
ListView.builder(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: _user.departmentName?.length ?? 0,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return (_user.departmentName![index] ?? "N/A").heading5(context).paddingOnly(top: 8, bottom: 8);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if ((_user.clientName ?? "").isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
_user.clientName!.heading5(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
Selector<UserProvider, bool>(
|
|
|
|
|
selector: (_, myModel) => myModel.isLoading, // Selects only the userName
|
|
|
|
|
builder: (_, isLoading, __) {
|
|
|
|
|
return AppDashedButton(
|
|
|
|
|
title: isLoading ? "Uploading..." : "Update Image",
|
|
|
|
|
height: 50,
|
|
|
|
|
width: MediaQuery.sizeOf(context).width / 2,
|
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
|
icon: isLoading
|
|
|
|
|
? const SizedBox(height: 16, width: 16, child: CircularProgressIndicator(color: AppColor.primary10, strokeWidth: 2))
|
|
|
|
|
: 'attachment_icon'.toSvgAsset(height: 24, width: 24),
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (isLoading) return;
|
|
|
|
|
|
|
|
|
|
if (pickedFile != null) {
|
|
|
|
|
CroppedFile? croppedFile = await ImageCropper().cropImage(
|
|
|
|
|
sourcePath: pickedFile.path,
|
|
|
|
|
aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
|
|
|
|
|
uiSettings: [
|
|
|
|
|
AndroidUiSettings(
|
|
|
|
|
toolbarTitle: 'ATOMS',
|
|
|
|
|
toolbarColor: Colors.white,
|
|
|
|
|
toolbarWidgetColor: color,
|
|
|
|
|
initAspectRatio: CropAspectRatioPreset.square,
|
|
|
|
|
lockAspectRatio: false,
|
|
|
|
|
final pickedFile = await ImagePicker().pickImage(source: ImageSource.gallery, imageQuality: 70, maxWidth: 800, maxHeight: 800);
|
|
|
|
|
|
|
|
|
|
if (pickedFile != null) {
|
|
|
|
|
CroppedFile? croppedFile = await ImageCropper().cropImage(
|
|
|
|
|
sourcePath: pickedFile.path,
|
|
|
|
|
aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
|
|
|
|
|
uiSettings: [
|
|
|
|
|
AndroidUiSettings(
|
|
|
|
|
toolbarTitle: 'ATOMS',
|
|
|
|
|
toolbarColor: Colors.white,
|
|
|
|
|
toolbarWidgetColor: color,
|
|
|
|
|
initAspectRatio: CropAspectRatioPreset.square,
|
|
|
|
|
lockAspectRatio: false,
|
|
|
|
|
),
|
|
|
|
|
IOSUiSettings(title: 'ATOMS'),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
if (croppedFile != null) {
|
|
|
|
|
await context.userProvider.uploadProfileImage(_user.userID!, File(croppedFile.path));
|
|
|
|
|
Provider.of<SettingProvider>(context, listen: false).setUser(_userProvider.user!);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
).center;
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
if (context.settingProvider.isUserFlowMedical)
|
|
|
|
|
FutureBuilder<List<UserRotaModel>>(
|
|
|
|
|
future: _userProvider.getUserRota(),
|
|
|
|
|
builder: (cxt, snapshot) {
|
|
|
|
|
bool isLoading = snapshot.connectionState == ConnectionState.waiting;
|
|
|
|
|
|
|
|
|
|
if ((!isLoading && (snapshot.hasError || (snapshot.data?.isEmpty ?? true)))) {
|
|
|
|
|
return const SizedBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
margin: const EdgeInsets.only(top: 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"Rota Details",
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.black10),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
if (!isLoading)
|
|
|
|
|
ListView.separated(
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (cxt, index) => Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// 'Site: ${_user.clientName ?? "-"}',
|
|
|
|
|
// style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
// ),
|
|
|
|
|
Text(
|
|
|
|
|
'Shift Name: ${snapshot.data![index].shiftName ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
IOSUiSettings(title: 'ATOMS'),
|
|
|
|
|
Text(
|
|
|
|
|
'Break: ${snapshot.data![index].breakTime ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
if (snapshot.data![index].leaveTypeCode?.isNotEmpty ?? false)
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(children: [
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
snapshot.data![index].leaveTypeCode ?? "",
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120, fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
snapshot.data![index].leaveDescription ?? "",
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
)
|
|
|
|
|
else ...[
|
|
|
|
|
Text(
|
|
|
|
|
'Shift Start Time: ${snapshot.data![index].shTActualStartTime?.toTime ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'Shift Start Time: ${snapshot.data![index].shTActualEndTime?.toTime ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
if (croppedFile != null) {
|
|
|
|
|
await snapshot.uploadProfileImage(_user.userID!, File(croppedFile.path));
|
|
|
|
|
Provider.of<SettingProvider>(context, listen: false).setUser(_userProvider.user!);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
|
|
|
|
|
itemCount: snapshot.data!.length),
|
|
|
|
|
if (isLoading) ...[
|
|
|
|
|
Text(
|
|
|
|
|
'Shift Start Time Time',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
).toShimmer(context: context, isShow: isLoading),
|
|
|
|
|
4.height,
|
|
|
|
|
Text(
|
|
|
|
|
'Shift Actual Actual Start Time',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
).toShimmer(context: context, isShow: isLoading),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
8.height,
|
|
|
|
|
(_user.username ?? "").heading3(context).custom(fontWeight: FontWeight.w600, color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.email}: ${_user.email ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.phoneNumber}: ${_user.phoneNumber ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.extensionNo}: ${_user.extensionNo ?? "-"}',
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
|
|
|
|
|
),
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// if ((_user.phoneNumber ?? "").isNotEmpty) ...[
|
|
|
|
|
// const Divider().defaultStyle(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// (_user.phoneNumber??"").heading5(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// ],
|
|
|
|
|
// if ((_user.extensionNo ?? "").isNotEmpty) ...[
|
|
|
|
|
// const Divider().defaultStyle(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// _user.extensionNo!.heading5(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// ],
|
|
|
|
|
if ((_user.departmentName?.length ?? 0) > 0) const Divider().defaultStyle(context),
|
|
|
|
|
ListView.builder(
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: _user.departmentName?.length ?? 0,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return (_user.departmentName![index] ?? "N/A").heading5(context).paddingOnly(top: 8, bottom: 8);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if ((_user.clientName ?? "").isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
_user.clientName!.heading5(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
8.height,
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
16.height,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
// if (!isDeviceSupported) {
|
|
|
|
|
// return Text("Your device did not support Fingerprint/Face ID.", style: AppTextStyles.tinyFont.copyWith(fontSize: 11, color: Colors.red));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// return Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
// children: [
|
|
|
|
|
// "Fingerprint/Face ID".heading5(context),
|
|
|
|
|
// customSwitch(localAuth).onPress(() {
|
|
|
|
|
// checkForLocalAuth(localAuth);
|
|
|
|
|
// }),
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
|
context: context,
|
|
|
|
|
child: AppFilledButton(
|
|
|
|
|
label: "Update Information",
|
|
|
|
|
buttonColor: context.isDark ? AppColor.primary10 : AppColor.neutral50,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
@ -193,163 +341,9 @@ class _ProfilePageState extends State<ProfilePage> {
|
|
|
|
|
),
|
|
|
|
|
title: "Update Information");
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
// child: Stack(
|
|
|
|
|
// children: [
|
|
|
|
|
// Form(
|
|
|
|
|
// key: _formKey,
|
|
|
|
|
// child: ListView(
|
|
|
|
|
// children: [
|
|
|
|
|
// //AppNameBar(),
|
|
|
|
|
// Hero(
|
|
|
|
|
// tag: "logo",
|
|
|
|
|
// child: Image(
|
|
|
|
|
// height: _height / 4,
|
|
|
|
|
// image: AssetImage("assets/images/logo.png"),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// Container(
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
|
|
|
// margin: EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
|
// decoration: BoxDecoration(color: AColors.primaryColor, borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)), boxShadow: [
|
|
|
|
|
// BoxShadow(
|
|
|
|
|
// color: AColors.grey,
|
|
|
|
|
// offset: Offset(0, -1),
|
|
|
|
|
// )
|
|
|
|
|
// ]),
|
|
|
|
|
// child: Column(
|
|
|
|
|
// children: [
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: _user.userName,
|
|
|
|
|
// hintText: context.translation.name,
|
|
|
|
|
// enable: false,
|
|
|
|
|
// prefixIconData: Icons.account_circle,
|
|
|
|
|
// style: Theme.of(context).textTheme.headline6,
|
|
|
|
|
// validator: (value) => Validator.hasValue(value) ? null : context.translation.nameValidateMessage,
|
|
|
|
|
// onSaved: (value) {
|
|
|
|
|
// _user.userName = value;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: _user.email,
|
|
|
|
|
// hintText: context.translation.email,
|
|
|
|
|
// enable: false,
|
|
|
|
|
// prefixIconData: Icons.email,
|
|
|
|
|
// textInputType: TextInputType.emailAddress,
|
|
|
|
|
// style: Theme.of(context).textTheme.headline6,
|
|
|
|
|
// validator: (value) => Validator.isEmail(value) ? null : context.translation.emailValidateMessage,
|
|
|
|
|
// onSaved: (value) {
|
|
|
|
|
// _user.email = value;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// AbsorbPointer(
|
|
|
|
|
// child: HospitalButton(
|
|
|
|
|
// hospital: Hospital(name: _user.clientName, id: _user.clientId),
|
|
|
|
|
// onHospitalPick: (hospital) {
|
|
|
|
|
// _user.clientName = hospital.name;
|
|
|
|
|
// _user.clientId = hospital.id;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// // DepartmentButton(
|
|
|
|
|
// // department: Department(name: _user.departmentName, id: _user.departmentId),
|
|
|
|
|
// // onDepartmentPick: (department) {
|
|
|
|
|
// // _user.departmentName = department.name;
|
|
|
|
|
// // _user.departmentId = department.id;
|
|
|
|
|
// // setState(() {});
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: _user.phoneNumber,
|
|
|
|
|
// hintText: context.translation.phoneNumber,
|
|
|
|
|
// style: Theme.of(context).textTheme.headline6,
|
|
|
|
|
// prefixIconData: Icons.phone_android,
|
|
|
|
|
// validator: (value) => Validator.isPhoneNumber(value) ? null : context.translation.phoneNumberValidateMessage,
|
|
|
|
|
// textInputType: TextInputType.phone,
|
|
|
|
|
// onSaved: (value) {
|
|
|
|
|
// _user.phoneNumber = value;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// // ATextFormField(
|
|
|
|
|
// // initialValue: _user.whatsApp,
|
|
|
|
|
// // hintText: context.translation.whatsApp,
|
|
|
|
|
// // style: Theme.of(context).textTheme.headline6,
|
|
|
|
|
// // prefixIconData: FontAwesomeIcons.whatsapp,
|
|
|
|
|
// // prefixIconSize: 36,
|
|
|
|
|
// // validator: (value) =>
|
|
|
|
|
// // Validator.isPhoneNumber(value) ? null : context.translation.phoneNumberValidateMessage,
|
|
|
|
|
// // textInputType: TextInputType.phone,
|
|
|
|
|
// // onSaved: (value){
|
|
|
|
|
// // _user.whatsApp = value;
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 16,
|
|
|
|
|
// ),
|
|
|
|
|
// Center(
|
|
|
|
|
// child: SizedBox(
|
|
|
|
|
// height: _width / 8,
|
|
|
|
|
// width: _width / 1.2,
|
|
|
|
|
// child: AButton(
|
|
|
|
|
// text: context.translation.update,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// // if (!_formKey.currentState.validate()) return;
|
|
|
|
|
// // _formKey.currentState.save();
|
|
|
|
|
// // if (_user.departmentId == null) {
|
|
|
|
|
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
|
|
|
// // content: Text(context.translation.unitRequired),
|
|
|
|
|
// // ));
|
|
|
|
|
// // return;
|
|
|
|
|
// // }
|
|
|
|
|
// // int status = await _userProvider.updateProfile(
|
|
|
|
|
// // user: _user,
|
|
|
|
|
// // host: _settingProvider.host,
|
|
|
|
|
// // );
|
|
|
|
|
// // if (status >= 200 && status < 300) {
|
|
|
|
|
// // _settingProvider.setUser(_userProvider.user);
|
|
|
|
|
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
|
|
|
// // content: Text(context.translation.requestCompleteSuccessfully),
|
|
|
|
|
// // ));
|
|
|
|
|
// // } else {
|
|
|
|
|
// // String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: context.translation);
|
|
|
|
|
// // ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
|
|
|
// // content: Text(errorMessage),
|
|
|
|
|
// // ));
|
|
|
|
|
// // }
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 32,
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ABackButton(),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|