PAP-886 fixed, Insurance image button added.

merge-update-with-lab-changes
Sikander Saleem 5 years ago
parent db84090694
commit 7771b8f320

@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_details.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/buttons/button.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.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';
@ -33,26 +33,41 @@ class _InsuranceCardState extends State<InsuranceCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
imagesInfo.add(ImagesInfo( imagesInfo.add(ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
return BaseView<InsuranceViewModel>( return BaseView<InsuranceViewModel>(
onModelReady: (model) => model.getInsurance(), onModelReady: (model) => model.getInsurance(),
builder: (BuildContext context, InsuranceViewModel model, Widget child) => builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold(
AppScaffold(
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model, baseViewModel: model,
showHomeAppBarIcon: false,
appBarTitle: TranslationBase.of(context).insuranceCards, appBarTitle: TranslationBase.of(context).insuranceCards,
description: TranslationBase.of(context).infoInsuranceCards, description: TranslationBase.of(context).infoInsuranceCards,
infoList: TranslationBase.of(context).infoInsuranceCardsPoints, infoList: TranslationBase.of(context).infoInsuranceCardsPoints,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
appBarIcons: [
IconButton(
padding: EdgeInsets.zero,
icon: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
margin: EdgeInsets.only(right: 8),
padding: EdgeInsets.only(right: 4, left: 4),
child: Image.asset(
'assets/images/medical/insurance_update_icon_.png',
height: SizeConfig.heightMultiplier * 5,
width: SizeConfig.heightMultiplier * 5,
),
),
onPressed: () {
Navigator.push(context, FadePage(page: InsuranceUpdate()));
},
),
],
body: Container( body: Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth * 0.004, top: SizeConfig.screenWidth * 0.04),
left: SizeConfig.screenWidth * 0.004,
right: SizeConfig.screenWidth * 0.004,
top: SizeConfig.screenWidth * 0.04),
child: ListView.builder( child: ListView.builder(
itemCount: model.insurance == null ? 0 : model.insurance.length, itemCount: model.insurance == null ? 0 : model.insurance.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
@ -82,23 +97,16 @@ class _InsuranceCardState extends State<InsuranceCard> {
Container( Container(
padding: EdgeInsets.all(14), padding: EdgeInsets.all(14),
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(shape: BoxShape.rectangle, border: Border.all(color: Colors.grey, width: 0.2), borderRadius: BorderRadius.all(Radius.circular(2)), boxShadow: [
shape: BoxShape.rectangle, BoxShadow(
border: Border.all( color: Colors.white70,
color: Colors.grey, width: 0.2), ),
borderRadius: ]),
BorderRadius.all(Radius.circular(2)),
boxShadow: [
BoxShadow(
color: Colors.white70,
),
]),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Texts( Texts(
TranslationBase.of(context).companyName + TranslationBase.of(context).companyName + model.insurance[index].companyName,
model.insurance[index].companyName,
fontSize: 20.0, fontSize: 20.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
), ),
@ -108,93 +116,46 @@ class _InsuranceCardState extends State<InsuranceCard> {
thickness: 0.5, thickness: 0.5,
), ),
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween, children: [Texts(TranslationBase.of(context).category, fontSize: 18.5), Texts(model.insurance[index].subCategoryDesc, fontSize: 18.5)],
children: [
Texts(
TranslationBase.of(context)
.category,
fontSize: 18.5),
Texts(
model.insurance[index]
.subCategoryDesc,
fontSize: 18.5)
],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Texts( Texts(TranslationBase.of(context).expirationDate, fontSize: 18.5),
TranslationBase.of(context)
.expirationDate,
fontSize: 18.5),
Texts( Texts(
convertDateFormat( convertDateFormat(
model.insurance[index] model.insurance[index].cardValidTo,
.cardValidTo,
), ),
fontSize: 18.5), fontSize: 18.5),
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Texts( Texts(TranslationBase.of(context).status + ": ", fontSize: 18.5),
TranslationBase.of(context) model.insurance[index].isActive == true
.status + ? Texts(TranslationBase.of(context).activeInsurence, color: Colors.green, fontWeight: FontWeight.w900, fontSize: 17.9)
": ", : Texts(TranslationBase.of(context).notActive, color: Colors.red, fontWeight: FontWeight.w900, fontSize: 17.9)
fontSize: 18.5),
model.insurance[index].isActive ==
true
? Texts(
TranslationBase.of(context)
.activeInsurence,
color: Colors.green,
fontWeight: FontWeight.w900,
fontSize: 17.9)
: Texts(
TranslationBase.of(context)
.notActive,
color: Colors.red,
fontWeight: FontWeight.w900,
fontSize: 17.9)
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween, children: [Texts(TranslationBase.of(context).patientCard, fontSize: 18.5), Texts(model.insurance[index].patientCardID, fontSize: 18.5)],
children: [
Texts(
TranslationBase.of(context)
.patientCard,
fontSize: 18.5),
Texts(
model.insurance[index]
.patientCardID,
fontSize: 18.5)
],
), ),
Row( Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
mainAxisAlignment: Texts(
MainAxisAlignment.spaceBetween, TranslationBase.of(context).policyNumber,
children: [ fontSize: 18.5,
Texts( ),
TranslationBase.of(context) Texts(
.policyNumber, model.insurance[index].insurancePolicyNumber,
fontSize: 18.5, fontSize: 18.5,
), )
Texts( ]),
model.insurance[index]
.insurancePolicyNumber,
fontSize: 18.5,
)
]),
], ],
), ),
SizedBox( SizedBox(
@ -204,11 +165,8 @@ class _InsuranceCardState extends State<InsuranceCard> {
Container( Container(
color: Colors.transparent, color: Colors.transparent,
child: SecondaryButton( child: SecondaryButton(
onTap: () => { onTap: () => {getDetails(model.insurance[index])},
getDetails(model.insurance[index]) label: TranslationBase.of(context).seeDetails,
},
label: TranslationBase.of(context)
.seeDetails,
textColor: Colors.white, textColor: Colors.white,
), ),
width: double.infinity, width: double.infinity,
@ -235,23 +193,16 @@ class _InsuranceCardState extends State<InsuranceCard> {
final startIndex = exDate.indexOf(start); final startIndex = exDate.indexOf(start);
final endIndex = exDate.indexOf(end, startIndex + start.length); final endIndex = exDate.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch( var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(exDate.substring(startIndex + start.length, endIndex)));
int.parse(exDate.substring(startIndex + start.length, endIndex))); String newDate = date.year.toString() + "-" + date.month.toString().padLeft(2, '0') + "-" + date.day.toString().padLeft(2, '0');
String newDate = date.year.toString() +
"-" +
date.month.toString().padLeft(2, '0') +
"-" +
date.day.toString().padLeft(2, '0');
return newDate.toString(); return newDate.toString();
} }
getDetails(data) { getDetails(data) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
_insuranceCardService.getInsuranceDetails(data).then((value) => { _insuranceCardService
GifLoaderDialogUtils.hideDialog(context), .getInsuranceDetails(data)
Navigator.push(context, .then((value) => {GifLoaderDialogUtils.hideDialog(context), Navigator.push(context, FadePage(page: InsuranceCardDetails(data: value[0]['CheckList'])))});
FadePage(page: InsuranceCardDetails(data: value[0]['CheckList'])))
});
} }
} }

