import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/new_text_Field.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../custom_validation_error.dart';

class UpdateChiefComplaints extends StatelessWidget {
  const UpdateChiefComplaints({
    Key key,
    @required this.formKey,
    @required this.complaintsController,
    @required this.illnessController,
    @required this.medicationController,
    this.complaintsControllerError,
    this.illnessControllerError,
    this.medicationControllerError,
  }) : super(key: key);

  final GlobalKey<FormState> formKey;
  final TextEditingController complaintsController;
  final TextEditingController illnessController;
  final TextEditingController medicationController;
  final String complaintsControllerError;
  final String illnessControllerError;
  final String medicationControllerError;

  @override
  Widget build(BuildContext context) {
    return Form(
      key: formKey,
      child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
        SizedBox(
          height: 20,
        ),
        //TODO handel error cases
        NewTextFields(
          hintText: TranslationBase.of(context).addChiefComplaints,
          controller: complaintsController,
          maxLines: 25,
          minLines: 3,
        ),

        Container(
            child: CustomValidationError(
          error: complaintsControllerError,
        )),

        // Container(
        //   margin:
        //   EdgeInsets.only(left: 10, right: 10, top: 15),
        //   child: TextFields(
        //       hasLabelText: complaintsController.text != ''
        //           ? true
        //           : false,
        //       hintText: TranslationBase
        //           .of(context)
        //           .addChiefComplaints,
        //       fontSize: 13.5,
        //       // hintColor: Colors.black,
        //       showLabelText: true,
        //       fontWeight: FontWeight.w600,
        //       maxLines: 25,
        //       minLines: 13,
        //       controller: complaintsController,
        //       validator: (value) {
        //         if (value == null || value == "")
        //           return TranslationBase.of(context)
        //               .emptyMessage;
        //         else if (value.length < 25)
        //           return TranslationBase
        //               .of(context)
        //               .chiefComplaintLength;
        //         //"";
        //         else
        //           return null;
        //       }),
        // ),
            SizedBox(
              height: 20,
            ),

            NewTextFields(
              hintText: TranslationBase
                  .of(context)
                  .historyOfPresentIllness,
              controller: illnessController,
              maxLines: 25,
              minLines: 3,
            ),
            Container(
                child: CustomValidationError(error: illnessControllerError,)),
            SizedBox(
              height: 20,
            ),
            SizedBox(
              height: 10,
            ),
            UpdateMedicationWidget(
              medicationController: medicationController,
            ),
            SizedBox(
              height: 10,
            ),
            NewTextFields(
              hintText: TranslationBase
                  .of(context)
                  .currentMedications,
              controller: medicationController,
              maxLines: 25,
              minLines: 3,
            ),
            Container(child: CustomValidationError(
              error: medicationControllerError,)),
            SizedBox(
              height: 10,
            ),
          ]),
    );
  }
}