policy validation

This commit is contained in:
venbaittech 2025-12-12 19:31:59 +05:30
parent dcbf177dde
commit dda10c8d91
4 changed files with 435 additions and 122 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,3 +17,4 @@ final dashboardKeyProvider = StateProvider<int?>((ref) => null);
final dashboardStatusProvider = StateProvider<String?>((ref) => null); final dashboardStatusProvider = StateProvider<String?>((ref) => null);
final dashboardStaffIdProvider = StateProvider<String?>((ref) => null); final dashboardStaffIdProvider = StateProvider<String?>((ref) => null);
final enquiryRefreshProvider = StateProvider<bool>((ref) => false); final enquiryRefreshProvider = StateProvider<bool>((ref) => false);
final policyDataAcurancyRefreshProvider = StateProvider<bool>((ref) => false);

View File

@ -47,6 +47,7 @@ class policylistState extends ConsumerState<policylist> {
dynamic choosedPolcyId; dynamic choosedPolcyId;
PlatformFile? docPDFUploadedFile; PlatformFile? docPDFUploadedFile;
String? selectedPDFFileNames; String? selectedPDFFileNames;
late ProviderSubscription<bool> refreshSub;
@override @override
void initState() { void initState() {
@ -67,6 +68,19 @@ class policylistState extends ConsumerState<policylist> {
if (userId != null) { if (userId != null) {
getStaffList(managerId!, userId, roleId); getStaffList(managerId!, userId, roleId);
} }
refreshSub = ref.listenManual<bool>(policyDataAcurancyRefreshProvider, (
previous,
next,
) {
if (next == true) {
print('refresh triggered Quick Creation');
// callRefresh();
getStaffList(managerId!, userId, roleId);
ref.read(policyDataAcurancyRefreshProvider.notifier).state = false;
}
});
}); });
} }

View File

