dashboard sreen updated

merge-requests/341/head
Sultan Khan 5 years ago
parent 05ef7a4b25
commit 3f7961b50c

@ -1,4 +1,6 @@
import 'package:doctor_app_flutter/screens/QR_reader_screen.dart';
import 'package:doctor_app_flutter/screens/dashboard_screen.dart'; import 'package:doctor_app_flutter/screens/dashboard_screen.dart';
import 'package:doctor_app_flutter/screens/doctor/doctor_reply_screen.dart';
import 'package:doctor_app_flutter/screens/doctor/message_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/message_screen.dart';
import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart';
import 'package:doctor_app_flutter/screens/doctor/services_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/services_screen.dart';
@ -64,9 +66,9 @@ class _LandingPageState extends State<LandingPage> {
ShowCaseWidget( ShowCaseWidget(
builder: Builder(builder: (context) => DashboardScreen()), builder: Builder(builder: (context) => DashboardScreen()),
), ),
// MessagesScreen(), DoctorReplyScreen(),
MyScheduleScreen(), MyScheduleScreen(),
// ServicesScreen() QrReaderScreen()
], ],
), ),
bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab),
@ -82,7 +84,7 @@ class _LandingPageState extends State<LandingPage> {
case 2: case 2:
return TranslationBase.of(context).mySchedule; return TranslationBase.of(context).mySchedule;
case 3: case 3:
return TranslationBase.of(context).services; return TranslationBase.of(context).qr;
} }
} }
} }

@ -17,6 +17,7 @@ import 'package:flutter/material.dart';
import '../routes.dart'; import '../routes.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
Helpers helpers = Helpers(); Helpers helpers = Helpers();
class QrReaderScreen extends StatefulWidget { class QrReaderScreen extends StatefulWidget {
@ -59,6 +60,7 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
onModelReady: (model) => model.getClinicsList(), onModelReady: (model) => model.getClinicsList(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false,
appBarTitle: appBarTitle:
TranslationBase.of(context).qr + TranslationBase.of(context).reader, TranslationBase.of(context).qr + TranslationBase.of(context).reader,
body: Center( body: Center(
@ -71,63 +73,63 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
AppText( AppText(
TranslationBase.of(context).startScanning, TranslationBase.of(context).startScanning,
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox( SizedBox(
height: 7, height: 7,
), ),
AppText(TranslationBase.of(context).scanQrCode, AppText(TranslationBase.of(context).scanQrCode,
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
textAlign: TextAlign.center), textAlign: TextAlign.center),
SizedBox( SizedBox(
height: 15, height: 15,
), ),
Container( Container(
height: 150, height: 150,
child: Image.asset('assets/images/qr_code.png'), child: Image.asset('assets/images/qr_code.png'),
),
SizedBox(
height: 35,
),
Button(
onTap: () {
_scanQrAndGetPatient(context, model);
},
title: TranslationBase.of(context).scanQr,
loading: isLoading,
icon: Image.asset('assets/images/qr_code_white.png'),
),
isError
? Container(
margin: EdgeInsets.only(top: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color: Theme.of(context).errorColor.withOpacity(0.06),
),
padding: EdgeInsets.symmetric(
vertical: 8.0, horizontal: 12.0),
child: Row(
children: <Widget>[
Expanded(
child: AppText(
error ??
TranslationBase.of(context)
.errorMessage,
color: Theme
.of(context)
.errorColor)),
],
),
)
: Container(),
],
), ),
), SizedBox(
height: 35,
),
Button(
onTap: () {
_scanQrAndGetPatient(context, model);
},
title: TranslationBase.of(context).scanQr,
loading: isLoading,
icon: Image.asset('assets/images/qr_code_white.png'),
),
isError
? Container(
margin: EdgeInsets.only(top: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.0),
color:
Theme.of(context).errorColor.withOpacity(0.06),
),
padding: EdgeInsets.symmetric(
vertical: 8.0, horizontal: 12.0),
child: Row(
children: <Widget>[
Expanded(
child: AppText(
error ??
TranslationBase.of(context)
.errorMessage,
color: Theme.of(context).errorColor)),
],
),
)
: Container(),
],
), ),
), ),
),); ),
),
),
);
} }
_scanQrAndGetPatient(BuildContext context, PatientViewModel model) async { _scanQrAndGetPatient(BuildContext context, PatientViewModel model) async {
@ -135,7 +137,7 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
/// var result = await BarcodeScanner.scan(); /// var result = await BarcodeScanner.scan();
/// int patientID = get from qr result /// int patientID = get from qr result
var result = await BarcodeScanner.scan(); var result = await BarcodeScanner.scan();
if (result.rawContent != "") { if (result.rawContent != "") {
List<String> listOfParams = result.rawContent.split(','); List<String> listOfParams = result.rawContent.split(',');
String patientType = "1"; String patientType = "1";
setState(() { setState(() {
@ -152,66 +154,65 @@ class _QrReaderScreenState extends State<QrReaderScreen> {
// patient.setClinicID = doctorProfile.clinicID; // patient.setClinicID = doctorProfile.clinicID;
// patient.setProjectID = doctorProfile.projectID; // patient.setProjectID = doctorProfile.projectID;
// Provider.of<PatientsProvider>(context, listen: false); // Provider.of<PatientsProvider>(context, listen: false);
patient.PatientID = 8808; patient.PatientID = 8808;
patient.TokenID = token; patient.TokenID = token;
model model.getPatientList(patient, "1", isBusyLocal: true).then((response) {
.getPatientList(patient, "1", isBusyLocal: true) if (response['MessageStatus'] == 1) {
.then((response) { switch (patientType) {
if (response['MessageStatus'] == 1) { case "0":
switch (patientType) { if (response['List_MyOutPatient'] != null) {
case "0": setState(() {
if (response['List_MyOutPatient'] != null) { patientList =
setState(() { ModelResponse.fromJson(response['List_MyOutPatient'])
patientList = .list;
ModelResponse.fromJson(response['List_MyOutPatient']).list; isLoading = false;
isLoading = false; });
}); Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { "patient": patientList[0],
"patient": patientList[0], });
}); } else {
} else { setState(() {
setState(() { isError = true;
isError = true; isLoading = false;
isLoading = false; });
}); DrAppToastMsg.showErrorToast('No patient');
DrAppToastMsg.showErrorToast('No patient'); }
}
break;
case "1":
if (response['List_MyInPatient'] != null) {
setState(() {
patientList =
ModelResponse.fromJson(response['List_MyInPatient']).list;
isLoading = false;
error = "";
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patientList[0],
});
} else {
setState(() {
isError = true;
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
break; break;
} case "1":
if (response['List_MyInPatient'] != null) {
setState(() {
patientList =
ModelResponse.fromJson(response['List_MyInPatient']).list;
isLoading = false;
error = "";
});
Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
"patient": patientList[0],
});
} else {
setState(() {
isError = true;
isLoading = false;
});
DrAppToastMsg.showErrorToast('No patient');
break;
}
}
} else {
setState(() {
isLoading = false;
isError = true;
});
DrAppToastMsg.showErrorToast(
response['ErrorEndUserMessage'] ?? response['ErrorMessage']);
} }
} else { }).catchError((error) {
setState(() { setState(() {
isLoading = false; isLoading = false;
isError = true;
}); });
DrAppToastMsg.showErrorToast( helpers.showErrorToast(error.message);
response['ErrorEndUserMessage'] ?? response['ErrorMessage']); //DrAppToastMsg.showErrorToast(error);
}
}).catchError((error) {
setState(() {
isLoading = false;
}); });
helpers.showErrorToast(error.message); }
//DrAppToastMsg.showErrorToast(error);
});
}
} }
} }

