Merge branch 'master' of gitlab.com:Cloud_Solution/driver-app into delivery_confirmed

setting_branch
enadhilal 6 years ago
commit c5cb40fdb4

@ -5,7 +5,9 @@ import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/pages/delivery/information_page.dart'; import 'package:driverapp/pages/delivery/information_page.dart';
import 'package:driverapp/pages/orders/pending_orders_page.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart';
import 'package:driverapp/uitl/app_toast.dart'; import 'package:driverapp/uitl/app_toast.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/data_display/circle-container.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:driverapp/widgets/others/network_base_view.dart'; import 'package:driverapp/widgets/others/network_base_view.dart';
import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:driverapp/widgets/others/rounded_container.dart';
@ -13,11 +15,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:driverapp/widgets/data_display/circle-container.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../base/base_view.dart'; import '../base/base_view.dart';
import 'package:driverapp/config/shared_pref_kay.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
class DashboardScreen extends StatefulWidget { class DashboardScreen extends StatefulWidget {
@override @override
@ -32,478 +30,496 @@ class _DashboardScreenState extends State<DashboardScreen> {
onModelReady: (model) => model.getPendingOrders(), onModelReady: (model) => model.getPendingOrders(),
builder: (BuildContext context, OrdersViewModel model, Widget child) => builder: (BuildContext context, OrdersViewModel model, Widget child) =>
AppScaffold( AppScaffold(
body: Column( body: Container(
// mainAxisAlignment: MainAxisAlignment.center, height: MediaQuery.of(context).size.height * .95,
crossAxisAlignment: CrossAxisAlignment.center, child: ListView(
children: <Widget>[ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.all(16.0), padding: EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
TranslationBase.of(context).haveGreatDay,
style: TextStyle(
fontSize: 14.5,
color: Color(0xff636363),
fontWeight: FontWeight.w300),
),
Padding(
padding: EdgeInsets.only(top: 4.5),
child: Text(
'Drive Name',
//model.user.userName,
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 25.0),
),
),
],
),
),
],
),
),
Padding(
padding: EdgeInsets.all(16.0),
child: SafeArea(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
CircleAvatar( SafeArea(
radius: 25.5, child: Column(
backgroundColor: Color(0xff30B7B9), mainAxisAlignment: MainAxisAlignment.start,
child: CircleAvatar( crossAxisAlignment: CrossAxisAlignment.start,
backgroundColor: Color(0xff30B7B9),
maxRadius: 26.0,
child: Image.asset(
'assets/images/driver.png',
fit: BoxFit.contain,
),
),
),
],
),
),
),
],
),
Row(
children: <Widget>[
Expanded(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
height: MediaQuery.of(context).size.height * 0.16,
width: MediaQuery.of(context).size.width * 0.44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
gradient: LinearGradient(
colors: [Color(0xff17AFB8), Color(0xff49C1BC)]),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Text(
child: Padding( TranslationBase.of(context).haveGreatDay,
padding: EdgeInsets.all(2.0), style: TextStyle(
child: Column( fontSize: 14.5,
mainAxisAlignment: color: Color(0xff636363),
MainAxisAlignment.spaceEvenly, fontWeight: FontWeight.w300),
children: <Widget>[
Text(
TranslationBase.of(context).youHave,
style: TextStyle(
color: Colors.white,
fontSize: 10.0),
),
Text(
'5',
style: TextStyle(
color: Colors.white,
fontSize: 25.0),
),
Text(
TranslationBase.of(context)
.undeliveredPackages,
style: TextStyle(
color: Colors.white, fontSize: 9.5),
)
],
),
),
), ),
Padding( Padding(
padding: EdgeInsets.only(right: 9.5), padding: EdgeInsets.only(top: 4.5),
child: Container( child: Text(
width: 110, 'Drive Name',
height: 110, //model.user.userName,
decoration: BoxDecoration( style: TextStyle(
color: Colors.white10, fontWeight: FontWeight.w400,
shape: BoxShape.circle), fontSize: 25.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/closed_box.png',
height:
MediaQuery.of(context).size.height *
0.10,
width:
MediaQuery.of(context).size.width *
0.20,
scale: 0.9,
fit: BoxFit.contain,
),
],
),
), ),
), ),
], ],
), ),
), ),
) ],
], ),
), ),
), Padding(
Expanded( padding: EdgeInsets.all(16.0),
child: Column( child: SafeArea(
children: <Widget>[ child: Column(
Padding( children: <Widget>[
padding: EdgeInsets.symmetric(horizontal: 10.0), CircleAvatar(
child: Container( radius: 25.5,
height: MediaQuery.of(context).size.height * 0.16, backgroundColor: Color(0xff30B7B9),
width: MediaQuery.of(context).size.width * 0.45, child: CircleAvatar(
decoration: BoxDecoration( backgroundColor: Color(0xff30B7B9),
borderRadius: BorderRadius.circular(15.0), maxRadius: 26.0,
gradient: LinearGradient( child: Image.asset(
colors: [Color(0xff17AFB8), Color(0xff49C1BC)]), 'assets/images/driver.png',
fit: BoxFit.contain,
),
),
), ),
child: Row( ],
mainAxisAlignment: MainAxisAlignment.spaceBetween, ),
children: <Widget>[ ),
Expanded( ),
child: Padding( ],
padding: EdgeInsets.all(2.0), ),
child: Column( Row(
mainAxisAlignment: children: <Widget>[
MainAxisAlignment.spaceEvenly, Expanded(
children: <Widget>[ child: Column(
Text( children: <Widget>[
TranslationBase.of(context).youHave, Padding(
style: TextStyle( padding: EdgeInsets.symmetric(horizontal: 10.0),
color: Colors.white, child: Container(
fontSize: 10.0), height: MediaQuery.of(context).size.height * 0.16,
), width: MediaQuery.of(context).size.width * 0.44,
Text( decoration: BoxDecoration(
'25', borderRadius: BorderRadius.circular(15.0),
style: TextStyle( gradient: LinearGradient(colors: [
color: Colors.white, Color(0xff17AFB8),
fontSize: 25.0), Color(0xff49C1BC)
), ]),
Text( ),
TranslationBase.of(context) child: Row(
.deliveredPackages, mainAxisAlignment: MainAxisAlignment.spaceBetween,
style: TextStyle( children: <Widget>[
color: Colors.white, Expanded(
fontSize: 10.0), child: Padding(
) padding: EdgeInsets.all(2.0),
], child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
TranslationBase.of(context).youHave,
style: TextStyle(
color: Colors.white,
fontSize: 10.0),
),
Text(
'5',
style: TextStyle(
color: Colors.white,
fontSize: 25.0),
),
Text(
TranslationBase.of(context)
.undeliveredPackages,
style: TextStyle(
color: Colors.white,
fontSize: 9.5),
)
],
),
), ),
), ),
), Padding(
Padding( padding: EdgeInsets.only(right: 9.5),
padding: EdgeInsets.only(right: 9.5), child: Container(
child: Container( width: 110,
width: 110, height: 110,
height: 110, decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white10,
color: Colors.white10, shape: BoxShape.circle),
shape: BoxShape.circle), child: Column(
child: Column( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment.center, MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'assets/images/opend_box.png', 'assets/images/closed_box.png',
height: height: MediaQuery.of(context)
MediaQuery.of(context).size.height * .size
0.10, .height *
width: 0.10,
MediaQuery.of(context).size.width * width: MediaQuery.of(context)
0.20, .size
scale: 0.9, .width *
fit: BoxFit.contain, 0.20,
), scale: 0.9,
], fit: BoxFit.contain,
),
],
),
), ),
), ),
), ],
], ),
), ),
), )
) ],
], ),
), ),
),
],
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0),
child: Row(
children: <Widget>[
Expanded( Expanded(
child: InkWell( child: Column(
child: Container( children: <Widget>[
height: MediaQuery.of(context).orientation == Padding(
Orientation.portrait padding: EdgeInsets.symmetric(horizontal: 10.0),
? MediaQuery.of(context).size.height * 0.18 child: Container(
: MediaQuery.of(context).size.height * 0.28, height: MediaQuery.of(context).size.height * 0.16,
width: MediaQuery.of(context).size.width * 0.50, width: MediaQuery.of(context).size.width * 0.45,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0), borderRadius: BorderRadius.circular(15.0),
gradient: LinearGradient( gradient: LinearGradient(colors: [
colors: [Hexcolor("#45B7AE"), Hexcolor("#119FA9")], Color(0xff17AFB8),
), Color(0xff49C1BC)
), ]),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/qr_code.png',
width:
MediaQuery.of(context).size.width * 0.26,
height:
MediaQuery.of(context).size.height * 0.14,
fit: BoxFit.contain,
)
],
), ),
Column( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
InkWell( Expanded(
onTap: () {
_scanQrAndGetPatient(context, model);
},
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 8.0), padding: EdgeInsets.all(2.0),
child: Text( child: Column(
TranslationBase.of(context).scan, mainAxisAlignment:
style: TextStyle( MainAxisAlignment.spaceEvenly,
fontSize: 35.0, children: <Widget>[
color: Colors.white, Text(
fontWeight: FontWeight.w400, TranslationBase.of(context).youHave,
), style: TextStyle(
color: Colors.white,
fontSize: 10.0),
),
Text(
'25',
style: TextStyle(
color: Colors.white,
fontSize: 25.0),
),
Text(
TranslationBase.of(context)
.deliveredPackages,
style: TextStyle(
color: Colors.white,
fontSize: 10.0),
)
],
), ),
), ),
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 0.0), padding: EdgeInsets.only(right: 9.5),
child: Text( child: Container(
TranslationBase.of(context) width: 110,
.toAddPackageToQue, height: 110,
style: TextStyle( decoration: BoxDecoration(
fontSize: 15.0, color: Colors.white10,
color: Colors.white, shape: BoxShape.circle),
letterSpacing: 0.2, child: Column(
wordSpacing: 0.5, mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/opend_box.png',
height: MediaQuery.of(context)
.size
.height *
0.10,
width: MediaQuery.of(context)
.size
.width *
0.20,
scale: 0.9,
fit: BoxFit.contain,
),
],
), ),
), ),
), ),
], ],
) ),
], ),
), )
), ],
), ),
) ),
], ],
), ),
), Padding(
NetworkBaseView( padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0),
baseViewModel: model,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Column( Expanded(
children: <Widget>[ child: InkWell(
Text( child: Container(
TranslationBase.of(context).nearestDropOffs, height: MediaQuery.of(context).orientation ==
style: TextStyle( Orientation.portrait
fontSize: 21.0, ? MediaQuery.of(context).size.height * 0.18
fontWeight: FontWeight.w400, : MediaQuery.of(context).size.height * 0.28,
width: MediaQuery.of(context).size.width * 0.50,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
gradient: LinearGradient(
colors: [
Hexcolor("#45B7AE"),
Hexcolor("#119FA9")
],
),
), ),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
InkWell(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
Text( Column(
TranslationBase.of(context).seeAll, mainAxisAlignment: MainAxisAlignment.center,
style: TextStyle( children: <Widget>[
fontSize: 14.5, color: Color(0xff42B6AD)), Image.asset(
), 'assets/images/qr_code.png',
Icon( width: MediaQuery.of(context).size.width *
Icons.arrow_forward_ios, 0.26,
size: 15.0, height: MediaQuery.of(context).size.height *
color: Color(0xff42B6AD), 0.14,
fit: BoxFit.contain,
)
],
), ),
Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: () {
_scanQrAndGetPatient(context, model);
},
child: Padding(
padding: EdgeInsets.only(top: 8.0),
child: Text(
TranslationBase.of(context).scan,
style: TextStyle(
fontSize: 35.0,
color: Colors.white,
fontWeight: FontWeight.w400,
),
),
),
),
Padding(
padding: EdgeInsets.only(top: 0.0),
child: Text(
TranslationBase.of(context)
.toAddPackageToQue,
style: TextStyle(
fontSize: 15.0,
color: Colors.white,
letterSpacing: 0.2,
wordSpacing: 0.5,
),
),
),
],
)
], ],
), ),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrdersListScreen()),
),
), ),
], ),
), )
], ],
), ),
), ),
), NetworkBaseView(
NetworkBaseView( baseViewModel: model,
baseViewModel: model, child: Padding(
child: Expanded( padding:
child: ListView.builder( EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0),
shrinkWrap: true, child: Row(
scrollDirection: Axis.vertical, mainAxisAlignment: MainAxisAlignment.spaceBetween,
itemCount: //model.orders == null ? 0 : model.orders.length, children: <Widget>[
3, Column(
itemBuilder: (BuildContext context, int index) { children: <Widget>[
return Padding( Text(
padding: EdgeInsets.symmetric(horizontal: 12.2), TranslationBase.of(context).nearestDropOffs,
child: InkWell( style: TextStyle(
child: RoundedContainer( fontSize: 21.0,
raduis: 25.0, fontWeight: FontWeight.w400,
height: MediaQuery.of(context).orientation == ),
Orientation.portrait ),
? MediaQuery.of(context).size.height * 0.109 ],
: MediaQuery.of(context).size.height * 0.209, ),
child: Row( Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Expanded( InkWell(
flex: 1, child: Row(
child: Column( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.start, Text(
crossAxisAlignment: CrossAxisAlignment.start, TranslationBase.of(context).seeAll,
children: <Widget>[ style: TextStyle(
Padding( fontSize: 14.5, color: Color(0xff42B6AD)),
padding: EdgeInsets.only(
left: 15.0, top: 14.0),
child: Image.asset(
'assets/images/location.png',
height: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.height *
0.06
: MediaQuery.of(context)
.size
.height *
0.11,
width: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.width *
0.05
: MediaQuery.of(context)
.size
.width *
0.09,
),
)
],
), ),
), Icon(
if (model.orders.length != 0) Icons.arrow_forward_ios,
size: 15.0,
color: Color(0xff42B6AD),
),
],
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrdersListScreen()),
),
),
],
),
],
),
),
),
NetworkBaseView(
baseViewModel: model,
child: 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(
raduis: 25.0,
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height * 0.109
: MediaQuery.of(context).size.height * 0.209,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded( Expanded(
flex: 5, flex: 1,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(
child: Text( left: 15.0, top: 14.0),
model.orders[index].firstName + child: Image.asset(
' ' + 'assets/images/location.png',
model.orders[index].lastName, height: MediaQuery.of(context)
style: TextStyle(fontSize: 18.0), .orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.height *
0.06
: MediaQuery.of(context)
.size
.height *
0.11,
width: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.width *
0.05
: MediaQuery.of(context)
.size
.width *
0.09,
), ),
), )
Text( ],
model.orders[index].mobileNumber, ),
style: TextStyle( ),
color: Color(0xff30B7B9), if (model.orders.length != 0)
fontWeight: FontWeight.w600, Expanded(
fontSize: 15.0, flex: 5,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 20.0),
child: Text(
model.orders[index].firstName +
' ' +
model.orders[index].lastName,
style: TextStyle(fontSize: 18.0),
),
), ),
), Text(
Expanded( model.orders[index].mobileNumber,
child: Text(
'Olaya ST, Behind kfc next to king , ',
style: TextStyle( style: TextStyle(
color: Color(0xff636363)), color: Color(0xff30B7B9),
fontWeight: FontWeight.w600,
fontSize: 15.0,
),
), ),
), Expanded(
], child: Text(
'Olaya ST, Behind kfc next to king , ',
style: TextStyle(
color: Color(0xff636363)),
),
),
],
),
), ),
), Padding(
Padding( padding: EdgeInsets.all(8.0),
padding: EdgeInsets.all(8.0), child: CircleContainer(
child: CircleContainer( child: Text(
child: Text( model.orders[index].distanceInKilometers
model.orders[index].distanceInKilometers .toString() +
.toString() + ' K.m\naway',
' K.m\naway', style: TextStyle(
style: TextStyle( color: Color(0xff42B6AD),
color: Color(0xff42B6AD), fontWeight: FontWeight.w800,
fontWeight: FontWeight.w800, fontStyle: FontStyle.normal),
fontStyle: FontStyle.normal), ),
), ),
), ),
), ],
], ),
), ),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
InformationPage(model.orders[index])));
},
), ),
onTap: () { );
Navigator.push( },
context, ),
MaterialPageRoute(
builder: (context) =>
InformationPage(model.orders[index])));
},
),
);
},
), ),
), ),
), ],
], ),
), ),
), ),
); );

@ -20,7 +20,7 @@ class CustomDialog extends StatelessWidget {
return BaseView<OrdersViewModel>( return BaseView<OrdersViewModel>(
builder: (_, model, w) => Center( builder: (_, model, w) => Center(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.35, height: MediaQuery.of(context).size.height * 0.50,
width: MediaQuery.of(context).size.width * 0.95, width: MediaQuery.of(context).size.width * 0.95,
child: Dialog( child: Dialog(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(

Loading…
Cancel
Save