dashboard and patient app

merge-requests/91/head
Salman Afzal 6 years ago
parent bde30d93ec
commit ac612f0eda

@ -32,303 +32,354 @@ class DashboardScreen extends StatefulWidget {
}
class _DashboardScreenState extends State<DashboardScreen> {
HospitalProvider projectsProvider;
@override
Widget build(BuildContext context) {
projectsProvider = Provider.of(context);
return AppScaffold(
appBarTitle: TranslationBase.of(context).dashboardScreenToolbarTitle,
current: 0,
body: Container(
child: Column(
children: <Widget>[
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.all(10),
child: AppText(
"Today's Statistics",
fontWeight: FontWeight.bold,
),
alignment: Alignment.centerLeft,
),
),
Expanded(
flex: 3,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: RoundedContainer(
child: CircularPercentIndicator(
radius: 90.0,
animation: true,
animationDuration: 1200,
lineWidth: 7.0,
percent: .75,
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
AppText("38",
fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 4),
AppText("Out-Patients",
fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 1.5,
color: Colors.grey[800]),
],
),
circularStrokeCap: CircularStrokeCap.butt,
backgroundColor: Colors.blueGrey[100],
progressColor: Colors.red,
),
appBarTitle: TranslationBase.of(context).dashboardScreenToolbarTitle,
current: 0,
body: Container(
child: new SingleChildScrollView(
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Column(
children: <Widget>[
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.all(10),
child: AppText(
"Today's Statistics",
fontWeight: FontWeight.bold,
),
alignment: Alignment.centerLeft,
),
Expanded(
flex: 2,
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: DashboardItemTexts(
"Arrived",
"23",
)),
Expanded(
child: DashboardItemTexts(
"Not Arrived",
"23",
),
),
],
),
Expanded(
flex: 3,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: RoundedContainer(
child: CircularPercentIndicator(
radius: 115.0,
animation: true,
animationDuration: 1200,
lineWidth: 7.0,
percent: .75,
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
AppText("38",
fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 4),
AppText("Out-Patients",
fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 1.2,
color: Colors.grey[800]),
],
),
circularStrokeCap: CircularStrokeCap.butt,
backgroundColor: Colors.blueGrey[100],
progressColor: Colors.red,
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: DashboardItemTexts(
"ER",
"23",
)),
Expanded(
child: DashboardItemTexts(
"Walk-in",
"23",
)),
],
)),
],
),
)
],
),
),
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"08",
"Lab Result",
backgroundColor: Colors.red,
),
),
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"10",
"Radiology",
backgroundColor: Colors.red,
)),
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"05",
"Referral",
backgroundColor: Colors.red,
)),
],
),
),
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"23",
"In-Patient",
showBorder: true,
),
),
Expanded(
flex: 2,
child: Padding(
padding: EdgeInsets.all(8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 1,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: DashboardItemTexts(
"Arrived",
"23",
)),
Expanded(
child: DashboardItemTexts(
"Not Arrived",
"23",
),
),
],
),
),
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
child: DashboardItemTexts(
"ER",
"23",
)),
Expanded(
child: DashboardItemTexts(
"Walk-in",
"23",
)),
],
)),
],
),
))
],
),
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"23",
"Operations",
showBorder: true,
)),
],
),
),
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.all(10),
child: AppText(
"Patient Services",
fontWeight: FontWeight.bold,
),
alignment: Alignment.centerLeft,
),
),
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: InkWell(
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"Search Patient",
showBorder: false,
backgroundColor: Colors.green[200],
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"08",
"Lab Result",
backgroundColor: Colors.black45,
// valueFontColor: Colors.white,
// titleFontColor: Colors.white,
// iconColor: Colors.white,
),
),
onTap: () {
Navigator.of(context).pushNamed(PATIENT_SEARCH);
},
),
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"10",
"Radiology",
backgroundColor: Colors.black45,
// valueFontColor: Colors.white,
// titleFontColor: Colors.white,
// iconColor: Colors.white,
)),
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"05",
"Referral",
backgroundColor: Colors.black45,
// valueFontColor: Colors.white,
// titleFontColor: Colors.white,
// iconColor: Colors.white,
)),
],
),
Expanded(
flex: 2,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => DoctorReplyProvider(),
child: DoctorReplyScreen(),
),
),
);
},
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"Doctor Reply",
showBorder: false,
backgroundColor: Colors.deepPurple[300],
),
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"23",
"In-Patient",
showBorder: true,
backgroundColor: Colors.red[900],
),
),
Expanded(
flex: 2,
child: new DashboardItemIconText(
DoctorApp.home_icon,
"23",
"Operations",
showBorder: true,
backgroundColor: Colors.red[900],
)),
],
),
),
Expanded(
flex: 1,
child: Container(
margin: EdgeInsets.all(10),
child: AppText(
"Patient Services",
fontWeight: FontWeight.bold,
),
alignment: Alignment.centerLeft,
),
],
),
),
Expanded(
flex: 3,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"Search Medicine",
showBorder: false,
backgroundColor: Colors.teal,
),
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 2,
child: InkWell(
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"Search Patient",
showBorder: true,
backgroundColor: Colors.white,
valueFontColor: Colors.black,
titleFontColor: Colors.black,
iconColor: Colors.black,
titleFontSize: 16,
),
onTap: () {
Navigator.of(context).pushNamed(PATIENT_SEARCH);
},
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => MedicineProvider(),
child: MedicineSearchScreen(),
),
Expanded(
flex: 2,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => DoctorReplyProvider(),
child: DoctorReplyScreen(),
),
),
);
},
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"Doctor Reply",
showBorder: true,
backgroundColor: Colors.white,
valueFontColor: Colors.black,
titleFontColor: Colors.black,
iconColor: Colors.black,
titleFontSize: 16,
),
);
},
),
),
),
],
),
Expanded(
flex: 1,
child: InkWell(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => MyReferralPatientProvider(),
child: MyReferralPatient(),
),
),
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"Search Medicine",
showBorder: true,
backgroundColor: Colors.white,
valueFontColor: Colors.black,
titleFontColor: Colors.black,
iconColor: Colors.black,
titleFontSize: 16,
),
);
},
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"My Referral Patient",
showBorder: false,
backgroundColor: Colors.brown[400],
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => MedicineProvider(),
child: MedicineSearchScreen(),
),
),
);
},
),
),
),
),
//==================
Expanded(
flex: 1,
child: InkWell(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => MyReferredPatientProvider(),
child: MyReferredPatient(),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => MyReferralPatientProvider(),
child: MyReferralPatient(),
),
),
);
},
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"My Referral Patient",
showBorder: true,
backgroundColor: Colors.white,
valueFontColor: Colors.black,
titleFontColor: Colors.black,
iconColor: Colors.black,
titleFontSize: 16,
),
);
},
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"My Referred Patient",
showBorder: false,
backgroundColor: Colors.orange,
),
),
),
],
),
//==================
],
),
),
Expanded(
flex: 2,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (_) => MyReferredPatientProvider(),
child: MyReferredPatient(),
),
),
);
},
child: DashboardItemIconText(
DoctorApp.home_icon,
"",
"My Referred Patient",
showBorder: true,
backgroundColor: Colors.white,
valueFontColor: Colors.black,
titleFontColor: Colors.black,
iconColor: Colors.black,
titleFontSize: 16,
),
),
),
Expanded(flex: 1, child: Container())
],
)),
],
),
],
),
),
);
//)
// ,
//constraints: new BoxConstraints(),
),
)));
// Container(
// );
}
}

