medical reports ui redesigned.

merge-requests/390/head
Sikander Saleem 5 years ago
parent 9fdebc2db7
commit 3cc18cfb24

@ -7,7 +7,8 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/report_list_widget.dart';
import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/reports_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.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';
@ -20,8 +21,7 @@ class HomeReportPage extends StatefulWidget {
_HomeReportPageState createState() => _HomeReportPageState(); _HomeReportPageState createState() => _HomeReportPageState();
} }
class _HomeReportPageState extends State<HomeReportPage> class _HomeReportPageState extends State<HomeReportPage> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
List<ImagesInfo> imagesInfo = List(); List<ImagesInfo> imagesInfo = List();
@ -41,20 +41,11 @@ class _HomeReportPageState extends State<HomeReportPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
imagesInfo.add(ImagesInfo( imagesInfo.add(ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png'));
'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/0.png'));
imagesInfo.add(ImagesInfo( imagesInfo.add(ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png'));
'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/1.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/1.png'));
imagesInfo.add(ImagesInfo( imagesInfo.add(ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png'));
'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/en/2.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/medical-reorts/ar/2.png'));
return BaseView<ReportsViewModel>( return BaseView<ReportsViewModel>(
onModelReady: (model) => model.getReports(), //model.getPrescriptions(), onModelReady: (model) => model.getReports(), //model.getPrescriptions(),
builder: (_, model, widget) => AppScaffold( builder: (_, model, widget) => AppScaffold(
@ -63,129 +54,71 @@ class _HomeReportPageState extends State<HomeReportPage>
title: TranslationBase.of(context).medReport, title: TranslationBase.of(context).medReport,
description: TranslationBase.of(context).infoMonthReport, description: TranslationBase.of(context).infoMonthReport,
baseViewModel: model, baseViewModel: model,
showNewAppBar: true,
showNewAppBarTitle: true,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
body: Scaffold( body: Column(
extendBodyBehindAppBar: true, children: [
appBar: PreferredSize( TabBar(
preferredSize: Size.fromHeight(65.0),
child: Stack(
children: <Widget>[
Positioned(
bottom: 1,
left: 0,
right: 0,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: Container(
color: Theme.of(context)
.scaffoldBackgroundColor
.withOpacity(0.8),
height: 70.0,
),
),
),
Center(
child: Container(
height: 60.0,
margin: EdgeInsets.only(top: 10.0),
width: MediaQuery.of(context).size.width * 0.9,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.7),
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: true, isScrollable: true,
controller: _tabController, controller: _tabController,
indicatorWeight: 5.0, indicatorWeight: 3.0,
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor, labelColor: Color(0xff2B353E),
unselectedLabelColor: Colors.grey[800], unselectedLabelColor: Color(0xff575757),
tabs: [ labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
Container( labelStyle: TextStyle(
width: MediaQuery.of(context).size.width * 0.20, fontSize: 16,
child: Center( fontWeight: FontWeight.w600,
child: Texts(TranslationBase.of(context).requested,fontSize: 11,), letterSpacing: -0.48,
), ),
), unselectedLabelStyle: TextStyle(
Container( fontSize: 16,
width: MediaQuery.of(context).size.width * 0.20, fontWeight: FontWeight.w600,
child: Center( letterSpacing: -0.48,
child: Texts(TranslationBase.of(context).ready,fontSize: 11,),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.20,
child: Center(
child:
Texts(TranslationBase.of(context).completed,fontSize: 11,),
),
),
Container(
width: MediaQuery.of(context).size.width * 0.20,
child: Center(
child:
Texts(TranslationBase.of(context).cancelled,fontSize: 11,),
),
), ),
], tabs: [
Text(
TranslationBase.of(context).requested,
), ),
Text(
TranslationBase.of(context).ready,
), ),
Text(
TranslationBase.of(context).completed,
), ),
Text(
TranslationBase.of(context).cancelled,
), ),
], ],
), ),
), if (model.user != null)
body: Column(
children: <Widget>[
if(model.user!=null)
Expanded( Expanded(
child: TabBarView( child: TabBarView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: _tabController, controller: _tabController,
children: <Widget>[ children: <Widget>[
ReportListWidget( ReportListWidget(reportList: model.reportsOrderRequestList, emailAddress: model.user.emailAddress),
reportList: model.reportsOrderRequestList, ReportListWidget(reportList: model.reportsOrderReadyList, emailAddress: model.user.emailAddress),
emailAddress: model.user.emailAddress ReportListWidget(reportList: model.reportsOrderCompletedList, emailAddress: model.user.emailAddress),
), ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress),
ReportListWidget(
reportList: model.reportsOrderReadyList,
emailAddress: model.user.emailAddress
),
ReportListWidget(
reportList: model.reportsOrderCompletedList,
emailAddress: model.user.emailAddress
),
ReportListWidget(
reportList: model.reportsOrderCanceledList,
emailAddress: model.user.emailAddress
),
], ],
), ),
), ),
SizedBox( if (projectViewModel.havePrivilege(21))
height: 110, Padding(
) padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
], child: DefaultButton(
), TranslationBase.of(context).requestMedicalReport.toLowerCase().capitalizeFirstofEach,
bottomSheet: projectViewModel.havePrivilege(21) ?Container( () => Navigator.push(
width: double.infinity,
height: 90,
margin: EdgeInsets.all(8.0),
child: Button(
label: TranslationBase.of(context).requestMedicalReport,
backgroundColor: Colors.grey[800],
onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
page: MedicalReports(), page: MedicalReports(),
), ),
), ),
), ),
):null, )
],
), ),
), ),
); );

