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.
PatientApp-KKUMC/lib/pages/medical/labs/labs_home_page.dart

147 lines
6.2 KiB
Dart

import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'laboratory_result_page.dart';
class LabsHomePage extends StatelessWidget {
List<ImagesInfo> imagesInfo = List();
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
imagesInfo.add(ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-lab/ar/0.png'));
return BaseView<LabsViewModel>(
onModelReady: (model) => model.getLabs(),
builder: (context, LabsViewModel model, widget) => AppScaffold(
baseViewModel: model,
isShowAppBar: true,
description: TranslationBase.of(context).infoLab,
appBarTitle: TranslationBase.of(context).labResults,
showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: Color(0xffF8F8F8),
imagesInfo: imagesInfo,
body: Column(
children: [
Row(
children: <Widget>[
MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, model.filterType, () {
model.setFilterType(FilterType.Clinic);
}),
MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, model.filterType, () {
model.setFilterType(FilterType.Hospital);
}),
],
),
Expanded(
child: FractionallySizedBox(
widthFactor: 1.0,
child: ListView.separated(
physics: BouncingScrollPhysics(),
separatorBuilder: (context, index) {
return Container(
height: 1,
color: Colors.grey,
);
},
itemBuilder: (context, index) {
return AppExpandableNotifier(
title: model.patientLabOrdersList[index].filterName,
bodyWidget: ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(left: 21, right: 21),
itemBuilder: (context, _index) {
PatientLabOrders labOrder = model.patientLabOrdersList[index].patientLabOrdersList[_index];
return DoctorCard(
onTap: () => Navigator.push(
context,
FadePage(
page: LaboratoryResultPage(
patientLabOrders: labOrder,
),
),
),
isInOutPatient: labOrder.isInOutPatient,
name: labOrder.doctorName,
billNo: labOrder.projectName,
profileUrl: labOrder.doctorImageURL,
subName: labOrder.clinicDescription,
isLiveCareAppointment: labOrder.isLiveCareAppointment,
date: labOrder.orderDate
//projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate),
);
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: model.patientLabOrdersList[index].patientLabOrdersList.length));
},
itemCount: model.patientLabOrdersList.length),
),
),
],
),
),
);
}
}
// todo 'Sikander' move this widget to separate file, so can find easily
class MyTabView extends StatelessWidget {
final String title;
final FilterType value;
final FilterType groupValue;
final VoidCallback onPressed;
MyTabView(
this.title,
this.value,
this.groupValue,
this.onPressed, {
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: InkWell(
onTap: onPressed,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 15),
Text(
title,
style: TextStyle(
fontSize: 16,
fontFamily: "Poppins",
fontWeight: FontWeight.w600,
color: value == groupValue ? Color(0xff2B353E) : Color(0xff575757),
letterSpacing: -0.48,
),
),
Container(
margin: EdgeInsets.only(top: 13),
height: 3,
color: value == groupValue ? Color(0xffD02127) : Colors.transparent,
)
],
),
),
);
}
}