merge with old code
This commit is contained in:
commit
428dff9ca8
@ -216,8 +216,8 @@ class _TravelAgentListPlansState extends State<TravelAgentListPlans> {
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final data = json.decode(response.body);
|
||||
List<dynamic> plansJson = [];
|
||||
// List<dynamic> plansJson = data['data'];
|
||||
// List<dynamic> plansJson = [];
|
||||
List<dynamic> plansJson = data['data'];
|
||||
return plansJson.map((json) => Plan.fromJson(json)).toList();
|
||||
} else {
|
||||
throw Exception('Failed to load plans');
|
||||
|
||||
@ -30,6 +30,8 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
final ApiService apiService = ApiService();
|
||||
bool _moved = false;
|
||||
|
||||
bool _isLoading = false;
|
||||
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final TextEditingController _emailController = TextEditingController();
|
||||
final TextEditingController _passwordController = TextEditingController();
|
||||
@ -103,6 +105,10 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
|
||||
Future<void> _login(BuildContext context) async {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
|
||||
const String url = '$apiUrl/auth/login';
|
||||
|
||||
try {
|
||||
@ -193,6 +199,10 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
fontSize: 16.0,
|
||||
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
||||
);
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -415,8 +425,9 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
// fit: BoxFit.contain,
|
||||
// ),
|
||||
Container(
|
||||
width: 200, // Optional: control size
|
||||
height: 100,
|
||||
// color: Colors.yellow,
|
||||
width: 120, // Optional: control size
|
||||
height: 200,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
@ -618,7 +629,13 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: () => _login(context),
|
||||
// onPressed: () => _login(context),
|
||||
onPressed:
|
||||
_isLoading
|
||||
? null
|
||||
: () => _login(
|
||||
context,
|
||||
), // disable when loading
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(
|
||||
0xFF12B24B,
|
||||
@ -638,23 +655,35 @@ class _LoginWidgetState extends State<LoginWidget> {
|
||||
horizontal: 24,
|
||||
vertical: 5,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
"Sign In",
|
||||
style: GoogleFonts.poppins(
|
||||
fontWeight: FontWeight.w800,
|
||||
fontSize: 13.5,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 3),
|
||||
Icon(
|
||||
Icons.arrow_forward_sharp,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
child:
|
||||
_isLoading
|
||||
? SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child:
|
||||
CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
"Sign In",
|
||||
style: GoogleFonts.poppins(
|
||||
fontWeight:
|
||||
FontWeight.w800,
|
||||
fontSize: 13.5,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 3),
|
||||
Icon(
|
||||
Icons.arrow_forward_sharp,
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -763,7 +763,10 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: GestureDetector(
|
||||
onTap: () => _selectCheckInDate(context),
|
||||
onTap: () {
|
||||
_checkInFocusNode.requestFocus();
|
||||
_selectCheckInDate(context);
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
child: TextField(
|
||||
focusNode: _checkInFocusNode,
|
||||
@ -816,6 +819,7 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
||||
height: 40,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
_checkInTimeFocusNode.requestFocus();
|
||||
_checkInTimeController.text = "";
|
||||
_selectCheckInTime(context);
|
||||
},
|
||||
@ -870,7 +874,10 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: GestureDetector(
|
||||
onTap: () => _selectCheckOutDate(context),
|
||||
onTap: () {
|
||||
_checkOutFocusNode.requestFocus();
|
||||
_selectCheckOutDate(context);
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
child: TextField(
|
||||
focusNode: _checkOutFocusNode,
|
||||
@ -922,7 +929,10 @@ class _AccomodationScreenState extends State<AccomodationScreen> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: GestureDetector(
|
||||
onTap: () => _selectCheckOutTime(context),
|
||||
onTap: () {
|
||||
_checkOutTimeFocusNode.requestFocus();
|
||||
_selectCheckOutTime(context);
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
child: TextField(
|
||||
focusNode: _checkOutTimeFocusNode,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -135,7 +135,6 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
String? selectedQuotedAmount;
|
||||
int? selectedCashPercent;
|
||||
int? selectedCardPercent;
|
||||
|
||||
bool userEdited = false;
|
||||
|
||||
Map<String, dynamic> get forexData {
|
||||
@ -399,7 +398,10 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
focusStates[field] = false;
|
||||
}
|
||||
}
|
||||
print("textControllers - $textControllers");
|
||||
|
||||
print("Focus States KeysII: ${focusStates.keys.toList()}");
|
||||
print("Focus Nodes KeysII: ${focusNodes.keys.toList()}");
|
||||
print("Text Controllers KeysII: ${textControllers.keys.toList()}");
|
||||
|
||||
// Add focus listeners
|
||||
focusNodes.forEach((key, focusNode) {
|
||||
@ -1347,64 +1349,85 @@ class _ForexScreenState extends State<ForexScreen> {
|
||||
// ),
|
||||
// ),
|
||||
CustomTextFieldForexWrapper(
|
||||
isFocused: focusStates["_countries"] ?? false,
|
||||
isFocused: focusStates["_countriesFocused"] ?? false,
|
||||
isDesktop: isDesktop,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem: countryMap[selectedCountry],
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true,
|
||||
fit: FlexFit.loose,
|
||||
constraints: BoxConstraints(maxHeight: 250),
|
||||
menuProps: const MenuProps(backgroundColor: Colors.white),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) => Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
child: Text(
|
||||
item,
|
||||
style: GoogleFonts.poppins(fontSize: 11.5),
|
||||
),
|
||||
),
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: countryMap.values.toList(),
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
child: Focus(
|
||||
focusNode: focusNodes["_countriesFocusNode"],
|
||||
onFocusChange: (hasFocus) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
selectedCountry =
|
||||
countryMap.entries
|
||||
.firstWhere((entry) => entry.value == newValue)
|
||||
.key;
|
||||
_onCountryChanged(selectedCountry);
|
||||
focusStates["_countriesFocused"] = hasFocus;
|
||||
});
|
||||
},
|
||||
child: GestureDetector(
|
||||
//
|
||||
onTap: () {
|
||||
// Request focus when user taps
|
||||
focusNodes["_countriesFocusNode"]?.requestFocus();
|
||||
},
|
||||
child: DropdownSearch<String>(
|
||||
selectedItem: countryMap[selectedCountry],
|
||||
popupProps: PopupProps.menu(
|
||||
showSearchBox: true,
|
||||
fit: FlexFit.loose,
|
||||
constraints: BoxConstraints(maxHeight: 250),
|
||||
menuProps: const MenuProps(
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
itemBuilder:
|
||||
(context, item, isSelected) => Container(
|
||||
color: Colors.white,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 6,
|
||||
),
|
||||
child: Text(
|
||||
item,
|
||||
style: GoogleFonts.poppins(fontSize: 11.5),
|
||||
),
|
||||
),
|
||||
searchFieldProps: TextFieldProps(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Search ...",
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
items: countryMap.values.toList(),
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 1),
|
||||
),
|
||||
),
|
||||
dropdownBuilder:
|
||||
(context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem ?? "Select ",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
// Find the country_code based on selected country_name
|
||||
selectedCountry =
|
||||
countryMap.entries
|
||||
.firstWhere(
|
||||
(entry) => entry.value == newValue,
|
||||
)
|
||||
.key;
|
||||
_onCountryChanged(selectedCountry);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
|
||||
import '../../utils/auth_utils.dart';
|
||||
import '../../widgets/custom_text_field.dart';
|
||||
import '../../widgets/custom_text_itnerary_sub.dart';
|
||||
|
||||
@ -53,6 +54,8 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
late TextEditingController _nomineerelationController =
|
||||
TextEditingController();
|
||||
|
||||
Color layoutColor = Colors.grey;
|
||||
|
||||
bool _isHotelNameFocused = false;
|
||||
bool _startDateFocus = false;
|
||||
bool _endDateFocus = false;
|
||||
@ -63,6 +66,18 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
String? selectedInsuranceType;
|
||||
|
||||
Map<String, String> errorMessages = {};
|
||||
Map<String, FocusNode> focusNodes = {};
|
||||
Map<String, bool> focusStates = {};
|
||||
|
||||
List<String> dataHeader = [
|
||||
"type_of_insurance",
|
||||
"start_date",
|
||||
"end_date",
|
||||
"comments",
|
||||
"nominee_name",
|
||||
"nominee_dob",
|
||||
"nominee_relationship",
|
||||
];
|
||||
|
||||
Map<String, dynamic> get InsuranceData {
|
||||
Map<String, dynamic> data = {
|
||||
@ -94,33 +109,27 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
loadInitialData();
|
||||
});
|
||||
focusNodes.clear();
|
||||
focusStates.clear();
|
||||
|
||||
_hotelNameFocusNode.addListener(() {
|
||||
setState(() {
|
||||
_isHotelNameFocused = _hotelNameFocusNode.hasFocus;
|
||||
});
|
||||
});
|
||||
_endDateFocusNode.addListener(() {
|
||||
setState(() {
|
||||
_endDateFocus = _endDateFocusNode.hasFocus;
|
||||
});
|
||||
});
|
||||
_startDateFocusNode.addListener(() {
|
||||
setState(() {
|
||||
_startDateFocus = _startDateFocusNode.hasFocus;
|
||||
});
|
||||
});
|
||||
_commentsFocusNode.addListener(() {
|
||||
setState(() {
|
||||
_commentsFocus = _commentsFocusNode.hasFocus;
|
||||
});
|
||||
});
|
||||
// Initialize fields dynamically
|
||||
for (var field in dataHeader) {
|
||||
focusNodes["${field}FocusNode"] = FocusNode();
|
||||
focusStates["${field}Focused"] = false;
|
||||
}
|
||||
|
||||
_nomineeFocusNode.addListener(() {
|
||||
setState(() {
|
||||
_nomineeFocus = _nomineeFocusNode.hasFocus;
|
||||
for (var key in focusNodes.keys) {
|
||||
_addFocusListener(focusNodes[key]!, (focus) {
|
||||
setState(() {
|
||||
focusStates[key.replaceFirst("FocusNode", "Focused")] = focus;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
print("Focus Nodes Keys: ${focusNodes.keys.toList()}");
|
||||
print("Focus States Keys: ${focusStates.keys.toList()}");
|
||||
|
||||
_insuranceCommentsController = TextEditingController(
|
||||
text: widget.selectedItem?["comments"] ?? "",
|
||||
@ -181,6 +190,16 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
String? layoutString = await getLayoutColor();
|
||||
setState(() {
|
||||
layoutColor =
|
||||
layoutString != null
|
||||
? Color(int.parse(layoutString))
|
||||
: Colors.redAccent;
|
||||
});
|
||||
}
|
||||
|
||||
Map<String, String?> getFlightTripDateRange(
|
||||
List<Map<String, dynamic>> flightData,
|
||||
) {
|
||||
@ -285,6 +304,11 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// Dispose all dynamically created FocusNodes
|
||||
for (var node in focusNodes.values) {
|
||||
node.dispose();
|
||||
}
|
||||
|
||||
_tripTypeFocusNode.dispose();
|
||||
_tripTypeController.dispose();
|
||||
_startDateController.dispose();
|
||||
@ -769,7 +793,9 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
// ),
|
||||
// ▼ Dropdown Wrapper ▼
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _isHotelNameFocused,
|
||||
// isFocused: _isHotelNameFocused,
|
||||
isFocused: false,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
isDesktop: isDesktop,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.31 : null,
|
||||
child: SizedBox(
|
||||
@ -802,14 +828,45 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
);
|
||||
},
|
||||
),
|
||||
dropdownDecoratorProps: const DropDownDecoratorProps(
|
||||
dropdownDecoratorProps: DropDownDecoratorProps(
|
||||
dropdownSearchDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
// border: InputBorder.none, // No underline
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
(focusStates["type_of_insuranceFocusNode"] ?? false)
|
||||
? layoutColor!
|
||||
: Colors.white,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
(focusStates["type_of_insuranceFocusNode"] ?? false)
|
||||
? layoutColor!
|
||||
: Colors.white,
|
||||
// : const Color(0xFFD6D5E6),
|
||||
width: 0.5,
|
||||
// const Color(0xFFD6D5E6),
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: layoutColor!, width: 1),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 10,
|
||||
vertical: 5,
|
||||
),
|
||||
),
|
||||
// dropdownSearchDecoration: InputDecoration(
|
||||
// border: InputBorder.none,
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// horizontal: 10,
|
||||
// vertical: 10,
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) {
|
||||
if (selectedItem == null || selectedItem.isEmpty) {
|
||||
@ -897,13 +954,15 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _startDateFocus,
|
||||
// isFocused: _startDateFocus,
|
||||
isFocused: focusStates["start_dateFocused"] ?? false,
|
||||
isDesktop: isDesktop,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.16 : null,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
focusNodes["start_dateFocusNode"]?.requestFocus();
|
||||
await _selectCheckOutDate(context);
|
||||
if (_startDateController.text.isNotEmpty) {
|
||||
setState(() {
|
||||
@ -915,7 +974,8 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
child: TextField(
|
||||
focusNode: _startDateFocusNode,
|
||||
// focusNode: _startDateFocusNode,
|
||||
focusNode: focusNodes["start_dateFocusNode"],
|
||||
controller: _startDateController,
|
||||
readOnly: true,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
@ -956,13 +1016,14 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _endDateFocus,
|
||||
isFocused: focusStates["end_dateFocused"] ?? false,
|
||||
isDesktop: isDesktop,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.16 : null,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
focusNodes["end_dateFocusNode"]?.requestFocus();
|
||||
await _selectEndCheckOutDate(context);
|
||||
|
||||
if (_endDateController.text.isNotEmpty) {
|
||||
@ -985,7 +1046,8 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
child: TextField(
|
||||
focusNode: _endDateFocusNode,
|
||||
// focusNode: _endDateFocusNode,
|
||||
focusNode: focusNodes["end_dateFocusNode"],
|
||||
controller: _endDateController,
|
||||
readOnly: true,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
@ -1108,7 +1170,8 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _nomineeFocus,
|
||||
// isFocused: _nomineeFocus,
|
||||
isFocused: focusStates["nominee_nameFocused"] ?? false,
|
||||
isDesktop: isDesktop,
|
||||
// width: isDesktop ? MediaQuery.of(context).size.width * 0.15 : null,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.31 : null,
|
||||
@ -1116,7 +1179,9 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
focusNode: _nomineeFocusNode,
|
||||
focusNode: focusNodes["nominee_nameFocusNode"],
|
||||
|
||||
// focusNode: _nomineeFocusNode,
|
||||
controller: _nomineeController,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
@ -1150,7 +1215,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _startDateFocus,
|
||||
isFocused: focusStates["nominee_dobFocused"] ?? false,
|
||||
isDesktop: isDesktop,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.16 : null,
|
||||
// width: isDesktop ? MediaQuery.of(context).size.width * 0.11 : null,
|
||||
@ -1158,6 +1223,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
height: 40,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
focusNodes["nominee_dobFocusNode"]?.requestFocus();
|
||||
await _selectCheckDOBOutDate(context);
|
||||
// await _selectDateOfBirth(context);
|
||||
if (_dateOfBirthController.text.isNotEmpty) {
|
||||
@ -1170,7 +1236,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
},
|
||||
child: AbsorbPointer(
|
||||
child: TextField(
|
||||
focusNode: _startDateFocusNode,
|
||||
focusNode: focusNodes["nominee_dobFocusNode"],
|
||||
controller: _dateOfBirthController,
|
||||
readOnly: true,
|
||||
style: const TextStyle(fontSize: 12),
|
||||
@ -1213,7 +1279,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
|
||||
//
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: false,
|
||||
isFocused: focusStates["nominee_relationshipFocused"] ?? false,
|
||||
isDesktop: isDesktop,
|
||||
width: isDesktop ? MediaQuery.of(context).size.width * 0.16 : null,
|
||||
// width: isDesktop ? MediaQuery.of(context).size.width * 0.31 : null,
|
||||
@ -1221,7 +1287,7 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
// focusNode: _nomineeFocusNode,
|
||||
focusNode: focusNodes["nominee_relationshipFocusNode"],
|
||||
controller: _nomineerelationController,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
@ -1260,7 +1326,9 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: _commentsFocus, // Dropdown doesn't use focus
|
||||
isFocused:
|
||||
focusStates["commentsFocused"] ??
|
||||
false, // Dropdown doesn't use focus
|
||||
isDesktop: isDesktop,
|
||||
width:
|
||||
isDesktop
|
||||
@ -1269,7 +1337,8 @@ class _InsuranceScreenState extends State<InsuranceScreen> {
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
focusNode: _commentsFocusNode,
|
||||
// focusNode: _commentsFocusNode,
|
||||
focusNode: focusNodes["commentsFocusNode"],
|
||||
controller: _insuranceCommentsController,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
|
||||
@ -29,17 +29,15 @@ class _MailSettingState extends State<MailSetting> {
|
||||
|
||||
Map<String, String> errorMessages = {};
|
||||
final Map<String, TextEditingController> controllers = {};
|
||||
Map<String, FocusNode> focusNodes = {};
|
||||
Map<String, bool> focusStates = {};
|
||||
bool _obscurePassword = true;
|
||||
|
||||
List<String> dataHeader = [
|
||||
"host",
|
||||
"userName",
|
||||
"password",
|
||||
"mail_password",
|
||||
"port",
|
||||
"senderEmail",
|
||||
"toEmail"
|
||||
"toEmail",
|
||||
];
|
||||
|
||||
Map<String, dynamic> getMailData() => mailData;
|
||||
@ -48,7 +46,7 @@ class _MailSettingState extends State<MailSetting> {
|
||||
final data = {
|
||||
"mail_host": controllers["host"]?.text,
|
||||
"mail_user_name": controllers["userName"]?.text,
|
||||
"mail_password": controllers["password"]?.text,
|
||||
"mail_password": controllers["mail_password"]?.text,
|
||||
"mail_port": controllers["port"]?.text,
|
||||
"sender_email": controllers["senderEmail"]?.text,
|
||||
"to_mail": controllers["toEmail"]?.text,
|
||||
@ -78,18 +76,11 @@ class _MailSettingState extends State<MailSetting> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
// loadAllServices();
|
||||
|
||||
for (var field in dataHeader) {
|
||||
controllers[field] = TextEditingController();
|
||||
focusNodes["${field}FocusNode"] = FocusNode();
|
||||
focusStates["${field}Focused"] = false;
|
||||
}
|
||||
for (var key in focusNodes.keys) {
|
||||
_addFocusListener(focusNodes[key]!, (focus) {
|
||||
setState(() {
|
||||
focusStates[key.replaceFirst("FocusNode", "Focused")] = focus;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_initControllers();
|
||||
updateData();
|
||||
|
||||
@ -98,14 +89,6 @@ class _MailSettingState extends State<MailSetting> {
|
||||
print(widget.initialMailData['sender_email']);
|
||||
}
|
||||
|
||||
void _addFocusListener(FocusNode node, Function(bool) updateState) {
|
||||
node.addListener(() {
|
||||
setState(() {
|
||||
updateState(node.hasFocus);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void updateData() {
|
||||
print("Updata 2");
|
||||
|
||||
@ -114,7 +97,7 @@ class _MailSettingState extends State<MailSetting> {
|
||||
widget.initialMailData['sender_email'] ?? '';
|
||||
controllers["userName"]?.text =
|
||||
widget.initialMailData['mail_user_name'] ?? '';
|
||||
controllers["password"]?.text =
|
||||
controllers["mail_password"]?.text =
|
||||
widget.initialMailData['mail_password'] ?? '';
|
||||
controllers["host"]?.text = widget.initialMailData['mail_host'] ?? '';
|
||||
controllers["port"]?.text =
|
||||
@ -198,8 +181,9 @@ class _MailSettingState extends State<MailSetting> {
|
||||
|
||||
// Email validation
|
||||
if (data["to_mail"] != null && data["to_mail"].toString().isNotEmpty) {
|
||||
if (!RegExp(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")
|
||||
.hasMatch(data["to_mail"].toString())) {
|
||||
if (!RegExp(
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
|
||||
).hasMatch(data["to_mail"].toString())) {
|
||||
errorMessages["to_mail"] =
|
||||
"Invalid email format"; // Invalid email format
|
||||
}
|
||||
@ -208,8 +192,9 @@ class _MailSettingState extends State<MailSetting> {
|
||||
// Email validation
|
||||
if (data["sender_email"] != null &&
|
||||
data["sender_email"].toString().isNotEmpty) {
|
||||
if (!RegExp(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")
|
||||
.hasMatch(data["sender_email"].toString())) {
|
||||
if (!RegExp(
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
|
||||
).hasMatch(data["sender_email"].toString())) {
|
||||
errorMessages["sender_email"] =
|
||||
"Invalid email format"; // Invalid email format
|
||||
}
|
||||
@ -243,22 +228,23 @@ class _MailSettingState extends State<MailSetting> {
|
||||
Text(
|
||||
"Sender Email",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: focusStates["senderEmailFocused"] ?? false,
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
// focusNode: _destinationFocusNode,
|
||||
focusNode: focusNodes["senderEmailFocusNode"],
|
||||
controller: controllers["senderEmail"],
|
||||
onChanged: (value) {
|
||||
_clearError("sender_email");
|
||||
@ -267,8 +253,8 @@ class _MailSettingState extends State<MailSetting> {
|
||||
if (value.trim().isEmpty) {
|
||||
errorMessages["sender_email"] = "Required";
|
||||
} else if (!RegExp(
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")
|
||||
.hasMatch(value)) {
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
|
||||
).hasMatch(value)) {
|
||||
errorMessages["sender_email"] =
|
||||
"Invalid email format";
|
||||
}
|
||||
@ -277,7 +263,9 @@ class _MailSettingState extends State<MailSetting> {
|
||||
decoration: InputDecoration(
|
||||
labelText: "sender email",
|
||||
labelStyle: GoogleFonts.poppins(
|
||||
fontSize: 12, color: Colors.grey),
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
@ -296,36 +284,28 @@ class _MailSettingState extends State<MailSetting> {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
widget.isDesktop
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: _buildMailFirstRow(widget.isDesktop),
|
||||
)
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: _buildMailFirstRow(widget.isDesktop),
|
||||
)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: _buildMailFirstRow(widget.isDesktop),
|
||||
),
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: _buildMailFirstRow(widget.isDesktop),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
widget.isDesktop
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: _buildMailSecondRow(widget.isDesktop),
|
||||
)
|
||||
: Column(
|
||||
children: _buildMailSecondRow(widget.isDesktop),
|
||||
),
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: _buildMailSecondRow(widget.isDesktop),
|
||||
)
|
||||
: Column(children: _buildMailSecondRow(widget.isDesktop)),
|
||||
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
|
||||
Container(
|
||||
// color: Color(0xFFF7F7FB),
|
||||
@ -335,7 +315,9 @@ class _MailSettingState extends State<MailSetting> {
|
||||
Text(
|
||||
"Test Mail",
|
||||
style: GoogleFonts.poppins(
|
||||
color: Color(0xFF114D8B), fontWeight: FontWeight.w600),
|
||||
color: Color(0xFF114D8B),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -345,7 +327,7 @@ class _MailSettingState extends State<MailSetting> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: _buildTestMail(widget.isDesktop),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -360,22 +342,23 @@ class _MailSettingState extends State<MailSetting> {
|
||||
Text(
|
||||
"User Name",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: focusStates["userNameFocused"] ?? false,
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
// focusNode: _destinationFocusNode,
|
||||
focusNode: focusNodes["userNameFocusNode"],
|
||||
controller: controllers["userName"],
|
||||
onChanged: (value) {
|
||||
_clearError("mail_user_name");
|
||||
@ -383,8 +366,10 @@ class _MailSettingState extends State<MailSetting> {
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
labelText: "user name",
|
||||
labelStyle:
|
||||
GoogleFonts.poppins(fontSize: 12, color: Colors.grey),
|
||||
labelStyle: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
@ -407,47 +392,56 @@ class _MailSettingState extends State<MailSetting> {
|
||||
Text(
|
||||
"Password",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: focusStates["passwordFocused"] ?? false,
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
focusNode: focusNodes["passwordFocusNode"],
|
||||
controller: controllers["password"],
|
||||
// focusNode: _destinationFocusNode,
|
||||
controller: controllers["mail_password"],
|
||||
onChanged: (value) {
|
||||
_clearError("mail_password");
|
||||
},
|
||||
obscureText: _obscurePassword,
|
||||
// obscureText: _obscurePassword,
|
||||
autofillHints: const [
|
||||
// AutofillHints.newPassword,
|
||||
], // <--- This is key
|
||||
enableSuggestions: false, // <--- Disable suggestions
|
||||
autocorrect: false,
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
labelText: "password",
|
||||
labelStyle:
|
||||
GoogleFonts.poppins(fontSize: 12, color: Colors.grey),
|
||||
labelText: "Access Key",
|
||||
labelStyle: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_obscurePassword
|
||||
? Icons.visibility_off
|
||||
: Icons.visibility,
|
||||
size: 16,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_obscurePassword = !_obscurePassword;
|
||||
});
|
||||
},
|
||||
),
|
||||
// suffixIcon: IconButton(
|
||||
// icon: Icon(
|
||||
// _obscurePassword
|
||||
// ? Icons.visibility_off
|
||||
// : Icons.visibility,
|
||||
// size: 16,
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// setState(() {
|
||||
// _obscurePassword = !_obscurePassword;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -472,21 +466,23 @@ class _MailSettingState extends State<MailSetting> {
|
||||
Text(
|
||||
"Host",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: focusStates["hostFocused"] ?? false,
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
focusNode: focusNodes["hostFocusNode"],
|
||||
// focusNode: _destinationFocusNode,
|
||||
controller: controllers["host"],
|
||||
onChanged: (value) {
|
||||
_clearError("mail_host");
|
||||
@ -494,8 +490,10 @@ class _MailSettingState extends State<MailSetting> {
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
labelText: "host",
|
||||
labelStyle:
|
||||
GoogleFonts.poppins(fontSize: 12, color: Colors.grey),
|
||||
labelStyle: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
@ -518,21 +516,22 @@ class _MailSettingState extends State<MailSetting> {
|
||||
Text(
|
||||
"Port",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: focusStates["portFocused"] ?? false,
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
focusNode: focusNodes["portFocusNode"],
|
||||
// focusNode: _destinationFocusNode,
|
||||
controller: controllers["port"],
|
||||
onChanged: (value) {
|
||||
@ -541,8 +540,10 @@ class _MailSettingState extends State<MailSetting> {
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
labelText: "port",
|
||||
labelStyle:
|
||||
GoogleFonts.poppins(fontSize: 12, color: Colors.grey),
|
||||
labelStyle: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
@ -570,22 +571,23 @@ class _MailSettingState extends State<MailSetting> {
|
||||
Text(
|
||||
"Enter Your Mail Id",
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74)),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF575A74),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
CustomTextFieldWrapper(
|
||||
isFocused: focusStates["toEmailFocused"] ?? false,
|
||||
isFocused: false,
|
||||
isDesktop: widget.isDesktop,
|
||||
width: widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
width:
|
||||
widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.34
|
||||
: MediaQuery.of(context).size.width * 0.85,
|
||||
child: SizedBox(
|
||||
height: 40,
|
||||
child: TextField(
|
||||
// focusNode: _destinationFocusNode,
|
||||
focusNode: focusNodes["toEmailFocusNode"],
|
||||
controller: controllers["toEmail"],
|
||||
onChanged: (value) {
|
||||
_clearError("to_mail");
|
||||
@ -594,16 +596,18 @@ class _MailSettingState extends State<MailSetting> {
|
||||
if (value.trim().isEmpty) {
|
||||
errorMessages["to_mail"] = "Required";
|
||||
} else if (!RegExp(
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")
|
||||
.hasMatch(value)) {
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
|
||||
).hasMatch(value)) {
|
||||
errorMessages["to_mail"] = "Invalid email format";
|
||||
}
|
||||
},
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
labelText: "To mail",
|
||||
labelStyle:
|
||||
GoogleFonts.poppins(fontSize: 12, color: Colors.grey),
|
||||
labelStyle: GoogleFonts.poppins(
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
),
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 16),
|
||||
@ -620,31 +624,28 @@ class _MailSettingState extends State<MailSetting> {
|
||||
],
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Column(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFF114D8B), // Keep original color
|
||||
foregroundColor: Colors.white, // Keep original color
|
||||
disabledBackgroundColor:
|
||||
Color(0xFF114D8B), // Ensure color remains when disabled
|
||||
disabledForegroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color(0xFF114D8B), // Keep original color
|
||||
foregroundColor: Colors.white, // Keep original color
|
||||
disabledBackgroundColor: Color(
|
||||
0xFF114D8B,
|
||||
), // Ensure color remains when disabled
|
||||
disabledForegroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(color: Color(0xFF114D8B), width: 2),
|
||||
),
|
||||
onPressed: () {
|
||||
handleTestMailSubmit();
|
||||
},
|
||||
child: Text(
|
||||
"Test Email",
|
||||
style: GoogleFonts.poppins(fontSize: 12),
|
||||
))
|
||||
padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12),
|
||||
),
|
||||
onPressed: () {
|
||||
handleTestMailSubmit();
|
||||
},
|
||||
child: Text("Test Email", style: GoogleFonts.poppins(fontSize: 12)),
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
// import 'package:flutter/rendering.dart';
|
||||
import 'dart:html' as html;
|
||||
import 'package:frontend/config/apiUrl.dart'; // 1 newly added
|
||||
import 'package:frontend/services/apiService.dart';
|
||||
@ -31,7 +31,7 @@ class _MyAppState extends State<MyApp> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here
|
||||
// SemanticsBinding.instance.ensureSemantics(); // ✅ Safe here
|
||||
if (kIsWeb) {
|
||||
final uri = Uri.parse(html.window.location.href);
|
||||
print("URI - $uri");
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
//api url
|
||||
const String apiUrl = 'http://apitest.tripapprovaltool.com/tstat_be';
|
||||
// const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
||||
// const String apiUrl = 'http://apitest.tripapprovaltool.com/tstat_be';
|
||||
const String apiUrl = 'https://uat.tripapprovaltool.com/tstat_be';
|
||||
|
||||
@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:frontend/Screens/authentication/login/login_page.dart';
|
||||
import 'package:frontend/Screens/authentication/loginPage1.dart';
|
||||
import 'package:frontend/Screens/dashboard/home_page.dart';
|
||||
import 'package:frontend/Screens/forex/forex_list.dart';
|
||||
import 'package:frontend/Screens/myTemplates/templatesList.dart';
|
||||
import 'package:frontend/Screens/organization/orgSetup.dart';
|
||||
import 'package:frontend/Screens/organization/org_List.dart';
|
||||
@ -27,6 +26,7 @@ import '../Screens/group/groupList.dart';
|
||||
import '../Screens/myTemplates/template.dart';
|
||||
import '../Screens/myTemplates/templateForex.dart';
|
||||
import '../Screens/myTemplates/templateTest.dart';
|
||||
import '../Screens/perdiem_amount/forex_list.dart';
|
||||
import '../Screens/userManagement/create_user/create_user.dart';
|
||||
import '../Screens/department/department_list.dart';
|
||||
import '../Screens/costCenter/costCenter_list.dart';
|
||||
@ -152,10 +152,7 @@ final GoRouter router = GoRouter(
|
||||
pageBuilder:
|
||||
(context, state) => MaterialPage(child: Group.fromState(state)),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/report',
|
||||
builder: (context, state) => ReportList(),
|
||||
),
|
||||
GoRoute(path: '/report', builder: (context, state) => ReportList()),
|
||||
GoRoute(
|
||||
path: '/advancePurchase',
|
||||
builder: (context, state) => AdvancePurchase(),
|
||||
@ -164,10 +161,7 @@ final GoRouter router = GoRouter(
|
||||
path: '/misservicesAnalysis',
|
||||
builder: (context, state) => ServicesAnalysis(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/misAirReport',
|
||||
builder: (context, state) => MISair(),
|
||||
),
|
||||
GoRoute(path: '/misAirReport', builder: (context, state) => MISair()),
|
||||
GoRoute(
|
||||
path: '/misHotelReport',
|
||||
builder: (context, state) => MIShotel(),
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:frontend/utils/colorOpcity.dart';
|
||||
|
||||
import '../utils/auth_utils.dart';
|
||||
|
||||
class CustomTextFieldWrapper extends StatefulWidget {
|
||||
final Widget child;
|
||||
final bool isFocused;
|
||||
@ -30,6 +32,28 @@ class CustomTextFieldWrapper extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CustomTextFieldWrapperState extends State<CustomTextFieldWrapper> {
|
||||
Color? layoutColor;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
loadInitialData();
|
||||
});
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
String? layoutString = await getLayoutColor();
|
||||
|
||||
setState(() {
|
||||
layoutColor =
|
||||
layoutString != null
|
||||
? Color(int.parse(layoutString))
|
||||
: Colors.redAccent;
|
||||
});
|
||||
}
|
||||
|
||||
Color getColorWithOpacity(Color color, double opacity) {
|
||||
final int alpha = (opacity * 255).round().clamp(0, 255);
|
||||
return Color.fromARGB(
|
||||
@ -43,36 +67,38 @@ class _CustomTextFieldWrapperState extends State<CustomTextFieldWrapper> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: widget.width ?? // Use custom width if provided, else default
|
||||
width:
|
||||
widget.width ?? // Use custom width if provided, else default
|
||||
(widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.3
|
||||
: MediaQuery.of(context).size.width * 0.85),
|
||||
: MediaQuery.of(context).size.width * 0.88),
|
||||
padding: widget.padding,
|
||||
decoration: BoxDecoration(
|
||||
color: widget.isFocused
|
||||
? (widget.layoutColor ?? widget.color)
|
||||
: widget.color,
|
||||
// color: widget.isFocused
|
||||
// ? (widget.layoutColor ?? widget.color)
|
||||
// : widget.color,
|
||||
color: Colors.white,
|
||||
borderRadius: widget.borderRadius ?? BorderRadius.circular(8),
|
||||
|
||||
border: Border.all(
|
||||
color: widget.isFocused
|
||||
? (widget.layoutColor ?? Colors.blueAccent)
|
||||
: Color(0xFFF5F5F5),
|
||||
width: widget.isFocused ? 1.5 : 1.5,
|
||||
color: widget.isFocused ? layoutColor! : Color(0xFFD6D5E6),
|
||||
// color: widget.isFocused ? Color(0xFF78B4FC) : Color(0xFFD6D5E6),
|
||||
width: widget.isFocused ? 1.0 : 0.5,
|
||||
),
|
||||
// boxShadow: widget.isFocused
|
||||
// ? [
|
||||
// BoxShadow(
|
||||
// // color: Color.fromRGBO(120, 180, 252, 0.3),
|
||||
// // color: widget.isFocused
|
||||
// // ? (widget.layoutColor ?? Colors.red).withAlpha(204)
|
||||
// // : Color(0xFFF5F5F5),
|
||||
// blurRadius: 10,
|
||||
// spreadRadius: 1,
|
||||
// offset: Offset(0, 4),
|
||||
// ),
|
||||
// ]
|
||||
// : [],
|
||||
// boxShadow:
|
||||
// widget.isFocused
|
||||
// ? [
|
||||
// BoxShadow(
|
||||
// color: widget.isFocused ? layoutColor! : Color(0xFFD6D5E6),
|
||||
// // color: widget.isFocused
|
||||
// // ? (widget.layoutColor ?? Colors.red).withAlpha(204)
|
||||
// // : Color(0xFFF5F5F5),
|
||||
// blurRadius: 10,
|
||||
// spreadRadius: 1,
|
||||
// offset: Offset(0, 4),
|
||||
// ),
|
||||
// ]
|
||||
// : [],
|
||||
),
|
||||
child: widget.child,
|
||||
);
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../utils/auth_utils.dart';
|
||||
|
||||
class CustomTextFieldItnerarySubWrapper extends StatefulWidget {
|
||||
final Widget child;
|
||||
final bool isFocused;
|
||||
@ -21,36 +23,64 @@ class CustomTextFieldItnerarySubWrapper extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
_CustomTextFieldItnerarySubWrapperState createState() => _CustomTextFieldItnerarySubWrapperState();
|
||||
_CustomTextFieldItnerarySubWrapperState createState() =>
|
||||
_CustomTextFieldItnerarySubWrapperState();
|
||||
}
|
||||
|
||||
class _CustomTextFieldItnerarySubWrapperState extends State<CustomTextFieldItnerarySubWrapper> {
|
||||
class _CustomTextFieldItnerarySubWrapperState
|
||||
extends State<CustomTextFieldItnerarySubWrapper> {
|
||||
Color? layoutColor;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
loadInitialData();
|
||||
});
|
||||
}
|
||||
|
||||
void loadInitialData() async {
|
||||
String? layoutString = await getLayoutColor();
|
||||
|
||||
setState(() {
|
||||
layoutColor =
|
||||
layoutString != null
|
||||
? Color(int.parse(layoutString))
|
||||
: Colors.redAccent;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: widget.width ?? // Use custom width if provided, else default
|
||||
width:
|
||||
widget.width ?? // Use custom width if provided, else default
|
||||
(widget.isDesktop
|
||||
? MediaQuery.of(context).size.width * 0.15
|
||||
: MediaQuery.of(context).size.width * 0.8),
|
||||
padding: widget.padding,
|
||||
decoration: BoxDecoration(
|
||||
color: widget.color,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: widget.isFocused ? Color(0xFF78B4FC) : Color(0xFFD6D5E6),
|
||||
width: widget.isFocused ? 2.0 : 0.5,
|
||||
),
|
||||
boxShadow: widget.isFocused
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Color.fromRGBO(120, 180, 252, 0.3),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 2,
|
||||
offset: Offset(0, 4),
|
||||
color: Colors.white,
|
||||
|
||||
),
|
||||
]
|
||||
: [],
|
||||
border: Border.all(
|
||||
color: widget.isFocused ? layoutColor! : Color(0xFFD6D5E6),
|
||||
// color: widget.isFocused ? Color(0xFF78B4FC) : Color(0xFFD6D5E6),
|
||||
width: widget.isFocused ? 1.0 : 0.5,
|
||||
),
|
||||
boxShadow:
|
||||
widget.isFocused
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Colors.white,
|
||||
// color: Color.fromRGBO(120, 180, 252, 0.3),
|
||||
blurRadius: 10,
|
||||
spreadRadius: 2,
|
||||
offset: Offset(0, 4),
|
||||
),
|
||||
]
|
||||
: [],
|
||||
),
|
||||
child: widget.child,
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user