@ -7,10 +7,12 @@ 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/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
class ReportListWidget extends StatelessWidget { class ReportListWidget extends StatelessWidget {
final List<Reports> reportList; final List<Reports> reportList;
@ -20,83 +22,92 @@ class ReportListWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView.separated(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
separatorBuilder: (context, index) => SizedBox(height: 14),
itemBuilder: (context, index) {
Reports report = reportList[index];
return Container( return Container(
child: ListView.builder(
itemBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: double.infinity,
margin: EdgeInsets.only(left: 8, right: 8, top: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 2),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(8.0), Radius.circular(10.0),
)), ),
child: Row( boxShadow: [
children: <Widget>[ BoxShadow(
Expanded( color: Color(0xff000000).withOpacity(.05),
flex: 1, //spreadRadius: 5,
child: Padding( blurRadius: 27,
padding: const EdgeInsets.all(8.0), offset: Offset(0, -3),
child: LargeAvatar(
name: reportList[index].doctorName,
url: reportList[index].doctorImageURL,
), ),
],
color: Colors.white),
child: Padding(
padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (report.doctorName != null)
Text(
report.doctorName,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
), ),
if (report.doctorName != null) SizedBox(height: 6),
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
LargeAvatar(
name: report.doctorName,
url: report.doctorImageURL,
width: 48,
height: 48,
), ),
SizedBox(width: 11),
Expanded( Expanded(
flex: 4, child: Column(
child: Padding( crossAxisAlignment: CrossAxisAlignment.start,
padding: const EdgeInsets.all(8.0), mainAxisSize: MainAxisSize.min,
child: Row( children: <Widget>[
if (report.projectName != null) myRichText(TranslationBase.of(context).clinic + ":", report.projectName),
if (report.clinicDescription != null) myRichText(TranslationBase.of(context).hospital + ":", report.clinicDescription),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ mainAxisSize: MainAxisSize.max,
Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox( RatingBar.readOnly(
height: 12, initialRating: report.actualDoctorRate.toDouble(),
), size: 16.0,
Texts(reportList[index].projectName), filledColor: Color(0XFFD02127),
Container( emptyColor: Color(0XFFD02127),
//height: MediaQuery.of(context).size.height * 0.07, isHalfAllowed: true,
width: MediaQuery.of(context).size.width * 0.35, halfFilledIcon: Icons.star_half,
child: Texts(reportList[index].clinicDescription), filledIcon: Icons.star,
), emptyIcon: Icons.star_border,
Texts(TranslationBase.of(context).invoiceNo + ': ${reportList[index].invoiceNo}'), ),
SizedBox(height: 12), if (reportList[index].status == 2)
], IconButton(
), icon: Icon(Icons.email),
reportList[index].status == 2 color: Color(0xff28323A),
? Expanded( constraints: BoxConstraints(),
child: Container( padding: EdgeInsets.zero,
margin: EdgeInsets.only(left: 15.0, right: 15.0), onPressed: () {
child: InkWell(
onTap: () {
showConfirmMessage(reportList[index]); showConfirmMessage(reportList[index]);
// sendReportEmail(reportList[index]); })
}, ],
child: Icon(
Icons.email,
color: Theme.of(context).primaryColor,
size: 30.0,
),
),
), ),
)
: Container(),
], ],
), ),
), ),
)
], ],
), ),
],
), ),
), ),
);
},
itemCount: reportList.length, itemCount: reportList.length,
),
); );
} }
@ -116,15 +127,8 @@ class ReportListWidget extends StatelessWidget {
GifLoaderDialogUtils.showMyDialog(AppGlobal.context); GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
ReportsService _reportsService = locator<ReportsService>(); ReportsService _reportsService = locator<ReportsService>();
_reportsService _reportsService
.sendEmailForMedicalReport( .sendEmailForMedicalReport(report.projectName, report.clinicDescription, report.doctorName, DateUtil.convertDateToString(report.requestDate), report.invoiceNo.toString(), report.projectID,
report.projectName, DateUtil.convertDateToString(report.requestDate), report.setupId)
report.clinicDescription,
report.doctorName,
DateUtil.convertDateToString(report.requestDate),
report.invoiceNo.toString(),
report.projectID,
DateUtil.convertDateToString(report.requestDate),
report.setupId)
.then((value) { .then((value) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context); GifLoaderDialogUtils.hideDialog(AppGlobal.context);
AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).emailSentSuccessfully); AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).emailSentSuccessfully);

Loading…
Cancel
Save