@ -59,13 +59,11 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
void _validateInputs() async {
//print("============== _selectedType============"+ _selectedType);
try {
//====================
//_selectedType=='3'?
//=====================
try {
//====================
//_selectedType=='3'?
//=====================
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile =
@ -73,22 +71,22 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType);
print('************_selectedType*************');
print('************_selectedType*************');
print('_selectedType${_selectedType}');
String token = await sharedPref.getString(TOKEN);
_patientSearchFormValues.TokenID = token;
_patientSearchFormValues.ProjectID = doctorProfile.projectID ;//15
_patientSearchFormValues.ProjectID = doctorProfile.projectID; //15
_patientSearchFormValues.DoctorID = doctorProfile.doctorID;
_patientSearchFormValues.ClinicID = doctorProfile.clinicID;
//=====================
// _patientSearchFormValues.
// _patientSearchFormValues.
//=====================
print("=============doctorProfile.clinicID="+doctorProfile.clinicID.toString());
print("=============doctorProfile.clinicID=" +
doctorProfile.clinicID.toString());
Navigator.of(context).pushNamed(PATIENTS, arguments: {
"patientSearchForm": _patientSearchFormValues,
"selectedType": _selectedType
@ -101,7 +99,6 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
} catch (err) {
handelCatchErrorCase(err);
}
}
handelCatchErrorCase(err) {
@ -154,7 +151,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
children: <Widget>[
Expanded(
// add Expanded to have your dropdown button fill remaining space
child: DropdownButton(
child: DropdownButtonHideUnderline(
child: DropdownButton(
isExpanded: true,
value: _selectedType,
iconSize: 40,
@ -178,7 +176,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
onChanged: (String newValue) => {
setState(() {
_selectedType = newValue;
selectedPatientType = int.parse(_selectedType);
selectedPatientType =
int.parse(_selectedType);
})
},
items: PATIENT_TYPE.map((item) {
@ -190,7 +189,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
value: item['val'],
);
}).toList(),
),
)),
),
],
),
@ -249,7 +248,6 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
_patientSearchFormValues.setLastName = "0";
}
},
inputFormatter: ONLY_LETTERS),
SizedBox(
height: 10,
@ -332,7 +330,8 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
children: <Widget>[
Expanded(
// add Expanded to have your dropdown button fill remaining space
child: DropdownButton(
child: DropdownButtonHideUnderline(
child: DropdownButton(
isExpanded: true,
value: _selectedLocation,
iconSize: 40,
@ -367,7 +366,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
value: item['val'],
);
}).toList(),
),
)),
),
],
),

