done dashboard page

merge-update-with-lab-changes
Mohammad Aljammal 6 years ago
parent 895c09efa4
commit 01a011a03d

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

@ -326,7 +326,7 @@ const Map<String, Map<String, String>> localizedValues = {
"OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'صيدلايات الحبيب'}, "OnlinePharmacy": {"en": "Online Pharmacy", 'ar': 'صيدلايات الحبيب'},
"EmergencyService": {"en": "Emergency Service", 'ar': 'الفحص الطبي الشامل'}, "EmergencyService": {"en": "Emergency Service", 'ar': 'الفحص الطبي الشامل'},
"OnlinePaymentService": {"en": "Online Payment Service", 'ar': 'خدمة الدفع عبر الإلكتدوني'}, "OnlinePaymentService": {"en": "Online Payment Service", 'ar': 'خدمة الدفع عبر الإلكتدوني'},
"OffersAndPackages": {"en": "Offers and Packages", 'ar': 'العروض والباقات'}, "OffersAndPackages": {"en": "Online transfer request", 'ar': 'طلب التحويل الالكتروني'},
"ComprehensiveMedicalCheckup": {"en": "Comprehensive Medical Check up", 'ar': 'فحص طبي شامل'}, "ComprehensiveMedicalCheckup": {"en": "Comprehensive Medical Check up", 'ar': 'فحص طبي شامل'},
"HMGService": {"en": "HMG Service", 'ar': 'جميع خدمات الحبيب'}, "HMGService": {"en": "HMG Service", 'ar': 'جميع خدمات الحبيب'},
"ViewAllHabibMedicalService": {"en": "View All Habib Medical Service", 'ar': 'عرض خدمات الحبيب الطبية'}, "ViewAllHabibMedicalService": {"en": "View All Habib Medical Service", 'ar': 'عرض خدمات الحبيب الطبية'},
@ -346,5 +346,6 @@ const Map<String, Map<String, String>> localizedValues = {
"gate":{"en":"Gate:","ar":"بوابة"}, "gate":{"en":"Gate:","ar":"بوابة"},
"building":{"en":"Building:","ar":"المبنى"}, "building":{"en":"Building:","ar":"المبنى"},
"branch":{"en":"Branch:","ar":"الفرع"}, "branch":{"en":"Branch:","ar":"الفرع"},
"emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"},
}; };

@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
class BaseViewModel extends ChangeNotifier { class BaseViewModel extends ChangeNotifier {
ViewState _state = ViewState.Idle; ViewState _state = ViewState.Idle;
bool isInternetConnection = true; bool isInternetConnection = true;
bool isLogin = false;
ViewState get state => _state; ViewState get state => _state;
@ -27,6 +28,10 @@ class BaseViewModel extends ChangeNotifier {
_getUser() async { _getUser() async {
var userData = await sharedPref.getObject(USER_PROFILE); var userData = await sharedPref.getObject(USER_PROFILE);
if (userData != null) user = AuthenticatedUser.fromJson(userData); if (userData != null) user = AuthenticatedUser.fromJson(userData);
var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID);
this.isLogin = isLogin != null;
notifyListeners(); notifyListeners();
} }
} }

@ -1,8 +1,29 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/service/dashboard_service.dart'; import 'package:diplomaticquarterapp/core/service/dashboard_service.dart';
import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import '../../locator.dart'; import '../../locator.dart';
class DashboardViewModel extends BaseViewModel { class DashboardViewModel extends BaseViewModel {
VitalSignService _vitalSignService = locator<VitalSignService>();
String weightKg = "";
String heightCm = "";
String bloadType = "";
getPatientRadOrders() async {
if (!isLogin) {
setState(ViewState.Busy);
await _vitalSignService.getPatientRadOrders();
if (_vitalSignService.hasError) {
error = _vitalSignService.error;
setState(ViewState.Error);
} else
_vitalSignService.vitalSignResModelList.forEach((element) {
weightKg = '${element.weightKg}';
heightCm = '${element.heightCm}';
});
setState(ViewState.Idle);
}
}
} }