@ -73,7 +73,6 @@ class _policyValidationState extends ConsumerState<policyValidation> {
String? pdfUrl; // full file path from API String? pdfUrl; // full file path from API
// --- Controllers (all editable fields) // --- Controllers (all editable fields)
late TextEditingController policyNumberController; late TextEditingController policyNumberController;
late TextEditingController insuredNameController; late TextEditingController insuredNameController;
@ -174,7 +173,8 @@ class _policyValidationState extends ConsumerState<policyValidation> {
rtoCityCodeController.text = item['rto_city_code']?.toString() ?? ''; rtoCityCodeController.text = item['rto_city_code']?.toString() ?? '';
weightController.text = item['weight']?.toString() ?? ''; weightController.text = item['weight']?.toString() ?? '';
fuelTypeController.text = item['fuel_type']?.toString() ?? ''; fuelTypeController.text = item['fuel_type']?.toString() ?? '';
registrationDateController.text = item['date_of_registration']?.toString() ?? ''; registrationDateController.text =
item['date_of_registration']?.toString() ?? '';
yomController.text = item['year_of_manufacture']?.toString() ?? ''; yomController.text = item['year_of_manufacture']?.toString() ?? '';
engineNoController.text = item['engine_no']?.toString() ?? ''; engineNoController.text = item['engine_no']?.toString() ?? '';
@ -185,7 +185,8 @@ class _policyValidationState extends ConsumerState<policyValidation> {
vehicleTypeController.text = item['vehicle_type']?.toString() ?? ''; vehicleTypeController.text = item['vehicle_type']?.toString() ?? '';
brokerNameController.text = item['broker_name']?.toString() ?? ''; brokerNameController.text = item['broker_name']?.toString() ?? '';
commissionAmountController.text = item['commission_amount']?.toString() ?? ''; commissionAmountController.text =
item['commission_amount']?.toString() ?? '';
// read providers + call APIs // read providers + call APIs
Future.microtask(() { Future.microtask(() {
@ -265,19 +266,22 @@ class _policyValidationState extends ConsumerState<policyValidation> {
setState(() => isLoading = true); setState(() => isLoading = true);
try { try {
final url = Uri.parse('${Env final url = Uri.parse(
.apiUrl}policy/PolicyFilePath?policy_id=$policyId&file_type=policy_pdf'); '${Env.apiUrl}policy/PolicyFilePath?policy_id=$policyId&file_type=policy_pdf',
);
setState(() { setState(() {
pdfUrl = "$url"; pdfUrl = "$url";
}); });
final response = await apiService.policyFilePathApi(policyId, 'policy_pdf'); final response = await apiService.policyFilePathApi(
policyId,
'policy_pdf',
);
debugPrint('policyFilePathApi response: $response'); debugPrint('policyFilePathApi response: $response');
if (response != null && response['status'] == 'success') { if (response != null && response['status'] == 'success') {
// final filePath = response['data']?.toString(); // final filePath = response['data']?.toString();
// //
// // The API returns a server absolute path like: // // The API returns a server absolute path like:
@ -299,7 +303,9 @@ class _policyValidationState extends ConsumerState<policyValidation> {
// debugPrint("FINAL PDF URL -> $pdfUrl"); // debugPrint("FINAL PDF URL -> $pdfUrl");
// } // }
} else { } else {
debugPrint('policyFilePathApi returned error: ${response?['message'] ?? 'unknown'}'); debugPrint(
'policyFilePathApi returned error: ${response?['message'] ?? 'unknown'}',
);
} }
} catch (e, st) { } catch (e, st) {
debugPrint('Exception in getPolicyFilePath: $e\n$st'); debugPrint('Exception in getPolicyFilePath: $e\n$st');
@ -329,15 +335,23 @@ class _policyValidationState extends ConsumerState<policyValidation> {
if (!mounted) return; if (!mounted) return;
setState(() { setState(() {
// update controllers (overwrite with authoritative API values) // update controllers (overwrite with authoritative API values)
policyNumberController.text = data['policy_number']?.toString() ?? policyNumberController.text; policyNumberController.text =
insuredNameController.text = data['insured_name']?.toString() ?? insuredNameController.text; data['policy_number']?.toString() ?? policyNumberController.text;
premiumController.text = data['premium_amount']?.toString() ?? premiumController.text; insuredNameController.text =
remarksController.text = data['remarks']?.toString() ?? remarksController.text; data['insured_name']?.toString() ?? insuredNameController.text;
premiumController.text =
data['premium_amount']?.toString() ?? premiumController.text;
remarksController.text =
data['remarks']?.toString() ?? remarksController.text;
rcNoController.text = data['rc_no']?.toString() ?? rcNoController.text; rcNoController.text =
issuedDateController.text = data['issued_date']?.toString() ?? issuedDateController.text; data['rc_no']?.toString() ?? rcNoController.text;
startDateController.text = data['start_date']?.toString() ?? startDateController.text; issuedDateController.text =
endDateController.text = data['end_date']?.toString() ?? endDateController.text; data['issued_date']?.toString() ?? issuedDateController.text;
startDateController.text =
data['start_date']?.toString() ?? startDateController.text;
endDateController.text =
data['end_date']?.toString() ?? endDateController.text;
tpController.text = data['tp']?.toString() ?? tpController.text; tpController.text = data['tp']?.toString() ?? tpController.text;
odController.text = data['od']?.toString() ?? odController.text; odController.text = data['od']?.toString() ?? odController.text;
@ -346,25 +360,43 @@ class _policyValidationState extends ConsumerState<policyValidation> {
sgstController.text = data['sgst']?.toString() ?? sgstController.text; sgstController.text = data['sgst']?.toString() ?? sgstController.text;
igstController.text = data['igst']?.toString() ?? igstController.text; igstController.text = data['igst']?.toString() ?? igstController.text;
rtoStateCodeController.text = data['rto_state_code']?.toString() ?? rtoStateCodeController.text; rtoStateCodeController.text =
rtoCityCodeController.text = data['rto_city_code']?.toString() ?? rtoCityCodeController.text; data['rto_state_code']?.toString() ?? rtoStateCodeController.text;
weightController.text = data['weight']?.toString() ?? weightController.text; rtoCityCodeController.text =
fuelTypeController.text = data['fuel_type']?.toString() ?? fuelTypeController.text; data['rto_city_code']?.toString() ?? rtoCityCodeController.text;
registrationDateController.text = data['date_of_registration']?.toString() ?? registrationDateController.text; weightController.text =
yomController.text = data['year_of_manufacture']?.toString() ?? yomController.text; data['weight']?.toString() ?? weightController.text;
fuelTypeController.text =
data['fuel_type']?.toString() ?? fuelTypeController.text;
registrationDateController.text =
data['date_of_registration']?.toString() ??
registrationDateController.text;
yomController.text =
data['year_of_manufacture']?.toString() ?? yomController.text;
engineNoController.text = data['engine_no']?.toString() ?? engineNoController.text; engineNoController.text =
chassisNoController.text = data['chassis_no']?.toString() ?? chassisNoController.text; data['engine_no']?.toString() ?? engineNoController.text;
chassisNoController.text =
data['chassis_no']?.toString() ?? chassisNoController.text;
makeController.text = data['make']?.toString() ?? makeController.text; makeController.text = data['make']?.toString() ?? makeController.text;
modelController.text = data['model']?.toString() ?? modelController.text; modelController.text =
cubicCapacityController.text = data['cubic_capacity']?.toString() ?? cubicCapacityController.text; data['model']?.toString() ?? modelController.text;
vehicleTypeController.text = data['vehicle_type']?.toString() ?? vehicleTypeController.text; cubicCapacityController.text =
data['cubic_capacity']?.toString() ??
cubicCapacityController.text;
vehicleTypeController.text =
data['vehicle_type']?.toString() ?? vehicleTypeController.text;
brokerNameController.text = data['broker_name']?.toString() ?? brokerNameController.text; brokerNameController.text =
commissionAmountController.text = data['commission_amount']?.toString() ?? commissionAmountController.text; data['broker_name']?.toString() ?? brokerNameController.text;
commissionAmountController.text =
data['commission_amount']?.toString() ??
commissionAmountController.text;
}); });
} else { } else {
debugPrint('findPolicyApi returned error: ${response?['message'] ?? 'unknown'}'); debugPrint(
'findPolicyApi returned error: ${response?['message'] ?? 'unknown'}',
);
} }
} catch (e, st) { } catch (e, st) {
debugPrint('Exception in getFindPolicy: $e\n$st'); debugPrint('Exception in getFindPolicy: $e\n$st');
@ -374,7 +406,10 @@ class _policyValidationState extends ConsumerState<policyValidation> {
} }
} }
Future<void> _pickDate(TextEditingController controller, BuildContext context) async { Future<void> _pickDate(
TextEditingController controller,
BuildContext context,
) async {
DateTime initial = DateTime.now(); DateTime initial = DateTime.now();
try { try {
if (controller.text.isNotEmpty) { if (controller.text.isNotEmpty) {
@ -395,7 +430,8 @@ class _policyValidationState extends ConsumerState<policyValidation> {
lastDate: DateTime(2100), lastDate: DateTime(2100),
); );
if (picked != null) { if (picked != null) {
controller.text = "${picked.day.toString().padLeft(2,'0')}-${picked.month.toString().padLeft(2,'0')}-${picked.year}"; controller.text =
"${picked.day.toString().padLeft(2, '0')}-${picked.month.toString().padLeft(2, '0')}-${picked.year}";
} }
} }
@ -421,21 +457,43 @@ class _policyValidationState extends ConsumerState<policyValidation> {
"cgst": cgstController.text.isEmpty ? null : cgstController.text, "cgst": cgstController.text.isEmpty ? null : cgstController.text,
"sgst": sgstController.text.isEmpty ? null : sgstController.text, "sgst": sgstController.text.isEmpty ? null : sgstController.text,
"igst": igstController.text.isEmpty ? null : igstController.text, "igst": igstController.text.isEmpty ? null : igstController.text,
"rto_state_code": rtoStateCodeController.text.isEmpty ? null : rtoStateCodeController.text, "rto_state_code": rtoStateCodeController.text.isEmpty
"rto_city_code": rtoCityCodeController.text.isEmpty ? null : rtoCityCodeController.text, ? null
: rtoStateCodeController.text,
"rto_city_code": rtoCityCodeController.text.isEmpty
? null
: rtoCityCodeController.text,
"weight": weightController.text.isEmpty ? null : weightController.text, "weight": weightController.text.isEmpty ? null : weightController.text,
"fuel_type": fuelTypeController.text.isEmpty ? null : fuelTypeController.text, "fuel_type": fuelTypeController.text.isEmpty
"date_of_registration": registrationDateController.text.isEmpty ? null : registrationDateController.text, ? null
"year_of_manufacture": yomController.text.isEmpty ? null : yomController.text, : fuelTypeController.text,
"engine_no": engineNoController.text.isEmpty ? null : engineNoController.text, "date_of_registration": registrationDateController.text.isEmpty
"chassis_no": chassisNoController.text.isEmpty ? null : chassisNoController.text, ? null
: registrationDateController.text,
"year_of_manufacture": yomController.text.isEmpty
? null
: yomController.text,
"engine_no": engineNoController.text.isEmpty
? null
: engineNoController.text,
"chassis_no": chassisNoController.text.isEmpty
? null
: chassisNoController.text,
"make": makeController.text.isEmpty ? null : makeController.text, "make": makeController.text.isEmpty ? null : makeController.text,
"model": modelController.text.isEmpty ? null : modelController.text, "model": modelController.text.isEmpty ? null : modelController.text,
"cubic_capacity": cubicCapacityController.text.isEmpty ? null : cubicCapacityController.text, "cubic_capacity": cubicCapacityController.text.isEmpty
"vehicle_type": vehicleTypeController.text.isEmpty ? null : vehicleTypeController.text, ? null
"broker_name": brokerNameController.text.isEmpty ? null : brokerNameController.text, : cubicCapacityController.text,
"commission_amount": commissionAmountController.text.isEmpty ? null : commissionAmountController.text, "vehicle_type": vehicleTypeController.text.isEmpty
"updated_by": userId ? null
: vehicleTypeController.text,
"broker_name": brokerNameController.text.isEmpty
? null
: brokerNameController.text,
"commission_amount": commissionAmountController.text.isEmpty
? null
: commissionAmountController.text,
"updated_by": userId,
}; };
if (!mounted) return; if (!mounted) return;
@ -451,10 +509,20 @@ class _policyValidationState extends ConsumerState<policyValidation> {
setState(() => isLoading = false); setState(() => isLoading = false);
context.pop(); context.pop();
ToastHelper.showSuccessToast(context, "Policy updated successfully"); ToastHelper.showSuccessToast(context, "Policy updated successfully");
WidgetsBinding.instance.addPostFrameCallback((_) {
// Now safe to do navigation + provider updates
final container = ProviderScope.containerOf(context);
container.read(policyDataAcurancyRefreshProvider.notifier).state =
true;
});
} else { } else {
if (!mounted) return; if (!mounted) return;
setState(() => isLoading = false); setState(() => isLoading = false);
ToastHelper.showErrorToast(context, result?['message']?.toString() ?? 'Error updating policy'); ToastHelper.showErrorToast(
context,
result?['message']?.toString() ?? 'Error updating policy',
);
} }
} catch (e, st) { } catch (e, st) {
debugPrint('Exception in updatePolicy: $e\n$st'); debugPrint('Exception in updatePolicy: $e\n$st');
@ -491,9 +559,13 @@ class _policyValidationState extends ConsumerState<policyValidation> {
); );
} }
Widget _buildInput(
String label,
Widget _buildInput(String label, TextEditingController controller, {TextInputType keyboardType = TextInputType.text, bool readOnly = false, VoidCallback? onTap}) { TextEditingController controller, {
TextInputType keyboardType = TextInputType.text,
bool readOnly = false,
VoidCallback? onTap,
}) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -529,7 +601,9 @@ class _policyValidationState extends ConsumerState<policyValidation> {
mainAxisAlignment: MainAxisAlignment.end, // 👉 move button to right mainAxisAlignment: MainAxisAlignment.end, // 👉 move button to right
children: [ children: [
ElevatedButton( ElevatedButton(
onPressed: widget.item?['is_data_accuracy_checked'] == '1' ? null : _save, onPressed: widget.item?['is_data_accuracy_checked'] == '1'
? null
: _save,
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2E7D6E), backgroundColor: const Color(0xFF2E7D6E),
foregroundColor: Colors.white, foregroundColor: Colors.white,
@ -543,10 +617,7 @@ class _policyValidationState extends ConsumerState<policyValidation> {
), ),
child: const Text( child: const Text(
'Confirm Data Accuracy', 'Confirm Data Accuracy',
style: TextStyle( style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600),
fontSize: 14,
fontWeight: FontWeight.w600,
),
), ),
), ),
], ],
@ -566,11 +637,30 @@ class _policyValidationState extends ConsumerState<policyValidation> {
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row( child: Row(
children: [ children: [
IconButton(icon: const Icon(Icons.file_open), onPressed: () => context.pop()), IconButton(
const Expanded(child: Text('Insurance Policy Review', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600))), icon: const Icon(Icons.file_open),
if (isLoading) const SizedBox(width: 12, height: 12, child: CircularProgressIndicator(strokeWidth: 2)), onPressed: () => context.pop(),
),
const Expanded(
child: Text(
'Insurance Policy Review',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
if (isLoading)
const SizedBox(
width: 12,
height: 12,
child: CircularProgressIndicator(strokeWidth: 2),
),
const SizedBox(width: 8), const SizedBox(width: 8),
IconButton(icon: const Icon(Icons.close), onPressed: () => context.pop()), IconButton(
icon: const Icon(Icons.close),
onPressed: () => context.pop(),
),
], ],
), ),
), ),
@ -597,7 +687,10 @@ class _policyValidationState extends ConsumerState<policyValidation> {
children: [ children: [
const Text( const Text(
'Orginal Policy Document', 'Orginal Policy Document',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600), style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
@ -606,14 +699,17 @@ class _policyValidationState extends ConsumerState<policyValidation> {
future: loadNetworkPdfBytes(pdfUrl!), future: loadNetworkPdfBytes(pdfUrl!),
builder: (context, snapshot) { builder: (context, snapshot) {
if (!snapshot.hasData) { if (!snapshot.hasData) {
return const Center(child: CircularProgressIndicator()); return const Center(
child: CircularProgressIndicator(),
);
} }
final pdfBytes = snapshot.data!; final pdfBytes = snapshot.data!;
return PdfDocumentLoader.openData( return PdfDocumentLoader.openData(
pdfBytes, pdfBytes,
documentBuilder: (context, pdfDocument, pageCount) { documentBuilder:
(context, pdfDocument, pageCount) {
return ListView.builder( return ListView.builder(
itemCount: pageCount, itemCount: pageCount,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -630,8 +726,7 @@ class _policyValidationState extends ConsumerState<policyValidation> {
); );
}, },
), ),
) ),
// Expanded( // Expanded(
// child: PdfDocumentLoader.openAsset( // child: PdfDocumentLoader.openAsset(
@ -672,40 +767,97 @@ class _policyValidationState extends ConsumerState<policyValidation> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
// Policy Details // Policy Details
Card( Card(
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [ children: [
_sectionHeader('Policy Details', icon: Icons.policy), _sectionHeader(
'Policy Details',
icon: Icons.policy,
),
SizedBox(height: 10), SizedBox(height: 10),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('Policy Number', policyNumberController)), Expanded(
child: _buildInput(
'Policy Number',
policyNumberController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Insured Name', insuredNameController)), Expanded(
child: _buildInput(
'Insured Name',
insuredNameController,
),
),
], ],
), ),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('Issued Date', issuedDateController, readOnly: true, onTap: () => _pickDate(issuedDateController, context))), Expanded(
child: _buildInput(
'Issued Date',
issuedDateController,
readOnly: true,
onTap: () => _pickDate(
issuedDateController,
context,
),
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Start Date', startDateController, readOnly: true, onTap: () => _pickDate(startDateController, context))), Expanded(
child: _buildInput(
'Start Date',
startDateController,
readOnly: true,
onTap: () => _pickDate(
startDateController,
context,
),
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('End Date', endDateController, readOnly: true, onTap: () => _pickDate(endDateController, context)),) Expanded(
child: _buildInput(
'End Date',
endDateController,
readOnly: true,
onTap: () => _pickDate(
endDateController,
context,
),
),
),
], ],
), ),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('Premium Amount', premiumController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'Premium Amount',
premiumController,
keyboardType:
TextInputType.number,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Remarks', remarksController)), Expanded(
child: _buildInput(
'Remarks',
remarksController,
),
),
], ],
), ),
], ],
@ -719,31 +871,78 @@ class _policyValidationState extends ConsumerState<policyValidation> {
Card( Card(
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [ children: [
_sectionHeader('Tax / Cover Details', icon: Icons.attach_money), _sectionHeader(
'Tax / Cover Details',
icon: Icons.attach_money,
),
SizedBox(height: 10), SizedBox(height: 10),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('TP', tpController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'TP',
tpController,
keyboardType:
TextInputType.number,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('OD', odController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'OD',
odController,
keyboardType:
TextInputType.number,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('PA', paController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'PA',
paController,
keyboardType:
TextInputType.number,
),
),
], ],
), ),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('CGST', cgstController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'CGST',
cgstController,
keyboardType:
TextInputType.number,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('SGST', sgstController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'SGST',
sgstController,
keyboardType:
TextInputType.number,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('IGST', igstController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'IGST',
igstController,
keyboardType:
TextInputType.number,
),
),
], ],
), ),
], ],
@ -757,48 +956,127 @@ class _policyValidationState extends ConsumerState<policyValidation> {
Card( Card(
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [ children: [
_sectionHeader('Vehicle Details', icon: Icons.directions_car), _sectionHeader(
'Vehicle Details',
icon: Icons.directions_car,
),
SizedBox(height: 10), SizedBox(height: 10),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('RTO State Name', rtoStateCodeController)), Expanded(
child: _buildInput(
'RTO State Name',
rtoStateCodeController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('RTO City Code', rtoCityCodeController)), Expanded(
child: _buildInput(
'RTO City Code',
rtoCityCodeController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Weight', weightController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'Weight',
weightController,
keyboardType:
TextInputType.number,
),
),
], ],
), ),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('Fuel Type', fuelTypeController)), Expanded(
child: _buildInput(
'Fuel Type',
fuelTypeController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Date of Registration', registrationDateController, readOnly: true, onTap: () => _pickDate(registrationDateController, context))), Expanded(
child: _buildInput(
'Date of Registration',
registrationDateController,
readOnly: true,
onTap: () => _pickDate(
registrationDateController,
context,
),
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Year of Manufacture', yomController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'Year of Manufacture',
yomController,
keyboardType:
TextInputType.number,
),
),
], ],
), ),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('Engine No', engineNoController)), Expanded(
child: _buildInput(
'Engine No',
engineNoController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Chassis No', chassisNoController)), Expanded(
child: _buildInput(
'Chassis No',
chassisNoController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: Expanded(child: _buildInput('Make', makeController))), Expanded(
child: Expanded(
child: _buildInput(
'Make',
makeController,
),
),
),
], ],
), ),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('Model', modelController)), Expanded(
child: _buildInput(
'Model',
modelController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Cubic Capacity', cubicCapacityController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'Cubic Capacity',
cubicCapacityController,
keyboardType:
TextInputType.number,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Vehicle Type', vehicleTypeController)), Expanded(
child: _buildInput(
'Vehicle Type',
vehicleTypeController,
),
),
], ],
), ),
], ],
@ -812,19 +1090,37 @@ class _policyValidationState extends ConsumerState<policyValidation> {
Card( Card(
elevation: 5, elevation: 5,
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [ children: [
_sectionHeader('Broker / Commission', icon: Icons.person), _sectionHeader(
'Broker / Commission',
icon: Icons.person,
),
SizedBox(height: 10), SizedBox(height: 10),
Row( Row(
children: [ children: [
Expanded(child: _buildInput('Broker Name', brokerNameController)), Expanded(
child: _buildInput(
'Broker Name',
brokerNameController,
),
),
const SizedBox(width: 8), const SizedBox(width: 8),
Expanded(child: _buildInput('Commission Amount', commissionAmountController, keyboardType: TextInputType.number)), Expanded(
child: _buildInput(
'Commission Amount',
commissionAmountController,
keyboardType:
TextInputType.number,
),
),
], ],
), ),
], ],
@ -832,13 +1128,15 @@ class _policyValidationState extends ConsumerState<policyValidation> {
), ),
), ),
const SizedBox(height: 20),// spacing above fixed button const SizedBox(
height: 20,
), // spacing above fixed button
], ],
), ),
), ),
), ),
), ),
) ),
], ],
), ),
), ),