From 875fa240fb6ffc904d3f18925db890f9a9e425a3 Mon Sep 17 00:00:00 2001 From: cj201199 Date: Mon, 29 Jul 2024 18:58:17 +0530 Subject: [PATCH] bug fixing done --- .../EditProfile/View/BusEditProfile.dart | 21 + .../EditProfile/View/EditProfile.dart | 394 ++---------------- .../EditProfile/View/ProfileTab.dart | 9 +- .../ProfileTab/TimeLine/AddTimeline.dart | 155 +------ 4 files changed, 66 insertions(+), 513 deletions(-) diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart index 6d3dd46..9b23da0 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/BusEditProfile.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; 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:regroup/Common/CommonButton.dart'; @@ -348,6 +349,10 @@ class _BusEditProfileState extends State { ), ), hintText: "Enter your business name", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], ), sizedBoxHeight(20.h), text16400white("Business username"), @@ -367,6 +372,10 @@ class _BusEditProfileState extends State { ), ), hintText: "Enter your business username", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], ), sizedBoxHeight(20.h), text16400white("Owner name"), @@ -385,6 +394,10 @@ class _BusEditProfileState extends State { ), ), hintText: "Enter your owner name", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], ), sizedBoxHeight(20.h), text16400white("Founded on"), @@ -457,6 +470,10 @@ class _BusEditProfileState extends State { ), ), hintText: "Enter your location", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], ), sizedBoxHeight(20.h), text16400white("Bio"), @@ -465,6 +482,10 @@ class _BusEditProfileState extends State { textEditingController: bioController, hintText: "Enter your business bio", maxlines: 3, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], ), sizedBoxHeight(60.h), CommonBtn( diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart index 6fcffce..f6cd840 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/EditProfile.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:dio/dio.dart'; 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:regroup/Common/CommonButton.dart'; @@ -71,7 +72,7 @@ class _EditProfileState extends State { RxBool isloading = true.obs; void getCatIdFromName(List selectedInterests) { - selectedinterestid.clear(); + // selectedinterestid.clear(); for (var name in selectedInterests) { for (var i = 0; i < interestlistobj!.data!.length; i++) { if (name == interestlistobj!.data![i].name) { @@ -366,6 +367,10 @@ class _EditProfileState extends State { ), ), hintText: "Enter your full name", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')), + ], ), sizedBoxHeight(20.h), text16400white("User name"), @@ -384,6 +389,10 @@ class _EditProfileState extends State { ), ), hintText: "Enter your user name", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')), + ], ), sizedBoxHeight(20.h), text16400white("Date of birth"), @@ -457,6 +466,10 @@ class _EditProfileState extends State { ), ), hintText: "Enter your location", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[a-zA-Z ]')), + ], ), sizedBoxHeight(20.h), Row( @@ -504,6 +517,9 @@ class _EditProfileState extends State { CustomTextFormField( textEditingController: positionController, hintText: "Enter your position", + inputFormatters: [ + LengthLimitingTextInputFormatter(50), + ], ), sizedBoxHeight(20.h), text16400white("Training Scores"), @@ -511,7 +527,13 @@ class _EditProfileState extends State { CustomTextFormField( textEditingController: trainingScoresController, + texttype: TextInputType.number, hintText: "Enter your training scores", + inputFormatters: [ + LengthLimitingTextInputFormatter(10), + FilteringTextInputFormatter.allow( + RegExp('[0-9]')), + ], ), sizedBoxHeight(20.h), text16400white("Height"), @@ -519,6 +541,10 @@ class _EditProfileState extends State { CustomTextFormField( textEditingController: heightController, hintText: "Enter your height", + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'[a-zA-Z0-9\s]')), + ], ), sizedBoxHeight(20.h), text16400white("Weight"), @@ -526,13 +552,23 @@ class _EditProfileState extends State { 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), @@ -577,361 +613,5 @@ class _EditProfileState extends State { return Container(); })), ); - - // 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.connectionState == ConnectionState.done && - // snapshot.hasData) { - // print("Data fetched-->"); - // 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: [ - // profilePicture != "" && isImageAdded - // ? ClipOval( - // child: SizedBox.fromSize( - // size: Size.fromRadius(50.r), - // child: Image.file( - // File(profilePicture), - // 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, - // ); - // }, - // ), - // ), - // ) - // : getEditProfileIndi?.data?.profilePhoto != - // null && - // getEditProfileIndi! - // .data!.profilePhoto!.isNotEmpty - // ? Container( - // width: 100.w, - // height: 100.h, - // decoration: ShapeDecoration( - // image: DecorationImage( - // image: NetworkImage( - // getEditProfileIndi! - // .data!.profilePhoto!, - // ), - // fit: BoxFit.cover, - // // onError: (error, stackTrace) { - // // // Fallback to default image in case of error - // // return const AssetImage("assets/images/png/cimg3.png"); - // // }, - // ), - // shape: const OvalBorder(), - // ), - // ) - // : CircleAvatar( - // backgroundImage: const AssetImage( - // "assets/images/png/cimg3.png"), - // radius: 50.r, - // ), - // Positioned( - // bottom: 0, - // right: 0, - // child: InkWell( - // onTap: () { - // ImageUploadBottomSheet().showModal( - // context, - // true, - // (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: Container( - // width: 18.w, - // height: 17.h, - // child: Center( - // child: Image.asset( - // "assets/images/png/Frame 24.png", - // width: 18.w, - // height: 17.h, - // ), - // ), - // ), - // hintText: "Edward Hackett", - // ), - // sizedBoxHeight(20.h), - // text16400white("User name"), - // sizedBoxHeight(16.h), - // CustomTextFormField( - // textEditingController: userNameController, - // leadingIcon: Container( - // width: 18.w, - // height: 17.h, - // child: Center( - // child: Image.asset( - // "assets/images/png/Frame 24.png", - // width: 18.w, - // height: 17.h, - // ), - // ), - // ), - // hintText: "edward_01", - // ), - // sizedBoxHeight(20.h), - // text16400white("Date of birth"), - // sizedBoxHeight(16.h), - // GestureDetector( - // onTap: () => - // datePicker(context, dateController), - // child: AbsorbPointer( - // child: CustomTextFormField( - // leadingIcon: Container( - // 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: [ - // "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: Container( - // width: 18.w, - // height: 17.h, - // child: Center( - // child: Image.asset( - // "assets/images/png/Group 58645.png", - // width: 18.w, - // height: 17.h, - // ), - // ), - // ), - // hintText: "Elm street london, United Kingdom", - // ), - // 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: _selectedsportType ?? - // // "Rowing, Rugby, Swimming", - // // title: "", - // // listData: [ - // // "Rowing", - // // "Cycling", - // // "Running", - // // "Swimming", - // // "Triathlon", - // // "Hiking", - // // "Football", - // // "Rugby" - // // ], - // // onItemSelected: _onSportSelected, - // // leadingImage: Image.asset( - // // "assets/images/png/Vector (4).png", - // // width: 18.w, - // // height: 17.h, - // // ), - // // showOtherOption: true, - // // initiallySelected: _selectedSports, - // // ), - // // CustomDropDownRadio( - // // showOtherOption: true, - // // header: _selectedsportType ?? - // // "Rowing, Rugby, Swimming", - // // title: "", - // // listData: [ - // // "Rowing", - // // "Cycling", - // // "Running", - // // "Swimming", - // // "Triathlon", - // // "Hiking", - // // "Football", - // // "Rugby" - // // ], - // // onItemSelected: _onSportSelected, - // // leadingImage: Image.asset( - // // "assets/images/png/Vector (4).png", - // // width: 18.w, - // // height: 17.h, - // // ), - // // ), - - // 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, - // ), - // // sizedBoxHeight(20.h), - - // text16400white("Position"), - // sizedBoxHeight(16.h), - // CustomTextFormField( - // textEditingController: positionController, - // hintText: "Lorem Ipsum", - // ), - // sizedBoxHeight(20.h), - // text16400white("Training Scores"), - // sizedBoxHeight(16.h), - // CustomTextFormField( - // textEditingController: - // trainingScoresController, - // hintText: "50", - // ), - // sizedBoxHeight(20.h), - // text16400white("Height"), - // sizedBoxHeight(16.h), - // CustomTextFormField( - // textEditingController: heightController, - // hintText: "6 feet", - // ), - // sizedBoxHeight(20.h), - // text16400white("Weight"), - // sizedBoxHeight(16.h), - // CustomTextFormField( - // textEditingController: weightController, - // hintText: "70kg", - // ), - // sizedBoxHeight(20.h), - // text16400white("Batting Average"), - // sizedBoxHeight(16.h), - // CustomTextFormField( - // textEditingController: battingAvgController, - // hintText: "372", - // ), - // sizedBoxHeight(20.h), - // sizedBoxHeight(60.h), - // CommonBtn( - // text: "Save", - // onTap: () { - // saveEditProfileInd(); - // }, - // ), - // sizedBoxHeight(60.h), - // ], - // ) - // ]))) - // ]); - // } - // return Container(); - // })); } } diff --git a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart index 132b92c..e725434 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/EditProfile/View/ProfileTab.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_reaction_button/flutter_reaction_button.dart'; @@ -522,7 +523,7 @@ class _ProfileTabState extends State { // ); Row( children: [ - Container( + SizedBox( width: 10, height: 170.h, child: Stack( @@ -750,7 +751,7 @@ class _ProfileTabState extends State { // }, // ), // ), - Container( + SizedBox( height: 30.h, // Adjust the height as needed child: @@ -1636,7 +1637,7 @@ class _ProfileTabState extends State { // }, // ), - Container( + SizedBox( height: 30.h, // Adjust the height as needed child: ListView.builder( shrinkWrap: true, @@ -1825,7 +1826,7 @@ class _ProfileTabState extends State { onTap: () { Get.toNamed(RouteName.postdetailsScreen); }, - child: Container( + child: SizedBox( height: 163.h, width: double.infinity, child: Image.asset( diff --git a/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart b/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart index 14dccf5..3e99e54 100644 --- a/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart +++ b/lib/Feed Module/Main_Screens/ProfileTab/TimeLine/AddTimeline.dart @@ -817,153 +817,6 @@ class _CustomDropDownCheckBoxTimelineState .addAll(widget.initiallySelected); // Initialize selectedValues } - // List> _buildDropdownMenuItems() { - // List> items = - // widget.listData.asMap().entries.map((entry) { - // int index = entry.key; - // String item = entry.value; - // return DropdownMenuItem( - // value: item, - // child: InkWell( - // onTap: () { - // setState(() { - // if (selectedValues.contains(item)) { - // selectedValues.remove(item); - // } else { - // selectedValues.add(item); - // } - // _textController.clear(); - // widget.onItemSelected( - // selectedValues.toList()); // Convert RxList to List - // }); - // }, - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Row( - // children: [ - // Obx(() { - // return Checkbox( - // value: selectedValues.contains(item), - // activeColor: Colors.white, - // checkColor: const Color(0xFFD90B2E), - // onChanged: (bool? value) { - // setState(() { - // if (value == true) { - // selectedValues.add(item); - // } else { - // selectedValues.remove(item); - // } - // _textController.clear(); - // widget.onItemSelected(selectedValues.toList()); - // }); - // }, - // ); - // }), - // const SizedBox(width: 8), - // Text( - // item, - // style: const TextStyle( - // color: Colors.white, - // fontSize: 16, - // fontFamily: 'Helvetica', - // fontWeight: FontWeight.w500, - // ), - // overflow: TextOverflow.ellipsis, - // ), - // ], - // ), - // if (index != widget.listData.length - 1) - // const Divider(thickness: 1, color: Color(0xFF434A53)), - // ], - // ), - // ), - // ); - // }).toList(); - - // if (widget.showOtherOption) { - // items.add( - // DropdownMenuItem( - // value: _textController.text, - // child: Column( - // children: [ - // const Divider(thickness: 1, color: Color(0xFF434A53)), - // Row( - // children: [ - // Obx(() { - // return Checkbox( - // value: selectedValues.contains(_textController.text), - // activeColor: Colors.white, - // onChanged: (bool? value) { - // setState(() { - // if (value == true && - // _textController.text.trim().isNotEmpty) { - // selectedValues.add(_textController.text); - // } else { - // selectedValues.remove(_textController.text); - // } - // widget.onItemSelected(selectedValues.toList()); - // }); - // }, - // ); - // }), - // const SizedBox(width: 8), - // const Text( - // "Other: ", - // style: TextStyle( - // color: Colors.white, - // fontSize: 16, - // fontFamily: 'Helvetica', - // fontWeight: FontWeight.w500, - // ), - // overflow: TextOverflow.ellipsis, - // ), - // Expanded( - // child: TextField( - // controller: _textController, - // style: const TextStyle( - // color: Colors.white, - // fontSize: 16, - // fontFamily: 'Helvetica', - // fontWeight: FontWeight.w500, - // ), - // decoration: const InputDecoration( - // hintText: '', - // hintStyle: TextStyle(color: Colors.white70), - // border: UnderlineInputBorder(), - // ), - // ), - // ), - // TextButton( - // onPressed: () { - // setState(() { - // if (_textController.text.trim().isNotEmpty) { - // selectedValues.add(_textController.text); - // widget.onItemSelected(selectedValues.toList()); - // } - // }); - // }, - // child: const Text( - // 'OK', - // style: TextStyle( - // color: Colors.white, - // fontSize: 16, - // fontFamily: 'Helvetica', - // fontWeight: FontWeight.w500, - // ), - // ), - // ), - // ], - // ), - // SizedBox(height: 10), - // ], - // ), - // ), - // ); - // } - // return items; - // } - List> _buildDropdownMenuItems() { return widget.listData.asMap().entries.map((entry) { int index = entry.key; @@ -1043,11 +896,9 @@ class _CustomDropDownCheckBoxTimelineState }, child: Container( width: double.infinity, - height: 50, - padding: EdgeInsets.only( - right: 22, - left: 12, - ), + // height: 50, + padding: + EdgeInsets.only(right: 22, left: 12, top: 15, bottom: 15), decoration: BoxDecoration( color: const Color(0xFFFFFFFF).withOpacity(0.10), borderRadius: onDropTap.value