Refactor visit request template component logic
This commit is contained in:
parent
05eb659c56
commit
3450a490c7
File diff suppressed because one or more lines are too long
|
@ -69,6 +69,7 @@ Future<Color> manageStatusColorAction(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
required String? visitStatusStr,
|
required String? visitStatusStr,
|
||||||
}) async {
|
}) async {
|
||||||
|
debugPrint('visitStatusStr: $visitStatusStr');
|
||||||
if (visitStatusStr == 'A') {
|
if (visitStatusStr == 'A') {
|
||||||
return FlutterFlowTheme.of(context).success;
|
return FlutterFlowTheme.of(context).success;
|
||||||
} else if ((visitStatusStr == 'C') ||
|
} else if ((visitStatusStr == 'C') ||
|
||||||
|
|
|
@ -7,7 +7,7 @@ class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> {
|
||||||
/// State fields for stateful widgets in this component.
|
/// State fields for stateful widgets in this component.
|
||||||
|
|
||||||
// Stores action output result for [Action Block - manageStatusColorAction] action in viewVisitDetail widget.
|
// Stores action output result for [Action Block - manageStatusColorAction] action in viewVisitDetail widget.
|
||||||
Color? visitStatusColor;
|
// Color? visitStatusColor;
|
||||||
// State field(s) for TextField widget.
|
// State field(s) for TextField widget.
|
||||||
FocusNode? textFieldFocusNode1;
|
FocusNode? textFieldFocusNode1;
|
||||||
TextEditingController? textController1;
|
TextEditingController? textController1;
|
||||||
|
|
|
@ -29,6 +29,7 @@ class ViewVisitDetailWidget extends StatefulWidget {
|
||||||
required this.visitorStrList,
|
required this.visitorStrList,
|
||||||
this.visitorJsonList,
|
this.visitorJsonList,
|
||||||
required this.visitIdStr,
|
required this.visitIdStr,
|
||||||
|
required this.visitStatusColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String? visitorImgPath;
|
final String? visitorImgPath;
|
||||||
|
@ -42,6 +43,7 @@ class ViewVisitDetailWidget extends StatefulWidget {
|
||||||
final String? visitorStrList;
|
final String? visitorStrList;
|
||||||
final List<dynamic>? visitorJsonList;
|
final List<dynamic>? visitorJsonList;
|
||||||
final String? visitIdStr;
|
final String? visitIdStr;
|
||||||
|
final Color? visitStatusColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ViewVisitDetailWidget> createState() => _ViewVisitDetailWidgetState();
|
State<ViewVisitDetailWidget> createState() => _ViewVisitDetailWidgetState();
|
||||||
|
@ -63,6 +65,7 @@ List<dynamic>? findVisitorById(List<dynamic>? jsonList, String? id) {
|
||||||
|
|
||||||
class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
||||||
late ViewVisitDetailModel _model;
|
late ViewVisitDetailModel _model;
|
||||||
|
bool isLoading = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback callback) {
|
void setState(VoidCallback callback) {
|
||||||
|
@ -76,14 +79,14 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
||||||
_model = createModel(context, () => ViewVisitDetailModel());
|
_model = createModel(context, () => ViewVisitDetailModel());
|
||||||
|
|
||||||
// On component load action.
|
// On component load action.
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
// SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||||
if (widget.visitStatusStr != null) {
|
// if (widget.visitStatusStr != null) {
|
||||||
_model.visitStatusColor = await action_blocks.manageStatusColorAction(
|
// _model.visitStatusColor = await action_blocks.manageStatusColorAction(
|
||||||
context,
|
// context,
|
||||||
visitStatusStr: widget.visitStatusStr!,
|
// visitStatusStr: widget.visitStatusStr!,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
_model.textController1 = TextEditingController(
|
_model.textController1 = TextEditingController(
|
||||||
text: widget.visitTempStr == 'null' ? '' : widget.visitTempStr ?? '');
|
text: widget.visitTempStr == 'null' ? '' : widget.visitTempStr ?? '');
|
||||||
|
@ -780,10 +783,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 35.0,
|
height: 35.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: valueOrDefault<Color>(
|
color: widget.visitStatusColor,
|
||||||
_model.visitStatusColor,
|
|
||||||
FlutterFlowTheme.of(context).primary,
|
|
||||||
),
|
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(
|
||||||
bottomLeft: Radius.circular(0.0),
|
bottomLeft: Radius.circular(0.0),
|
||||||
bottomRight: Radius.circular(0.0),
|
bottomRight: Radius.circular(0.0),
|
||||||
|
|
|
@ -22,6 +22,7 @@ class VisitDetailsModalTemplateComponentWidget extends StatefulWidget {
|
||||||
this.visitIdStr,
|
this.visitIdStr,
|
||||||
this.updateToggleIdx,
|
this.updateToggleIdx,
|
||||||
this.repeatVisitSchedule,
|
this.repeatVisitSchedule,
|
||||||
|
this.visitStatusColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String? visitStatusStr;
|
final String? visitStatusStr;
|
||||||
|
@ -38,6 +39,7 @@ class VisitDetailsModalTemplateComponentWidget extends StatefulWidget {
|
||||||
final String? visitIdStr;
|
final String? visitIdStr;
|
||||||
final Future Function()? updateToggleIdx;
|
final Future Function()? updateToggleIdx;
|
||||||
final Future Function()? repeatVisitSchedule;
|
final Future Function()? repeatVisitSchedule;
|
||||||
|
final Color? visitStatusColor;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<VisitDetailsModalTemplateComponentWidget> createState() =>
|
State<VisitDetailsModalTemplateComponentWidget> createState() =>
|
||||||
|
@ -91,6 +93,7 @@ class _VisitDetailsModalTemplateComponentWidgetState
|
||||||
visitorStrList: widget.visitorStrList!,
|
visitorStrList: widget.visitorStrList!,
|
||||||
visitorJsonList: widget.visitorJsonList,
|
visitorJsonList: widget.visitorJsonList,
|
||||||
visitIdStr: widget.visitIdStr!,
|
visitIdStr: widget.visitIdStr!,
|
||||||
|
visitStatusColor: widget.visitStatusColor!,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -135,16 +135,16 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
path: '/peopleOnThePropertyPage',
|
path: '/peopleOnThePropertyPage',
|
||||||
builder: (context, params) => const PeopleOnThePropertyPageWidget(),
|
builder: (context, params) => const PeopleOnThePropertyPageWidget(),
|
||||||
),
|
),
|
||||||
FFRoute(
|
// FFRoute(
|
||||||
name: 'acessHistoryPage',
|
// name: 'acessHistoryPage',
|
||||||
path: '/acessHistoryPage',
|
// path: '/acessHistoryPage',
|
||||||
builder: (context, params) => const AcessHistoryPageWidget(),
|
// builder: (context, params) => const AcessHistoryPageWidget(),
|
||||||
),
|
// ),
|
||||||
FFRoute(
|
// FFRoute(
|
||||||
name: 'liberationHistory',
|
// name: 'liberationHistory',
|
||||||
path: '/liberationHistory',
|
// path: '/liberationHistory',
|
||||||
builder: (context, params) => const LiberationHistoryWidget(),
|
// builder: (context, params) => const LiberationHistoryWidget(),
|
||||||
)
|
// )
|
||||||
].map((r) => r.toRoute(appStateNotifier)).toList(),
|
].map((r) => r.toRoute(appStateNotifier)).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
// import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'acess_history_page_widget.dart' show AcessHistoryPageWidget;
|
// import 'acess_history_page_widget.dart' show AcessHistoryPageWidget;
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
// class AcessHistoryPageModel extends FlutterFlowModel<AcessHistoryPageWidget> {
|
||||||
/// State fields for stateful widgets in this page.
|
// /// State fields for stateful widgets in this page.
|
||||||
|
|
||||||
final unfocusNode = FocusNode();
|
// final unfocusNode = FocusNode();
|
||||||
// State field(s) for TabBar widget.
|
// // State field(s) for TabBar widget.
|
||||||
TabController? tabBarController;
|
// TabController? tabBarController;
|
||||||
int get tabBarCurrentIndex =>
|
// int get tabBarCurrentIndex =>
|
||||||
tabBarController != null ? tabBarController!.index : 0;
|
// tabBarController != null ? tabBarController!.index : 0;
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
void initState(BuildContext context) {}
|
// void initState(BuildContext context) {}
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
void dispose() {
|
// void dispose() {
|
||||||
unfocusNode.dispose();
|
// unfocusNode.dispose();
|
||||||
tabBarController?.dispose();
|
// tabBarController?.dispose();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +1,23 @@
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
// import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'liberation_history_widget.dart' show LiberationHistoryWidget;
|
// import 'liberation_history_widget.dart' show LiberationHistoryWidget;
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
// class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||||
/// State fields for stateful widgets in this page.
|
// /// State fields for stateful widgets in this page.
|
||||||
|
|
||||||
final unfocusNode = FocusNode();
|
// final unfocusNode = FocusNode();
|
||||||
// State field(s) for TextField widget.
|
// // State field(s) for TextField widget.
|
||||||
FocusNode? textFieldFocusNode;
|
// FocusNode? textFieldFocusNode;
|
||||||
TextEditingController? textController;
|
// TextEditingController? textController;
|
||||||
String? Function(BuildContext, String?)? textControllerValidator;
|
// String? Function(BuildContext, String?)? textControllerValidator;
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
void initState(BuildContext context) {}
|
// void initState(BuildContext context) {}
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
void dispose() {
|
// void dispose() {
|
||||||
unfocusNode.dispose();
|
// unfocusNode.dispose();
|
||||||
textFieldFocusNode?.dispose();
|
// textFieldFocusNode?.dispose();
|
||||||
textController?.dispose();
|
// textController?.dispose();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2461,6 +2461,20 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
visitaWrapItem,
|
visitaWrapItem,
|
||||||
r'''$.VAW_ID''',
|
r'''$.VAW_ID''',
|
||||||
).toString(),
|
).toString(),
|
||||||
|
visitStatusColor:
|
||||||
|
getJsonField(
|
||||||
|
visitaWrapItem,
|
||||||
|
r'''$.VAW_STATUS''',
|
||||||
|
)
|
||||||
|
.toString() ==
|
||||||
|
'A'
|
||||||
|
? FlutterFlowTheme
|
||||||
|
.of(
|
||||||
|
context)
|
||||||
|
.success
|
||||||
|
: FlutterFlowTheme
|
||||||
|
.of(context)
|
||||||
|
.error,
|
||||||
visitorJsonList: PhpGroup
|
visitorJsonList: PhpGroup
|
||||||
.getVisitsCall
|
.getVisitsCall
|
||||||
.visitasList(
|
.visitasList(
|
||||||
|
|
Loading…
Reference in New Issue