@ -2,10 +2,11 @@ import 'dart:async';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class ProjectViewModel with ChangeNotifier { class ProjectViewModel extends BaseViewModel {
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
Locale _appLocale; Locale _appLocale;
String currentLanguage = 'ar'; String currentLanguage = 'ar';

@ -1,3 +1,5 @@
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
class AuthenticatedUser { class AuthenticatedUser {
String setupID; String setupID;
int patientType; int patientType;
@ -11,6 +13,7 @@ class AuthenticatedUser {
int relationshipID; int relationshipID;
int gender; int gender;
String dateofBirth; String dateofBirth;
DateTime dateofBirthDataTime;
dynamic dateofBirthN; dynamic dateofBirthN;
String nationalityID; String nationalityID;
dynamic phoneResi; dynamic phoneResi;
@ -135,6 +138,7 @@ class AuthenticatedUser {
relationshipID = json['RelationshipID']; relationshipID = json['RelationshipID'];
gender = json['Gender']; gender = json['Gender'];
dateofBirth = json['DateofBirth']; dateofBirth = json['DateofBirth'];
dateofBirthDataTime = DateUtil.convertStringToDate(json['DateofBirth']);
dateofBirthN = json['DateofBirthN']; dateofBirthN = json['DateofBirthN'];
nationalityID = json['NationalityID']; nationalityID = json['NationalityID'];
phoneResi = json['PhoneResi']; phoneResi = json['PhoneResi'];

@ -1,6 +1,9 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.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/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
@ -12,6 +15,10 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
final Function goToMyProfile;
HomePage({Key key, this.goToMyProfile});
@override @override
_HomePageState createState() => _HomePageState(); _HomePageState createState() => _HomePageState();
} }
@ -20,7 +27,9 @@ class _HomePageState extends State<HomePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return BaseView<DashboardViewModel>(
onModelReady: (model) => model.getPatientRadOrders(),
builder: (_, model, wi) => AppScaffold(
body: Container( body: Container(
width: double.infinity, width: double.infinity,
child: SingleChildScrollView( child: SingleChildScrollView(
@ -37,7 +46,7 @@ class _HomePageState extends State<HomePage> {
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: ExactAssetImage( image: ExactAssetImage(
'assets/images/timeline_bg.png'), 'assets/images/dashboard_top_bg.png'),
fit: BoxFit.cover), fit: BoxFit.cover),
), ),
child: Stack( child: Stack(
@ -47,7 +56,8 @@ class _HomePageState extends State<HomePage> {
left: 15, left: 15,
right: 15, right: 15,
child: Container( child: Container(
width: MediaQuery.of(context).size.width * 0.8, width:
MediaQuery.of(context).size.width * 0.8,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
@ -56,16 +66,15 @@ class _HomePageState extends State<HomePage> {
FadePage(page: LiveCareHome())), FadePage(page: LiveCareHome())),
child: Container( child: Container(
height: 110, height: 110,
padding: EdgeInsets.all(15),
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.transparent color: Colors.white
.withOpacity(0.3), .withOpacity(0.3),
), borderRadius: BorderRadius.all(
child: Center( Radius.circular(5))),
child: Texts( child: Image.asset(
'Live care ', 'assets/images/livecare_white_logo.png',
color: Colors.white,
),
), ),
), ),
), ),
@ -73,11 +82,15 @@ class _HomePageState extends State<HomePage> {
Expanded( Expanded(
child: Container( child: Container(
height: 110, height: 110,
padding: EdgeInsets.all(15),
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.transparent color:
.withOpacity(0.3), Colors.white.withOpacity(0.3),
)), borderRadius: BorderRadius.all(
Radius.circular(5))),
// child: Image.asset('assets/images/livecare_white_logo.png',),
),
), ),
], ],
), ),
@ -101,15 +114,17 @@ class _HomePageState extends State<HomePage> {
Orientation.landscape Orientation.landscape
? 0.02 ? 0.02
: 0.03), : 0.03),
child: Container( child: (!model.isLogin && projectViewModel.user == null)
? Container(
width: double.infinity, width: double.infinity,
height: 125, height: 125,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Hexcolor('#A59E9E'), color: Hexcolor('#A59E9E'),
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
border: border: Border.all(
Border.all(color: Colors.transparent, width: 0.5), color: Colors.transparent, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(9)), borderRadius:
BorderRadius.all(Radius.circular(9)),
image: DecorationImage( image: DecorationImage(
image: ExactAssetImage( image: ExactAssetImage(
'assets/images/bg_graphic.png'), 'assets/images/bg_graphic.png'),
@ -132,7 +147,8 @@ class _HomePageState extends State<HomePage> {
height: 5, height: 5,
), ),
Texts( Texts(
TranslationBase.of(context).myMedicalFileSubTitle, TranslationBase.of(context)
.myMedicalFileSubTitle,
color: Colors.black, color: Colors.black,
fontSize: 16, fontSize: 16,
), ),
@ -141,7 +157,9 @@ class _HomePageState extends State<HomePage> {
? Alignment.bottomLeft ? Alignment.bottomLeft
: Alignment.bottomRight, : Alignment.bottomRight,
child: InkWell( child: InkWell(
onTap: () {}, onTap: () {
widget.goToMyProfile();
},
child: Container( child: Container(
margin: EdgeInsets.all(2), margin: EdgeInsets.all(2),
width: 90, width: 90,
@ -149,20 +167,174 @@ class _HomePageState extends State<HomePage> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Hexcolor('#D81A2E'), color: Hexcolor('#D81A2E'),
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
border: Border.all(
color: Colors.transparent,
width: 0.5),
borderRadius: BorderRadius.all(
Radius.circular(9)),
),
child: Center(
child: Texts(
TranslationBase.of(context)
.viewMore,
color: Colors.white,
fontSize: 12,
),
),
),
),
)
],
),
),
)
: Container(
width: double.infinity,
height: 130,
decoration: BoxDecoration(
color: Hexcolor('#A59E9E'),
shape: BoxShape.rectangle,
border: Border.all( border: Border.all(
color: Colors.transparent, width: 0.5), color: Colors.transparent, width: 0.5),
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(9)), BorderRadius.all(Radius.circular(9)),
image: DecorationImage(
image: ExactAssetImage(
'assets/images/bg_graphic.png'),
fit: BoxFit.cover),
),
child: Container(
margin: EdgeInsets.all(5),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
if (model.user != null)
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 8,
),
Texts(
model.user.firstName +
" " +
model.user.lastName,
color: Colors.grey[100],
bold: true,
fontSize: 15,
),
Texts(
'${model.user.patientID}',
color: Colors.white,
fontSize: 14,
),
SizedBox(
height: 5,
),
Texts(
'${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}',
color: Colors.grey[100],
fontWeight: FontWeight.normal,
fontSize: 14,
),
],
),
),
InkWell(
onTap: () {
widget.goToMyProfile();
},
child: Container(
margin: EdgeInsets.all(2),
width: 90,
height: 30,
decoration: BoxDecoration(
color: Hexcolor('#D81A2E'),
shape: BoxShape.rectangle,
border: Border.all(
color: Colors.transparent,
width: 0.5),
borderRadius: BorderRadius.all(
Radius.circular(5),
),
), ),
child: Center( child: Center(
child: Texts( child: Texts(
TranslationBase.of(context).viewMore, TranslationBase.of(context)
.viewMore,
color: Colors.white, color: Colors.white,
fontSize: 12, fontSize: 12,
), ),
), ),
), ),
)
],
), ),
Row(
//crossAxisAlignment: CrossAxisAlignment.center,
//mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Expanded(
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Image.asset(
'assets/images/height_icon.png',
width: 35,
height: 40,
),
Texts(
"${model.heightCm}",
color: Colors.white,
)
],
),
),
SizedBox(
width: 3,
),
Expanded(
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Image.asset(
'assets/images/weight_icon.png',
width: 25,
height: 40,
),
Texts(
'${model.weightKg}',
color: Colors.white,
)
],
),
),
SizedBox(
width: 3,
),
Expanded(
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Image.asset(
'assets/images/blood_icon.png',
width: 35,
height: 40,
),
Texts(
'${model.bloadType}',
color: Colors.white,
)
],
),
),
],
) )
], ],
), ),
@ -213,7 +385,7 @@ class _HomePageState extends State<HomePage> {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'assets/images/new-design/pharmacy_icon.png', 'assets/images/pharmacy_logo.png',
width: 40, width: 40,
height: 40, height: 40,
), ),
@ -240,7 +412,7 @@ class _HomePageState extends State<HomePage> {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'assets/images/Dr_Schedule_report.png', 'assets/images/comprehensive_medical_checkup_logo.png',
width: 50, width: 50,
height: 50, height: 50,
), ),
@ -281,9 +453,8 @@ class _HomePageState extends State<HomePage> {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'assets/images/new-design/online_payment_icon.png', 'assets/images/al-habib_online_payment_service_icon.png',
width: 80, height: 55,
height: 50,
), ),
SizedBox( SizedBox(
height: 15, height: 15,
@ -313,15 +484,16 @@ class _HomePageState extends State<HomePage> {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'assets/images/offer_icon.png', 'assets/images/ereferral_service_icon.png',
width: 50, width: 50,
height: 50, height: 55,
), ),
SizedBox( SizedBox(
height: 15, height: 15,
), ),
Texts( Texts(
TranslationBase.of(context).offersAndPackages, TranslationBase.of(context)
.offersAndPackages,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Colors.black87, color: Colors.black87,
bold: false, bold: false,
@ -353,8 +525,7 @@ class _HomePageState extends State<HomePage> {
height: 15, height: 15,
), ),
Texts( Texts(
TranslationBase.of(context) TranslationBase.of(context).emergencyServices,
.comprehensiveMedicalCheckup,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Colors.black87, color: Colors.black87,
bold: false, bold: false,
@ -464,6 +635,7 @@ class _HomePageState extends State<HomePage> {
), ),
), ),
), ),
),
); );
} }
} }

