email added to profile view adnd custom text field changes

This commit is contained in:
Ashutosh 2024-08-14 15:40:06 +05:30
parent cd83375b98
commit 17c100a035
5 changed files with 141 additions and 120 deletions

View File

@ -4,23 +4,26 @@ import 'package:get/get.dart';
class SignInScreenController extends GetxController { class SignInScreenController extends GetxController {
final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>(); final GlobalKey<ScaffoldState> screenKey = GlobalKey<ScaffoldState>();
// final emailController = TextEditingController(text: ""); // final emailController = TextEditingController(text: "");
// final passwordController = TextEditingController(text: ""); // final passwordController = TextEditingController(text: "");
final emailController = TextEditingController(text: "ashu@gmail.com"); final emailController = TextEditingController(text: "jack.davis@gmail.com");
final passwordController = TextEditingController(text: "Abc@1234"); final passwordController = TextEditingController(text: "abc@1234");
final emailErrorMsg = "".obs, passwordErrorMsg = "".obs; final emailErrorMsg = "".obs, passwordErrorMsg = "".obs;
// final isRememberMe = false.obs; // final isRememberMe = false.obs;
final isLoading = false.obs; final isLoading = false.obs;
final obsecure = true.obs;
@override @override
void onInit() { void onInit() {
emailController.text = emailController.text = LocalStorageManager.getSessionToken(
LocalStorageManager.getSessionToken(tokenKey: LocalStorageKeys.kSaveEmailKey); tokenKey: LocalStorageKeys.kSaveEmailKey);
// isRememberMe.value = _sessionManagement // isRememberMe.value = _sessionManagement
// .getSessionToken(tokenKey: SessionKeys.kRememberMeKey) // .getSessionToken(tokenKey: SessionKeys.kRememberMeKey)
// .toLowerCase() == // .toLowerCase() ==
// "true"; // "true";
emailController.text = 'ashu@gmail.com'; emailController.text = 'jack.davis@gmail.com';
super.onInit(); super.onInit();
} }

View File

@ -12,8 +12,10 @@ class CustomTextFieldWidget extends StatelessWidget {
final ValueChanged<String>? onChange; final ValueChanged<String>? onChange;
final bool isEnabled; final bool isEnabled;
final bool isObscure; final bool isObscure;
final Widget? suffix;
final BorderRadius? borderRadius; final BorderRadius? borderRadius;
final Color? borderColor; final Color? borderColor;
final Color? disabledColor;
final double? borderWidth; final double? borderWidth;
final Widget? bottomChild; final Widget? bottomChild;
final TextInputType? inputType; final TextInputType? inputType;
@ -33,17 +35,21 @@ class CustomTextFieldWidget extends StatelessWidget {
this.isObscure = false, this.isObscure = false,
this.borderRadius, this.borderRadius,
this.borderColor, this.borderColor,
this.disabledColor,
this.borderWidth = 1.0, this.borderWidth = 1.0,
this.bottomChild, this.bottomChild,
this.textCapitalization, this.textCapitalization,
this.inputType, this.inputType,
this.inputFormatters, this.inputFormatters, this.suffix,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: isEnabled
? Colors.white
: disabledColor ?? CustomAppColors.kSmokeColor.withOpacity(0.5),
borderRadius: borderRadius, borderRadius: borderRadius,
border: Border.all( border: Border.all(
color: borderColor ?? CustomAppColors.kSmokeColor, color: borderColor ?? CustomAppColors.kSmokeColor,
@ -54,24 +60,19 @@ class CustomTextFieldWidget extends StatelessWidget {
vertical: 10.h, vertical: 10.h,
horizontal: 15.w, horizontal: 15.w,
), ),
child: Row(
children: [
Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// CustomTextWidget(
// text: heading,
// fontSize: 10.sp,
// fontWeight: FontWeight.w500,
// fontColor: CustomAppColors.kLightTextColor,
// alignment: Alignment.centerLeft,
// textAlign: TextAlign.left,
// ),
Text( Text(
heading, heading,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
fontSize: 10.sp, fontSize: 12.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: CustomAppColors.kLightTextColor, color: CustomAppColors.kLightTextColor,
), ),
@ -125,6 +126,10 @@ class CustomTextFieldWidget extends StatelessWidget {
if (bottomChild != null) bottomChild!, if (bottomChild != null) bottomChild!,
], ],
), ),
),
suffix ?? const SizedBox.shrink(),
],
),
); );
} }
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart'; import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -36,52 +37,62 @@ class _SignInScreenState extends State<SignInScreen> {
height: 132.h, height: 132.h,
width: 203.w, width: 203.w,
), ),
CustomTextWidget( CustomTextWidget(
text: ConstantText.kWelcomeBack, text: ConstantText.kWelcomeBack,
fontColor: CustomAppColors.kIconColor, fontColor: CustomAppColors.kIconColor,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 24.sp, fontSize: 24.sp,
), ),
CustomTextWidget( CustomTextWidget(
text: ConstantText.kPleaseLoginToContinue, text: ConstantText.kPleaseLoginToContinue,
fontColor: CustomAppColors.kIconColor, fontColor: CustomAppColors.kIconColor,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 14.sp, fontSize: 14.sp,
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 30.0.h), padding: EdgeInsets.only(top: 30.0.h),
child: CustomTextFieldWidget( child: CustomTextFieldWidget(
controller: _controller.emailController, controller: _controller.emailController,
hintText: ConstantText.kPleaseInputEmail, hintText: ConstantText.kPleaseInputEmail,
heading: ConstantText.kEmailHeading, heading: ConstantText.kEmailHeading,
onChange: (_){ onChange: (_) {
_controller.validateEmail(); _controller.validateEmail();
}, },
), ),
), ),
Obx((){ Obx(() {
return CustomErrorMsg( return CustomErrorMsg(
message: _controller.emailErrorMsg.value, message: _controller.emailErrorMsg.value,
); );
}), }),
Padding( Padding(
padding: EdgeInsets.only(top: 15.0.h), padding: EdgeInsets.only(top: 15.0.h),
child: CustomTextFieldWidget( child: Obx(() {
return CustomTextFieldWidget(
controller: _controller.passwordController, controller: _controller.passwordController,
hintText: "******", hintText: "******",
heading: ConstantText.kPasswordHeading, heading: ConstantText.kPasswordHeading,
onChange: (_){ onChange: (_) {
_controller.validatePassword(); _controller.validatePassword();
}, },
isObscure: true, isObscure: _controller.obsecure(),
maxLines: 1, maxLines: 1,
suffix: IconButton(
onPressed: _controller.obsecure.toggle,
icon: Icon(
_controller.obsecure.isTrue
? CupertinoIcons.eye_slash
: CupertinoIcons.eye,
color: _controller.obsecure.isTrue
? CustomAppColors.kLightGreyColor
: Get.theme.colorScheme.primary,
size: 24.r,
), ),
), ),
Obx((){ );
}),
),
Obx(() {
return CustomErrorMsg( return CustomErrorMsg(
message: _controller.passwordErrorMsg.value, message: _controller.passwordErrorMsg.value,
); );
@ -119,10 +130,9 @@ class _SignInScreenState extends State<SignInScreen> {
], ],
), ),
), ),
Padding( Padding(
padding: EdgeInsets.only(bottom: 8.0.h), padding: EdgeInsets.only(bottom: 8.0.h),
child: Obx((){ child: Obx(() {
return CustomAppButton( return CustomAppButton(
isLoading: _controller.isLoading.value, isLoading: _controller.isLoading.value,
buttonText: ConstantText.kLogIn.toUpperCase(), buttonText: ConstantText.kLogIn.toUpperCase(),
@ -151,7 +161,6 @@ class _SignInScreenState extends State<SignInScreen> {
); );
} }
@override @override
void dispose() { void dispose() {
_controller.dispose(); _controller.dispose();

View File

@ -33,31 +33,31 @@ class _ClientProfileScreenState extends State<ClientProfileScreen> {
screenKey: controller.screenKey, screenKey: controller.screenKey,
onScreenTap: controller.removeFocus, onScreenTap: controller.removeFocus,
showAppBar: false, showAppBar: false,
appBar: CustomAppBar( // appBar: CustomAppBar(
leadingButton: Container(), // leadingButton: Container(),
showBoxShadow: false, // showBoxShadow: false,
titleWidget: Row( // titleWidget: Row(
children: [ // children: [
InkWell( // InkWell(
onTap: () => controller.backButtonPressed(context), // onTap: () => controller.backButtonPressed(context),
child: CustomImageWidget( // child: CustomImageWidget(
imagePath: AssetsManager.kBackIcon, // imagePath: AssetsManager.kBackIcon,
height: 11.53.h, // height: 11.53.h,
width: 8.66.w, // width: 8.66.w,
), // ),
), // ),
const SizedBox( // const SizedBox(
width: 15, // width: 15,
), // ),
CustomTextWidget( // CustomTextWidget(
text: 'Client: ${controller.serviceUser()?.displayName ?? ""}', // text: 'Client: ${controller.serviceUser()?.displayName ?? ""}',
isExpanded: false, // isExpanded: false,
fontSize: 16.sp, // fontSize: 16.sp,
fontWeight: FontWeight.w700, // fontWeight: FontWeight.w700,
fontColor: CustomAppColors.kDarkBlueTextColor), // fontColor: CustomAppColors.kDarkBlueTextColor),
], // ],
), // ),
), // ),
body: Obx(() { body: Obx(() {
if (controller.serviceUser() == null) { if (controller.serviceUser() == null) {
return FrequentFunctions.centerText(text: "User detail not found"); return FrequentFunctions.centerText(text: "User detail not found");
@ -84,6 +84,11 @@ class _ClientProfileScreenState extends State<ClientProfileScreen> {
text: detail.displayName, text: detail.displayName,
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
CustomTextWidget(
text: detail.email ?? "",
fontSize: 12.sp,
fontColor: Colors.grey,
fontWeight: FontWeight.w400),
16.verticalSpace, 16.verticalSpace,
BuildDetailRow( BuildDetailRow(
title: 'Contact Number', title: 'Contact Number',

View File

@ -18,7 +18,6 @@ import '../models/clients/HealthIssuesDetailsModel.dart';
import '../models/clients/allClientsList/AllClientsResponse.dart'; import '../models/clients/allClientsList/AllClientsResponse.dart';
import '../models/clients/documents_list_model.dart'; import '../models/clients/documents_list_model.dart';
import '../models/create_care_plan_request.dart'; import '../models/create_care_plan_request.dart';
import '../models/profile_screen_model.dart';
class ClientService { class ClientService {
static final ClientService _instance = ClientService._private(); static final ClientService _instance = ClientService._private();