UI_ADDITIONAL_COLOR, UI_ALLTRIPS_CARD

This commit is contained in:
venbaittech 2025-07-18 09:47:33 +05:30
parent bc8968f9c5
commit 66d62ca8f8
4 changed files with 1126 additions and 661 deletions

View File

@ -503,7 +503,10 @@ class _ListAllPlansState extends State<ListAllPlans> {
return Container( return Container(
margin: isDesktop ? EdgeInsets.all(10.0) : null, margin: isDesktop ? EdgeInsets.all(10.0) : null,
padding: const EdgeInsets.only(top: 15, bottom: 15, left: 20, right: 20), padding:
isDesktop
? const EdgeInsets.only(top: 15, bottom: 15, left: 20, right: 20)
: EdgeInsets.all(3.0),
height: height:
isDesktop isDesktop
? MediaQuery.of(context).size.height * 0.98 ? MediaQuery.of(context).size.height * 0.98
@ -1177,13 +1180,36 @@ class _ListAllPlansState extends State<ListAllPlans> {
// shadowColor: Colors.black54, // Softer shadow // shadowColor: Colors.black54, // Softer shadow
// clipBehavior: Clip.antiAlias, // clipBehavior: Clip.antiAlias,
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(10.0),
// padding: EdgeInsets.symmetric(vertical: 12),
child: Column( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, children: [
mainAxisAlignment: MainAxisAlignment.start, Container(
// color: Colors.red.shade50,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
Image.asset(
plan.tripType == 'Domestic'
? 'assets/images/IconsImg/Domestic_new.png'
: 'assets/images/IconsImg/International_new.png',
// width: 65,
height:
plan.tripType == 'Domestic'
? 37
: 40,
),
],
),
),
SizedBox(width: 10),
Expanded(
child: Container(
// color: Colors.yellow.shade50,
child: Column(
children: [ children: [
// Status and Employee Code
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
@ -1192,31 +1218,12 @@ class _ListAllPlansState extends State<ListAllPlans> {
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
GestureDetector( Text(
onTap: '${plan.tripTitle}',
() => _showDetails(plan.planId),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: getStatusColor(
plan.statusValue,
),
borderRadius:
BorderRadius.circular(8),
),
child: Text(
plan.statusValue,
style: TextStyle( style: TextStyle(
color: getStatusTextColor( fontSize: 12,
plan.statusValue, fontFamily: "Inter",
), fontWeight: FontWeight.bold,
fontSize: 10,
fontWeight: FontWeight.w600,
),
),
), ),
), ),
], ],
@ -1244,12 +1251,15 @@ class _ListAllPlansState extends State<ListAllPlans> {
child: Container( child: Container(
padding: padding:
EdgeInsets.symmetric( EdgeInsets.symmetric(
horizontal: 8, horizontal: 1,
vertical: 8, vertical: 1,
// horizontal: 8,
// vertical: 8,
), ),
child: Row( child: Row(
mainAxisSize: mainAxisSize:
MainAxisSize.min, MainAxisSize
.min,
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment
.center, .center,
@ -1272,7 +1282,8 @@ class _ListAllPlansState extends State<ListAllPlans> {
ApiService.viewPlan( ApiService.viewPlan(
context, context,
plan.planId, plan.planId,
isViewMode: true, isViewMode:
true,
); );
}, },
), ),
@ -1284,7 +1295,8 @@ class _ListAllPlansState extends State<ListAllPlans> {
icon: Image.asset( icon: Image.asset(
'assets/images/IconsImg/edit.png', 'assets/images/IconsImg/edit.png',
width: 20, width: 20,
height: 15, height:
15,
), ),
tooltip: tooltip:
'Edit The Trip Details', 'Edit The Trip Details',
@ -1319,7 +1331,8 @@ class _ListAllPlansState extends State<ListAllPlans> {
), ),
IconButton( IconButton(
icon: Icon( icon: Icon(
Icons.download, Icons
.download,
color: Color( color: Color(
0xFF114D8B, 0xFF114D8B,
), ),
@ -1339,7 +1352,8 @@ class _ListAllPlansState extends State<ListAllPlans> {
), ),
IconButton( IconButton(
icon: const Icon( icon: const Icon(
Icons.comment, Icons
.comment,
color: Color( color: Color(
0xFF475569, 0xFF475569,
), ),
@ -1349,15 +1363,15 @@ class _ListAllPlansState extends State<ListAllPlans> {
'Trip Comments', 'Trip Comments',
onPressed: () { onPressed: () {
showDialog( showDialog(
context: context, context:
context,
builder: builder:
( (
context, context,
) => CommentModalList( ) => CommentModalList(
// planId: plan.planId, // planId: plan.planId,
planId: planId:
plan.planId plan.planId.toString(),
.toString(),
layoutColorForUser: layoutColorForUser:
layoutColor!, layoutColor!,
role: role:
@ -1377,65 +1391,10 @@ class _ListAllPlansState extends State<ListAllPlans> {
], ],
), ),
SizedBox(height: 2),
// Trip Id and Trip Name
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
' ${plan.tripTitle}',
style: TextStyle(
fontSize: 12,
fontFamily: "Inter",
fontWeight: FontWeight.bold,
),
),
],
),
],
),
SizedBox(height: 2),
// Type and Created On
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
' ${plan.tripType}',
style: TextStyle(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${_formatDate(plan.createdOn)}',
style: TextStyle(
fontSize: 9,
color: Colors.black87,
fontFamily: "Inter",
),
),
],
),
],
),
SizedBox(height: 3),
// Name
Row(
children: [ children: [
Column( Column(
crossAxisAlignment: crossAxisAlignment:
@ -1446,33 +1405,397 @@ class _ListAllPlansState extends State<ListAllPlans> {
? '${plan.userName}' ? '${plan.userName}'
: '${plan.travellerName}', : '${plan.travellerName}',
style: TextStyle( style: TextStyle(
fontSize: 9, fontSize: 12,
fontFamily: "Inter", fontFamily: "Inter",
color: Colors.black87, color: Colors.black87,
), ),
), ),
],
),
Spacer(),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text( Text(
plan.employeeCode ?? 'No Data', plan.employeeCode ??
'No Data',
style: TextStyle( style: TextStyle(
fontSize: 9, fontSize: 9,
fontFamily: "Inter", fontFamily: "Inter",
color: Colors.black87, color: Colors.black87,
), ),
), ),
Text(
'${_formatDate(plan.createdOn)}',
style: TextStyle(
fontSize: 10,
color: Colors.black87,
fontFamily: "Inter",
),
),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
//
// ],
// ),
// Spacer(),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
//
// ],
// ),
// ],
// ),
],
),
Column(
children: [
GestureDetector(
onTap:
() => _showDetails(
plan.planId,
),
child: Container(
padding:
EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: getStatusColor(
plan.statusValue,
),
borderRadius:
BorderRadius.circular(
8,
),
),
child: Text(
plan.statusValue,
style: TextStyle(
color:
getStatusTextColor(
plan.statusValue,
),
fontSize: 10,
fontWeight:
FontWeight.w600,
),
),
),
),
],
),
], ],
), ),
], ],
), ),
// Actions ),
),
], ],
), ),
// padding: EdgeInsets.symmetric(vertical: 12),
// child: Container(
// // color: Colors.yellow,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// // Status and Employee Code
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// GestureDetector(
// onTap:
// () => _showDetails(plan.planId),
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 8,
// vertical: 4,
// ),
// decoration: BoxDecoration(
// color: getStatusColor(
// plan.statusValue,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// child: Text(
// plan.statusValue,
// style: TextStyle(
// color: getStatusTextColor(
// plan.statusValue,
// ),
// fontSize: 10,
// fontWeight: FontWeight.w600,
// ),
// ),
// ),
// ),
// ],
// ),
// Column(
// children: [
// // PlanPopupMenu(
// // plan: plan,
// // deletePlan: deletePlan,
// // apiService: apiService,
// // layoutColor: layoutColor,
// // ),
// PopupMenuButton<int>(
// color: Colors.white,
// padding: EdgeInsets.zero,
// offset: Offset(0, 30),
// icon: Icon(
// Icons.more_vert,
// color: Color(0xFF475569),
// size: 14,
// ),
// itemBuilder:
// (context) => [
// CustomPopupMenuEntry(
// child: Container(
// padding:
// EdgeInsets.symmetric(
// horizontal: 1,
// vertical: 1,
// // horizontal: 8,
// // vertical: 8,
// ),
// child: Row(
// mainAxisSize:
// MainAxisSize.min,
// mainAxisAlignment:
// MainAxisAlignment
// .center,
// children: [
// IconButton(
// icon: Icon(
// Icons
// .remove_red_eye,
// color: Color(
// 0xFF475569,
// ),
// size: 18,
// ),
// tooltip:
// 'View The Trip Details',
// onPressed: () {
// Navigator.pop(
// context,
// ); // Close popup manually
// ApiService.viewPlan(
// context,
// plan.planId,
// isViewMode:
// true,
// );
// },
// ),
// if (plan.statusValue ==
// "Pending Approval" ||
// plan.statusValue ==
// "Partially Approved")
// IconButton(
// icon: Image.asset(
// 'assets/images/IconsImg/edit.png',
// width: 20,
// height: 15,
// ),
// tooltip:
// 'Edit The Trip Details',
// onPressed: () {
// Navigator.pop(
// context,
// );
// ApiService.viewPlan(
// context,
// plan.planId,
// isViewMode:
// false,
// );
// },
// ),
// IconButton(
// icon: Icon(
// Icons
// .cancel_rounded,
// size: 18,
// ),
// tooltip:
// 'Cancellation The Trip Details',
// onPressed: () {
// Navigator.pop(
// context,
// );
// deletePlan(
// plan.planId,
// );
// },
// ),
// IconButton(
// icon: Icon(
// Icons.download,
// color: Color(
// 0xFF114D8B,
// ),
// size: 18,
// ),
// tooltip:
// 'Download The PDF',
// onPressed: () {
// Navigator.pop(
// context,
// );
// apiService
// .getPdfDownload(
// plan.planId,
// );
// },
// ),
// IconButton(
// icon: const Icon(
// Icons.comment,
// color: Color(
// 0xFF475569,
// ),
// size: 11,
// ),
// tooltip:
// 'Trip Comments',
// onPressed: () {
// showDialog(
// context:
// context,
// builder:
// (
// context,
// ) => CommentModalList(
// // planId: plan.planId,
// planId:
// plan.planId
// .toString(),
// layoutColorForUser:
// layoutColor!,
// role:
// "Admin",
// ),
// );
// },
// ),
// ],
// ),
// ),
// ),
// ],
// ),
// ],
// ),
// ],
// ),
//
// SizedBox(height: 2),
// // Trip Id and Trip Name
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// ' ${plan.tripTitle}',
// style: TextStyle(
// fontSize: 12,
// fontFamily: "Inter",
// fontWeight: FontWeight.bold,
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 2),
// // Type and Created On
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// ' ${plan.tripType}',
// style: TextStyle(
// fontSize: 9,
// color: Colors.black87,
// fontFamily: "Inter",
// ),
// ),
// ],
// ),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// '${_formatDate(plan.createdOn)}',
// style: TextStyle(
// fontSize: 9,
// color: Colors.black87,
// fontFamily: "Inter",
// ),
// ),
// ],
// ),
// ],
// ),
// SizedBox(height: 3),
// // Name
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// plan.userName.isNotEmpty
// ? '${plan.userName}'
// : '${plan.travellerName}',
// style: TextStyle(
// fontSize: 9,
// fontFamily: "Inter",
// color: Colors.black87,
// ),
// ),
// ],
// ),
// Spacer(),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// plan.employeeCode ?? 'No Data',
// style: TextStyle(
// fontSize: 9,
// fontFamily: "Inter",
// color: Colors.black87,
// ),
// ),
// ],
// ),
// ],
// ),
// // Actions
// ],
// ),
// ),
), ),
); );
}, },

