import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils_new.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';

import '../../models/InPatientServices/get_medical_instructions_response_model.dart';

class MedicalInstructionsPage extends StatefulWidget {
  List<GetMedicalInstructions> getMedicalInstructionsList;

  MedicalInstructionsPage({required this.getMedicalInstructionsList});

  @override
  State<MedicalInstructionsPage> createState() => _MedicalInstructionsPageState();
}

class _MedicalInstructionsPageState extends State<MedicalInstructionsPage> {
  late ProjectViewModel projectViewModel;

  @override
  Widget build(BuildContext context) {
    projectViewModel = Provider.of(context);
    return AppScaffold(
        isShowAppBar: true,
        isShowDecPage: false,
        showNewAppBarTitle: true,
        showNewAppBar: true,
        appBarTitle: TranslationBase.of(context).InPatientServicesHeader,
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisSize: MainAxisSize.min,
          children: [
            Padding(
              padding: const EdgeInsets.all(21.0),
              child: Text(TranslationBase.of(context).medicalInstructions,
                  overflow: TextOverflow.clip,
                  style: TextStyle(
                    fontSize: 21.0,
                    fontWeight: FontWeight.w600,
                    color: Color(0xff2B353E),
                    letterSpacing: -0.64,
                  )),
            ),
            Expanded(
              child: Container(
                width: MediaQuery.of(context).size.width,
                child: Card(
                  elevation: 0.0,
                  margin: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0),
                  color: Colors.white,
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(10),
                    side: BorderSide(color: Colors.transparent, width: 0.0),
                  ),
                  child: Padding(
                    padding: EdgeInsets.all(16.0),
                    child: Container(
                        child: ListView.separated(
                      itemCount: widget.getMedicalInstructionsList[0].medicaLInstructionsField!.length,
                      itemBuilder: (BuildContext context, int index) {
                        return Container(
                            child: Row(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Container(
                              child: SvgPicture.asset("assets/images/new-design/ionic-ios-checkmark-circle.svg"),
                            ),
                            Container(
                              width: MediaQuery.of(context).size.width * 0.75,
                              margin: EdgeInsets.only(left: 5.0, right: 5.0),
                              child: Text(widget.getMedicalInstructionsList[0].medicaLInstructionsField![index].descriptionField!,
                                  overflow: TextOverflow.clip,
                                  style: TextStyle(
                                    fontSize: 14.0,
                                    fontWeight: FontWeight.w600,
                                    color: Color(0xff2B353E),
                                    letterSpacing: -0.64,
                                  )),
                            ),
                          ],
                        ));
                      },
                      separatorBuilder: (BuildContext context, int index) {
                        return Padding(
                          padding: const EdgeInsets.only(left: 14, right: 14),
                          child: mHeight(16.0),
                        );
                      },
                    )),
                  ),
                ),
              ),
            )
          ],
        ));
  }
}
