import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/patient/prescription/prescription_report_for_in_patient.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'large_avatar.dart'; class PrescriptionInPatientWidget extends StatelessWidget { final List prescriptionReportForInPatientList; PrescriptionInPatientWidget( {Key key, this.prescriptionReportForInPatientList}); @override Widget build(BuildContext context) { return Container( child: prescriptionReportForInPatientList.length == 0 ? Center( child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( padding: EdgeInsets.all(40), decoration: BoxDecoration( border: Border.all(color: HexColor('#B8382C'), width: 4), borderRadius: BorderRadius.all(Radius.circular(100))), child: IconButton( icon: Icon( Icons.add, size: 35, ), onPressed: () { // openAddPrescription(context); }), ), Padding( child: AppText( TranslationBase.of(context).noPrescription, fontWeight: FontWeight.bold, ), padding: EdgeInsets.all(10), ), AppText( TranslationBase.of(context).applyNow, fontWeight: FontWeight.bold, color: HexColor('#B8382C'), ) ], ), )) : Container( margin: EdgeInsets.fromLTRB(SizeConfig.realScreenWidth * 0.05, 0, SizeConfig.realScreenWidth * 0.05, 0), child: ListView.builder( itemCount: prescriptionReportForInPatientList.length, itemBuilder: (BuildContext context, int index) { return InkWell( onTap: () { Navigator.of(context).pushNamed( IN_PATIENT_PRESCRIPTIONS_DETAILS, arguments: { 'prescription': prescriptionReportForInPatientList[index] }); }, child: CardWithBgWidgetNew( widget: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ LargeAvatar( name: prescriptionReportForInPatientList[index] .createdByName, radius: 10, width: 70, ), Expanded( child: Container( margin: EdgeInsets.only(left: 15, right: 15), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( '${prescriptionReportForInPatientList[index].createdByName}', fontSize: 2.5 * SizeConfig.textMultiplier, ), SizedBox( height: 8, ), AppText( '${prescriptionReportForInPatientList[index].itemDescription}', fontSize: 2.5 * SizeConfig.textMultiplier, color: Theme.of(context).primaryColor), SizedBox( height: 8, ), ], ), ), ) ], ), ], ), )); }, ), ), ); } }