FIX_Account Login - Policy Report - Commission popup kannan sir
This commit is contained in:
parent
fba7f9a639
commit
e59d163a2e
File diff suppressed because one or more lines are too long
@ -607,7 +607,7 @@ class AgentState extends ConsumerState<Agent> {
|
||||
validator: (value) => Validators.requiredField(value, "name"),
|
||||
inputFormatters: [
|
||||
// This line now allows letters, numbers, hyphens, and underscores
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9\-_]')),
|
||||
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9\-_ ]')),
|
||||
],
|
||||
borderColor: Color(0xFFE2E8F0),
|
||||
highlightColor: Color(0xFF50A398),
|
||||
|
||||
@ -55,7 +55,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
];
|
||||
|
||||
List<Map<String, dynamic>> getVehicleTypeData = [];
|
||||
List<Map<String, dynamic>> filteredVechicleData = [];
|
||||
List<Map<String, dynamic>> filteredVehicleData = [];
|
||||
|
||||
List<Map<String, dynamic>> getAgentListData = [];
|
||||
List<Map<String, dynamic>> filteredAgentData = [];
|
||||
@ -73,6 +73,10 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
dropDownSelectStaffKey =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
dropDownSelectVehicleTypeKey =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>> dropDownKey =
|
||||
GlobalKey<DropdownSearchState<Map<String, dynamic>>>();
|
||||
final GlobalKey<DropdownSearchState<Map<String, dynamic>>>
|
||||
@ -232,12 +236,12 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
);
|
||||
print('API Data - $getVehicleTypeData');
|
||||
|
||||
filteredVechicleData = List.from(getVehicleTypeData);
|
||||
print('originalData - $filteredVechicleData');
|
||||
filteredVehicleData = List.from(getVehicleTypeData);
|
||||
print('originalData - $filteredVehicleData');
|
||||
});
|
||||
} else {
|
||||
getVehicleTypeData = [];
|
||||
filteredVechicleData = [];
|
||||
filteredVehicleData = [];
|
||||
}
|
||||
} catch (e) {
|
||||
print('Exception occurred: $e');
|
||||
@ -310,6 +314,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> getAgentList(id) async {
|
||||
print('getAgentListData called');
|
||||
setState(() {
|
||||
@ -419,7 +424,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
buildAgentName(context, fromHeader: true),
|
||||
buildBroker(context),
|
||||
buildInsurer(context, fromHeader: true),
|
||||
|
||||
buildVehicleType(context),
|
||||
// buildInsuredName(context, fromHeader: true),
|
||||
buildVehicleNumber(context),
|
||||
Row(
|
||||
@ -1242,6 +1247,153 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildVehicleType(BuildContext context) {
|
||||
Map<String, dynamic>? selectedVehicleTypes = filteredVehicleData.firstWhere(
|
||||
(item) => item['id'].toString() == selectedVehicleType,
|
||||
orElse: () => {},
|
||||
);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Vehicle Type *', style: _subLabelTimeStyle),
|
||||
SizedBox(height: 5),
|
||||
SizedBox(
|
||||
// height: 30,
|
||||
width: MediaQuery.of(context).size.width * 0.12,
|
||||
child: DropdownSearch<Map<String, dynamic>>(
|
||||
key: dropDownSelectVehicleTypeKey,
|
||||
selectedItem: selectedVehicleTypes.isNotEmpty ? selectedVehicleTypes : null,
|
||||
items: (filter, infiniteScrollProps) {
|
||||
return filteredVehicleData;
|
||||
},
|
||||
|
||||
itemAsString: (val) => val['vehicle_type'].toString(), // what to show
|
||||
compareFn: (item, selectedItem) =>
|
||||
item['vehicle_type'].toString() == selectedItem['vehicle_type'].toString(),
|
||||
validator: (val) {
|
||||
if (val == null) {
|
||||
return "Required"; // ✅ error message
|
||||
}
|
||||
return null;
|
||||
},
|
||||
suffixProps: DropdownSuffixProps(
|
||||
// make sure the dropdown button is visible
|
||||
dropdownButtonProps: DropdownButtonProps(
|
||||
isVisible: true,
|
||||
padding: EdgeInsets.zero, // remove default padding
|
||||
constraints: const BoxConstraints(
|
||||
// shrink icon tap area
|
||||
minWidth: 12,
|
||||
minHeight: 12,
|
||||
),
|
||||
iconSize: 15, // smaller icon
|
||||
// icon: const Icon(Icons.arrow_drop_down),
|
||||
),
|
||||
),
|
||||
dropdownBuilder: (context, selectedItem) => Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
selectedItem != null ? selectedItem['vehicle_type'].toString() : "",
|
||||
style: GoogleFonts.poppins(fontSize: 11, color: Colors.black),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
),
|
||||
),
|
||||
decoratorProps: DropDownDecoratorProps(
|
||||
decoration:
|
||||
AppInputDecorations.dropdownDecoration(
|
||||
label: "Select Vehicle Type",
|
||||
).copyWith(
|
||||
filled: true,
|
||||
fillColor:
|
||||
Colors.white, // 👈 makes the dropdown input white
|
||||
isDense: true,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFFE2E8F0),
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
borderSide: const BorderSide(
|
||||
color: Color(0xFFE2E8F0),
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 6,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
popupProps: PopupProps.menu(
|
||||
fit: FlexFit.loose,
|
||||
constraints: BoxConstraints(maxHeight: 250),
|
||||
menuProps: MenuProps(
|
||||
backgroundColor:
|
||||
Colors.white, // 👈 sets dropdown background to white
|
||||
),
|
||||
showSearchBox: true,
|
||||
searchFieldProps: TextFieldProps(
|
||||
autofocus: true,
|
||||
style: GoogleFonts.inter(fontSize: 11, color: Colors.black),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(1),
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
hintText: "Search Vehicle Type...",
|
||||
hintStyle: GoogleFonts.inter(
|
||||
fontSize: 12,
|
||||
color: Colors.black,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.white,
|
||||
), // 👈 Normal border
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.white,
|
||||
width: 1.5,
|
||||
), // 👈 Focused border
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
itemBuilder: (context, item, isDisabled, isSelected) {
|
||||
return Container(
|
||||
// color: isSelected ? Colors.blue.withOpacity(0.1) : null,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 3,
|
||||
),
|
||||
child: Text(
|
||||
item['vehicle_type'].toString(),
|
||||
style: GoogleFonts.inter(fontSize: 12, color: Colors.black),
|
||||
),
|
||||
);
|
||||
},
|
||||
// constraints: BoxConstraints(),
|
||||
),
|
||||
|
||||
onChanged: (val) {
|
||||
if (val != null) {
|
||||
// print("Selected vehicletype : ${val['vehicle_type']}");
|
||||
// print("Id: ${val['id']}");
|
||||
// print("Value: ${val}");
|
||||
selectedVehicleType = val['id'];
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildSave(context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
@ -1303,6 +1455,7 @@ class RaiseEnqFormState extends ConsumerState<RaiseEnqForm> {
|
||||
dropDownKeyAgent.currentState?.clear();
|
||||
dropDownKeyInsurerEnqAsgn.currentState?.clear();
|
||||
dropDownSelectStaffKey.currentState?.clear();
|
||||
dropDownSelectVehicleTypeKey.currentState?.clear();
|
||||
dropDownKeyInsurer.currentState?.clear();
|
||||
dropDownKey.currentState?.clear();
|
||||
dropDownKeyBroker.currentState?.clear();
|
||||
|
||||
@ -1331,7 +1331,7 @@ class PolicyStaffTabState extends ConsumerState<PolicyStaffTab> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Vehicle Number*', style: _textStyle),
|
||||
Text('Vehicle Number *', style: _textStyle),
|
||||
SizedBox(height: 10),
|
||||
ThemedFormField(
|
||||
controller: controllers['regNum']!,
|
||||
|
||||
@ -973,7 +973,7 @@ class PolicyScreenState extends ConsumerState<PolicyScreen> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Vehicle Number*', style: _textStyle),
|
||||
Text('Vehicle Number *', style: _textStyle),
|
||||
SizedBox(height: 10),
|
||||
ThemedFormField(
|
||||
controller: controllers['regNum']!,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user