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