import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; // ignore: must_be_immutable class PatientProfileButton extends StatelessWidget { final String nameLine1; final String nameLine2; final String icon; final dynamic route; final PatiantInformtion patient; final String patientType; String arrivalType; final bool isInPatient; String from; String to; final String url = "assets/images/"; final bool isDisable; final bool isLoading; final Function onTap; final bool isDischargedPatient; final bool isSelectInpatient; final bool isDartIcon; final IconData dartIcon; final bool isFromLiveCare; final Color color; PatientProfileButton({ Key key, this.patient, this.patientType, this.arrivalType, this.nameLine1, this.nameLine2, this.icon, this.route, this.isDisable = false, this.onTap, this.isLoading = false, this.from, this.to, this.isInPatient = false, this.isDischargedPatient = false, this.isSelectInpatient = false, this.isDartIcon = false, this.dartIcon, this.isFromLiveCare = false, this.color, }) : super(key: key); @override Widget build(BuildContext context) { ProjectViewModel projectsProvider = Provider.of(context); return Container( margin: EdgeInsets.symmetric(horizontal: 0.0), padding: EdgeInsets.symmetric(horizontal: 8, vertical: 0), child: InkWell( onTap: isDisable ? null : onTap != null ? onTap : () { navigator(context, this.route); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( padding: EdgeInsets.fromLTRB(8, 0, 8, 8), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Container( child: isDartIcon ? Icon( dartIcon, size: 30, color: color ?? Color(0xFF333C45), ) : new SvgPicture.asset( icon, width: 30, height: 30, ), ) ], )), Container( alignment: projectsProvider.isArabic ? Alignment.topRight : Alignment.topLeft, padding: EdgeInsets.symmetric(horizontal: 7), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ AppText( !projectsProvider.isArabic ? this.nameLine1 : nameLine2, color: color ?? AppGlobal.appTextColor, letterSpacing: -0.33, fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 1.30, ), AppText( !projectsProvider.isArabic ? this.nameLine2 : nameLine1, color: color ?? Color(0xFF2B353E), fontWeight: FontWeight.w600, textAlign: TextAlign.left, fontSize: SizeConfig.textMultiplier * 1.30, ), if (isLoading) DrAppCircularProgressIndeicator() ], ), ), ]), ), decoration: BoxDecoration( // border: Border.all(), color: isDisable ? Colors.grey.withOpacity(0.4) : Colors.white, borderRadius: BorderRadius.all(Radius.circular(15)), border: Border.fromBorderSide(BorderSide( color: color ?? Color(0xFFEFEFEF), width: 1, )), ), ); } void navigator(BuildContext context, route) { if (route == null) return; if (from == null) { from = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); } if (to == null) { to = AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd'); } if (arrivalType == null) { arrivalType = "0"; } Navigator.of(context).pushNamed(route, arguments: { 'patient': patient, 'from': from, 'to': to, 'patientType': patientType, 'arrivalType': arrivalType, 'isInpatient': isInPatient, 'isDischargedPatient': isDischargedPatient, 'isSelectInpatient': isSelectInpatient, "isFromLiveCare": isFromLiveCare }); } }