second commit
This commit is contained in:
320
lib/View/More/Editprofile/Editprofileview.dart
Normal file
320
lib/View/More/Editprofile/Editprofileview.dart
Normal file
@@ -0,0 +1,320 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../Controller/More/Editprofile/Editprofilecontroller.dart';
|
||||
import '../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../Helper/custombutton.dart';
|
||||
import '../../../Helper/customederaction.dart';
|
||||
import '../../../Model/Response/User/Usermodelresponse.dart';
|
||||
|
||||
class EditProfile extends StatelessWidget {
|
||||
UserDetails? data;
|
||||
EditProfile({super.key,this.data});
|
||||
|
||||
EditProfileController editProfileController = Get.put(EditProfileController());
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: SingleChildScrollView(
|
||||
child: GetBuilder<EditProfileController>(
|
||||
initState: (_){
|
||||
editProfileController.userInfo = data;
|
||||
editProfileController.getDetails();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 0.30,
|
||||
width: Get.width,
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
AssetConstants.nearleAppbarTop,
|
||||
),
|
||||
fit: BoxFit.fill),
|
||||
// color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.elliptical(20, 20),
|
||||
bottomRight: Radius.elliptical(20, 20))),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 64, left: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: SizedBox(
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.7,
|
||||
child: Image.asset(AssetConstants.nearleAppbarDarkLogo),
|
||||
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 45,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"Edit Profile",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
fontSize: 24),
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Text(
|
||||
"+91 ${data?.contactno}",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.white,
|
||||
fontSize: 17),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 25.0,horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 10,),
|
||||
firstName(),
|
||||
const SizedBox(height: 10,),
|
||||
lastName(),
|
||||
const SizedBox(height: 10,),
|
||||
email(),
|
||||
const SizedBox(height: 10,),
|
||||
contactNo(),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
bottomNavigationBar:Container(
|
||||
height: Get.height*0.1,
|
||||
width: Get.width,
|
||||
decoration: const BoxDecoration(
|
||||
image:DecorationImage(image:AssetImage(AssetConstants.nearleAppbarBottom,),fit: BoxFit.fill),
|
||||
// color: ColorConstants.primaryColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.elliptical(3, 3),
|
||||
bottomRight: Radius.elliptical(3, 3))),
|
||||
child: Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height*0.08,
|
||||
child: submit()),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Widget firstName() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Firstname',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
|
||||
controller: editProfileController.firstNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget lastName() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Lastname',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
|
||||
controller: editProfileController.lastNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget email() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Email',
|
||||
prefixIcon: Icon(
|
||||
Icons.email_outlined,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
controller: editProfileController.emailController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget contactNo() {
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
|
||||
// enabled: false,
|
||||
style: const TextStyle(fontFamily: 'Inter'),
|
||||
buildCounter: (BuildContext context,
|
||||
{int? currentLength, int? maxLength, bool? isFocused}) =>
|
||||
null,
|
||||
maxLength: 10,
|
||||
keyboardType:
|
||||
const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Contact no',
|
||||
// prefixIcon: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: Get.width * 0.3,
|
||||
// height: Get.height * 0.04,
|
||||
// child: Row(
|
||||
// children: [
|
||||
// const SizedBox(
|
||||
// width: 25,
|
||||
// ),
|
||||
// InkWell(
|
||||
// child: CountryPickerUtils.getDefaultFlagImage(
|
||||
// editProfileController.selectedDialogCountry),
|
||||
// // onTap: _openCountryPickerDialog,
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// width: 8,
|
||||
// ),
|
||||
// Text(
|
||||
// "+${editProfileController.selectedDialogCountry.phoneCode}"),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
prefixIcon: Icon(
|
||||
Icons.phone,
|
||||
color: ColorConstants.darkGreyColor,
|
||||
)),
|
||||
controller: editProfileController.contactNoController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget submit(){
|
||||
return GetBuilder<EditProfileController>(
|
||||
builder: (controller) {
|
||||
return RoundedButton(
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
onPressed: () {
|
||||
controller.doSomething();
|
||||
},
|
||||
color: ColorConstants.primaryColor!,
|
||||
title: 'Update',
|
||||
controller: controller.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Inter",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
class UpperCaseTextFormatter extends TextInputFormatter {
|
||||
@override
|
||||
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
|
||||
return TextEditingValue(
|
||||
text: capitalize(newValue.text),
|
||||
selection: newValue.selection,
|
||||
);
|
||||
}
|
||||
}
|
||||
String capitalize(String value) {
|
||||
if(value.trim().isEmpty) return "";
|
||||
return "${value[0].toUpperCase()}${value.substring(1)}";
|
||||
}
|
||||
Reference in New Issue
Block a user