You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RSGDoctorApp/lib/widgets/doctor/doctor_reply_widget.dart

243 lines
11 KiB
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/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/doctor/list_gt_my_patients_question_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.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_bg_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class DoctorReplyWidget extends StatefulWidget {
final ListGtMyPatientsQuestions reply;
bool isShowMore = false;
DoctorReplyWidget({Key? key, required this.reply});
@override
_DoctorReplyWidgetState createState() => _DoctorReplyWidgetState();
}
class _DoctorReplyWidgetState extends State<DoctorReplyWidget> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
child: CardWithBgWidget(
bgColor: widget.reply.status == 2 ? Color(0xFF2E303A) : Color(0xFFD02127),
hasBorder: false,
widget: Container(
// padding: EdgeInsets.only(left: 20, right: 0, bottom: 0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
RichText(
text: new TextSpan(
style: new TextStyle(fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: widget.reply.status == 2
? "Active"
: widget.reply.status == 1
? "Hold"
: "Cancelled", //TranslationBase.of(context).replied :TranslationBase.of(context).unReplied ,
style: TextStyle(
color: widget.reply.status == 2 ? Color(0xFF2E303A) : Color(0xFFD02127),
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
fontSize: 2.0 * SizeConfig.textMultiplier)),
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
AppText(
AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn!).day.toString() +
" " +
AppDateUtils.getMonth(
AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn!).month)
.toString()
.substring(0, 3) +
' ' +
AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn!).year.toString(),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
AppText(
AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn!).hour.toString() +
":" +
AppDateUtils.getDateTimeFromServerFormat(widget.reply.createdOn!).minute.toString(),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
)
],
),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: AppText(
Helpers.capitalize(widget.reply.patientName),
fontSize: SizeConfig.textMultiplier * 2.5,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 4),
child: InkWell(
onTap: () {
launch("tel://" + widget.reply.mobileNumber!);
},
child: Icon(
Icons.phone,
color: Colors.black87,
),
),
),
SizedBox(
width: 4,
),
widget.reply.gender == 1
? Icon(
DoctorApp.male_2,
color: Colors.blue,
)
: Icon(
DoctorApp.female_1,
color: Colors.pink,
),
],
),
SizedBox(
height: 20,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 5),
width: 60,
height: 60,
child: Image.asset(
widget.reply.gender == 1
? 'assets/images/male_avatar.png'
: 'assets/images/female_avatar.png',
fit: BoxFit.cover,
),
),
],
),
SizedBox(
width: 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// SizedBox(height: 10,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: new TextSpan(
style: new TextStyle(fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context).fileNumber,
style: TextStyle(
fontSize: 14,
color: Color(0xFF575757),
fontWeight: FontWeight.bold,
fontFamily: 'Poppins')),
new TextSpan(
text: widget.reply.patientID.toString(),
style: TextStyle(
fontWeight: FontWeight.w700, fontFamily: 'Poppins', fontSize: 15)),
],
),
),
Container(
width: MediaQuery.of(context).size.width * 0.45,
child: RichText(
text: new TextSpan(
style: new TextStyle(
fontSize: 2.0 * SizeConfig.textMultiplier,
color: Colors.black,
fontFamily: 'Poppins',
),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context).age! + " : ",
style: TextStyle(
fontSize: 14, color: Color(0xFF575757), fontWeight: FontWeight.bold)),
new TextSpan(
text: "${AppDateUtils.getAgeByBirthday(widget.reply.dateofBirth!, context)}",
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 15)),
],
),
),
)
],
),
],
),
Container(
width: MediaQuery.of(context).size.width * 0.5,
child: RichText(
maxLines: 3,
overflow: TextOverflow.ellipsis,
text: new TextSpan(
style: new TextStyle(fontSize: 2.0 * SizeConfig.textMultiplier, color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: "Patient Question :", //TranslationBase.of(context).doctorResponse + " : ",
style: TextStyle(
fontSize: 14,
fontFamily: 'Poppins',
color: Color(0xFF575757),
fontWeight: FontWeight.bold)),
new TextSpan(
text: widget.reply?.remarks?.trim() ?? '',
style: TextStyle(fontFamily: 'Poppins', color: Color(0xFF575757), fontSize: 12)),
],
),
),
),
],
)
],
),
// Container(
// alignment: projectViewModel.isArabic?Alignment.centerLeft:Alignment.centerRight,
// child: Icon(FontAwesomeIcons.arrowRight,
// size: 20, color: Colors.black),)
],
),
// onTap: onTap,
)),
),
);
}
}