import 'package:flutter/material.dart';
import 'package:hub/features/storage/index.dart';
import 'package:hub/shared/mixins/switcher_mixin.dart';

import '/components/templates_components/sign_up_template_component/sign_up_template_component_widget.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'sign_up_page_model.dart';

export 'sign_up_page_model.dart';

class SignUpPageWidget extends StatefulWidget with Switcher {
  const SignUpPageWidget({super.key});

  @override
  State<SignUpPageWidget> createState() => _SignUpPageWidgetState();
}

class _SignUpPageWidgetState extends State<SignUpPageWidget> {
  late SignUpPageModel _model;

  final scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  void initState() {
    super.initState();
    _model = createModel(context, () => SignUpPageModel());
  }

  @override
  void dispose() {
    _model.dispose();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    StorageHelper().context = context;
    return GestureDetector(
      onTap: () => _model.unfocusNode.canRequestFocus
          ? FocusScope.of(context).requestFocus(_model.unfocusNode)
          : FocusScope.of(context).unfocus(),
      child: Scaffold(
        key: scaffoldKey,
        backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
        body: SafeArea(
          top: true,
          child: wrapWithModel(
            model: _model.signUpTemplateComponentModel,
            updateCallback: () => setState(() {}),
            updateOnChange: true,
            child: SignUpTemplateComponentWidget(
              toggleSignInPage: () async {
                await Switcher.toggleSignInPage(context);
                safeSetState(() {});
              },
            ),
          ),
        ),
      ),
    );
  }
}
