edit profile screen ui
This commit is contained in:
@@ -98,7 +98,7 @@ class _SideMenuState extends State<SideMenu> {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
// Get.toNamed(RouteName.investorprofile);
|
||||
Get.toNamed(RouteName.myProfileScreen);
|
||||
});
|
||||
},
|
||||
child: Padding(
|
||||
|
||||
321
lib/view/Sidemenu/myProfile/my_profile_screen.dart
Normal file
321
lib/view/Sidemenu/myProfile/my_profile_screen.dart
Normal file
@@ -0,0 +1,321 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../Utils/Common/CommonAppbar.dart';
|
||||
import '../../../Utils/Common/CustomTextFormField.dart';
|
||||
import '../../../Utils/Common/ImageUpload.dart';
|
||||
import '../../../Utils/Common/commonBotton.dart';
|
||||
import '../../../Utils/text.dart';
|
||||
import '../../../controller/profile_image_controller.dart';
|
||||
import '../../onBoarding/splashScreen1.dart';
|
||||
|
||||
class MyProfileScreen extends StatefulWidget {
|
||||
const MyProfileScreen({super.key});
|
||||
|
||||
@override
|
||||
State<MyProfileScreen> createState() => _MyProfileScreenState();
|
||||
}
|
||||
|
||||
class _MyProfileScreenState extends State<MyProfileScreen> {
|
||||
final ProfileImageController editProfileImage =
|
||||
Get.put(ProfileImageController());
|
||||
RxBool isEdit = false.obs;
|
||||
final GlobalKey<FormState> formK = GlobalKey<FormState>();
|
||||
TextEditingController fullNameController = TextEditingController();
|
||||
TextEditingController emailController = TextEditingController();
|
||||
TextEditingController phoneNoController = TextEditingController();
|
||||
TextEditingController dobController = TextEditingController();
|
||||
TextEditingController cityController = TextEditingController();
|
||||
|
||||
DateTime timebackPressed = DateTime.now();
|
||||
|
||||
Future<void> _selectDate(BuildContext context) async {
|
||||
final DateTime? picked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(1900),
|
||||
lastDate: DateTime.now(),
|
||||
builder: (context, child) {
|
||||
return Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
colorScheme: const ColorScheme.light(
|
||||
surface: Colors.black,
|
||||
onSurface: Colors.white,
|
||||
primary: Color(0xff9A0000),
|
||||
onPrimary: Colors.white,
|
||||
),
|
||||
textButtonTheme: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: child!);
|
||||
});
|
||||
|
||||
if (picked != null && picked != DateTime.now()) {
|
||||
setState(() {
|
||||
dobController.text = "${picked.toLocal()}".split(' ')[0];
|
||||
final birthDate = DateTime(
|
||||
picked.year,
|
||||
picked.month,
|
||||
picked.day,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(
|
||||
() => Form(
|
||||
key: formK,
|
||||
child: Scaffold(
|
||||
appBar: CommonAppbar(
|
||||
height: 75,
|
||||
titleTxt: "",
|
||||
customActionWidget: text16W400(""),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
extendBody: true,
|
||||
body: Stack(
|
||||
children: [
|
||||
const CommonBlurLeft(),
|
||||
const CommonBlurRight(),
|
||||
Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 16),
|
||||
child: ListView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
text25W600("My Profile"),
|
||||
isEdit.value
|
||||
? const SizedBox()
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
isEdit.value = true;
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 20.r,
|
||||
backgroundColor: const Color(0xFF5A5A5A),
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 20.sp,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Gap(20),
|
||||
Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
Obx(
|
||||
() =>
|
||||
editProfileImage.profilePicPath.value != ''
|
||||
? ClipOval(
|
||||
child: SizedBox.fromSize(
|
||||
size: Size.fromRadius(60.r),
|
||||
child: editProfileImage
|
||||
.profilePicPath
|
||||
.value !=
|
||||
''
|
||||
? Image(
|
||||
image: FileImage(
|
||||
File(
|
||||
editProfileImage
|
||||
.profilePicPath
|
||||
.value,
|
||||
),
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
width: 200.w,
|
||||
height: 200.h,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/images/blank-profile-picture-973460_1280.png"),
|
||||
),
|
||||
)
|
||||
: ClipOval(
|
||||
child: SizedBox.fromSize(
|
||||
size: Size.fromRadius(60.r),
|
||||
child:
|
||||
// ProfileObj?.user?.profileImage !=
|
||||
// null
|
||||
// ? ClipOval(
|
||||
// child: SizedBox.fromSize(
|
||||
// size: Size.fromRadius(25.r),
|
||||
// child: CircleAvatar(
|
||||
// backgroundImage:
|
||||
// NetworkImage(ProfileObj!
|
||||
// .user!
|
||||
// .profileImage!),
|
||||
// radius: 25.r,
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// :
|
||||
Image.asset(
|
||||
"assets/images/png/Ellipse 560 (1).png",
|
||||
width: 130,
|
||||
height: 130,
|
||||
)),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
ImageUploadBottomSheet().showModal(
|
||||
context,
|
||||
false,
|
||||
(result) {
|
||||
print("File path is $result");
|
||||
editProfileImage.profilePicPath.value =
|
||||
result;
|
||||
},
|
||||
);
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 20.r,
|
||||
backgroundColor: const Color(0xFF5A5A5A),
|
||||
child: Icon(
|
||||
Icons.camera_alt_outlined,
|
||||
size: 20.sp,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
text18W400("Full Name"),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
CustomTextFormField(
|
||||
textEditingController: fullNameController,
|
||||
enabled: isEdit.value,
|
||||
validator: (value) {
|
||||
if (value == "") {
|
||||
return "Name is Required";
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
text18W400("Email Address"),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
CustomTextFormField(
|
||||
textEditingController: emailController,
|
||||
enabled: isEdit.value,
|
||||
texttype: TextInputType.emailAddress,
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
text18W400("Phone Number"),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
CustomTextFormField(
|
||||
textEditingController: phoneNoController,
|
||||
enabled: isEdit.value,
|
||||
texttype: TextInputType.phone,
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
text18W400("Date Of Birth"),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
CustomTextFormField(
|
||||
textEditingController: dobController,
|
||||
enabled: isEdit.value,
|
||||
suffixIcon: const Icon(
|
||||
Icons.calendar_month_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
readonly: true,
|
||||
onTap: () {
|
||||
_selectDate(context);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
text18W400("City"),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
CustomTextFormField(
|
||||
textEditingController: cityController,
|
||||
enabled: isEdit.value,
|
||||
),
|
||||
SizedBox(
|
||||
height: 40.h,
|
||||
),
|
||||
!isEdit.value
|
||||
? const SizedBox()
|
||||
: SizedBox(
|
||||
width: Get.width,
|
||||
child: kycBtn(
|
||||
text: "Save",
|
||||
onTap: () {
|
||||
final isValid =
|
||||
formK.currentState?.validate();
|
||||
|
||||
if (isValid!) {}
|
||||
},
|
||||
bgClr: const Color(0xFF6C0000),
|
||||
borderClr: const Color(0xFF990000),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user