import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';

void addPrescriptionForm(context) {
  final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
  final double spaceBetweenTextFileds = 12;
  showModalBottomSheet(
      isScrollControlled: true,
      context: context,
      builder: (BuildContext bc) {
        return SingleChildScrollView(
          child: Container(
            height: 700,
            child: Padding(
              padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                //mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  AppText(
                    TranslationBase.of(context).medicines.toUpperCase(),
                    fontWeight: FontWeight.w900,
                  ),
                  SizedBox(
                    height: spaceBetweenTextFileds,
                  ),
                  Container(
                    child: Form(
                      key: _formKey,
                      child: Column(
                        //mainAxisAlignment: MainAxisAlignment.end,
                        children: [
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText:
                                  TranslationBase.of(context).searchMedicine,
                              borderColor: Colors.white,
                              textInputType: TextInputType.text,
                              inputFormatter: ONLY_LETTERS,
                            ),
                          ),
                          SizedBox(
                            height: spaceBetweenTextFileds,
                          ),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).orderType,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).strength,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).route,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).frequency,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).doseTime,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).indication,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).fromDate,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText: TranslationBase.of(context).duration,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(6.0)),
                                border: Border.all(
                                    width: 1.0, color: HexColor("#CCCCCC"))),
                            child: AppTextFormField(
                              labelText:
                                  TranslationBase.of(context).instruction,
                              borderColor: Colors.white,
                              textInputType: TextInputType.number,
                              inputFormatter: ONLY_NUMBERS,
                            ),
                          ),
                          SizedBox(height: spaceBetweenTextFileds),
                          Container(
                            margin:
                                EdgeInsets.all(SizeConfig.widthMultiplier * 5),
                            child: Wrap(
                              alignment: WrapAlignment.center,
                              children: <Widget>[
                                AppButton(
                                  title:
                                      TranslationBase.of(context).addMedication,
                                  onPressed: () {
                                    Navigator.pop(context);
                                    prescriptionWarning(context);
                                  },
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        );
      });
}
