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

class GeneralInstructions extends StatelessWidget {
  List<GetGeneralInstructions> getGeneralInstructionsList;
  late ProjectViewModel projectViewModel;

  GeneralInstructions({required this.getGeneralInstructionsList});

  @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).generalInstructions,
                  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: getGeneralInstructionsList.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(projectViewModel.isArabic ? getGeneralInstructionsList[index].textN! : getGeneralInstructionsList[index].text!,
                                  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),
                        );
                      },
                    )),
                  ),
                ),
              ),
            )
          ],
        ));
  }
}
