import 'package:doctor_app_flutter/core/viewModel/referred_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/doctor/my_referred_patient_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';

import '../../widgets/shared/app_scaffold_widget.dart';

class MyReferredPatient extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return BaseView<ReferredPatientViewModel>(
        onModelReady: (model) => model.getMyReferredPatient(),
        builder: (_, model, w) => AppScaffold(
              baseViewModel: model,
              isShowAppBar: false,
              appBarTitle: TranslationBase.of(context).myReferredPatient,
              body: model.listMyReferredPatientModel.length == 0
                  ? Center(
                      child: AppText(
                        TranslationBase.of(context).errorNoSchedule,
                        color: Theme.of(context).errorColor,
                      ),
                    )
                  : Container(
                      padding: EdgeInsetsDirectional.fromSTEB(20, 0, 20, 0),
                      child: ListView(
                        children: <Widget>[
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              SizedBox(
                                height: 100,
                              ),
                              Container(
                                child: Column(
                                  //children: referredPatientProvider.listMyReferralPatientModel.map((item) {
                                  children: model.listMyReferredPatientModel
                                      .map((item) {
                                    return MyReferredPatientWidget(
                                        myReferredPatientModel: item,
                                        model: model);
                                  }).toList(),
                                ),
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
            ));
  }
}