@ -989,50 +989,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
); );
}, },
), ),
DashboardItem(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Icon(
DoctorApp.qr_code,
size: 50,
color: Colors.black,
),
Column(
children: [
AppText(
projectsProvider.isArabic
? TranslationBase.of(context).reader
: TranslationBase.of(context).qr,
color: Colors.black,
textAlign: TextAlign.center,
),
AppText(
projectsProvider.isArabic
? TranslationBase.of(context).qr
: TranslationBase.of(context).reader,
color: Colors.black,
textAlign: TextAlign.center,
),
],
)
],
),
// imageName: '1.png',
hasBorder: true,
onTap: () {
Navigator.of(context).pushNamed(QR_READER);
},
),
],
),
SizedBox(
height: 20,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DashboardItem( DashboardItem(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -1060,44 +1016,88 @@ class _DashboardScreenState extends State<DashboardScreen> {
); );
}, },
), ),
// DashboardItem(
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: <Widget>[
// Icon(
// DoctorApp.qr_code,
// size: 50,
// color: Colors.black,
// ),
// Column(
// children: [
// AppText(
// projectsProvider.isArabic
// ? TranslationBase.of(context).reader
// : TranslationBase.of(context).qr,
// color: Colors.black,
// textAlign: TextAlign.center,
// ),
// AppText(
// projectsProvider.isArabic
// ? TranslationBase.of(context).qr
// : TranslationBase.of(context).reader,
// color: Colors.black,
// textAlign: TextAlign.center,
// ),
// ],
// )
// ],
// ),
// // imageName: '1.png',
// hasBorder: true,
// onTap: () {
// Navigator.of(context).pushNamed(QR_READER);
// },
// ),
],
),
SizedBox(
height: 20,
),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox( SizedBox(
width: 8, width: 8,
), ),
DashboardItem( // DashboardItem(
child: Column( // child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, // mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ // children: <Widget>[
Icon( // Icon(
DoctorApp.mail, // DoctorApp.mail,
size: 50, // size: 50,
color: Colors.black, // color: Colors.black,
), // ),
Column( // Column(
children: [ // children: [
AppText( // AppText(
TranslationBase.of(context).theDoctor, // TranslationBase.of(context).theDoctor,
textAlign: TextAlign.center, // textAlign: TextAlign.center,
color: Colors.black, // color: Colors.black,
), // ),
AppText( // AppText(
TranslationBase.of(context).reply, // TranslationBase.of(context).reply,
textAlign: TextAlign.center, // textAlign: TextAlign.center,
color: Colors.black, // color: Colors.black,
), // ),
], // ],
) // )
], // ],
), // ),
hasBorder: true, // hasBorder: true,
onTap: () { // onTap: () {
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => DoctorReplyScreen(), // builder: (context) => DoctorReplyScreen(),
), // ),
); // );
}, // },
) // )
], ],
), ),
SizedBox( SizedBox(
@ -1275,7 +1275,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
authProvider.getDocProfiles(docInfo.toJson()).then((res) async { authProvider.getDocProfiles(docInfo.toJson()).then((res) async {
changeIsLoading(false); changeIsLoading(false);
sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]);
model.getDashboard(); // model.getDashboard();
}).catchError((err) { }).catchError((err) {
changeIsLoading(false); changeIsLoading(false);
helpers.showErrorToast(err); helpers.showErrorToast(err);

@ -15,32 +15,32 @@ import 'package:flutter/material.dart';
*@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service *@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service
*/ */
class DoctorReplyScreen extends StatelessWidget { class DoctorReplyScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<DoctorReplayViewModel>( return BaseView<DoctorReplayViewModel>(
onModelReady: (model) => model.getDoctorReply(), onModelReady: (model) => model.getDoctorReply(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).replay2, appBarTitle: TranslationBase.of(context).replay2,
body: model isShowAppBar: false,
.listDoctorWorkingHoursTable.isEmpty ? DrAppEmbeddedError(error: TranslationBase.of(context).noItem):Container( body: model.listDoctorWorkingHoursTable.isEmpty
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), ? DrAppEmbeddedError(
child: ListView( error: TranslationBase.of(context).noItem)
children: [ : Container(
Column( padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
crossAxisAlignment: CrossAxisAlignment.start, child: ListView(
mainAxisAlignment: children: [
MainAxisAlignment.spaceBetween, Column(
children: model crossAxisAlignment: CrossAxisAlignment.start,
.listDoctorWorkingHoursTable mainAxisAlignment: MainAxisAlignment.spaceBetween,
.map((reply) { children:
return DoctorReplyWidget(reply: reply); model.listDoctorWorkingHoursTable.map((reply) {
}).toList(), return DoctorReplyWidget(reply: reply);
) }).toList(),
], )
), ],
), ),
),
)); ));
} }
} }

