import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';

void prescriptionWarning(context) {
  showModalBottomSheet(
      context: context,
      isScrollControlled: true,
      builder: (BuildContext bc) {
        return SingleChildScrollView(
            child: Padding(
          padding: const EdgeInsets.all(12.0),
          child: Container(
            height: 600,
            child: Column(
              children: [
                ...List.generate(
                  5,
                  (index) => Container(
                    child: ExpansionTile(
                      title: AppText('Prescription warning and alerts(0)'),
                      children: [
                        Column(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            AppText(
                              'DOSESCREENINGRESULTFORETCETC',
                              color: Color(0XFFB8382C),
                            )
                          ],
                        )
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: 10.0,
                ),
                Container(
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.all(Radius.circular(6.0)),
                      border:
                          Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
                  child: AppTextFormField(
                    labelText: 'Remarks',
                    borderColor: Colors.white,
                    textInputType: TextInputType.number,
                    inputFormatter: ONLY_NUMBERS,
                  ),
                ),
                SizedBox(
                  height: 95.0,
                ),
                Container(
                  margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
                  child: Wrap(
                    alignment: WrapAlignment.center,
                    children: <Widget>[
                      AppButton(
                        title: 'CONTINUE',
                        onPressed: () {
                          Navigator.pop(context);
                          authorizationForm(context);
                        },
                      ),
                    ],
                  ),
                ),
                Container(
                  margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
                  child: Wrap(
                    alignment: WrapAlignment.center,
                    children: <Widget>[
                      AppButton(
                        color: Colors.white,
                        title: 'remove',
                        fontColor: Colors.red,
                        onPressed: () {
                          Navigator.pop(context);
                          prescriptionWarning(context);
                        },
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ));
      });
}

void authorizationForm(context) {
  showModalBottomSheet(
      context: context,
      isScrollControlled: true,
      builder: (BuildContext bc) {
        return Container(
            height: 500,
            child: Form(
              child: Padding(
                padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    AppText(
                      'Prescription authorization'.toUpperCase(),
                      fontWeight: FontWeight.w900,
                    ),
                    SizedBox(
                      height: 30.0,
                    ),
                    Container(
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(6.0)),
                          border: Border.all(
                              width: 1.0, color: HexColor("#CCCCCC"))),
                      child: AppTextFormField(
                        labelText: 'Auth ID',
                        borderColor: Colors.white,
                        textInputType: TextInputType.number,
                        inputFormatter: ONLY_NUMBERS,
                      ),
                    ),
                    SizedBox(
                      height: 12.0,
                    ),
                    Container(
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(6.0)),
                          border: Border.all(
                              width: 1.0, color: HexColor("#CCCCCC"))),
                      child: AppTextFormField(
                        labelText: 'Password',
                        borderColor: Colors.white,
                        textInputType: TextInputType.text,
                        inputFormatter: ONLY_LETTERS,
                        obscureText: true,
                      ),
                    ),
                    SizedBox(
                      height: 190.0,
                    ),
                    Container(
                      margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
                      child: Wrap(
                        alignment: WrapAlignment.center,
                        children: <Widget>[
                          AppButton(
                            title: 'CONTINUE',
                            onPressed: () {
                              Navigator.pop(context);
                              authorizationForm(context);
                            },
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ));
      });
}
