This commit is contained in:
J. A. Messias 2024-10-01 08:56:12 -03:00
parent 0aaee82b77
commit 267ab3c4ab
2 changed files with 22 additions and 19 deletions

View File

@ -82,7 +82,8 @@ class ScheduleCompleteVisitPageModel
if ((textController1!.text != '') && if ((textController1!.text != '') &&
(textController2!.text != '') && (textController2!.text != '') &&
(dropDownValue1 != null && dropDownValue1 != '') && (dropDownValue1 != null && dropDownValue1 != '') &&
(dropDownValue2 != null && dropDownValue2 != '')) { (dropDownValue2 != null && dropDownValue2 != '') &&
(visitorStrList.isNotEmpty)) {
DateTime selectedDateTime; DateTime selectedDateTime;
DateTime currentDateTime = DateTime.now().subtract(Duration(minutes: 10)); DateTime currentDateTime = DateTime.now().subtract(Duration(minutes: 10));
try { try {

View File

@ -220,8 +220,8 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
); );
} }
Widget scheduleVisit(BuildContext context, Widget scheduleVisit(BuildContext context, ScheduleCompleteVisitPageModel model,
ScheduleCompleteVisitPageModel model, Function safeSetState) { Function safeSetState) {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -858,9 +858,13 @@ Widget scheduleVisit(BuildContext context,
), ),
IconButton( IconButton(
onPressed: () async { onPressed: () async {
model.removeFromVisitorJsonList( safeSetState(() {
visitorListViewItem); model.removeFromVisitorJsonList(
safeSetState(() {}); visitorListViewItem);
if (model.visitorJsonList.isEmpty) {
model.visitorStrList = '';
}
});
}, },
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
), ),
@ -890,11 +894,11 @@ Widget scheduleVisit(BuildContext context,
context: context, context: context,
builder: (context) { builder: (context) {
return GestureDetector( return GestureDetector(
onTap: () => model onTap: () =>
.unfocusNode.canRequestFocus model.unfocusNode.canRequestFocus
? FocusScope.of(context) ? FocusScope.of(context)
.requestFocus(model.unfocusNode) .requestFocus(model.unfocusNode)
: FocusScope.of(context).unfocus(), : FocusScope.of(context).unfocus(),
child: SizedBox( child: SizedBox(
height: height:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
@ -913,9 +917,8 @@ Widget scheduleVisit(BuildContext context,
safeSetState(() {}); safeSetState(() {});
}, },
getDocs: (docsParam) async { getDocs: (docsParam) async {
model.visitorStrList = model.visitorStrList = strListToStr(
strListToStr( docsParam!.toList());
docsParam!.toList());
safeSetState(() {}); safeSetState(() {});
}, },
), ),
@ -1470,8 +1473,8 @@ Widget scheduleVisit(BuildContext context,
textAlign: TextAlign.start, textAlign: TextAlign.start,
maxLines: null, maxLines: null,
maxLength: 80, maxLength: 80,
validator: model.textController3Validator validator:
.asValidator(context), model.textController3Validator.asValidator(context),
), ),
), ),
), ),
@ -1614,9 +1617,8 @@ Widget scheduleVisit(BuildContext context,
?.group(1) ?.group(1)
.toString()) ?? .toString()) ??
'', '',
'Single Visit': model.switchValue == true 'Single Visit':
? 'Sim' model.switchValue == true ? 'Sim' : 'Não',
: 'Não',
if (model.textController3.text.isNotEmpty) if (model.textController3.text.isNotEmpty)
'Observation': model.textController3.text, 'Observation': model.textController3.text,
}, },