131 lines
4.5 KiB
Dart
131 lines
4.5 KiB
Dart
|
|
import '/backend/api_requests/api_calls.dart';
|
||
|
|
import '/components/alert_box_widget.dart';
|
||
|
|
import '/components/appbar_widget.dart';
|
||
|
|
import '/components/nav_bar1_widget.dart';
|
||
|
|
import '/flutterlib/flutter_button_tabbar.dart';
|
||
|
|
import '/flutterlib/flutter_theme.dart';
|
||
|
|
import '/flutterlib/flutter_util.dart';
|
||
|
|
import '/flutterlib/flutter_widgets.dart';
|
||
|
|
import 'setting_widget.dart' show SettingWidget;
|
||
|
|
import 'package:aligned_dialog/aligned_dialog.dart';
|
||
|
|
import 'package:expandable/expandable.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:flutter/services.dart';
|
||
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
||
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||
|
|
import 'package:google_fonts/google_fonts.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
|
||
|
|
class SettingModel extends FlutterModel<SettingWidget> {
|
||
|
|
/// State fields for stateful widgets in this page.
|
||
|
|
|
||
|
|
final unfocusNode = FocusNode();
|
||
|
|
final formKey = GlobalKey<FormState>();
|
||
|
|
// State field(s) for TabBar widget.
|
||
|
|
TabController? tabBarController;
|
||
|
|
int get tabBarCurrentIndex =>
|
||
|
|
tabBarController != null ? tabBarController!.index : 0;
|
||
|
|
|
||
|
|
// State field(s) for user_push_notification widget.
|
||
|
|
bool? userPushNotificationValue;
|
||
|
|
// State field(s) for user_bookkeeping_queue widget.
|
||
|
|
bool? userBookkeepingQueueValue;
|
||
|
|
// State field(s) for user_company_security_queue widget.
|
||
|
|
bool? userCompanySecurityQueueValue;
|
||
|
|
// State field(s) for user_chat_room widget.
|
||
|
|
bool? userChatRoomValue;
|
||
|
|
// Stores action output result for [Backend Call - API (Get Notifications Settings)] action in Button widget.
|
||
|
|
ApiCallResponse? apiResulti93;
|
||
|
|
// State field(s) for password widget.
|
||
|
|
FocusNode? passwordFocusNode;
|
||
|
|
TextEditingController? passwordController;
|
||
|
|
late bool passwordVisibility;
|
||
|
|
String? Function(BuildContext, String?)? passwordControllerValidator;
|
||
|
|
String? _passwordControllerValidator(BuildContext context, String? val) {
|
||
|
|
if (val == null || val.isEmpty) {
|
||
|
|
return FFLocalizations.of(context).getText(
|
||
|
|
's6d44i6v' /* Field is required */,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
// State field(s) for new_password widget.
|
||
|
|
FocusNode? newPasswordFocusNode;
|
||
|
|
TextEditingController? newPasswordController;
|
||
|
|
late bool newPasswordVisibility;
|
||
|
|
String? Function(BuildContext, String?)? newPasswordControllerValidator;
|
||
|
|
String? _newPasswordControllerValidator(BuildContext context, String? val) {
|
||
|
|
if (val == null || val.isEmpty) {
|
||
|
|
return FFLocalizations.of(context).getText(
|
||
|
|
'mcbh27ez' /* Field is required */,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
// State field(s) for new_password_confirmation widget.
|
||
|
|
FocusNode? newPasswordConfirmationFocusNode;
|
||
|
|
TextEditingController? newPasswordConfirmationController;
|
||
|
|
late bool newPasswordConfirmationVisibility;
|
||
|
|
String? Function(BuildContext, String?)?
|
||
|
|
newPasswordConfirmationControllerValidator;
|
||
|
|
String? _newPasswordConfirmationControllerValidator(
|
||
|
|
BuildContext context, String? val) {
|
||
|
|
if (val == null || val.isEmpty) {
|
||
|
|
return FFLocalizations.of(context).getText(
|
||
|
|
'7pp0pxok' /* Field is required */,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Stores action output result for [Backend Call - API (change password)] action in Button widget.
|
||
|
|
ApiCallResponse? apiResultopa;
|
||
|
|
// State field(s) for Expandable widget.
|
||
|
|
late ExpandableController expandableController;
|
||
|
|
|
||
|
|
// Model for NavBar1 component.
|
||
|
|
late NavBar1Model navBar1Model;
|
||
|
|
// Model for appbar component.
|
||
|
|
late AppbarModel appbarModel;
|
||
|
|
|
||
|
|
/// Initialization and disposal methods.
|
||
|
|
|
||
|
|
void initState(BuildContext context) {
|
||
|
|
passwordVisibility = false;
|
||
|
|
passwordControllerValidator = _passwordControllerValidator;
|
||
|
|
newPasswordVisibility = false;
|
||
|
|
newPasswordControllerValidator = _newPasswordControllerValidator;
|
||
|
|
newPasswordConfirmationVisibility = false;
|
||
|
|
newPasswordConfirmationControllerValidator =
|
||
|
|
_newPasswordConfirmationControllerValidator;
|
||
|
|
navBar1Model = createModel(context, () => NavBar1Model());
|
||
|
|
appbarModel = createModel(context, () => AppbarModel());
|
||
|
|
}
|
||
|
|
|
||
|
|
void dispose() {
|
||
|
|
unfocusNode.dispose();
|
||
|
|
tabBarController?.dispose();
|
||
|
|
passwordFocusNode?.dispose();
|
||
|
|
passwordController?.dispose();
|
||
|
|
|
||
|
|
newPasswordFocusNode?.dispose();
|
||
|
|
newPasswordController?.dispose();
|
||
|
|
|
||
|
|
newPasswordConfirmationFocusNode?.dispose();
|
||
|
|
newPasswordConfirmationController?.dispose();
|
||
|
|
|
||
|
|
expandableController.dispose();
|
||
|
|
navBar1Model.dispose();
|
||
|
|
appbarModel.dispose();
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Action blocks are added here.
|
||
|
|
|
||
|
|
/// Additional helper methods are added here.
|
||
|
|
}
|