@ -95,7 +95,8 @@ class AppScaffold extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.context = context; AppGlobal.context = context;
return Scaffold( return Scaffold(
backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar appBar: isShowAppBar
? appBar = AppBarWidget( ? appBar = AppBarWidget(
appBarTitle: appBarTitle, appBarTitle: appBarTitle,
@ -112,19 +113,21 @@ class AppScaffold extends StatelessWidget {
body: SafeArea( body: SafeArea(
top: true, top: true,
bottom: true, bottom: true,
child: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && isShowDecPage) child:
? NotAutPage( (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
title: title ?? appBarTitle, isShowDecPage)
description: description, ? NotAutPage(
infoList: infoList, title: title ?? appBarTitle,
imagesInfo: imagesInfo, description: description,
) infoList: infoList,
: baseViewModel != null imagesInfo: imagesInfo,
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: baseViewModel,
) )
: buildBodyWidget(context), : baseViewModel != null
? NetworkBaseView(
child: buildBodyWidget(context),
baseViewModel: baseViewModel,
)
: buildBodyWidget(context),
), ),
floatingActionButton: floatingActionButton, floatingActionButton: floatingActionButton,
); );
@ -135,12 +138,14 @@ class AppScaffold extends StatelessWidget {
} }
buildBodyWidget(context) { buildBodyWidget(context) {
return Stack(children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]); return Stack(
children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]);
} }
} }
class AppBarWidget extends StatefulWidget with PreferredSizeWidget { class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); final AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
final String appBarTitle; final String appBarTitle;
final bool showHomeAppBarIcon; final bool showHomeAppBarIcon;
@ -188,12 +193,22 @@ class AppBarWidgetState extends State<AppBarWidget> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppBar( return AppBar(
elevation: 0, elevation: 0,
backgroundColor: widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, backgroundColor: widget.isPharmacy
? Colors.green
: Theme.of(context).appBarTheme.color,
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), headline6: TextStyle(
color: Theme.of(context).textTheme.headline1.color,
fontWeight: FontWeight.bold),
), ),
title: Text(widget.authenticatedUserObject.isLogin || !widget.isShowDecPage ? widget.appBarTitle.toUpperCase() : TranslationBase.of(context).serviceInformationTitle, title: Text(
style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), widget.authenticatedUserObject.isLogin || !widget.isShowDecPage
? widget.appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).textTheme.headline1.color,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
leading: Builder( leading: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return ArrowBack(); return ArrowBack();
@ -203,7 +218,9 @@ class AppBarWidgetState extends State<AppBarWidget> {
actions: <Widget>[ actions: <Widget>[
(widget.isPharmacy && widget.showPharmacyCart) (widget.isPharmacy && widget.showPharmacyCart)
? IconButton( ? IconButton(
icon: Badge(badgeContent: Text(badgeText), child: Icon(Icons.shopping_cart)), icon: Badge(
badgeContent: Text(badgeText),
child: Icon(Icons.shopping_cart)),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
Navigator.of(context).popUntil(ModalRoute.withName('/')); Navigator.of(context).popUntil(ModalRoute.withName('/'));
@ -215,7 +232,10 @@ class AppBarWidgetState extends State<AppBarWidget> {
position: BadgePosition.topStart(top: -15, start: -10), position: BadgePosition.topStart(top: -15, start: -10),
badgeContent: Text( badgeContent: Text(
badgeText, badgeText,
style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal), style: TextStyle(
fontSize: 9,
color: Colors.white,
fontWeight: FontWeight.normal),
), ),
child: Icon(Icons.shopping_cart)), child: Icon(Icons.shopping_cart)),
color: Colors.white, color: Colors.white,
@ -229,7 +249,10 @@ class AppBarWidgetState extends State<AppBarWidget> {
icon: Icon(FontAwesomeIcons.home), icon: Icon(FontAwesomeIcons.home),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false); Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> r) => false);
// Cart Click Event // Cart Click Event
if (_onCartClick != null) _onCartClick(); if (_onCartClick != null) _onCartClick();
@ -293,11 +316,18 @@ class _RobotIcon extends State<RobotIcon> {
], ],
), ),
child: TyperAnimatedTextKit( child: TyperAnimatedTextKit(
text: Provider.of<ProjectViewModel>(context, listen: false).isArabic == true text: Provider.of<ProjectViewModel>(context,
listen: false)
.isArabic ==
true
? "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." ? "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي."
: "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", : "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.",
textLength: Provider.of<ProjectViewModel>(context, listen: false).isArabic == true textLength: Provider.of<ProjectViewModel>(context,
? "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي.".length listen: false)
.isArabic ==
true
? "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي."
.length
: "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file." : "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file."
.length)) .length))
: Container(), : Container(),

Loading…
Cancel
Save