import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/EReferral/search_e_referral_response_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class ReferralDetails extends StatefulWidget { final SearchEReferralResponseModel referral; const ReferralDetails({Key key, @required this.referral}) : super(key: key); @override _ReferralDetailsState createState() => _ReferralDetailsState(); } class _ReferralDetailsState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, showNewAppBar: true, showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).ereferral, body: Column( children: [ Container( width: double.infinity, child: Container( decoration: cardRadius(12), margin: EdgeInsets.only(left: 16, top: 8, right: 16, bottom: 16), child: Padding( padding: const EdgeInsets.all(15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( margin: EdgeInsets.only(bottom: 10.0), child: Text(TranslationBase.of(context).ereferral, style: TextStyle(letterSpacing: -0.64, color: Colors.black, fontSize: 18.0, fontWeight: FontWeight.bold)), ), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).referralStatus), ), Expanded( child: _getNormalText(projectViewModel.isArabic ? widget.referral.statusAr : widget.referral.status, isBold: true), ) ], ), ), mDivider(Colors.grey[600]), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).patientName), ), Expanded( child: _getNormalText(widget.referral.patientName, isBold: true), ) ], ), ), mDivider(Colors.grey[600]), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).referralNumber), ), Expanded( child: _getNormalText(widget.referral.referralNumber.toString(), isBold: true), ) ], ), ), mDivider(Colors.grey[600]), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).referralDate), ), Expanded( child: _getNormalText(DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(widget.referral.referralDate)), isBold: true), ) ], ), ), mDivider(Colors.grey[600]), Container( width: double.infinity, padding: EdgeInsets.only(top: 10, bottom: 5), child: Row( children: [ Expanded( child: _getNormalText(TranslationBase.of(context).hospital), ), Expanded( child: _getNormalText(widget.referral.preferredBranchName ?? "", isBold: true), ) ], ), ), ], ), ), )), ], )); } _getNormalText(text, {bool isBold = false}) { return Text( text, style: TextStyle( fontSize: isBold ? 14 : 12, letterSpacing: -0.5, color: isBold ? Colors.black : Colors.grey[700], fontWeight: FontWeight.w600, ), ); } }