import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:flutter_svg/svg.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:fluttericon/typicons_icons.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:unit2/screens/sos/components/mobile.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart';

import '../../theme-data.dart/btn-style.dart';
import '../../theme-data.dart/form-style.dart';
import '../../utils/global.dart';

class RequestSOS extends StatefulWidget {
  const RequestSOS({super.key});

  @override
  State<RequestSOS> createState() => _RequestSOSState();
}

class _RequestSOSState extends State<RequestSOS> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: const Text(sOSTitle),
          backgroundColor: second,
        ),
        body: SingleChildScrollView(
          child: Container(
              height: screenHeight * .89,
              padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
              child: Column(
                children: [
                  SizedBox(
                    height: blockSizeVertical * 2,
                  ),
                  SvgPicture.asset(
                    'assets/svgs/request_sos.svg',
                    height: blockSizeVertical * 22,
                    allowDrawingOutsideViewBox: true,
                  ),
                  Mobile(
                      title: "09661548775",
                      subtitle: mobile1,
                      onPressed: () {}),
                  const Divider(),
                  Mobile(
                      title: "09661548775",
                      subtitle: mobile2,
                      onPressed: () {}),
                  const Divider(),
                  ListTile(
                    leading: const Icon(
                      Typicons.location,
                      color: second,
                    ),
                    title: Text("Latitude/Longitude"),
                    subtitle: Text(
                      currentLocation,
                      style: Theme.of(context).textTheme.caption,
                    ),
                  ),
                  FormBuilderTextField(
                    name: "message",
                    validator: FormBuilderValidators.compose([
                      FormBuilderValidators.required(
                          errorText: messageRequired)
                    ]),
                    autovalidateMode: AutovalidateMode.onUserInteraction,
                    maxLines: 5,
                    decoration: normalTextFieldStyle("", sosMessage),
                  ),
                 const Expanded(
                    child: SizedBox(),
                  ),
                  SizedBox(
                    width: double.infinity,
                    height: screenHeight * .06,
                    child: ElevatedButton(
                      style: secondaryBtnStyle(
                          second, Colors.transparent, Colors.white54),
                      child: const Text(
                        submit,
                        style: TextStyle(color: Colors.white),
                      ),
                      onPressed: () {
                        // if (_formKey.currentState.validate()) {
                        //   _formKey.currentState.save();
                        //   BlocProvider.of<UserBloc>(context)
                        //       .add(UserWebLogin(
                        //           password: password,
                        //           username: username));
                        // }
                      },
                    ),
                  ),
                ],
              )),
        ),
      ),
    );
  }
}
