|
|
|
|
@ -1,27 +1,34 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/clinic_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/doctor_profile_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/profile_req_Model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/auth_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/doctor_reply_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/medicine_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/hospital_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/medicine_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/referral_patient_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/referred_patient_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/QR_reader_screen.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import '../routes.dart';
|
|
|
|
|
import '../widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:percent_indicator/circular_percent_indicator.dart';
|
|
|
|
|
import 'package:platform_action_sheet/platform_action_sheet.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../presentation/doctor_app_icons.dart';
|
|
|
|
|
import '../routes.dart';
|
|
|
|
|
import '../widgets/dashboard/dashboard_item_icons_texts.dart';
|
|
|
|
|
import '../widgets/dashboard/dashboard_item_texts_widget.dart';
|
|
|
|
|
import '../widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import '../widgets/shared/rounded_container_widget.dart';
|
|
|
|
|
import 'doctor/doctor_reply_screen.dart';
|
|
|
|
|
import 'doctor/my_referral_patient_screen.dart';
|
|
|
|
|
|
|
|
|
|
import 'doctor/my_referred_patient_screen.dart';
|
|
|
|
|
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
|
|
|
|
Helpers helpers = Helpers();
|
|
|
|
|
|
|
|
|
|
class DashboardScreen extends StatefulWidget {
|
|
|
|
|
DashboardScreen({Key key, this.title}) : super(key: key);
|
|
|
|
|
@ -33,11 +40,14 @@ class DashboardScreen extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
HospitalProvider projectsProvider;
|
|
|
|
|
HospitalProvider hospitalProvider;
|
|
|
|
|
AuthProvider authProvider;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectsProvider = Provider.of(context);
|
|
|
|
|
hospitalProvider = Provider.of(context);
|
|
|
|
|
authProvider = Provider.of(context);
|
|
|
|
|
print(authProvider.doctorsClinicList);
|
|
|
|
|
return SafeArea(
|
|
|
|
|
bottom: true,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
@ -60,12 +70,20 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
),
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 10, top: 10, right: 10),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.settings,
|
|
|
|
|
size: SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
))
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
showCupertinoPicker(
|
|
|
|
|
context: context,
|
|
|
|
|
actionList: authProvider.doctorsClinicList);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(left: 10, top: 10, right: 10),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.settings,
|
|
|
|
|
size: SizeConfig.textMultiplier * 2.5,
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 10, top: 5),
|
|
|
|
|
@ -408,17 +426,119 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
//)
|
|
|
|
|
|
|
|
|
|
// ,
|
|
|
|
|
//constraints: new BoxConstraints(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Container(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ActionSheetAction> buildActionSheetAction(
|
|
|
|
|
{List<ClinicModel> actionList, List defaultActionList}) {
|
|
|
|
|
List<ActionSheetAction> AList = [];
|
|
|
|
|
|
|
|
|
|
actionList.forEach((element) {
|
|
|
|
|
print(element.clinicID);
|
|
|
|
|
AList.add(ActionSheetAction(
|
|
|
|
|
text: element.clinicName,
|
|
|
|
|
onPressed: () => Navigator.pop(context),
|
|
|
|
|
isCancel: true,
|
|
|
|
|
defaultAction: true,
|
|
|
|
|
));
|
|
|
|
|
});
|
|
|
|
|
return AList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showCupertinoPicker(
|
|
|
|
|
{context, List<ClinicModel> actionList, decKey, onSelectFun}) {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
isDismissible: false,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext builder) {
|
|
|
|
|
return Container(
|
|
|
|
|
// height: 500,
|
|
|
|
|
height: SizeConfig.realScreenHeight * 0.4,
|
|
|
|
|
color: Color(0xfff7f7f7),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
color: Color(0xfff7f7f7),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
CupertinoButton(
|
|
|
|
|
child: Text(
|
|
|
|
|
'Cancel'.toUpperCase(),
|
|
|
|
|
// style: TextStyle(context)
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
CupertinoButton(
|
|
|
|
|
child: Text(
|
|
|
|
|
'Done'.toUpperCase(),
|
|
|
|
|
// style: textStyle(context),
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
// onSelectFun(cupertinoPickerIndex);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: SizeConfig.realScreenHeight * 0.3,
|
|
|
|
|
color: Color(0xfff7f7f7),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: actionList
|
|
|
|
|
.map((e) => Container(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: changeClinic(e.clinicID),
|
|
|
|
|
child: Text(
|
|
|
|
|
e.clinicName,
|
|
|
|
|
style: TextStyle(fontSize: 15),
|
|
|
|
|
)),
|
|
|
|
|
))
|
|
|
|
|
.toList(),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeClinic(clinicId) async{
|
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
DoctorProfileModel doctorProfile =
|
|
|
|
|
new DoctorProfileModel.fromJson(profile);
|
|
|
|
|
ProfileReqModel docInfo = new ProfileReqModel(
|
|
|
|
|
doctorID: doctorProfile.doctorID,
|
|
|
|
|
clinicID: clinicId,
|
|
|
|
|
license: true,
|
|
|
|
|
projectID: doctorProfile.projectID,
|
|
|
|
|
tokenID: '',
|
|
|
|
|
languageID: 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// authProvider.getDocProfiles(docInfo)
|
|
|
|
|
authProvider.getDocProfiles(docInfo.toJson()).then((res)async {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]);
|
|
|
|
|
Map profile1 = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
print(1);
|
|
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
} else {
|
|
|
|
|
// changeLoadingStata(false);
|
|
|
|
|
// helpers.showErrorToast(res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
|
|
|
|
|
// changeLoadingStata(false);
|
|
|
|
|
helpers.showErrorToast(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|