@ -44,14 +44,14 @@ class _BottomNavBarState extends State<BottomNavBar> {
currentIndex: 0, currentIndex: 0,
name: TranslationBase.of(context).home, name: TranslationBase.of(context).home,
), ),
// BottomNavigationItem( BottomNavigationItem(
// icon: DoctorApp.message_icon, icon: DoctorApp.message_icon,
// activeIcon: DoctorApp.message_icon_active, activeIcon: DoctorApp.message_icon_active,
// changeIndex: _changeIndex, changeIndex: _changeIndex,
// index: _index, index: _index,
// currentIndex: 1, currentIndex: 1,
// name: TranslationBase.of(context).replay2, name: TranslationBase.of(context).replay2,
// ), ),
BottomNavigationItem( BottomNavigationItem(
icon: DoctorApp.schedule_icon, icon: DoctorApp.schedule_icon,
activeIcon: DoctorApp.scdedule_icon_active, activeIcon: DoctorApp.scdedule_icon_active,
@ -60,14 +60,14 @@ class _BottomNavBarState extends State<BottomNavBar> {
currentIndex: 2, currentIndex: 2,
name: TranslationBase.of(context).mySchedule, name: TranslationBase.of(context).mySchedule,
), ),
// BottomNavigationItem( BottomNavigationItem(
// icon: DoctorApp.menu_icon, icon: DoctorApp.qr_code,
// activeIcon: DoctorApp.menu_icon_active, activeIcon: DoctorApp.qr_code,
// changeIndex: _changeIndex, changeIndex: _changeIndex,
// index: _index, index: _index,
// currentIndex: 3, currentIndex: 3,
// name: TranslationBase.of(context).services, name: TranslationBase.of(context).qr,
// ) )
], ],
), ),
), ),

@ -403,6 +403,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_page_indicator:
dependency: transitive
description:
name: flutter_page_indicator
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:
@ -410,6 +417,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.11" version: "1.0.11"
flutter_swiper:
dependency: "direct main"
description:
name: flutter_swiper
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -873,6 +887,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1+3" version: "0.1.1+3"
transformer_page_view:
dependency: transitive
description:
name: transformer_page_view
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save