View File

@ -39,6 +39,8 @@ class _OrgSetUpState extends State<OrgSetUp> {
List<dynamic>? apiAllServices; List<dynamic>? apiAllServices;
Map<String, dynamic>? selectedOrg; Map<String, dynamic>? selectedOrg;
Color? layoutColor; Color? layoutColor;
Color? layoutSecondaryColor;
Color? layoutTertiaryColor;
Color? bodyColor; Color? bodyColor;
bool isSelected = false; bool isSelected = false;
@ -112,6 +114,10 @@ class _OrgSetUpState extends State<OrgSetUp> {
"layout_color": "layout_color":
"0x${layoutColor?.toARGB32().toRadixString(16).padLeft(8, '0').toUpperCase()}", "0x${layoutColor?.toARGB32().toRadixString(16).padLeft(8, '0').toUpperCase()}",
"secondary_color":
"0x${layoutSecondaryColor?.toARGB32().toRadixString(16).padLeft(8, '0').toUpperCase()}",
"tertiary_color":
"0x${layoutTertiaryColor?.toARGB32().toRadixString(16).padLeft(8, '0').toUpperCase()}",
"color": "color":
"0x${bodyColor?.toARGB32().toRadixString(16).padLeft(8, '0').toUpperCase()}", "0x${bodyColor?.toARGB32().toRadixString(16).padLeft(8, '0').toUpperCase()}",
@ -181,6 +187,7 @@ class _OrgSetUpState extends State<OrgSetUp> {
// } // }
String? rawLogoPath = selectedOrg?['logo']; String? rawLogoPath = selectedOrg?['logo'];
if (rawLogoPath != null && rawLogoPath.contains('/assets')) { if (rawLogoPath != null && rawLogoPath.contains('/assets')) {
const baseUrl = apiUrl; const baseUrl = apiUrl;
// const baseUrl = "https://apitest.tripapprovaltool.com"; // const baseUrl = "https://apitest.tripapprovaltool.com";
@ -202,6 +209,30 @@ class _OrgSetUpState extends State<OrgSetUp> {
), ),
) )
: Colors.white; : Colors.white;
layoutSecondaryColor =
selectedOrg?['secondary_color'] != null
? Color(
int.parse(
selectedOrg!['secondary_color'].toString().replaceFirst(
'0x',
'',
),
radix: 16,
),
)
: Colors.white;
layoutTertiaryColor =
selectedOrg?['tertiary_color'] != null
? Color(
int.parse(
selectedOrg!['tertiary_color'].toString().replaceFirst(
'0x',
'',
),
radix: 16,
),
)
: Colors.white;
bodyColor = bodyColor =
selectedOrg?['color'] != null selectedOrg?['color'] != null
@ -760,24 +791,34 @@ class _OrgSetUpState extends State<OrgSetUp> {
// color: Color(0xFFF5F5F5), // color: Color(0xFFF5F5F5),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 5), padding: EdgeInsets.only(
left: 5,
right: 5,
top: 15,
bottom: 5,
),
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
child: isDesktop child:
isDesktop
? Row( ? Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: _buildOptions(), children: _buildOptions(),
) )
: SingleChildScrollView( : SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: ConstrainedBox( // Prevent overflow by setting min width child: ConstrainedBox(
// Prevent overflow by setting min width
constraints: BoxConstraints( constraints: BoxConstraints(
minWidth: MediaQuery.of(context).size.width, minWidth: MediaQuery.of(context).size.width,
), ),
child: IntrinsicWidth( // Let Row size itself correctly child: IntrinsicWidth(
// Let Row size itself correctly
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: _buildOptions(), children: _buildOptions(),
), ),
), ),
@ -817,9 +858,15 @@ class _OrgSetUpState extends State<OrgSetUp> {
initialBodyColor: bodyColor, initialBodyColor: bodyColor,
onLayoutColorSelected: ( onLayoutColorSelected: (
Color selectedLayoutColor, Color selectedLayoutColor,
Color selectedSecondaryColor,
Color selectedTeritaryColor,
) { ) {
setState(() { setState(() {
layoutColor = selectedLayoutColor; layoutColor = selectedLayoutColor;
layoutSecondaryColor =
selectedSecondaryColor;
layoutTertiaryColor =
selectedTeritaryColor;
}); });
}, },
onBodyColorSelected: ( onBodyColorSelected: (

View File

@ -4,7 +4,8 @@ class ColorThemePickerWidget extends StatefulWidget {
final Color? initialLayoutColor; final Color? initialLayoutColor;
final Color? initialBodyColor; final Color? initialBodyColor;
final Function(Color) onLayoutColorSelected; final Function(Color layout, Color secondaryColor, Color tertiaryColor)
onLayoutColorSelected;
final Function(Color) onBodyColorSelected; final Function(Color) onBodyColorSelected;
const ColorThemePickerWidget({ const ColorThemePickerWidget({
@ -21,6 +22,8 @@ class ColorThemePickerWidget extends StatefulWidget {
class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> { class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
late Color selectedLayoutColor; late Color selectedLayoutColor;
Color? selectedSecondaryColor;
Color? selectedTertiaryColor;
late Color selectedBodyColor; late Color selectedBodyColor;
// Layout colors // Layout colors
@ -38,6 +41,34 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
Color(0xFF9B59B6), // Purple 2 Color(0xFF9B59B6), // Purple 2
]; ];
final List<Color> layoutSecondaryColors = [
Color(0xFF00B0FF), // Lighter Blue
Color(0xFF00ACC1), // Teal Blue
Color(0xFF43A047), // Dark Green
Color(0xFF27AE60), // Medium Emerald
Color(0xFFFFC107), // Amber (complementary to orange)
Color(0xFFFFA726), // Light orange
Color(0xFFE64A19), // Deep Orange
Color(0xFFFF4081), // Bright Pink (complementary to rose)
Color(0xFFF48FB1), // Light Pink
Color(0xFFBA68C8), // Light Purple
Color(0xFFAB47BC), // Orchid Purple
];
final List<Color> layoutTertiaryColors = [
Color(0xFF82B1FF), // Very Light Blue
Color(0xFF4DD0E1), // Lighter Teal
Color(0xFF81C784), // Light Green
Color(0xFFAAF0D1), // Pastel Mint
Color(0xFFFFE0B2), // Pale Orange
Color(0xFFFFCCBC), // Light Orange Peach
Color(0xFFFFAB91), // Light Coral
Color(0xFFF8BBD0), // Pastel Rose
Color(0xFFF8BBD0), // Pastel Pink
Color(0xFFE1BEE7), // Lavender
Color(0xFFD1C4E9), // Light Purple Grey
];
// Body colors // Body colors
final List<Color> bodyThemeColors = [ final List<Color> bodyThemeColors = [
Color(0xFFD9EAFF), Color(0xFFD9EAFF),
@ -63,14 +94,34 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
children: [ children: [
// Layout Color Picker // Layout Color Picker
GestureDetector( GestureDetector(
onTap: () => _showColorPickerDialog( onTap:
() => _showColorPickerDialog(
title: "Choose Layout Color", title: "Choose Layout Color",
colors: layoutThemeColors, colors: layoutThemeColors,
onColorSelected: (color) { onColorSelected: (color) {
setState(() { setState(() {
selectedLayoutColor = color; selectedLayoutColor = color;
print("selectedLayoutColor - $selectedLayoutColor");
final SelectedIndex = layoutThemeColors.indexOf(color);
print("SelectedIndexLayout - $SelectedIndex");
if (SelectedIndex != -1) {
final secondaryColor =
layoutSecondaryColors[SelectedIndex];
final primaryColor = layoutTertiaryColors[SelectedIndex];
selectedSecondaryColor = secondaryColor;
selectedTertiaryColor = primaryColor;
print("selectedSecondaryColor - $selectedSecondaryColor");
print("selectedPrimaryColor - $selectedTertiaryColor");
}
}); });
widget.onLayoutColorSelected(color); widget.onLayoutColorSelected(
color,
selectedSecondaryColor!,
selectedTertiaryColor!,
);
}, },
), ),
child: _buildColorBox( child: _buildColorBox(
@ -179,20 +230,33 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
showDialog( showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder:
(context) => AlertDialog(
title: Text(title), title: Text(title),
content: Column( content: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: firstRow.map((color) => _buildColorCircle(color, onColorSelected)).toList(), children:
firstRow
.map(
(color) =>
_buildColorCircle(color, onColorSelected),
)
.toList(),
), ),
if (secondRow.isNotEmpty) SizedBox(height: 10), if (secondRow.isNotEmpty) SizedBox(height: 10),
if (secondRow.isNotEmpty) if (secondRow.isNotEmpty)
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: secondRow.map((color) => _buildColorCircle(color, onColorSelected)).toList(), children:
secondRow
.map(
(color) =>
_buildColorCircle(color, onColorSelected),
)
.toList(),
), ),
], ],
), ),
@ -215,5 +279,4 @@ class _ColorThemePickerWidgetState extends State<ColorThemePickerWidget> {
), ),
); );
} }
} }

View File

@ -103,7 +103,6 @@ class PersonalDetailsState extends State<PersonalDetails> {
bool _postalCodeFocus = false; bool _postalCodeFocus = false;
bool _roleIdFocus = false; bool _roleIdFocus = false;
late bool isTravelAgent = false; late bool isTravelAgent = false;
String? selectedTab; String? selectedTab;
@ -158,7 +157,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
Color? bodyColor; Color? bodyColor;
final Map<String, TextEditingController> controllers = {}; final Map<String, TextEditingController> controllers = {};
Map<String, String> errorMessages2 = {}; Map<String, String> errorMessages = {};
@override @override
void initState() { void initState() {
@ -180,21 +179,28 @@ class PersonalDetailsState extends State<PersonalDetails> {
print("selectedServiceIdsAPI - $selectedServiceIds"); print("selectedServiceIdsAPI - $selectedServiceIds");
_addFocusListener(_fnameFocusNode, (focus) => _fnameFocus = focus); _addFocusListener(_fnameFocusNode, (focus) => _fnameFocus = focus);
_addFocusListener(_lnameFocusNode, (focus) => _lnameFocus = focus); _addFocusListener(_lnameFocusNode, (focus) => _lnameFocus = focus);
_addFocusListener(_emailFocusNode, (focus) => _emailFocus = focus); _addFocusListener(_emailFocusNode, (focus) => _emailFocus = focus);
_addFocusListener(_passwordFocusNode, (focus) => _passwordFocus = focus); _addFocusListener(_passwordFocusNode, (focus) => _passwordFocus = focus);
_addFocusListener(_dobFocusNode, (focus) => _dobFocus = focus); _addFocusListener(_dobFocusNode, (focus) => _dobFocus = focus);
_addFocusListener(_genderFocusNode, (focus) => _genderFocus = focus); _addFocusListener(_genderFocusNode, (focus) => _genderFocus = focus);
_addFocusListener(_mobileNumberFocusNode, (focus) => _mobileNumberFocus = focus); _addFocusListener(
_addFocusListener(_alternateMobileFocusNode, (focus) => _alternateMobileFocus = focus); _mobileNumberFocusNode,
(focus) => _mobileNumberFocus = focus,
);
_addFocusListener(
_alternateMobileFocusNode,
(focus) => _alternateMobileFocus = focus,
);
_addFocusListener(_addressFocusNode, (focus) => _addressFocus = focus); _addFocusListener(_addressFocusNode, (focus) => _addressFocus = focus);
_addFocusListener(_countryFocusNode, (focus) => _countryFocus = focus); _addFocusListener(_countryFocusNode, (focus) => _countryFocus = focus);
_addFocusListener(_postalCodeFocusNode, (focus) => _postalCodeFocus = focus); _addFocusListener(
_postalCodeFocusNode,
(focus) => _postalCodeFocus = focus,
);
_addFocusListener(_roleIdFocusNode, (focus) => _roleIdFocus = focus); _addFocusListener(_roleIdFocusNode, (focus) => _roleIdFocus = focus);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
loadAllServices(); loadAllServices();
getOrganizationData(); getOrganizationData();
@ -233,7 +239,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
userId, userId,
); );
if (response.isNotEmpty) { if (response.isNotEmpty) {
_clearError(field); // _clearError(field);
widget.errorMessages[field] = widget.errorMessages[field] =
response['message'] ?? "$label Already Exists"; response['message'] ?? "$label Already Exists";
print("Duplicate found: ${response['message']}"); print("Duplicate found: ${response['message']}");
@ -1100,7 +1106,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color : (layoutColor ?? Colors.grey), width: 0.5), color: (layoutColor ?? Colors.grey),
width: 0.5,
),
), ),
contentPadding: EdgeInsets.symmetric( contentPadding: EdgeInsets.symmetric(
horizontal: 10, horizontal: 10,
@ -1130,7 +1138,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
}); });
widget.onGenderChanged?.call(newValue); widget.onGenderChanged?.call(newValue);
}, },
),),), ),
),
),
), ),
), ),
], ],
@ -1187,8 +1197,7 @@ class PersonalDetailsState extends State<PersonalDetails> {
isDesktop: widget.isDesktop, isDesktop: widget.isDesktop,
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: child: Focus(
Focus(
focusNode: _dobFocusNode, focusNode: _dobFocusNode,
onKeyEvent: (FocusNode node, KeyEvent event) { onKeyEvent: (FocusNode node, KeyEvent event) {
// Only act on KeyDown and when Enter is pressed // Only act on KeyDown and when Enter is pressed
@ -1225,7 +1234,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
child: TextField( child: TextField(
controller: widget.controllers["dob"], controller: widget.controllers["dob"],
readOnly: true, readOnly: true,
style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), style: GoogleFonts.poppins(
fontSize: 12,
color: Colors.black,
),
decoration: InputDecoration( decoration: InputDecoration(
labelText: "Select Date", labelText: "Select Date",
labelStyle: GoogleFonts.poppins( labelStyle: GoogleFonts.poppins(
@ -1538,7 +1550,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
searchFieldProps: TextFieldProps( searchFieldProps: TextFieldProps(
decoration: InputDecoration( decoration: InputDecoration(
hintText: "Search Country...", hintText: "Search Country...",
contentPadding: EdgeInsets.symmetric(horizontal: 3,vertical: 3), contentPadding: EdgeInsets.symmetric(
horizontal: 3,
vertical: 3,
),
), ),
), ),
), ),
@ -1569,9 +1584,14 @@ class PersonalDetailsState extends State<PersonalDetails> {
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color : (layoutColor ?? Colors.grey), width: 0.5), color: (layoutColor ?? Colors.grey),
width: 0.5,
),
),
contentPadding: EdgeInsets.symmetric(
horizontal: 10.0,
vertical: 8.0,
), ),
contentPadding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0),
), ),
), ),
dropdownBuilder: dropdownBuilder:
@ -1610,7 +1630,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
final countryCode = final countryCode =
countryMap.entries countryMap.entries
.firstWhere((entry) => entry.value == newValue) .firstWhere(
(entry) => entry.value == newValue,
)
.key; .key;
setState(() { setState(() {
@ -1621,7 +1643,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
countryCode, countryCode,
); // send code not name ); // send code not name
}, },
),),) ),
),
),
), ),
), ),
], ],
@ -1781,7 +1805,8 @@ class PersonalDetailsState extends State<PersonalDetails> {
_roleIdFocusNode?.requestFocus(); _roleIdFocusNode?.requestFocus();
}, },
child: DropdownSearch<String>( child: DropdownSearch<String>(
selectedItem: selectedRole != null ? roleMap[selectedRole] : null, selectedItem:
selectedRole != null ? roleMap[selectedRole] : null,
enabled: !widget.isViewMode, enabled: !widget.isViewMode,
popupProps: PopupProps.menu( popupProps: PopupProps.menu(
showSearchBox: true, showSearchBox: true,
@ -1834,7 +1859,10 @@ class PersonalDetailsState extends State<PersonalDetails> {
), ),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color : (layoutColor ?? Colors.grey), width: 0.5), borderSide: BorderSide(
color: (layoutColor ?? Colors.grey),
width: 0.5,
),
), ),
contentPadding: EdgeInsets.symmetric( contentPadding: EdgeInsets.symmetric(
horizontal: 8, horizontal: 8,
@ -1861,7 +1889,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
if (newValue == null) return; if (newValue == null) return;
final selectedKey = final selectedKey =
roleMap.entries roleMap.entries
.firstWhere((entry) => entry.value == newValue) .firstWhere(
(entry) => entry.value == newValue,
)
.key; .key;
setState(() { setState(() {
@ -1872,7 +1902,9 @@ class PersonalDetailsState extends State<PersonalDetails> {
widget.onUserTypeChanged?.call(isTravelAgent); widget.onUserTypeChanged?.call(isTravelAgent);
widget.onRoleChanged?.call(selectedKey); widget.onRoleChanged?.call(selectedKey);
}, },
),),), ),
),
),
), ),
), ),
if (widget.errorMessages["role_id"] != null) ...[ if (widget.errorMessages["role_id"] != null) ...[