From 3428ac17f7c8a471991082e69bc9cec920dec9a6 Mon Sep 17 00:00:00 2001 From: jayesh Date: Wed, 14 Aug 2024 16:33:09 +0530 Subject: [PATCH] bugs fixing - login, edit profile, --- lib/Login/View/loginscreen.dart | 91 +- .../EditProfile/View/EditProfile.dart | 803 +++++++++--------- .../View/Individual/step2Selectactivity.dart | 68 +- .../View/Individual/tellusindividual.dart | 12 +- lib/onboarding/Signup/View/signupscreen.dart | 2 +- 5 files changed, 510 insertions(+), 466 deletions(-) diff --git a/lib/Login/View/loginscreen.dart b/lib/Login/View/loginscreen.dart index 0d187e4..a3a4109 100644 --- a/lib/Login/View/loginscreen.dart +++ b/lib/Login/View/loginscreen.dart @@ -2,13 +2,13 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_facebook_auth/flutter_facebook_auth.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Login/ViewModel/LoginApi.dart'; import 'package:regroup/Utils/Common/AppleOAuthService.dart'; -import 'package:regroup/Utils/Common/CustomNextButton.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; import 'package:regroup/Utils/Common/googleOAuthService.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; @@ -17,8 +17,6 @@ import 'package:regroup/Utils/texts.dart'; import 'package:regroup/onboarding/Signup/view_model/getUserprofile.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; -import 'package:flutter_facebook_auth/flutter_facebook_auth.dart'; - class LoginScreen extends StatefulWidget { const LoginScreen({super.key}); @@ -32,6 +30,7 @@ class _LoginScreenState extends State { RxBool isObscured = true.obs; final TextEditingController _passwordController = TextEditingController(); GoogleAuthService googleSigninController = Get.put(GoogleAuthService()); + bool isLoading = false; @override void initState() { @@ -120,7 +119,6 @@ class _LoginScreenState extends State { final LoginResult result = await FacebookAuth.instance.login(); if (result.status == LoginStatus.success) { - final userData = await FacebookAuth.instance.getUserData(); logger.i(userData['email']); logger.i(userData['id']); @@ -216,7 +214,7 @@ class _LoginScreenState extends State { context: context, builder: (context) { return AlertDialog( - backgroundColor: Color(0xff222935), + backgroundColor: const Color(0xff222935), title: Text( 'Exit App', style: TextStyle( @@ -300,7 +298,7 @@ class _LoginScreenState extends State { padding: EdgeInsets.symmetric(horizontal: 16.w), child: Align( alignment: Alignment.center, - child: Container( + child: SizedBox( width: 107.w, height: 86.h, child: SvgPicture.asset( @@ -350,7 +348,6 @@ class _LoginScreenState extends State { } return null; }, - inputFormatters: [ LengthLimitingTextInputFormatter(30), @@ -396,22 +393,72 @@ class _LoginScreenState extends State { ), sizedBoxHeight(10.h), Align( - alignment: Alignment.centerRight, - child: Padding( - padding: EdgeInsets.only(right: 6.w), - child: GestureDetector( - onTap: () { - Get.toNamed(RouteName.forgotpass); - }, - child: - text14400white('Forgot password ?')), - )), + alignment: Alignment.centerRight, + child: Padding( + padding: EdgeInsets.only(right: 6.w), + child: GestureDetector( + onTap: () { + Get.toNamed(RouteName.forgotpass); + }, + child: text14400white('Forgot password ?'), + ), + ), + ), sizedBoxHeight(40.h), - CustomButton( - text: "Login", - onPressed: () { - _logincheck(); - }), + Center( + child: SizedBox( + width: isLoading ? 50 : double.infinity, + height: 50, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFFD90B2E), + padding: EdgeInsets.zero), + onPressed: () { + setState( + () { + isLoading = true; + }, + ); + Future.delayed( + const Duration(seconds: 1), + () { + setState(() { + isLoading = false; + }); + _logincheck(); + }, + ); + }, + child: isLoading + ? const Row( + mainAxisAlignment: + MainAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + SizedBox( + width: 30, + height: 30, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 2, + ), + ), + ], + ) + : Text( + 'Login', + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: "Helvetica", + fontWeight: FontWeight.w400, + fontSize: 16.sp, + color: const Color(0xFFFCFCFC), + ), + ), + ), + ), + ), sizedBoxHeight(20.h), GestureDetector( onTap: () { diff --git a/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart b/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart index a80db9e..80ffc44 100644 --- a/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart +++ b/lib/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart @@ -6,21 +6,20 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart' hide MultipartFile, FormData; +import 'package:path/path.dart' as path; import 'package:regroup/Common/CommonButton.dart'; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Main_Screens/ProfileTab/EditProfile/View/picturecontroller/indiprofileimagecontroller.dart'; import 'package:regroup/Main_Screens/ProfileTab/EditProfile/ViewModel/EditProfileApi.dart'; import 'package:regroup/Main_Screens/ProfileTab/EditProfile/ViewModel/InterestApiList.dart'; - +import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/CommonDropdown.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; -import 'package:regroup/Utils/Common/CommonAppbar.dart'; import 'package:regroup/Utils/Common/ImageUpload.dart'; import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; -import 'package:path/path.dart' as path; import 'package:regroup/resources/routes/route_name.dart'; class EditProfile extends StatefulWidget { @@ -101,16 +100,15 @@ class _EditProfileState extends State { locationController.text = getEditProfileIndi!.data!.about ?? ''; aboutController.text = getEditProfileIndi!.data!.about ?? ''; - positionController.text = - getEditProfileIndi!.data!.position ?? 'Lorem lpsum'; + positionController.text = getEditProfileIndi!.data!.position ?? ''; trainingScoresController.text = - getEditProfileIndi!.data!.trainingScores ?? '50'; + getEditProfileIndi!.data!.trainingScores ?? ''; - heightController.text = getEditProfileIndi!.data!.height ?? '6 feet'; - weightController.text = getEditProfileIndi!.data!.weight ?? '70kg'; + heightController.text = getEditProfileIndi!.data!.height ?? ''; + weightController.text = getEditProfileIndi!.data!.weight ?? ''; battingAvgController.text = - getEditProfileIndi!.data!.battingAverage ?? '372'; + getEditProfileIndi!.data!.battingAverage ?? ''; isOnce = false; setState(() {}); @@ -119,16 +117,12 @@ class _EditProfileState extends State { void saveEditProfileInd() async { utils.loader(); - FormData? updata; - - var imageFile; + MultipartFile imageFile = MultipartFile.fromBytes([]); selectedinterestid.isEmpty ? getCatIdFromName(listofUserInterests) : selectedinterestid; - String abilitiesIds = selectedinterestid.toString(); - if (editProfileImage.usserprofilePicPath.value.isNotEmpty) { imageFile = await MultipartFile.fromFile( editProfileImage.usserprofilePicPath.value, @@ -138,8 +132,9 @@ class _EditProfileState extends State { updata = FormData.fromMap({ "full_name": fullNameController.text, - "profile_image": - editProfileImage.usserprofilePicPath.isNotEmpty ? imageFile : null, + "profile_image": editProfileImage.usserprofilePicPath.value.isNotEmpty + ? imageFile + : null, "user_name": userNameController.text, "date_of_birth": dateController.text, "gender": _selectedgenderType, @@ -182,404 +177,400 @@ class _EditProfileState extends State { return GestureDetector( onTap: () => FocusManager.instance.primaryFocus?.unfocus(), child: Scaffold( - backgroundColor: const Color(0xFF222935), - extendBody: true, - appBar: const CommonAppbar( - titleTxt: "", - ), - body: FutureBuilder( - future: myfuture, - builder: (ctx, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center( - child: CircularProgressIndicator( - color: Colors.blue, - ), - ); - } + backgroundColor: const Color(0xFF222935), + extendBody: true, + appBar: const CommonAppbar( + titleTxt: "", + ), + body: FutureBuilder( + future: myfuture, + builder: (ctx, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center( + child: CircularProgressIndicator( + color: Colors.blue, + ), + ); + } - if (snapshot.hasError) { - return Center( - child: Text( - '${snapshot.error} occurred', - style: TextStyle(fontSize: 18.spMin), - ), - ); - } + if (snapshot.hasError) { + return Center( + child: Text( + '${snapshot.error} occurred', + style: TextStyle(fontSize: 18.spMin), + ), + ); + } - if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - return Stack(children: [ - Container( - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage( - "assets/images/png/Ellipse 1496.png"), - fit: BoxFit.fill)), - ), - SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: Column(children: [ - sizedBoxHeight(25.h), - Stack( - children: [ - Obx( - () => editProfileImage - .usserprofilePicPath.value != - '' - ? ClipOval( - child: SizedBox.fromSize( - size: Size.fromRadius(50.r), - child: editProfileImage - .usserprofilePicPath - .value != - '' - ? Image( - image: FileImage( - File( - editProfileImage - .usserprofilePicPath - .value, - ), + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + return Stack(children: [ + Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/png/Ellipse 1496.png"), + fit: BoxFit.fill)), + ), + SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column(children: [ + sizedBoxHeight(25.h), + Stack( + children: [ + Obx( + () => editProfileImage + .usserprofilePicPath.value != + '' + ? ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(50.r), + child: editProfileImage + .usserprofilePicPath + .value != + '' + ? Image( + image: FileImage( + File( + editProfileImage + .usserprofilePicPath + .value, ), - fit: BoxFit.cover, - width: double.infinity, - errorBuilder: - (BuildContext - context, - Object - exception, - StackTrace? - stackTrace) { - return CircleAvatar( - backgroundImage: - const AssetImage( - "assets/images/png/cimg3.png"), - radius: 50.r, - ); - }, - ) - : Image.asset( - 'assets/images/png/cimg3.png')), - ) - : ClipOval( - child: SizedBox.fromSize( - size: Size.fromRadius(60.r), - child: getEditProfileIndi!.data! - .profilePhoto != - null - ? ClipOval( - child: - SizedBox.fromSize( - size: Size.fromRadius( - 25.r), - child: CircleAvatar( - backgroundImage: - NetworkImage( - getEditProfileIndi! - .data! - .profilePhoto!), - radius: 25.r, - ), + ), + fit: BoxFit.cover, + width: double.infinity, + errorBuilder: + (BuildContext context, + Object exception, + StackTrace? + stackTrace) { + return CircleAvatar( + backgroundImage: + const AssetImage( + "assets/images/png/cimg3.png"), + radius: 50.r, + ); + }, + ) + : Image.asset( + 'assets/images/png/cimg3.png')), + ) + : ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(60.r), + child: getEditProfileIndi! + .data!.profilePhoto != + null + ? ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius( + 25.r), + child: CircleAvatar( + backgroundImage: NetworkImage( + getEditProfileIndi! + .data! + .profilePhoto!), + radius: 25.r, ), - ) - : Image.asset( - "assets/images/blank-profile-picture-973460_1280.png")), - ), - ), - Positioned( - bottom: 0, - right: 0, - child: InkWell( - onTap: () { - ImageUploadBottomSheet().showModal( - context, - true, - (result) { - editProfileImage - .usserprofilePicPath - .value = result; + ), + ) + : Image.asset( + "assets/images/blank-profile-picture-973460_1280.png")), + ), + ), + Positioned( + bottom: 0, + right: 0, + child: InkWell( + onTap: () { + ImageUploadBottomSheet().showModal( + context, + true, + (result) { + editProfileImage.usserprofilePicPath + .value = result; - var filenameresult = - extractFileName1(result); + var filenameresult = + extractFileName1(result); - profilePicture = result; - isImageAdded = true; - setState(() {}); - }, - ); - }, - child: Container( - height: 35.h, - width: 35.w, - decoration: const BoxDecoration( - shape: BoxShape.circle, - color: Color(0xFFD90B2E)), - child: Center( - child: Image.asset( - "assets/images/png/cameraicon2.png", - height: 19.h, - width: 19.w, - ), - ), - ), - )) - ], - ), - sizedBoxHeight(15.h), - text16400white("Edit profile picture"), - sizedBoxHeight(20.h), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - text16400white("Full name"), - sizedBoxHeight(16.h), - CustomTextFormField( - textEditingController: fullNameController, - leadingIcon: SizedBox( - width: 18.w, - height: 17.h, - child: Center( - child: Image.asset( - "assets/images/png/Frame 24.png", - width: 18.w, - height: 17.h, - ), - ), - ), - hintText: "Enter your full name", - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp('[a-zA-Z ]')), - ], - ), - sizedBoxHeight(20.h), - text16400white("User name"), - sizedBoxHeight(16.h), - CustomTextFormField( - textEditingController: userNameController, - leadingIcon: SizedBox( - width: 18.w, - height: 17.h, - child: Center( - child: Image.asset( - "assets/images/png/Frame 24.png", - width: 18.w, - height: 17.h, - ), - ), - ), - hintText: "Enter your user name", - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp('[a-zA-Z ]')), - ], - ), - sizedBoxHeight(20.h), - text16400white("Date of birth"), - sizedBoxHeight(16.h), - GestureDetector( - onTap: () => - datePicker(context, dateController), - child: AbsorbPointer( - child: CustomTextFormField( - leadingIcon: SizedBox( - width: 18.0, - height: 17.0, - child: Center( - child: Image.asset( - "assets/images/png/calender.png", - width: 18.0, - height: 17.0, - ), - ), - ), - hintText: "12-04-2024", - textEditingController: dateController, - ), - ), - ), - sizedBoxHeight(20.h), - text16400white("Gender"), - sizedBoxHeight(16.h), - CustomDropDownRadio( - initialSelectedValue: _selectedgenderType, - header: _selectedgenderType ?? "Male", - title: "", - showOtherOption: true, - listData: const [ - "Male", - "Female", - "Prefer not to say" - ], - onItemSelected: _onItemSelected, - leadingImage: Image.asset( - "assets/images/png/Vector ws.png", - width: 18.w, - height: 17.h, - ), - ), - sizedBoxHeight(25.h), - Row( - children: [ - text16400white("Location"), - sizedBoxWidth(6.w), - Image.asset( - "assets/images/png/octicon_question-24.png", - height: 16.h, - width: 16.w, - ) - ], - ), - sizedBoxHeight(16.h), - CustomTextFormField( - textEditingController: locationController, - leadingIcon: SizedBox( - width: 18.w, - height: 17.h, - child: Center( - child: Image.asset( - "assets/images/png/Group 58645.png", - width: 18.w, - height: 17.h, - ), - ), - ), - hintText: "Enter your location", - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp('[a-zA-Z ]')), - ], - ), - sizedBoxHeight(20.h), - Row( - children: [ - text16400white("Interests"), - sizedBoxWidth(6.w), - Image.asset( - "assets/images/png/octicon_question-24.png", - height: 16.h, - width: 16.w, - ) - ], - ), - sizedBoxHeight(16.h), - CustomDropDownChexkBox( - header: 'Select interest', - title: "", - listData: listofInterests, - onItemSelected: getCatIdFromName, - leadingImage: Image.asset( - "assets/images/png/Vector (4).png", - width: 18.w, - height: 17.h, - ), - initiallySelected: listofUserInterests, - ), - sizedBoxHeight(20.h), - text16400white("About"), - sizedBoxHeight(16.h), - CustomTextFormField2( - textEditingController: aboutController, - hintText: - "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. Lorem Ipsum has been the industry's standard", - maxlines: 3, - ), - text16400white("Position"), - sizedBoxHeight(16.h), - CustomTextFormField( - textEditingController: positionController, - hintText: "Enter your position", - inputFormatters: [ - LengthLimitingTextInputFormatter(50), - ], - ), - sizedBoxHeight(20.h), - text16400white("Training Scores"), - sizedBoxHeight(16.h), - CustomTextFormField( - textEditingController: - trainingScoresController, - texttype: TextInputType.number, - hintText: "Enter your training scores", - inputFormatters: [ - LengthLimitingTextInputFormatter(10), - FilteringTextInputFormatter.allow( - RegExp('[0-9]')), - ], - ), - sizedBoxHeight(20.h), - text16400white("Height"), - sizedBoxHeight(16.h), - CustomTextFormField( - textEditingController: heightController, - hintText: "Enter your height", - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'[a-zA-Z0-9\s]')), - ], - ), - sizedBoxHeight(20.h), - text16400white("Weight"), - sizedBoxHeight(16.h), - CustomTextFormField( - textEditingController: weightController, - hintText: "Enter your weight", - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'[a-zA-Z0-9\s]')), - ], - ), - sizedBoxHeight(20.h), - text16400white("Batting Average"), - sizedBoxHeight(16.h), - CustomTextFormField( - texttype: TextInputType.number, - textEditingController: battingAvgController, - hintText: "Enter your batting average", - inputFormatters: [ - LengthLimitingTextInputFormatter(10), - FilteringTextInputFormatter.allow( - RegExp('[0-9]')), - ], - ), - sizedBoxHeight(20.h), - sizedBoxHeight(60.h), - CommonBtn( - text: "Save", - onTap: () { - if (fullNameController.text.isBlank! || - userNameController.text.isBlank! || - dateController.text.isBlank! || - locationController.text.isBlank! || - aboutController.text.isBlank! || - positionController.text.isBlank! || - trainingScoresController - .text.isBlank! || - heightController.text.isBlank! || - weightController.text.isBlank! || - battingAvgController.text.isBlank!) { - Get.snackbar( - 'Error', - 'Please fill missing details', - snackPosition: SnackPosition.BOTTOM, - backgroundColor: Colors.red, - colorText: Colors.white, + profilePicture = result; + isImageAdded = true; + setState(() {}); + }, ); - } else { - saveEditProfileInd(); - } - }, + }, + child: Container( + height: 35.h, + width: 35.w, + decoration: const BoxDecoration( + shape: BoxShape.circle, + color: Color(0xFFD90B2E)), + child: Center( + child: Image.asset( + "assets/images/png/cameraicon2.png", + height: 19.h, + width: 19.w, + ), + ), + ), + )) + ], + ), + sizedBoxHeight(15.h), + text16400white("Edit profile picture"), + sizedBoxHeight(20.h), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + text16400white("Full name"), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: fullNameController, + leadingIcon: SizedBox( + width: 18.w, + height: 17.h, + child: Center( + child: Image.asset( + "assets/images/png/Frame 24.png", + width: 18.w, + height: 17.h, + ), + ), ), - sizedBoxHeight(60.h), - ], - ) - ]))) - ]); - } - return Container(); - })), + hintText: "Enter your full name", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')), + ], + ), + sizedBoxHeight(20.h), + text16400white("User name"), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: userNameController, + leadingIcon: SizedBox( + width: 18.w, + height: 17.h, + child: Center( + child: Image.asset( + "assets/images/png/Frame 24.png", + width: 18.w, + height: 17.h, + ), + ), + ), + hintText: "Enter your user name", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')), + ], + ), + sizedBoxHeight(20.h), + text16400white("Date of birth"), + sizedBoxHeight(16.h), + GestureDetector( + onTap: () => + datePicker(context, dateController), + child: AbsorbPointer( + child: CustomTextFormField( + leadingIcon: SizedBox( + width: 18.0, + height: 17.0, + child: Center( + child: Image.asset( + "assets/images/png/calender.png", + width: 18.0, + height: 17.0, + ), + ), + ), + hintText: "12-04-2024", + textEditingController: dateController, + ), + ), + ), + sizedBoxHeight(20.h), + text16400white("Gender"), + sizedBoxHeight(16.h), + CustomDropDownRadio( + initialSelectedValue: _selectedgenderType, + header: _selectedgenderType ?? "Male", + title: "", + showOtherOption: true, + listData: const [ + "Male", + "Female", + "Prefer not to say" + ], + onItemSelected: _onItemSelected, + leadingImage: Image.asset( + "assets/images/png/Vector ws.png", + width: 18.w, + height: 17.h, + ), + ), + sizedBoxHeight(25.h), + Row( + children: [ + text16400white("Location"), + sizedBoxWidth(6.w), + Image.asset( + "assets/images/png/octicon_question-24.png", + height: 16.h, + width: 16.w, + ) + ], + ), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: locationController, + leadingIcon: SizedBox( + width: 18.w, + height: 17.h, + child: Center( + child: Image.asset( + "assets/images/png/Group 58645.png", + width: 18.w, + height: 17.h, + ), + ), + ), + hintText: "Enter your location", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')), + ], + ), + sizedBoxHeight(20.h), + Row( + children: [ + text16400white("Interests"), + sizedBoxWidth(6.w), + Image.asset( + "assets/images/png/octicon_question-24.png", + height: 16.h, + width: 16.w, + ) + ], + ), + sizedBoxHeight(16.h), + CustomDropDownChexkBox( + header: 'Select interest', + title: "", + listData: listofInterests, + onItemSelected: getCatIdFromName, + leadingImage: Image.asset( + "assets/images/png/Vector (4).png", + width: 18.w, + height: 17.h, + ), + initiallySelected: listofUserInterests, + ), + sizedBoxHeight(20.h), + text16400white("About"), + sizedBoxHeight(16.h), + CustomTextFormField2( + textEditingController: aboutController, + hintText: + "Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. Lorem Ipsum has been the industry's standard", + maxlines: 3, + ), + text16400white("Position"), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: positionController, + hintText: "Enter your position", + inputFormatters: [ + LengthLimitingTextInputFormatter(50), + ], + ), + sizedBoxHeight(20.h), + text16400white("Training Scores"), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: + trainingScoresController, + texttype: TextInputType.number, + hintText: "Enter your training scores", + inputFormatters: [ + LengthLimitingTextInputFormatter(10), + FilteringTextInputFormatter.allow( + RegExp('[0-9]')), + ], + ), + sizedBoxHeight(20.h), + text16400white("Height"), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: heightController, + hintText: "Enter your height", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], + ), + sizedBoxHeight(20.h), + text16400white("Weight"), + sizedBoxHeight(16.h), + CustomTextFormField( + textEditingController: weightController, + hintText: "Enter your weight", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], + ), + sizedBoxHeight(20.h), + text16400white("Batting Average"), + sizedBoxHeight(16.h), + CustomTextFormField( + texttype: TextInputType.number, + textEditingController: battingAvgController, + hintText: "Enter your batting average", + inputFormatters: [ + LengthLimitingTextInputFormatter(10), + FilteringTextInputFormatter.allow( + RegExp('[0-9]')), + ], + ), + sizedBoxHeight(20.h), + sizedBoxHeight(60.h), + CommonBtn( + text: "Save", + onTap: () { + if (fullNameController.text.isBlank! || + userNameController.text.isBlank! || + dateController.text.isBlank! || + locationController.text.isBlank! || + aboutController.text.isBlank! || + positionController.text.isBlank! || + trainingScoresController + .text.isBlank! || + heightController.text.isBlank! || + weightController.text.isBlank! || + battingAvgController.text.isBlank!) { + Get.snackbar( + 'Error', + 'Please fill missing details', + snackPosition: SnackPosition.BOTTOM, + backgroundColor: Colors.red, + colorText: Colors.white, + ); + } else { + saveEditProfileInd(); + } + }, + ), + sizedBoxHeight(60.h), + ], + ) + ]))) + ]); + } + return Container(); + }), + ), ); } } diff --git a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart index 2d54159..1243faa 100644 --- a/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart +++ b/lib/onboarding/Signup/View/Individual/step2Selectactivity.dart @@ -70,10 +70,10 @@ class _SelectIndividualActivityState extends State { return Colors.transparent; } else if (_firstSelectedIndex == index && _isFirstSelectionActive) { // Apply Color(0XFFD90B2E) to the first selected item - return Color(0XFFD90B2E); + return const Color(0XFFD90B2E); } else if (_selectedIndices.contains(index)) { // Apply Color(0xFF009DAB) to all other selected items - return Color(0xFF009DAB); + return const Color(0xFF009DAB); } return Colors.transparent; } @@ -318,35 +318,40 @@ class _SelectIndividualActivityState extends State { shrinkWrap: true, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: - 3, // Number of items in each row - crossAxisSpacing: 12 - .w, // Horizontal spacing between items - mainAxisSpacing: 12 - .h, // Vertical spacing between items + crossAxisCount: 3, + crossAxisSpacing: 12.w, + mainAxisSpacing: 12.h, ), itemCount: indiactivityobj!.data!.length, itemBuilder: (context, index) { + final activity = + indiactivityobj!.data![index]; return ActivityContainer( - index: indiactivityobj! - .data![index].id!, - titleString: indiactivityobj! - .data![index].name!, - image: indiactivityobj! - .data![index].image, - // 'assets/images/svg/individualact7.svg', + key: ValueKey( + activity.id), // Added ValueKey + index: activity.id!, + titleString: activity.name!, + image: activity.image, isSelected: _selectedIndices - .contains(indiactivityobj! - .data![index].id!), - gradientColor: _getGradientColor( - indiactivityobj! - .data![index].id!), - onTap: _onContainerTap, + .contains(activity.id!), + gradientColor: + _getGradientColor(activity.id!), + onTap: (selectedIndex) { + setState(() { + if (_selectedIndices + .contains(selectedIndex)) { + _selectedIndices + .remove(selectedIndex); + } else { + _selectedIndices + .add(selectedIndex); + } + }); + }, ); }, ), - sizedBoxHeight(30.h), // text20400FCFCFC("Add other activity"), // sizedBoxHeight(25.h), @@ -412,10 +417,10 @@ class _SelectIndividualActivityState extends State { width: 212.w, height: 35.h, decoration: BoxDecoration( - color: Color(0xFF363636), + color: const Color(0xFF363636), borderRadius: BorderRadius.circular(20), - border: - Border.all(color: Color(0xFFD90B2E), width: 1.w)), + border: Border.all( + color: const Color(0xFFD90B2E), width: 1.w)), child: Center( child: text16400white("Can’t find your interest"))), ) @@ -450,7 +455,7 @@ class _SelectIndividualActivityState extends State { children: [ Row( children: [ - Spacer(), + const Spacer(), InkWell( onTap: () { Get.back(); @@ -524,7 +529,7 @@ class _SelectIndividualActivityState extends State { children: [ Row( children: [ - Spacer(), + const Spacer(), Image.asset( "assets/images/png/x-circle.png", height: 28.h, @@ -560,7 +565,8 @@ class ActivityContainer extends StatelessWidget { final Color gradientColor; final Function(int) onTap; - ActivityContainer({ + const ActivityContainer({ + super.key, required this.index, required this.titleString, required this.image, @@ -584,8 +590,8 @@ class ActivityContainer extends StatelessWidget { ? _firstSelectedIndex == index && _isFirstSelectionActive == true ? [ - Color(0xFF009DAB).withOpacity(0.80), - Color(0xFF009DAB).withOpacity(0.77), + const Color(0xFF009DAB).withOpacity(0.80), + const Color(0xFF009DAB).withOpacity(0.77), gradientColor.withOpacity(0.70), gradientColor.withOpacity(0.50), ] @@ -604,7 +610,7 @@ class ActivityContainer extends StatelessWidget { _isFirstSelectionActive == true ? BorderSide(width: 0.4.w, color: Colors.transparent) : BorderSide(width: 3.w, color: gradientColor) - : BorderSide(width: 2.w, color: Color(0xFF434A53)), + : BorderSide(width: 2.w, color: const Color(0xFF434A53)), borderRadius: BorderRadius.circular(10), ), ), diff --git a/lib/onboarding/Signup/View/Individual/tellusindividual.dart b/lib/onboarding/Signup/View/Individual/tellusindividual.dart index 6e0deba..025f4fb 100644 --- a/lib/onboarding/Signup/View/Individual/tellusindividual.dart +++ b/lib/onboarding/Signup/View/Individual/tellusindividual.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; import 'dart:io'; import 'package:dio/dio.dart'; @@ -6,7 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart' hide MultipartFile, FormData; -import 'package:glassmorphism/glassmorphism.dart'; +import 'package:path/path.dart' as path; import 'package:regroup/Common/CommonWidget.dart'; import 'package:regroup/Common/base_manager.dart'; import 'package:regroup/Common/controller/profileimagecontroller.dart'; @@ -15,14 +14,12 @@ import 'package:regroup/Utils/Common/CommonDropdown.dart'; import 'package:regroup/Utils/Common/CustomNextButton.dart'; import 'package:regroup/Utils/Common/CustomTextformfield.dart'; import 'package:regroup/Utils/Common/ImageUpload.dart'; - import 'package:regroup/Utils/Common/sized_box.dart'; import 'package:regroup/Utils/dialogs.dart'; import 'package:regroup/Utils/texts.dart'; import 'package:regroup/onboarding/Signup/view_model/postmethod.dart'; import 'package:regroup/resources/routes/route_name.dart'; import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart'; -import 'package:path/path.dart' as path; class TellusaboutIndividual extends StatefulWidget { const TellusaboutIndividual({super.key}); @@ -36,6 +33,7 @@ class _TellusaboutIndividualState extends State { TextEditingController userNameController = TextEditingController(); TextEditingController datecontroller = TextEditingController(); TextEditingController locationcontroller = TextEditingController(); + TextEditingController imageFile = TextEditingController(); DateTime? _selectedDate; final photographController = TextEditingController(); @@ -132,7 +130,7 @@ class _TellusaboutIndividualState extends State { void TellusUploadData() async { utils.loader(); - var imageFile; + MultipartFile? imageFile; if (editProfileImage.profilePicPath.value.isNotEmpty) { imageFile = await MultipartFile.fromFile( editProfileImage.profilePicPath.value, @@ -431,8 +429,10 @@ class _TellusaboutIndividualState extends State { datecontroller.text.isBlank! || _selectedgendertype.isEmpty || locationcontroller.text.isBlank! || + // imageFile.text.isBlank! || editProfileImage.profilePicPath.value == '') { - utils.showToast('Please fill all fields'); + utils + .showToast('Please Upload Profile Picture'); } else { TellusUploadData(); } diff --git a/lib/onboarding/Signup/View/signupscreen.dart b/lib/onboarding/Signup/View/signupscreen.dart index f64ce17..5f8ecd9 100644 --- a/lib/onboarding/Signup/View/signupscreen.dart +++ b/lib/onboarding/Signup/View/signupscreen.dart @@ -520,7 +520,7 @@ class _SignupScreenState extends State { decoration: ShapeDecoration( gradient: LinearGradient( begin: const Alignment( - 0.71, -0.70), + 0.71, -0.70), end: const Alignment(-0.71, 0.7), colors: [