import '/backend/api_requests/api_calls.dart';
import '/components/alert_box_custom_widget.dart';
import '/components/appbar_widget.dart';
import '/components/nav_bar1_widget.dart';
import '/components/new_member_widget.dart';
import '/components/update_member_widget.dart';
import '/flutterlib/flutter_theme.dart';
import '/flutterlib/flutter_util.dart';
import '/flutterlib/flutter_widgets.dart';
import '/flutterlib/custom_functions.dart' as functions;
import 'dashboard_widget.dart' show DashboardWidget;
import 'package:aligned_dialog/aligned_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.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 DashboardModel extends FlutterModel<DashboardWidget> {
  ///  Local state fields for this page.

  bool showNewMemberForm = false;

  int? memberID;

  bool setBirthDate = false;

  bool checkPermission19 = false;

  ///  State fields for stateful widgets in this page.

  final unfocusNode = FocusNode();
  // Stores action output result for [Backend Call - API (Check role has permission)] action in dashboard widget.
  ApiCallResponse? apiResult19;
  // State field(s) for companyEn widget.
  FocusNode? companyEnFocusNode;
  TextEditingController? companyEnController;
  String? Function(BuildContext, String?)? companyEnControllerValidator;
  // State field(s) for companyCn widget.
  FocusNode? companyCnFocusNode;
  TextEditingController? companyCnController;
  String? Function(BuildContext, String?)? companyCnControllerValidator;
  // State field(s) for officeAddEn widget.
  FocusNode? officeAddEnFocusNode;
  TextEditingController? officeAddEnController;
  String? Function(BuildContext, String?)? officeAddEnControllerValidator;
  // State field(s) for officeAddCn widget.
  FocusNode? officeAddCnFocusNode;
  TextEditingController? officeAddCnController;
  String? Function(BuildContext, String?)? officeAddCnControllerValidator;
  // State field(s) for BRno widget.
  FocusNode? bRnoFocusNode;
  TextEditingController? bRnoController;
  String? Function(BuildContext, String?)? bRnoControllerValidator;
  // Stores action output result for [Backend Call - API (Update Company Details)] action in Button widget.
  ApiCallResponse? updateCompany;
  // Model for newMember component.
  late NewMemberModel newMemberModel;
  // Model for NavBar1 component.
  late NavBar1Model navBar1Model;
  // Model for appbar component.
  late AppbarModel appbarModel;

  /// Initialization and disposal methods.

  void initState(BuildContext context) {
    newMemberModel = createModel(context, () => NewMemberModel());
    navBar1Model = createModel(context, () => NavBar1Model());
    appbarModel = createModel(context, () => AppbarModel());
  }

  void dispose() {
    unfocusNode.dispose();
    companyEnFocusNode?.dispose();
    companyEnController?.dispose();

    companyCnFocusNode?.dispose();
    companyCnController?.dispose();

    officeAddEnFocusNode?.dispose();
    officeAddEnController?.dispose();

    officeAddCnFocusNode?.dispose();
    officeAddCnController?.dispose();

    bRnoFocusNode?.dispose();
    bRnoController?.dispose();

    newMemberModel.dispose();
    navBar1Model.dispose();
    appbarModel.dispose();
  }

  /// Action blocks are added here.

  /// Additional helper methods are added here.
}
