diff --git a/lib/core/viewModels/medical/medical_view_model.dart b/lib/core/viewModels/medical/medical_view_model.dart index b5db9d80..59e8db48 100644 --- a/lib/core/viewModels/medical/medical_view_model.dart +++ b/lib/core/viewModels/medical/medical_view_model.dart @@ -5,14 +5,14 @@ import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; class MedicalViewModel extends BaseViewModel { - List get appoitmentAllHistoryResultList => - List(); - MedicalService _medicalService = locator(); - getAppointmentHistory() { + List get appoitmentAllHistoryResultList => + _medicalService.appoitmentAllHistoryResultList; + + getAppointmentHistory() async{ setState(ViewState.Busy); - _medicalService.getAppointmentHistory(); + await _medicalService.getAppointmentHistory(); if (_medicalService.hasError) { error = _medicalService.error; setState(ViewState.Error); diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 26fe9a89..1e6a3b61 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/medical/radiology/radiology_home_page import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_details_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_home_page.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/sliver_app_bar_delegate.dart'; @@ -28,7 +29,6 @@ class MedicalProfilePage extends StatefulWidget { } class _MedicalProfilePageState extends State { - @override Widget build(BuildContext context) { return BaseView( @@ -46,7 +46,18 @@ class _MedicalProfilePageState extends State { Container( width: double.infinity, color: Colors.grey, - height: 150, + height: 210, + child: ListView.builder( + itemBuilder: (context, index) => TimeLineWidget( + isUp: index % 2 == 1, + appoitmentAllHistoryResul: + model.appoitmentAllHistoryResultList[index], + ), + itemCount: + model.appoitmentAllHistoryResultList.length, + scrollDirection: Axis.horizontal, + reverse: true, + ), ), Padding( padding: EdgeInsets.symmetric(vertical: 12.0), @@ -87,7 +98,8 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), + onTap: () => Navigator.push(context, + FadePage(page: LabsHomePage())), child: MedicalProfileItem( title: 'Lab', imagePath: 'lab_result_icon.png', @@ -249,10 +261,10 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: () { - Navigator.push( - context, FadePage(page: HomeReportPage())); - }, + onTap: () { + Navigator.push(context, + FadePage(page: HomeReportPage())); + }, child: MedicalProfileItem( title: 'Medical', imagePath: 'insurance_approvals_icon.png', @@ -393,7 +405,7 @@ class _MedicalProfilePageState extends State { ), if (model.user != null) Positioned( - top: 110, + top: 175, left: 20, right: 20, child: Container( @@ -404,7 +416,7 @@ class _MedicalProfilePageState extends State { shape: BoxShape.rectangle, border: Border.all( color: Colors.transparent, width: 0.5), - borderRadius: BorderRadius.all(Radius.circular(5)), + borderRadius: BorderRadius.all(Radius.circular(9)), ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -428,7 +440,11 @@ class _MedicalProfilePageState extends State { ], ), ), - ) + ), + + Positioned(top: 10,left: 10, + child: Texts('Time Line ',color: Colors.white,fontSize: 14,fontWeight: FontWeight.normal,), + ) ], ), ], diff --git a/lib/widgets/data_display/medical/time_line_widget.dart b/lib/widgets/data_display/medical/time_line_widget.dart index eb6f1146..18887bd2 100644 --- a/lib/widgets/data_display/medical/time_line_widget.dart +++ b/lib/widgets/data_display/medical/time_line_widget.dart @@ -1,32 +1,151 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class TimeLineWidget extends StatefulWidget { +class TimeLineWidget extends StatelessWidget { final bool isUp; + final AppoitmentAllHistoryResultList appoitmentAllHistoryResul; - TimeLineWidget({Key key, this.isUp}); + TimeLineWidget({Key key, this.isUp, this.appoitmentAllHistoryResul}); - _TimeLineWidgetState createState() => _TimeLineWidgetState(); -} - -class _TimeLineWidgetState extends State { @override Widget build(BuildContext context) { return Stack( children: [ Container( - width: double.infinity, - height: 150, - color: Colors.grey[400], + width: 140, + height: 190, + color: Colors.grey, child: Center( child: Divider( color: Colors.white, - height: 5, - thickness: 5, + height: 3, + thickness: 3, ), ), ), - if (widget.isUp) Container() else Container(), + if (isUp) + Positioned( + top: 20, + child: Container( + margin: EdgeInsets.only(left: 2, right: 2), + child: Column( + children: [ + Texts( + appoitmentAllHistoryResul.doctorNameObj, + color: Colors.white, + fontSize: 10.5, + fontWeight: FontWeight.normal, + ), + SizedBox( + height: 3, + ), + LargeAvatar( + onTap: () { + //AppointmentDetails + Navigator.push(context, + FadePage(page: AppointmentDetails(appo: appoitmentAllHistoryResul,))); + }, + name: appoitmentAllHistoryResul.doctorNameObj, + url: appoitmentAllHistoryResul.doctorImageURL, + width: 30, + height: 30, + ), + Container( + height: 20, + width: 3, + color: Colors.white, + ), + Container( + width: 15, + height: 15, + decoration: BoxDecoration( + color: Colors.yellow[700], + border: Border.all(color: Colors.yellow[700], width: 2), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all( + Radius.circular(25.0), + ), + ), + ), + SizedBox( + height: 4, + ), + Texts( + DateUtil.getMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + appoitmentAllHistoryResul.appointmentDate)), + color: Colors.white, + fontSize: 10.5, + fontWeight: FontWeight.normal, + ) + ], + ), + ), + ) + else + Positioned( + top: 70, + child: Container( + margin: EdgeInsets.only(left: 2, right: 2), + child: Column( + children: [ + Texts( + DateUtil.getMonthDayYearDateFormatted( + DateUtil.convertStringToDate( + appoitmentAllHistoryResul.appointmentDate)), + color: Colors.white, + fontSize: 10.5, + fontWeight: FontWeight.normal, + ), + SizedBox( + height: 5, + ), + Container( + width: 15, + height: 15, + decoration: BoxDecoration( + color: Colors.yellow[700], + border: Border.all(color: Colors.yellow[700], width: 2), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all( + Radius.circular(25.0), + ), + ), + ), + Container( + height: 20, + width: 3, + color: Colors.white, + ), + LargeAvatar( + onTap: (){ + Navigator.push(context, + FadePage(page: AppointmentDetails(appo: appoitmentAllHistoryResul,))); + }, + name: appoitmentAllHistoryResul.doctorNameObj, + url: appoitmentAllHistoryResul.doctorImageURL, + width: 30, + height: 30, + ), + SizedBox( + height: 3, + ), + Texts( + appoitmentAllHistoryResul.doctorNameObj, + color: Colors.white, + fontSize: 10.5, + fontWeight: FontWeight.normal, + ), + ], + ), + ), + ), Container() ], );