@ -1,48 +1,79 @@
import 'dart:ffi';
import '../shared/rounded_container_widget.dart';
import 'package:flutter/material.dart';
import '../shared/app_texts_widget.dart';
class DashboardItemIconText extends StatefulWidget {
final IconData icon;
final String value;
final String label;
final Color backgroundColor;
final bool showBorder;
final Color borderColor;
final IconData icon;
final String value;
final String label;
final Color backgroundColor;
final bool showBorder;
final Color borderColor;
final double titleFontSize;
final Color titleFontColor;
final Color valueFontColor;
final double valueFontSize;
final Color iconColor;
// OWNER : Ibrahim albitar
// DATE : 05-04-2020
// DESCRIPTION : Custom widget for dashboard items has texts and icons widgets
DashboardItemIconText(this.icon, this.value, this.label, {this.backgroundColor = Colors.white, this.showBorder = false, this.borderColor = Colors.white});
DashboardItemIconText(this.icon, this.value, this.label,
{this.backgroundColor = Colors.white,
this.showBorder = false,
this.titleFontSize = 12,
this.valueFontSize = 26,
this.valueFontColor = Colors.white,
this.titleFontColor = Colors.white,
this.iconColor = Colors.white,
this.borderColor = Colors.white});
@override
_DashboardItemTextsState createState() => _DashboardItemTextsState();
}
class _DashboardItemTextsState extends State<DashboardItemIconText> {
@override
@override
Widget build(BuildContext context) {
return new RoundedContainer(
child:Stack(
children: <Widget>[
Align(
alignment: FractionalOffset.topLeft,
child: Container(margin: EdgeInsets.all(10), child: Icon(widget.icon,),)
),
Align(
alignment: FractionalOffset.bottomRight,
child: Container(margin: EdgeInsets.all(10), child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
AppText(widget.value,),
Text(widget.label),
],))
),
],
) ,backgroundColor: widget.backgroundColor,
showBorder: widget.showBorder, borderColor: widget.borderColor,);
margin: 10,
child: Stack(
children: <Widget>[
Align(
alignment: FractionalOffset.topLeft,
child: Container(
margin: EdgeInsets.all(10),
child: Icon(
widget.icon,
color: widget.iconColor,
),
)),
Align(
alignment: FractionalOffset.bottomRight,
child: Container(
margin: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
AppText(
widget.value,
color: widget.valueFontColor,
fontSize: widget.valueFontSize,
),
AppText(
widget.label,
color: widget.titleFontColor,
fontSize: widget.titleFontSize,
),
],
))),
],
),
backgroundColor: widget.backgroundColor,
showBorder: widget.showBorder,
borderColor: widget.borderColor,
);
}
}
}

