import 'package:hmg_patient_app/core/model/ImagesInfo.dart';
import 'package:hmg_patient_app/core/viewModels/medical/AllergiesViewModel.dart';
import 'package:hmg_patient_app/pages/base/base_view.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/data_display/text.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class AllergiesPage extends StatelessWidget {
  List<ImagesInfo> imagesInfo =[];
  @override
  Widget build(BuildContext context) {
    imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/alllergies/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/alllergies/ar/0.png'));
    return BaseView<AllergiesViewModel>(
      onModelReady: (model) => model.getAllergies(),
      builder: (_, model, w) => AppScaffold(
        isShowAppBar: true,
        showNewAppBar: true,
        showNewAppBarTitle: true,
        appBarTitle: TranslationBase.of(context).allergies,
        baseViewModel: model,
        description: TranslationBase.of(context).infoAllergies,
        imagesInfo: imagesInfo,
        body: model.allergies.isNotEmpty ? ListView.builder(
          itemCount: model.allergies.length,
          itemBuilder: (context, index) => Container(
            margin: EdgeInsets.all(15),
            padding: EdgeInsets.all(10),
            decoration: BoxDecoration(
              shape: BoxShape.rectangle,
              color: Colors.white,
            ),
            child: Row(
              children: [
                Image.asset(
                  'assets/images/new-design/allergiesDetails.png',
                  width: 50,
                  height: 50,
                  fit: BoxFit.cover,
                ),
                SizedBox(
                  width: 15,
                ),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Texts(TranslationBase.of(context).remarks+" :"),
                      Texts(TranslationBase.of(context).description + ": " + model.allergies[index].description! ?? ''),
                    ],
                  ),
                )
              ],
            ),
          ),
        ) : getNoDataWidget(context),
      ),
    );
  }
}
