An error occurred while loading the file. Please try again.
-
Shoaib authored5db73dec
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:smf_mobile/constants/app_constants.dart';
import 'package:smf_mobile/constants/color_constants.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:smf_mobile/util/helper.dart';
class AssistantInspectorApplicationField extends StatefulWidget {
final String fieldName;
final Map fieldData;
final Map leadInspectorData;
final ValueChanged<Map> parentAction;
const AssistantInspectorApplicationField({
Key? key,
required this.fieldName,
required this.fieldData,
required this.leadInspectorData,
required this.parentAction,
}) : super(key: key);
@override
_AssistantInspectorApplicationFieldState createState() =>
_AssistantInspectorApplicationFieldState();
}
class _AssistantInspectorApplicationFieldState
extends State<AssistantInspectorApplicationField> {
String _radioValue = '';
String _inspectionValue = '';
String _inspectionComment = '';
String _attachment = '';
String _noteText = '';
@override
void initState() {
super.initState();
try {
_inspectionComment = widget.leadInspectorData['comments'];
_radioValue = widget.leadInspectorData['value'];
_inspectionValue = widget.leadInspectorData['inspectionValue'];
_attachment = widget.leadInspectorData['attachment'];
} catch (_) {
return;
}
// print('$_inspectionComment, $_radioValue, $_inspectionValue');
}
triggerUpdate(Map dialogData) {
Map data = {
widget.fieldName: {
widget.fieldData.keys.elementAt(0): {
'value': _radioValue,
'comments': dialogData['noteText'],
'inspectionValue': dialogData['inspectionValue']
}
}
};
// print(data);
setState(() {
_noteText = dialogData['noteText'];
_inspectionValue = dialogData['inspectionValue'];
});
widget.parentAction(data);
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
reverse: true,
child: Container(
margin: const EdgeInsets.fromLTRB(20, 0, 20, 20),
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
margin: const EdgeInsets.only(top: 20),
padding: const EdgeInsets.all(20),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(4),
topRight: Radius.circular(4)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: AppColors.black16,
offset: Offset(0, 2),
blurRadius: 2)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 5),
child: Text(
widget.fieldName,
style: GoogleFonts.lato(
color: AppColors.black87,
fontSize: 14.0,
letterSpacing: 0.25,
fontWeight: FontWeight.w700,
),
),
),
Container(
margin: const EdgeInsets.only(top: 10),
padding: const EdgeInsets.fromLTRB(15, 10, 15, 10),
width: double.infinity,
decoration: BoxDecoration(
border: Border.all(color: AppColors.black16),
),
child: Text(
widget.fieldData.keys.elementAt(0),
style: GoogleFonts.lato(
color: AppColors.black87,
fontSize: 14.0,
letterSpacing: 0.25,
fontWeight: FontWeight.w400,
),
),
)
],
),
),
Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(4),
bottomRight: Radius.circular(4)),
color: AppColors.fieldBackground,
boxShadow: [
BoxShadow(
color: AppColors.black16,
offset: Offset(0, 2),
blurRadius: 2)
],
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
),
child: SizedBox(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.only(bottom: 10),
child: Text(
AppLocalizations.of(context)!
.isGivenInformationCorrect,
style: GoogleFonts.lato(
color: AppColors.black60,
fontWeight: FontWeight.w700,
fontSize: 14.0,
letterSpacing: 0.25,
),
)),
Container(
// width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.only(bottom: 0),
child: Container(
padding:
const EdgeInsets.fromLTRB(15, 10, 15, 10),
margin: const EdgeInsets.only(right: 15),
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: const BorderRadius.all(
Radius.circular(4.0)),
border: Border.all(
color: AppColors.black16,
),
),
child: Text(
Helper.capitalize(_radioValue),
style: GoogleFonts.lato(
color: AppColors.black87,
fontWeight: FontWeight.w400,
fontSize: 14.0,
letterSpacing: 0.25,
),
),
),
),
_radioValue.toLowerCase() ==
FieldValue.inCorrect.toLowerCase()
? Wrap(children: [
Container(
width:
MediaQuery.of(context).size.width,
padding:
const EdgeInsets.only(top: 20),
child: Text(
AppLocalizations.of(context)!
.reasonForIncorrectSelection,
style: GoogleFonts.lato(
color: AppColors.black60,
fontWeight: FontWeight.w700,
fontSize: 14.0,
letterSpacing: 0.25,
),
)),
Container(
width:
MediaQuery.of(context).size.width,
margin:
const EdgeInsets.only(bottom: 0),
child: Container(
padding: const EdgeInsets.fromLTRB(
211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
15, 10, 15, 10),
margin:
const EdgeInsets.only(top: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
const BorderRadius.all(
Radius.circular(4.0)),
border: Border.all(
color: AppColors.black08,
),
),
child: Text(
_inspectionComment,
style: GoogleFonts.lato(
color: AppColors.black87,
fontWeight: FontWeight.w400,
fontSize: 14.0,
letterSpacing: 0.25,
),
),
),
),
Container(
width:
MediaQuery.of(context).size.width,
padding:
const EdgeInsets.only(top: 20),
child: Text(
AppLocalizations.of(context)!
.actualValue,
style: GoogleFonts.lato(
color: AppColors.black60,
fontWeight: FontWeight.w700,
fontSize: 14.0,
letterSpacing: 0.25,
),
)),
Container(
width:
MediaQuery.of(context).size.width,
margin:
const EdgeInsets.only(bottom: 0),
child: Container(
padding: const EdgeInsets.fromLTRB(
15, 10, 15, 10),
margin:
const EdgeInsets.only(top: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
const BorderRadius.all(
Radius.circular(4.0)),
border: Border.all(
color: AppColors.black08,
),
),
child: Text(
_inspectionValue,
style: GoogleFonts.lato(
color: AppColors.black87,
fontWeight: FontWeight.w400,
fontSize: 14.0,
letterSpacing: 0.25,
),
),
),
),
_attachment != ''
? Container(
281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
width: MediaQuery.of(context)
.size
.width,
margin: const EdgeInsets.only(
bottom: 0),
child: Container(
padding:
const EdgeInsets.fromLTRB(
15, 10, 15, 10),
margin: const EdgeInsets.only(
top: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
const BorderRadius.all(
Radius.circular(4.0)),
border: Border.all(
color: AppColors.black08,
),
),
child:
Image.network(_attachment),
),
)
: const Center(),
])
: const Center()
],
))),
])));
}
}