@ -1,41 +1,56 @@
import '../shared/rounded_container_widget.dart';
import '../shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
class DashboardItemTexts extends StatefulWidget {
final String label;
final String value;
final Color backgroundColor;
final bool showBorder;
final Color borderColor;
final String label;
final String value;
final Color backgroundColor;
final bool showBorder;
final Color borderColor;
// OWNER : Ibrahim albitar
// DATE : 05-04-2020
// DESCRIPTION : Custom widget for dashboard items has texts widgets
DashboardItemTexts(this.label, this.value, {this.backgroundColor = Colors.white, this.showBorder = false, this.borderColor = Colors.white});
DashboardItemTexts(this.label, this.value,
{this.backgroundColor = Colors.white,
this.showBorder = false,
this.borderColor = Colors.white});
@override
_DashboardItemTextsState createState() => _DashboardItemTextsState();
}
class _DashboardItemTextsState extends State<DashboardItemTexts> {
@override
@override
Widget build(BuildContext context) {
return new RoundedContainer(
child:Stack(
children: <Widget>[
Align(
alignment: FractionalOffset.topLeft,
child:Container(margin: EdgeInsets.all(5), child: AppText(widget.label),)
),
Align(
alignment: FractionalOffset.bottomRight,
child: Container(margin: EdgeInsets.all(10), child: AppText(widget.value, fontWeight: FontWeight.bold),)
),
],) ,backgroundColor: widget.backgroundColor, showBorder: widget.showBorder, borderColor: widget.borderColor, margin: 4,);
child: Stack(
children: <Widget>[
Align(
alignment: FractionalOffset.topLeft,
child: Container(
margin: EdgeInsets.all(5),
child: AppText(
widget.label,
fontSize: 12,
),
)),
Align(
alignment: FractionalOffset.bottomRight,
child: Container(
margin: EdgeInsets.all(10),
child: AppText(
widget.value,
fontWeight: FontWeight.bold,
),
)),
],
),
backgroundColor: widget.backgroundColor,
showBorder: widget.showBorder,
borderColor: widget.borderColor,
margin: 4,
);
}
}
}

@ -22,22 +22,21 @@ class RoundedContainer extends StatefulWidget {
final double borderWidth;
RoundedContainer(
{@required this.child,
this.width,
this.height,
this.raduis = 10,
this.backgroundColor = Colors.white,
this.margin = 10,
this.elevation = 1,
this.showBorder = false,
this.borderColor = Colors.red,
this.customCornerRaduis = false,
this.topLeft = 0,
this.topRight = 0,
this.bottomRight = 0,
this.bottomLeft = 0,
this.borderWidth =1
});
{@required this.child,
this.width,
this.height,
this.raduis = 10,
this.backgroundColor = Colors.white,
this.margin = 10,
this.elevation = 1,
this.showBorder = false,
this.borderColor = Colors.red,
this.customCornerRaduis = false,
this.topLeft = 0,
this.topRight = 0,
this.bottomRight = 0,
this.bottomLeft = 0,
this.borderWidth = 1});
@override
_RoundedContainerState createState() => _RoundedContainerState();
@ -47,13 +46,14 @@ class _RoundedContainerState extends State<RoundedContainer> {
@override
Widget build(BuildContext context) {
return Container(
width: widget.width,
height: widget.height,
width: widget.width,
height: widget.height,
margin: EdgeInsets.all(widget.margin),
decoration: widget.showBorder == true
? BoxDecoration(
color: Theme.of(context).primaryColor,
border: Border.all(color: widget.borderColor, width: widget.borderWidth),
color: Theme.of(context).primaryColor,
border: Border.all(
color: widget.borderColor, width: widget.borderWidth),
borderRadius: widget.customCornerRaduis
? BorderRadius.only(
topLeft: Radius.circular(widget.topLeft),
@ -61,18 +61,25 @@ class _RoundedContainerState extends State<RoundedContainer> {
bottomRight: Radius.circular(widget.bottomRight),
bottomLeft: Radius.circular(widget.bottomLeft))
: BorderRadius.circular(widget.raduis),
)
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
spreadRadius: 10,
blurRadius: 5,
offset: Offset(0, 5), // changes position of shadow
),
])
: null,
child: Card(
margin: EdgeInsets.all(0),
shape: RoundedRectangleBorder(
borderRadius: widget.customCornerRaduis
? BorderRadius.only(
topLeft: Radius.circular(widget.topLeft),
topRight: Radius.circular(widget.topRight),
bottomRight: Radius.circular(widget.bottomRight),
bottomLeft: Radius.circular(widget.bottomLeft))
: BorderRadius.circular(widget.raduis),
? BorderRadius.only(
topLeft: Radius.circular(widget.topLeft),
topRight: Radius.circular(widget.topRight),
bottomRight: Radius.circular(widget.bottomRight),
bottomLeft: Radius.circular(widget.bottomLeft))
: BorderRadius.circular(widget.raduis),
),
color: widget.backgroundColor,
child: widget.child,

Loading…
Cancel
Save