my doctor screen.

merge-update-with-lab-changes
Sikander Saleem 5 years ago
parent ec6693c55e
commit 350ff20a1a

@ -4,6 +4,9 @@ import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsLis
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
@ -21,109 +24,82 @@ class DoctorView extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: () { onTap: () {
if(isShowFlag) if (isShowFlag) getDoctorsProfile(context, doctor);
getDoctorsProfile(context, doctor);
}, },
child: Card(
margin: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0),
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container( child: Container(
decoration: BoxDecoration(), decoration: BoxDecoration(
padding: EdgeInsets.all(7.0), borderRadius: BorderRadius.all(
width: MediaQuery.of(context).size.width, Radius.circular(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 1,
child: ClipRRect(
borderRadius: BorderRadius.circular(100.0),
child: Image.network(this.doctor.doctorImageURL,
fit: BoxFit.fill, height: 60.0, width: 60.0),
), ),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
), ),
Expanded( ],
flex: 4, color: Colors.white),
child: Container( child: Padding(
width: MediaQuery.of(context).size.width * 0.55, padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: [
if (doctor.doctorTitle != null) if (doctor.doctorTitle != null)
Text(this.doctor.doctorTitle + " " + this.doctor.name, Text(
style: TextStyle( doctor.doctorTitle + " " + doctor.name,
fontSize: 14.0, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
color: Colors.grey[700],
letterSpacing: 1.0)),
Container(
margin: EdgeInsets.only(top: 3.0),
child: Text(
this.doctor.clinicName != null
? this.doctor.clinicName
: "",
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
letterSpacing: 1.0)),
), ),
Container( if (doctor.doctorTitle != null) SizedBox(height: 6),
margin: EdgeInsets.only(top: 3.0), Row(
child: Text(this.doctor.projectName, mainAxisSize: MainAxisSize.min,
style: TextStyle( children: <Widget>[
fontSize: 12.0, LargeAvatar(
color: Colors.grey[600], name: doctor.name,
letterSpacing: 1.0)), url: doctor.doctorImageURL,
width: 48,
height: 48,
), ),
SizedBox(width: 11),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
if (doctor.clinicName != null) myRichText(TranslationBase.of(context).clinic + ":", doctor.clinicName),
if (doctor.projectName != null) myRichText(TranslationBase.of(context).hospital + ":", doctor.projectName),
if (doctor.speciality != null) if (doctor.speciality != null)
Container( Text(
margin: EdgeInsets.only(top: 3.0, bottom: 3.0), getDoctorSpeciality(this.doctor.speciality).trim(),
child: Text( style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12),
getDoctorSpeciality(this.doctor.speciality) ),
.trim(), if (doctor.nearestFreeSlot != null)
style: TextStyle( Text(
fontSize: 12.0, getDate(doctor.nearestFreeSlot),
color: Colors.grey[600], style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff359846), letterSpacing: -0.48, height: 18 / 12),
letterSpacing: 1.0)),
), ),
this.doctor.nearestFreeSlot != null
? Container(
margin: EdgeInsets.only(top: 3.0, bottom: 3.0),
child: Text(getDate(this.doctor.nearestFreeSlot),
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Colors.green[600],
letterSpacing: 1.0)),
)
: Container(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[
RatingBar.readOnly( RatingBar.readOnly(
initialRating: initialRating: this.doctor.actualDoctorRate.toDouble(),
this.doctor.actualDoctorRate.toDouble(), size: 15.0,
size: 20.0, filledColor: Color(0XFFD02127),
filledColor: Colors.yellow[700], emptyColor: Color(0XFFD02127),
emptyColor: Colors.grey[500],
isHalfAllowed: true, isHalfAllowed: true,
halfFilledIcon: Icons.star_half, halfFilledIcon: Icons.star_half,
filledIcon: Icons.star, filledIcon: Icons.star,
emptyIcon: Icons.star, emptyIcon: Icons.star_border,
), ),
isShowFlag ? Container( if (isShowFlag) Image.network(this.doctor.nationalityFlagURL, width: 22.0, height: 22.0)
child: Image.network(this.doctor.nationalityFlagURL,
width: 25.0, height: 25.0),
) : Container(),
], ],
), ),
], ],
), ),
), ),
],
), ),
], ],
), ),
@ -144,10 +120,7 @@ class DoctorView extends StatelessWidget {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
List<DoctorProfileList> docProfileList = []; List<DoctorProfileList> docProfileList = [];
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
service service.getDoctorsProfile(docObject.doctorID, docObject.clinicID, docObject.projectID, context).then((res) {
.getDoctorsProfile(docObject.doctorID, docObject.clinicID,
docObject.projectID, context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
if (res['DoctorProfileList'].length != 0) { if (res['DoctorProfileList'].length != 0) {
@ -155,8 +128,7 @@ class DoctorView extends StatelessWidget {
docProfileList.add(new DoctorProfileList.fromJson(v)); docProfileList.add(new DoctorProfileList.fromJson(v));
}); });
} else {} } else {}
navigateToDoctorProfile(context, docObject, docProfileList[0], navigateToDoctorProfile(context, docObject, docProfileList[0], isAppo: isAppo);
isAppo: isAppo);
} else { } else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']); AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
} }
@ -188,8 +160,7 @@ class DoctorView extends StatelessWidget {
} }
} }
Future navigateToDoctorProfile(context, docObject, docProfile, Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async {
{isAppo}) async {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(

@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -19,8 +20,10 @@ class DoctorHomePage extends StatelessWidget {
List<ImagesInfo> imagesInfo = List(); List<ImagesInfo> imagesInfo = List();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/0.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/0.png')); imagesInfo
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/1.png',imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/1.png')); .add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/0.png'));
imagesInfo
.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-doctor/ar/1.png'));
return BaseView<MyDoctorViewModel>( return BaseView<MyDoctorViewModel>(
onModelReady: (model) => model.getMyDoctor(), onModelReady: (model) => model.getMyDoctor(),
builder: (context, MyDoctorViewModel model, widget) => AppScaffold( builder: (context, MyDoctorViewModel model, widget) => AppScaffold(
@ -29,86 +32,70 @@ class DoctorHomePage extends StatelessWidget {
appBarTitle: TranslationBase.of(context).myDoctor, appBarTitle: TranslationBase.of(context).myDoctor,
description: TranslationBase.of(context).infoMyDoctor, description: TranslationBase.of(context).infoMyDoctor,
infoList: TranslationBase.of(context).infoMyDoctorPoints, infoList: TranslationBase.of(context).infoMyDoctorPoints,
showNewAppBar: true,
showNewAppBarTitle: true,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
body: SingleChildScrollView( backgroundColor: Color(0xffF8F8F8),
physics: BouncingScrollPhysics(), body: Column(
child: FractionallySizedBox(
widthFactor: 1.0,
child: Center(
child: Column(
children: <Widget>[ children: <Widget>[
Row( Row(
children: <Widget>[ children: <Widget>[
Expanded( MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, model.filterType, () {
flex: 1, model.setFilterType(FilterType.Clinic);
child: InkWell( }),
onTap: () => model.setFilterType(FilterType.Clinic), MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, model.filterType, () {
child: ListTile( model.setFilterType(FilterType.Hospital);
title: Text(TranslationBase.of(context).clinic), }),
leading: Radio(
value: FilterType.Clinic,
groupValue: model.filterType,
onChanged: (FilterType value) {
model.setFilterType(value);
},
),
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => model.setFilterType(FilterType.Hospital),
child: ListTile(
title: Text(TranslationBase.of(context).hospital),
leading: Radio(
value: FilterType.Hospital,
groupValue: model.filterType,
onChanged: (FilterType value) =>
model.setFilterType(value),
),
),
),
)
], ],
), ),
...List.generate( Expanded(
model.patientDoctorAppointmentList.length, child: FractionallySizedBox(
(index) => AppExpandableNotifier( widthFactor: 1.0,
title: model child: ListView.separated(
.patientDoctorAppointmentList[index].filterName, physics: BouncingScrollPhysics(),
bodyWidget: Column( separatorBuilder: (context, index) {
crossAxisAlignment: CrossAxisAlignment.start, return Container(
mainAxisAlignment: MainAxisAlignment.spaceBetween, height: 1,
children: model.patientDoctorAppointmentList[index] margin: EdgeInsets.only(left: 21, right: 21),
.patientDoctorAppointmentList color: Color(0xffD9D9D9),
.map((doctor) { );
},
itemBuilder: (context, index) {
return AppExpandableNotifier(
title: model.patientDoctorAppointmentList[index].filterName,
bodyWidget: ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
itemBuilder: (context, _index) {
DoctorList _doctorList = model.patientDoctorAppointmentList[index].patientDoctorAppointmentList[_index];
DoctorList doctorList = DoctorList( DoctorList doctorList = DoctorList(
projectID: doctor.projectID, projectID: _doctorList.projectID,
setupID: doctor.setupID, setupID: _doctorList.setupID,
clinicID: doctor.clinicID, clinicID: _doctorList.clinicID,
projectName: doctor.projectName, projectName: _doctorList.projectName,
clinicName: doctor.clinicName, clinicName: _doctorList.clinicName,
actualDoctorRate: doctor.actualDoctorRate, actualDoctorRate: _doctorList.actualDoctorRate,
doctorID: doctor.doctorID, doctorID: _doctorList.doctorID,
doctorRate: doctor.doctorRate, doctorRate: _doctorList.doctorRate,
gender: doctor.gender, gender: _doctorList.gender,
doctorTitle: doctor.doctorTitle, doctorTitle: _doctorList.doctorTitle,
name: doctor.name, name: _doctorList.name,
doctorImageURL: doctor.doctorImageURL, doctorImageURL: _doctorList.doctorImageURL,
nationalityFlagURL: doctor.nationalityFlagURL); nationalityFlagURL: _doctorList.nationalityFlagURL);
return DoctorView( return DoctorView(
doctor: doctorList, doctor: doctorList,
isLiveCareAppointment: false, isLiveCareAppointment: false,
); );
},
}).toList(), separatorBuilder: (context, index) => SizedBox(height: 14),
)), itemCount: model.patientDoctorAppointmentList[index].patientDoctorAppointmentList.length),
) );
], },
), itemCount: model.patientDoctorAppointmentList.length),
), ),
), ),
],
), ),
), ),
); );

Loading…
Cancel
Save