import 'package:diplomaticquarterapp/core/viewModels/medical/AllergiesViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class AllergiesPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return BaseView<AllergiesViewModel>(
      onModelReady: (model) => model.getAllergies(),
      builder: (_, model, w) => AppScaffold(
        isShowAppBar: true,
        appBarTitle: TranslationBase.of(context).allergies,
        baseViewModel: model,
        body: 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 ?? ''),
                    ],
                  ),
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}
