first commit
This commit is contained in:
260
lib/components/update_member_model.dart
Normal file
260
lib/components/update_member_model.dart
Normal file
@@ -0,0 +1,260 @@
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/components/alert_box_custom_o_k_widget.dart';
|
||||
import '/components/alert_box_custom_widget.dart';
|
||||
import '/flutterlib/flutter_drop_down.dart';
|
||||
import '/flutterlib/flutter_icon_button.dart';
|
||||
import '/flutterlib/flutter_radio_button.dart';
|
||||
import '/flutterlib/flutter_theme.dart';
|
||||
import '/flutterlib/flutter_util.dart';
|
||||
import '/flutterlib/flutter_widgets.dart';
|
||||
import '/flutterlib/form_field_controller.dart';
|
||||
import '/flutterlib/upload_data.dart';
|
||||
import '/flutterlib/custom_functions.dart' as functions;
|
||||
import 'update_member_widget.dart' show UpdateMemberWidget;
|
||||
import 'package:aligned_dialog/aligned_dialog.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class UpdateMemberModel extends FlutterModel<UpdateMemberWidget> {
|
||||
/// Local state fields for this component.
|
||||
|
||||
dynamic memberData;
|
||||
|
||||
dynamic companyID;
|
||||
|
||||
bool setBirthDate = false;
|
||||
|
||||
bool uploadPhoto = false;
|
||||
|
||||
bool reuploadPhoto = false;
|
||||
|
||||
bool hideApiPhoto = false;
|
||||
|
||||
int? documentID;
|
||||
|
||||
/// State fields for stateful widgets in this component.
|
||||
|
||||
final formKey = GlobalKey<FormState>();
|
||||
// State field(s) for position widget.
|
||||
FormFieldController<String>? positionValueController;
|
||||
// State field(s) for title widget.
|
||||
String? titleValue;
|
||||
FormFieldController<String>? titleValueController;
|
||||
// State field(s) for name_english widget.
|
||||
FocusNode? nameEnglishFocusNode;
|
||||
TextEditingController? nameEnglishController;
|
||||
String? Function(BuildContext, String?)? nameEnglishControllerValidator;
|
||||
String? _nameEnglishControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'4okvufdw' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for name_chinese widget.
|
||||
FocusNode? nameChineseFocusNode;
|
||||
TextEditingController? nameChineseController;
|
||||
String? Function(BuildContext, String?)? nameChineseControllerValidator;
|
||||
String? _nameChineseControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'1aer0il2' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for phone widget.
|
||||
FocusNode? phoneFocusNode;
|
||||
TextEditingController? phoneController;
|
||||
String? Function(BuildContext, String?)? phoneControllerValidator;
|
||||
String? _phoneControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'1o5n5vu2' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for email widget.
|
||||
FocusNode? emailFocusNode;
|
||||
TextEditingController? emailController;
|
||||
String? Function(BuildContext, String?)? emailControllerValidator;
|
||||
String? _emailControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'gxrowkvz' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for date widget.
|
||||
FocusNode? dateFocusNode;
|
||||
TextEditingController? dateController;
|
||||
String? Function(BuildContext, String?)? dateControllerValidator;
|
||||
String? _dateControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'ip2ppggj' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
DateTime? datePicked;
|
||||
// State field(s) for documentType widget.
|
||||
String? documentTypeValue;
|
||||
FormFieldController<String>? documentTypeValueController;
|
||||
// State field(s) for documentNo widget.
|
||||
FocusNode? documentNoFocusNode;
|
||||
TextEditingController? documentNoController;
|
||||
String? Function(BuildContext, String?)? documentNoControllerValidator;
|
||||
String? _documentNoControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'agnaksg0' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for country widget.
|
||||
FocusNode? countryFocusNode;
|
||||
TextEditingController? countryController;
|
||||
String? Function(BuildContext, String?)? countryControllerValidator;
|
||||
String? _countryControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'gbnww8g4' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for city widget.
|
||||
FocusNode? cityFocusNode;
|
||||
TextEditingController? cityController;
|
||||
String? Function(BuildContext, String?)? cityControllerValidator;
|
||||
String? _cityControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'4lmj71tb' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for addressEn widget.
|
||||
FocusNode? addressEnFocusNode;
|
||||
TextEditingController? addressEnController;
|
||||
String? Function(BuildContext, String?)? addressEnControllerValidator;
|
||||
String? _addressEnControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'8og0cme2' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// State field(s) for addressCn widget.
|
||||
FocusNode? addressCnFocusNode;
|
||||
TextEditingController? addressCnController;
|
||||
String? Function(BuildContext, String?)? addressCnControllerValidator;
|
||||
String? _addressCnControllerValidator(BuildContext context, String? val) {
|
||||
if (val == null || val.isEmpty) {
|
||||
return FFLocalizations.of(context).getText(
|
||||
'7hdsppit' /* Field is required */,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Stores action output result for [Backend Call - API (Delete Member Document)] action in Text widget.
|
||||
ApiCallResponse? deleteDocument1;
|
||||
bool isDataUploading1 = false;
|
||||
FFUploadedFile uploadedLocalFile1 =
|
||||
FFUploadedFile(bytes: Uint8List.fromList([]));
|
||||
|
||||
// Stores action output result for [Backend Call - API (Delete Member Document)] action in Text widget.
|
||||
ApiCallResponse? deleteDocument;
|
||||
bool isDataUploading2 = false;
|
||||
FFUploadedFile uploadedLocalFile2 =
|
||||
FFUploadedFile(bytes: Uint8List.fromList([]));
|
||||
|
||||
// Stores action output result for [Backend Call - API (Save or Update Member)] action in Button widget.
|
||||
ApiCallResponse? updateMember1;
|
||||
// Stores action output result for [Backend Call - API (Save or Update Member)] action in Button widget.
|
||||
ApiCallResponse? updateMember2;
|
||||
|
||||
/// Initialization and disposal methods.
|
||||
|
||||
void initState(BuildContext context) {
|
||||
nameEnglishControllerValidator = _nameEnglishControllerValidator;
|
||||
nameChineseControllerValidator = _nameChineseControllerValidator;
|
||||
phoneControllerValidator = _phoneControllerValidator;
|
||||
emailControllerValidator = _emailControllerValidator;
|
||||
dateControllerValidator = _dateControllerValidator;
|
||||
documentNoControllerValidator = _documentNoControllerValidator;
|
||||
countryControllerValidator = _countryControllerValidator;
|
||||
cityControllerValidator = _cityControllerValidator;
|
||||
addressEnControllerValidator = _addressEnControllerValidator;
|
||||
addressCnControllerValidator = _addressCnControllerValidator;
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
nameEnglishFocusNode?.dispose();
|
||||
nameEnglishController?.dispose();
|
||||
|
||||
nameChineseFocusNode?.dispose();
|
||||
nameChineseController?.dispose();
|
||||
|
||||
phoneFocusNode?.dispose();
|
||||
phoneController?.dispose();
|
||||
|
||||
emailFocusNode?.dispose();
|
||||
emailController?.dispose();
|
||||
|
||||
dateFocusNode?.dispose();
|
||||
dateController?.dispose();
|
||||
|
||||
documentNoFocusNode?.dispose();
|
||||
documentNoController?.dispose();
|
||||
|
||||
countryFocusNode?.dispose();
|
||||
countryController?.dispose();
|
||||
|
||||
cityFocusNode?.dispose();
|
||||
cityController?.dispose();
|
||||
|
||||
addressEnFocusNode?.dispose();
|
||||
addressEnController?.dispose();
|
||||
|
||||
addressCnFocusNode?.dispose();
|
||||
addressCnController?.dispose();
|
||||
}
|
||||
|
||||
/// Action blocks are added here.
|
||||
|
||||
/// Additional helper methods are added here.
|
||||
|
||||
String? get positionValue => positionValueController?.value;
|
||||
}
|
||||
Reference in New Issue
Block a user