import 'package:flutter/material.dart';
import 'package:hub/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart';
import 'package:hub/flutter_flow/nav/nav.dart';

import '/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'menu_component_widget.dart' show MenuComponentWidget;



class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
  ///  Local state fields for this component.

  bool isGrid = false;

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

  // Model for menuListViewComponent.
  late MenuListViewComponentModel menuListViewComponentModel;

  // Model for menuStaggeredViewComponent.
  late MenuStaggeredViewComponentModel menuStaggeredViewComponentModel;

  @override
  void initState(BuildContext context) {
    menuListViewComponentModel =
        createModel(context, () => MenuListViewComponentModel());
    menuStaggeredViewComponentModel =
        createModel(context, () => MenuStaggeredViewComponentModel());
  }

  @override
  void dispose() {
    menuListViewComponentModel.dispose();
    menuStaggeredViewComponentModel.dispose();
  }

  /// Action blocks.
  Future changeMenuStyle(BuildContext context) async {
    isGrid = !isGrid;
  }

  Future scheduleVisitOptAction(BuildContext context) async {
    await showAdaptiveDialog(
      context: context,
      builder: (context) {
        return Padding(
          padding: MediaQuery.viewInsetsOf(context),
          child: OptionSelectionModalWidget(
            routesListStr: <String>[
              'scheduleCompleteVisitPage',
              'scheduleProvisionalVisitPage',
              'fastPassPage',
            ],
            iconsListIcon: <IconData>[
              Icons.date_range_rounded,
              Icons.date_range_rounded,
              Icons.date_range_rounded,
            ],
            nameListStr: <String>[
              FFLocalizations.of(context).getVariableText(
                ptText: 'Visita\nCompleta',
                enText: 'Complete\nSchedule',
              ),
              FFLocalizations.of(context).getVariableText(
                ptText: 'Visita\nProvisória',
                enText: 'Provisional\nSchedule',
              ),
              FFLocalizations.of(context).getVariableText(
                ptText: 'Visita\nRápida',
                enText: 'Fast\nSchedule',
              ),
            ],
          ),
        );
      },
    );
  }

  Future registerVisitorOptAction(BuildContext context) async {
    context.pushNamed(
      'registerVisitorPage',
      extra: <String, dynamic>{
        kTransitionInfoKey: const TransitionInfo(
          hasTransition: true,
          transitionType: PageTransitionType.scale,
          alignment: Alignment.bottomCenter,
        ),
      },
    );
  }

  Future peopleOnThePropertyAction(BuildContext context) async {
    context.pushNamed(
      'peopleOnThePropertyPage',
      extra: <String, dynamic>{
        kTransitionInfoKey: const TransitionInfo(
          hasTransition: true,
          transitionType: PageTransitionType.fade,
        ),
      },
    );
  }

  Future preferencesSettings(BuildContext context) async {
    context.pushNamed(
      'preferencesSettings',
      extra: <String, dynamic>{
        kTransitionInfoKey: const TransitionInfo(
          hasTransition: true,
          transitionType: PageTransitionType.scale,
          alignment: Alignment.bottomCenter,
        ),
      },
    );
  }

  Future liberationHistoryOptAction(BuildContext context) async {
    await showAdaptiveDialog(
      // isScrollControlled: true,
      // backgroundColor: Colors.transparent,
      // enableDrag: false,
      context: context,
      builder: (context) {
        return Padding(
          padding: MediaQuery.viewInsetsOf(context),
          child: OptionSelectionModalWidget(
            routesListStr: <String>[
              'liberationHistory',
              'acessHistoryPage',
              'scheduleCompleteVisitPage',
              'messageHistoryPage'
            ],
            iconsListIcon: <IconData>[
              Icons.history_rounded,
              Icons.history_rounded,
              Icons.history_rounded,
              Icons.history_rounded,
            ],
            nameListStr: <String>[
              FFLocalizations.of(context).getVariableText(
                ptText: 'Histórico\nde Liberação',
                enText: 'Liberation\nHistory',
              ),
              FFLocalizations.of(context).getVariableText(
                ptText: 'Histórico\nde Acesso',
                enText: 'Access\nHistory',
              ),
              FFLocalizations.of(context).getVariableText(
                ptText: 'Histórico\nde Visita',
                enText: 'Visit\nHistory',
              ),
              FFLocalizations.of(context).getVariableText(
                ptText: 'Histórico\nde Mensagens',
                enText: 'Message\nHistory',
              ),
            ],
          ),
        );
      },
    );
  }

  Future accessQRCodeOptAction(BuildContext context) async {
    context.pushNamed(
      'qrCodePage',
      extra: <String, dynamic>{
        kTransitionInfoKey: const TransitionInfo(
          hasTransition: true,
          transitionType: PageTransitionType.scale,
          alignment: Alignment.bottomCenter,
        ),
      },
    );
  }

    Future messageHistoryAction(BuildContext context) async {
    context.pushNamed(
      'messageHistoryPage',
      extra: <String, dynamic>{
        kTransitionInfoKey: const TransitionInfo(
          hasTransition: true,
          transitionType: PageTransitionType.scale,
          alignment: Alignment.bottomCenter,
        ),
      },
    );
  }


}