@ -229,14 +229,16 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
controller: pageController, controller: pageController,
children: [ children: [
HomePage(), HomePage(goToMyProfile: (){
_changeCurrentTab(1);
},),
MedicalProfilePage(), MedicalProfilePage(),
MyAdmissionsPage(), MyAdmissionsPage(),
ToDo(), ToDo(),
BookingOptions() BookingOptions()
], // Please do not remove the BookingOptions from this array ], // Please do not remove the BookingOptions from this array
), ),
bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab,index: currentTab,),
); );
} }

@ -142,7 +142,7 @@ class AuthProvider with ChangeNotifier {
return Future.value(localRes); return Future.value(localRes);
} catch (error) { } catch (error) {
print(error); print(error);
throw error; //throw error;
} }
} }

@ -430,6 +430,7 @@ class TranslationBase {
String get gate =>localizedValues['gate'][locale.languageCode]; String get gate =>localizedValues['gate'][locale.languageCode];
String get building =>localizedValues['building'][locale.languageCode]; String get building =>localizedValues['building'][locale.languageCode];
String get branch =>localizedValues['branch'][locale.languageCode]; String get branch =>localizedValues['branch'][locale.languageCode];
String get emergencyServices =>localizedValues['emergencyServices'][locale.languageCode];

@ -9,8 +9,8 @@ import 'bottom_navigation_item.dart';
class BottomNavBar extends StatefulWidget { class BottomNavBar extends StatefulWidget {
final ValueChanged<int> changeIndex; final ValueChanged<int> changeIndex;
final int index ;
BottomNavBar({Key key, this.changeIndex}) : super(key: key); BottomNavBar({Key key, this.changeIndex,this.index}) : super(key: key);
@override @override
_BottomNavBarState createState() => _BottomNavBarState(); _BottomNavBarState createState() => _BottomNavBarState();
@ -21,15 +21,6 @@ class _BottomNavBarState extends State<BottomNavBar> {
_changeIndex(int index) { _changeIndex(int index) {
widget.changeIndex(index); widget.changeIndex(index);
setState(() {
_index = index;
// Navigate to Appointment Booking Flow
// if (_index == 4) navigateToBookingOptions(context);
// Navigate to upcoming list
//if (_index == 3) navigateToToDoList(context);
});
} }
@override @override
@ -48,7 +39,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
icon: EvaIcons.home, icon: EvaIcons.home,
activeIcon: EvaIcons.home, activeIcon: EvaIcons.home,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: _index, index: widget.index,
currentIndex: 0, currentIndex: 0,
name: TranslationBase.of(context).home, name: TranslationBase.of(context).home,
), ),
@ -56,7 +47,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
icon: EvaIcons.list, icon: EvaIcons.list,
activeIcon: EvaIcons.list, activeIcon: EvaIcons.list,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: _index, index: widget.index,
currentIndex: 1, currentIndex: 1,
name: TranslationBase.of(context).medicalProfile, name: TranslationBase.of(context).medicalProfile,
), ),
@ -87,7 +78,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
icon: EvaIcons.person, icon: EvaIcons.person,
activeIcon: EvaIcons.person, activeIcon: EvaIcons.person,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: _index, index: widget.index,
currentIndex: 2, currentIndex: 2,
name: TranslationBase.of(context).mySchedule, name: TranslationBase.of(context).mySchedule,
), ),
@ -95,7 +86,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
icon: EvaIcons.calendar, icon: EvaIcons.calendar,
activeIcon: EvaIcons.calendar, activeIcon: EvaIcons.calendar,
changeIndex: _changeIndex, changeIndex: _changeIndex,
index: _index, index: widget.index,
currentIndex: 3, currentIndex: 3,
name: TranslationBase.of(context).todoList, name: TranslationBase.of(context).todoList,
) )

Loading…
Cancel
Save