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 'setting1_widget.dart' show Setting1Widget;
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 Setting1Model extends FlutterModel<Setting1Widget> {
  ///  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 SwitchListTile widget.
  bool? switchListTileValue1;
  // State field(s) for SwitchListTile widget.
  bool? switchListTileValue2;
  // State field(s) for SwitchListTile widget.
  bool? switchListTileValue3;
  // State field(s) for SwitchListTile widget.
  bool? switchListTileValue4;
  // 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(
        'eyfmp88r' /* 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(
        'i8mpw0ks' /* 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(
        'jsim05nr' /* Field is required */,
      );
    }

    return null;
  }

  // Stores action output result for [Backend Call - API (change password)] action in Button widget.
  ApiCallResponse? apiResultqep;
  // 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.
}
