|
|
|
|
@ -25,7 +25,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
onModelReady: (model) => model.getPendingOrders(),
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context, OrdersViewModel model, Widget child) =>
|
|
|
|
|
AppScaffold(
|
|
|
|
|
AppScaffold(
|
|
|
|
|
body: Column(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
@ -92,8 +92,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.15,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.44,
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height * 0.15,
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.44,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15.0),
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
@ -106,7 +112,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
padding: EdgeInsets.all(10.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
'You Have',
|
|
|
|
|
@ -139,13 +145,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
padding: EdgeInsets.only(right: 9.5),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/closed_box.png',
|
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.09,
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.20,
|
|
|
|
|
//fit: BoxFit.cover,
|
|
|
|
|
)),
|
|
|
|
|
@ -166,7 +174,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.15,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.44,
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.44,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15.0),
|
|
|
|
|
gradient: LinearGradient(
|
|
|
|
|
@ -180,7 +191,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
padding: EdgeInsets.all(12.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
|
MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
'You Have',
|
|
|
|
|
@ -236,8 +247,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
Expanded(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.16,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.50,
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height * 0.16,
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.50,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(15.0),
|
|
|
|
|
gradient: LinearGradient(colors: [
|
|
|
|
|
@ -253,9 +270,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
Image.asset(
|
|
|
|
|
'assets/images/qr_code.png',
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width * 0.25,
|
|
|
|
|
MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width * 0.25,
|
|
|
|
|
height:
|
|
|
|
|
MediaQuery.of(context).size.height * 0.14,
|
|
|
|
|
MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height * 0.14,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
@ -265,8 +288,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap:(){
|
|
|
|
|
_scanQrAndGetPatient(context,model);
|
|
|
|
|
onTap: () {
|
|
|
|
|
_scanQrAndGetPatient(context, model);
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
'SCAN',
|
|
|
|
|
@ -329,10 +352,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
onTap: () => Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => OrdersListScreen()),
|
|
|
|
|
)),
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => OrdersListScreen()),
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -340,47 +363,52 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
itemCount: //model.orders == null ? 0 : model.orders.length,
|
|
|
|
|
3,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.2),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: RoundedContainer(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.108,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 22.0),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/location.png',
|
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.10,
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.09,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (model.orders.length != 0)
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
itemCount: //model.orders == null ? 0 : model.orders.length,
|
|
|
|
|
3,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.2),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: RoundedContainer(
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height * 0.108,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 22.0),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/location.png',
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.10,
|
|
|
|
|
width: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.09,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (model.orders.length != 0)
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
model.orders[index].firstName +
|
|
|
|
|
@ -453,7 +481,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_scanQrAndGetPatient(BuildContext context,OrdersViewModel model) async {
|
|
|
|
|
_scanQrAndGetPatient(BuildContext context, OrdersViewModel model) async {
|
|
|
|
|
/// When give qr we will change this method to get data
|
|
|
|
|
/// var result = await BarcodeScanner.scan();
|
|
|
|
|
/// int patientID = get from qr result
|
|
|
|
|
@ -464,10 +492,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
await model.insertOrder();
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Utils.showErrorToast(model.error);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showSuccessToast(message: "Order Added");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|