import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.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/patients/PatientCard.dart'; import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:flutter/material.dart'; import '../../routes.dart'; class LiveCarePatientScreen extends StatefulWidget { @override _LiveCarePatientScreenState createState() => _LiveCarePatientScreenState(); } class _LiveCarePatientScreenState extends State { @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { await model.getPendingPatientERForDoctorApp(); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( color: Colors.white, ), child: Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), margin: EdgeInsets.only(top: 50), child: Row(children: [ IconButton( icon: Icon(Icons.arrow_back_ios), color: Colors.black, //Colors.black, onPressed: () => Navigator.pop(context), ), Expanded( child: AppText( "Live Care Patients", fontSize: SizeConfig.textMultiplier * 2.8, fontWeight: FontWeight.bold, color: Color(0xFF2B353E), ), ), ]), ), ), model.state == ViewState.Idle ?Expanded( child: Container( child: model.filterData.isEmpty ? Center( child: ErrorMessage( error: TranslationBase.of(context) .youDontHaveAnyPatient, ), ) : ListView.builder( scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model.filterData.length, itemBuilder: (BuildContext ctxt, int index) { return Padding( padding: EdgeInsets.all(8.0), child: PatientCard( patientInfo: model.filterData[index], patientType: "0", arrivalType: "0", isFromSearch: false, isInpatient: false, isFromLiveCare:true, onTap: () { // TODO change the parameter to daynamic Navigator.of(context).pushNamed( PATIENTS_PROFILE, arguments: { "patient": model.filterData[index], "patientType": "0", "isSearch": false, "isInpatient": false, "arrivalType": "0", "isSearchAndOut": false, }); }, // isFromSearch: widget.isSearch, ), ); })), ):Expanded(child: AppLoaderWidget()), ], ), ), ); } }