Login check implemented for appointment & ToDo

fix_issues
haroon amjad 4 years ago
parent af780bca76
commit ff3368eefb

@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResu
import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCardView.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -33,12 +34,14 @@ class _MyAppointmentsState extends State<MyAppointments>
bool isDataLoaded = false;
var sharedPref = new AppSharedPreferences();
var authProvider = new AuthProvider();
@override
void initState() {
_tabController = new TabController(length: 3, vsync: this);
WidgetsBinding.instance
.addPostFrameCallback((_) => getPatientAppointmentHistory());
WidgetsBinding.instance.addPostFrameCallback((_) {
if (authProvider.isLogin) getPatientAppointmentHistory();
});
super.initState();
}

@ -39,8 +39,9 @@ class _ToDoState extends State<ToDo> {
@override
void initState() {
widget.patientShareResponse = new PatientShareResponse();
WidgetsBinding.instance
.addPostFrameCallback((_) => getPatientAppointmentHistory());
WidgetsBinding.instance.addPostFrameCallback((_) {
if (authProvider.isLogin) getPatientAppointmentHistory();
});
super.initState();
}

@ -15,6 +15,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/paymentService/payment_service.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/medicine_search_screen.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
@ -88,9 +89,10 @@ class _HomePageState extends State<HomePage> {
)
],
),
),
Container(width: double.infinity, height:projectViewModel.isArabic ? 120:110),
Container(
width: double.infinity,
height: projectViewModel.isArabic ? 120 : 110),
],
),
Positioned(
@ -301,7 +303,9 @@ class _HomePageState extends State<HomePage> {
bold: true,
),
Texts(
TranslationBase.of(context).height,
TranslationBase.of(
context)
.height,
color: Colors.white,
fontSize: 10,
),
@ -333,7 +337,9 @@ class _HomePageState extends State<HomePage> {
bold: true,
),
Texts(
TranslationBase.of(context).weight,
TranslationBase.of(
context)
.weight,
color: Colors.white,
fontSize: 10,
)
@ -347,8 +353,10 @@ class _HomePageState extends State<HomePage> {
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/blood-drop.png',
@ -362,7 +370,9 @@ class _HomePageState extends State<HomePage> {
color: Colors.white,
),
Texts(
TranslationBase.of(context).bloodType,
TranslationBase.of(
context)
.bloodType,
color: Colors.white,
fontSize: 10,
)
@ -401,28 +411,35 @@ class _HomePageState extends State<HomePage> {
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
SizedBox(height: 15,),
SizedBox(
height: 15,
),
Container(
width: 60,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(12)
),
child: Center(child: Image.asset('assets/images/vital_sign_icon.png',
borderRadius:
BorderRadius.circular(12)),
child: Center(
child: Image.asset(
'assets/images/vital_sign_icon.png',
width: 80,
height: 50,
fit: BoxFit.contain,)),
fit: BoxFit.contain,
)),
),
SizedBox(
height: 20,
),
SizedBox(height: 20,),
Texts(
TranslationBase.of(context)
.vitalSigns,
TranslationBase.of(context).vitalSigns,
textAlign: TextAlign.center,
color: Colors.white,
bold: true,
fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7,
fontSize: projectViewModel.isArabic
? SizeConfig.textMultiplier * 1.5
: SizeConfig.textMultiplier * 1.7,
)
],
),
@ -450,26 +467,35 @@ class _HomePageState extends State<HomePage> {
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
SizedBox(height: 15,),
SizedBox(
height: 15,
),
Container(
width: 50,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(12)
),
child: Center(child: Image.asset('assets/images/search_medicine_icon.png',
borderRadius:
BorderRadius.circular(12)),
child: Center(
child: Image.asset(
'assets/images/search_medicine_icon.png',
width: 50,
height: 50,
fit: BoxFit.contain,)),
fit: BoxFit.contain,
)),
),
SizedBox(
height: 20,
),
SizedBox(height: 20,),
Texts(
TranslationBase.of(context).searchMedicine,
textAlign: TextAlign.center,
color: Colors.white,
bold: true,
fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7,
fontSize: projectViewModel.isArabic
? SizeConfig.textMultiplier * 1.5
: SizeConfig.textMultiplier * 1.7,
)
],
),
@ -481,8 +507,9 @@ class _HomePageState extends State<HomePage> {
),
),
Expanded(
child: DashboardItem(opacity: 1.0,
onTap: (){
child: DashboardItem(
opacity: 1.0,
onTap: () {
Navigator.push(
context,
FadePage(
@ -495,25 +522,35 @@ class _HomePageState extends State<HomePage> {
padding: const EdgeInsets.all(15.0),
child: Column(
children: <Widget>[
SizedBox(height: 15,),
SizedBox(
height: 15,
),
Container(
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(12)
),
child: Center(child: Image.asset('assets/images/online_payment_icon.png',
borderRadius:
BorderRadius.circular(12)),
child: Center(
child: Image.asset(
'assets/images/online_payment_icon.png',
width: 80,
height: 50,
fit: BoxFit.contain,)),
fit: BoxFit.contain,
)),
),
SizedBox(
height: 15,
),
SizedBox(height: 15,),
Texts(
TranslationBase.of(context).onlinePaymentService,
TranslationBase.of(context)
.onlinePaymentService,
textAlign: TextAlign.center,
color: Colors.white,
bold: true,
fontSize: projectViewModel.isArabic? SizeConfig.textMultiplier * 1.5 :SizeConfig.textMultiplier * 1.7,
fontSize: projectViewModel.isArabic
? SizeConfig.textMultiplier * 1.5
: SizeConfig.textMultiplier * 1.7,
)
],
),
@ -549,34 +586,33 @@ class _HomePageState extends State<HomePage> {
);
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.myAppointments,
title:
TranslationBase.of(context).myAppointments,
imagePath: 'my_appointment_icon.png',
subTitle: TranslationBase.of(context).myAppointmentsList,
subTitle: TranslationBase.of(context)
.myAppointmentsList,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.push(context,
FadePage(page: LabsHomePage())),
onTap: () => Navigator.push(
context, FadePage(page: LabsHomePage())),
child: MedicalProfileItem(
title: TranslationBase.of(context).lab,
imagePath: 'lab_result_icon.png',
subTitle:
TranslationBase.of(context).lab,
subTitle: TranslationBase.of(context).lab,
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => Navigator.push(context,
FadePage(page: RadiologyHomePage())),
onTap: () => Navigator.push(
context, FadePage(page: RadiologyHomePage())),
child: MedicalProfileItem(
title: TranslationBase.of(context)
.radiology,
title: TranslationBase.of(context).radiology,
imagePath: 'radiology_icon.png',
subTitle: TranslationBase.of(context)
.radiologySubtitle,
@ -599,8 +635,7 @@ class _HomePageState extends State<HomePage> {
);
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.medicines,
title: TranslationBase.of(context).medicines,
imagePath: 'prescription_icon.png',
subTitle: TranslationBase.of(context)
.medicinesSubtitle,
@ -619,8 +654,7 @@ class _HomePageState extends State<HomePage> {
);
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.myDoctor,
title: TranslationBase.of(context).myDoctor,
imagePath: 'doctor_icon.png',
subTitle: TranslationBase.of(context)
.myDoctorSubtitle,
@ -631,12 +665,11 @@ class _HomePageState extends State<HomePage> {
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(context,
FadePage(page: InsuranceCard()));
Navigator.push(
context, FadePage(page: InsuranceCard()));
},
child: MedicalProfileItem(
title: TranslationBase.of(context)
.insurance,
title: TranslationBase.of(context).insurance,
imagePath: 'insurance_card_icon.png',
subTitle: TranslationBase.of(context)
.insuranceSubtitle,
@ -645,7 +678,6 @@ class _HomePageState extends State<HomePage> {
),
],
),
],
),
),
@ -658,7 +690,7 @@ class _HomePageState extends State<HomePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
DashboardItem(
opacity:1.0,
opacity: 1.0,
child: Container(
width: double.infinity,
padding: EdgeInsets.all(10),
@ -671,7 +703,8 @@ class _HomePageState extends State<HomePage> {
bold: true,
),
Texts(
TranslationBase.of(context).viewAllHabibMedicalService,
TranslationBase.of(context)
.viewAllHabibMedicalService,
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: 10,
@ -689,13 +722,17 @@ class _HomePageState extends State<HomePage> {
),
height: 100,
imageName: 'ask_doctor_bg.png',
//color: Colors.grey[700],
//color: Colors.grey[700],
width: MediaQuery.of(context).size.width * 0.45,
onTap: () => Navigator.push(
context, FadePage(page: AllHabibMedicalService(goToMyProfile: widget.goToMyProfile,))),
context,
FadePage(
page: AllHabibMedicalService(
goToMyProfile: widget.goToMyProfile,
))),
),
DashboardItem(
opacity:1.0,
opacity: 1.0,
onTap: () {
Navigator.push(
context, FadePage(page: ContactUsPage()));
@ -715,7 +752,7 @@ class _HomePageState extends State<HomePage> {
TranslationBase.of(context).viewAllWaysReachUs,
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 1.0 ,
fontSize: SizeConfig.textMultiplier * 1.0,
),
Expanded(
child: Container(),
@ -753,20 +790,23 @@ class _HomePageState extends State<HomePage> {
}
getToDoCount() {
toDoProvider.setState(0);
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
print(res['AppointmentActiveNumber']);
if (res['MessageStatus'] == 1) {
setState(() {
toDoProvider.setState(res['AppointmentActiveNumber']);
});
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
print(err);
});
var authProvider = AuthProvider();
if (authProvider.isLogin) {
toDoProvider.setState(0);
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
print(res['AppointmentActiveNumber']);
if (res['MessageStatus'] == 1) {
setState(() {
toDoProvider.setState(res['AppointmentActiveNumber']);
});
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
}).catchError((err) {
print(err);
});
}
}
}
@ -780,7 +820,9 @@ class DashboardItem extends StatelessWidget {
this.width,
this.height,
this.color,
this.opacity = 1.0,this.icon,this.margin=0})
this.opacity = 1.0,
this.icon,
this.margin = 0})
: super(key: key);
final bool hasBorder;
final String imageName;

Loading…
Cancel
Save