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.
339 lines
16 KiB
Dart
339 lines
16 KiB
Dart
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
import 'package:doctor_app_flutter/models/my_referral_patient_model.dart';
|
|
import 'package:doctor_app_flutter/providers/referral_patient_provider.dart';
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_button.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:provider/provider.dart';
|
|
|
|
class MyReferralPatientWidget extends StatefulWidget {
|
|
final MyReferralPatientModel myReferralPatientModel;
|
|
|
|
MyReferralPatientWidget({Key key, this.myReferralPatientModel});
|
|
|
|
@override
|
|
_MyReferralPatientWidgetState createState() =>
|
|
_MyReferralPatientWidgetState();
|
|
}
|
|
|
|
class _MyReferralPatientWidgetState extends State<MyReferralPatientWidget> {
|
|
bool _showDetails = false;
|
|
bool _isLoading = false;
|
|
final _formKey = GlobalKey<FormState>();
|
|
String error;
|
|
TextEditingController answerController;
|
|
|
|
@override
|
|
void initState() {
|
|
answerController = new TextEditingController(text: widget.myReferralPatientModel.referredDoctorRemarks ?? '');
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CardWithBgWidgetNew(
|
|
widget: Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: <Widget>[
|
|
AppText(
|
|
'${widget.myReferralPatientModel.firstName} ${widget.myReferralPatientModel.lastName}',
|
|
fontSize: 2.5 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
_showDetails = !_showDetails;
|
|
});
|
|
},
|
|
child: Icon(_showDetails
|
|
? Icons.keyboard_arrow_up
|
|
: Icons.keyboard_arrow_down)),
|
|
],
|
|
),
|
|
!_showDetails
|
|
? Container()
|
|
: AnimatedContainer(
|
|
duration: Duration(milliseconds: 200),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Divider(color: Colors.grey),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(
|
|
'File No',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
AppText(
|
|
'${widget.myReferralPatientModel.referringDoctor}',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.w300,
|
|
)
|
|
],
|
|
),
|
|
|
|
),
|
|
Container(
|
|
height: SizeConfig.realScreenWidth * 0.1,
|
|
width: 0.8,
|
|
color: Colors.grey,
|
|
margin: EdgeInsets.only(left: 15, right: 15),
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(
|
|
'Referring Doctor',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
AppText(
|
|
widget.myReferralPatientModel
|
|
.referringClinicDescription,
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.w300,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
Divider(color: Colors.grey),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(
|
|
'Referring Clinic',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
AppText(
|
|
'${widget.myReferralPatientModel.referringClinicDescription}',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.w300,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: SizeConfig.realScreenWidth * 0.1,
|
|
width: 0.8,
|
|
color: Colors.grey,
|
|
margin: EdgeInsets.only(left: 15, right: 15),
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(
|
|
'Frequency',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
AppText(
|
|
widget.myReferralPatientModel
|
|
.frequencyDescription,
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.w300,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(color: Colors.grey),
|
|
Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(
|
|
'Priority',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
AppText(
|
|
'${widget.myReferralPatientModel.priorityDescription}',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.w300,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: SizeConfig.realScreenWidth * 0.1,
|
|
width: 0.8,
|
|
color: Colors.grey,
|
|
margin: EdgeInsets.only(left: 15, right: 15),
|
|
),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(
|
|
'Max Response Time',
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
AppText(
|
|
Helpers.getDateFormatted(widget
|
|
.myReferralPatientModel
|
|
.mAXResponseTime),
|
|
fontSize:
|
|
1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.w300,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(color: Colors.grey),
|
|
AppText(
|
|
'Clinic Details and Remarks',
|
|
fontSize: 1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
textAlign: TextAlign.start,
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Texts(
|
|
'73 years old female known case of HTN and dm on regular medication one day prior the patient had rt sided weakness suddenly and reduced level of conscoiusness no vomting no headache no bluriing of vision no other relevant symptoms.\r\nPMH:No history of similar condition no history of surgey or blood transfusions\r\nCT brain was done apparently effaced left insular cortex',
|
|
style: "bodyText1",
|
|
readMore: true,
|
|
textAlign: TextAlign.start,
|
|
maxLength: 100),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
AppText(
|
|
'Answer/Suggestions',
|
|
fontSize: 1.7 * SizeConfig.textMultiplier,
|
|
fontWeight: FontWeight.bold,
|
|
textAlign: TextAlign.start,
|
|
),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Form(
|
|
key: _formKey,
|
|
child: TextFields(
|
|
maxLines: 2,
|
|
minLines: 2,
|
|
hintText: 'Answer the patient',
|
|
initialValue: widget.myReferralPatientModel.referredDoctorRemarks ?? '',
|
|
readOnly: _isLoading,
|
|
validator: (value) {
|
|
if (value.isEmpty)
|
|
return "please enter answer";
|
|
else
|
|
return null;
|
|
},
|
|
),
|
|
),
|
|
SizedBox(height: 10.0),
|
|
if (error != null && error.isNotEmpty)
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(6.0),
|
|
color: Theme.of(context)
|
|
.errorColor
|
|
.withOpacity(0.06),
|
|
),
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 8.0, horizontal: 12.0),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Expanded(
|
|
child: Texts(error ?? "",
|
|
style: "bodyText1",
|
|
color: Theme.of(context)
|
|
.errorColor)),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: 10.0),
|
|
],
|
|
),
|
|
SizedBox(height: 10.0),
|
|
Container(
|
|
width: double.infinity,
|
|
child: Button(
|
|
onTap: () async {
|
|
final form = _formKey.currentState;
|
|
if (form.validate()) {
|
|
setState(() {
|
|
_isLoading = true;
|
|
});
|
|
try {
|
|
await Provider.of<MyReferralPatientProvider>(context, listen: false).replay(answerController.text.toString(), widget.myReferralPatientModel);
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
} catch (e) {
|
|
setState(() {
|
|
error = e.toString();
|
|
_isLoading = false;
|
|
});
|
|
}
|
|
}
|
|
},
|
|
title: 'Reply',
|
|
loading: _isLoading,
|
|
),
|
|
)
|
|
],
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|