Merge branch 'updates_new' into 'development'

Updates new

See merge request Cloud_Solution/driver-app!111
barcode_scanner
Elham 5 years ago
commit 8d9449a239

@ -55,210 +55,98 @@ 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: Container( body: SingleChildScrollView(
child: Column( child: Container(
mainAxisSize: MainAxisSize.min, height: MediaQuery.of(context).size.height * 1.6,
children: <Widget>[ child: Column(
Row( children: <Widget>[
mainAxisAlignment: MainAxisAlignment.spaceBetween, Row(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.spaceBetween,
Padding( children: <Widget>[
padding: EdgeInsets.all(16.0), Padding(
child: Column( padding: EdgeInsets.all(16.0),
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(
_authenticationViewModel.user.userName,
style: TextStyle(
fontSize: 22.0,
color: Hexcolor("#343333"),
fontWeight: FontWeight.bold),
),
),
],
),
),
],
),
),
Padding(
padding: EdgeInsets.all(16.0),
child: SafeArea(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
InkWell( SafeArea(
child: CircleAvatar( child: Column(
radius: 25.5, mainAxisAlignment: MainAxisAlignment.start,
backgroundColor: Color(0xff30B7B9), crossAxisAlignment: CrossAxisAlignment.start,
child: CircleAvatar(
backgroundColor: Color(0xff30B7B9),
maxRadius: 26.0,
child: Image.asset(
'assets/images/driver.png',
fit: BoxFit.contain,
),
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SettingPage(
driverName: _authenticationViewModel
.user.userName,
driverID: _authenticationViewModel
.user.userID)));
},
),
],
),
),
),
],
),
Row(
children: <Widget>[
Expanded(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height * 0.16
: MediaQuery.of(context).size.height * 0.30,
width: MediaQuery.of(context).size.width * 0.44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
gradient: LINEAR_GRADIENT,
),
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: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig.textMultiplier *
2.2
: SizeConfig.textMultiplier *
1.3,
),
),
Text(
'5',
style: TextStyle(
color: Colors.white,
fontSize:
SizeConfig.textMultiplier *
3.0),
),
Text(
TranslationBase.of(context)
.undeliveredPackages,
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig.textMultiplier *
2.2
: SizeConfig.textMultiplier *
1.3,
),
)
],
),
),
), ),
Padding( Padding(
padding: EdgeInsets.only(right: 9.5), padding: EdgeInsets.only(top: 4.5),
child: Container( child: Text(
width: 100, _authenticationViewModel.user.userName,
height: 100, style: TextStyle(
decoration: BoxDecoration( fontSize: 22.0,
color: Colors.white10, color: Hexcolor("#343333"),
shape: BoxShape.circle), fontWeight: FontWeight.bold),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/closed_box.png',
height: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.height *
0.09
: MediaQuery.of(context)
.size
.height *
0.20,
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), InkWell(
child: Container( child: CircleAvatar(
height: MediaQuery.of(context).orientation == radius: 25.5,
Orientation.portrait backgroundColor: Color(0xff30B7B9),
? MediaQuery.of(context).size.height * 0.16 child: CircleAvatar(
: MediaQuery.of(context).size.height * 0.30, backgroundColor: Color(0xff30B7B9),
width: MediaQuery.of(context).size.width * 0.45, maxRadius: 26.0,
decoration: BoxDecoration( child: Image.asset(
borderRadius: BorderRadius.circular(15.0), 'assets/images/driver.png',
gradient: LINEAR_GRADIENT, fit: BoxFit.contain,
),
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SettingPage(
driverName: _authenticationViewModel
.user.userName,
driverID: _authenticationViewModel
.user.userID)));
},
), ),
child: InkWell( ],
onTap: () => Navigator.push( ),
context, ),
MaterialPageRoute( ),
builder: (context) => ],
DeliverdOrdersPage())), ),
Row(
children: <Widget>[
Expanded(
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height * 0.16
: MediaQuery.of(context).size.height * 0.30,
width: MediaQuery.of(context).size.width * 0.44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0),
gradient: LINEAR_GRADIENT,
),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
@ -284,7 +172,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
), ),
), ),
Text( Text(
'3', '5',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: fontSize:
@ -293,7 +181,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
), ),
Text( Text(
TranslationBase.of(context) TranslationBase.of(context)
.deliveredPackages, .undeliveredPackages,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: MediaQuery.of(context) fontSize: MediaQuery.of(context)
@ -315,15 +203,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
width: 100, width: 100,
height: 100, height: 100,
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: MediaQuery.of(context) height: MediaQuery.of(context)
.orientation == .orientation ==
Orientation.portrait Orientation.portrait
@ -349,170 +236,301 @@ class _DashboardScreenState extends State<DashboardScreen> {
], ],
), ),
), ),
), )
) ],
], ),
), ),
),
],
),
Padding(
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0),
child: Row(
children: <Widget>[
Expanded( Expanded(
child: InkWell( child: Column(
onTap: () { children: <Widget>[
_scanQrAndGetPatient(context, model); Padding(
}, padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Container( child: Container(
height: MediaQuery.of(context).orientation == height: MediaQuery.of(context).orientation ==
Orientation.portrait Orientation.portrait
? MediaQuery.of(context).size.height * 0.18 ? MediaQuery.of(context).size.height * 0.16
: MediaQuery.of(context).size.height * 0.30, : MediaQuery.of(context).size.height * 0.30,
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: LINEAR_GRADIENT, gradient: LINEAR_GRADIENT,
),
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)
.orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height *
0.14
: MediaQuery.of(context).size.height *
0.28,
fit: BoxFit.contain,
)
],
), ),
Column( child: InkWell(
mainAxisAlignment: onTap: () => Navigator.push(
MainAxisAlignment.spaceEvenly, context,
crossAxisAlignment: CrossAxisAlignment.start, MaterialPageRoute(
children: <Widget>[ builder: (context) =>
Padding( DeliverdOrdersPage())),
padding: EdgeInsets.only(top: 8.0), child: Row(
child: Text( mainAxisAlignment:
TranslationBase.of(context).scan, MainAxisAlignment.spaceBetween,
style: TextStyle( children: <Widget>[
fontSize: MediaQuery.of(context) Expanded(
.orientation == child: Padding(
Orientation.landscape padding: EdgeInsets.all(2.0),
? SizeConfig.textMultiplier * 6.0 child: Column(
: SizeConfig.textMultiplier * 4.0, mainAxisAlignment:
color: Colors.white, MainAxisAlignment.spaceEvenly,
fontWeight: FontWeight.w400, children: <Widget>[
Text(
TranslationBase.of(context)
.youHave,
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig
.textMultiplier *
2.2
: SizeConfig
.textMultiplier *
1.3,
),
),
Text(
'3',
style: TextStyle(
color: Colors.white,
fontSize: SizeConfig
.textMultiplier *
3.0),
),
Text(
TranslationBase.of(context)
.deliveredPackages,
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig
.textMultiplier *
2.2
: SizeConfig
.textMultiplier *
1.3,
),
)
],
),
), ),
), ),
), Padding(
Padding( padding: EdgeInsets.only(right: 9.5),
padding: EdgeInsets.only(top: 0.0), child: Container(
child: Text( width: 100,
TranslationBase.of(context) height: 100,
.toAddPackageToQue, decoration: BoxDecoration(
style: TextStyle( color: Colors.white10,
fontSize: MediaQuery.of(context) shape: BoxShape.circle,
.orientation == ),
Orientation.landscape child: Column(
? SizeConfig.textMultiplier * 3.0 mainAxisAlignment:
: SizeConfig.textMultiplier * 2.0, MainAxisAlignment.center,
color: Colors.white, children: <Widget>[
letterSpacing: 0.2, Image.asset(
wordSpacing: 0.5, 'assets/images/opend_box.png',
height: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.height *
0.09
: MediaQuery.of(context)
.size
.height *
0.20,
width: MediaQuery.of(context)
.size
.width *
0.20,
scale: 0.9,
fit: BoxFit.contain,
),
],
),
), ),
), ),
), ],
], ),
) ),
], ),
), )
), ],
), ),
) ),
], ],
), ),
), Padding(
Padding( padding:
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0), EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
children: <Widget>[ Expanded(
Column( child: InkWell(
children: <Widget>[ onTap: () {
Text(TranslationBase.of(context).nearestDropOffs, _scanQrAndGetPatient(context, model);
style: TextStyle( },
fontSize: 18.0, child: Container(
color: Hexcolor("#343333"), height: MediaQuery.of(context).orientation ==
fontWeight: FontWeight.bold)), Orientation.portrait
], ? MediaQuery.of(context).size.height * 0.18
), : MediaQuery.of(context).size.height * 0.30,
if (model.state == ViewState.Idle) width: MediaQuery.of(context).size.width * 0.50,
Column( decoration: BoxDecoration(
mainAxisAlignment: MainAxisAlignment.center, borderRadius: BorderRadius.circular(15.0),
children: <Widget>[ gradient: LINEAR_GRADIENT,
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)
color: Color(0xff42B6AD), .orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height *
0.14
: MediaQuery.of(context).size.height *
0.28,
fit: BoxFit.contain,
)
],
), ),
Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 8.0),
child: Text(
TranslationBase.of(context).scan,
style: TextStyle(
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig.textMultiplier * 6.0
: SizeConfig.textMultiplier * 4.0,
color: Colors.white,
fontWeight: FontWeight.w400,
),
),
),
Padding(
padding: EdgeInsets.only(top: 0.0),
child: Text(
TranslationBase.of(context)
.toAddPackageToQue,
style: TextStyle(
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig.textMultiplier * 3.0
: SizeConfig.textMultiplier * 2.0,
color: Colors.white,
letterSpacing: 0.2,
wordSpacing: 0.5,
),
),
),
],
)
], ],
), ),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrdersListScreen()),
),
), ),
),
)
],
),
),
Padding(
padding:
EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
children: <Widget>[
Text(TranslationBase.of(context).nearestDropOffs,
style: TextStyle(
fontSize: 18.0,
color: Hexcolor("#343333"),
fontWeight: FontWeight.bold)),
], ],
), ),
], if (model.state == ViewState.Idle)
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
InkWell(
child: Row(
children: <Widget>[
Text(
TranslationBase.of(context).seeAll,
style: TextStyle(
fontSize: 14.5,
color: Color(0xff42B6AD)),
),
Icon(
Icons.arrow_forward_ios,
size: 15.0,
color: Color(0xff42B6AD),
),
],
),
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => OrdersListScreen()),
),
),
],
),
],
),
), ),
), if (model.state == ViewState.Idle)
NetworkBaseView( model.orders.length == 0
baseViewModel: model, ? Text("There's No Orders To deliver")
child: Column( : Text(""),
children: <Widget>[ NetworkBaseView(
...List.generate( baseViewModel: model,
model.orders == null child: Expanded(
? 0 child: ListView.builder(
: model.orders.length < 3 ? model.orders.length : 3, shrinkWrap: true,
(index) => Padding( scrollDirection: Axis.vertical,
padding: EdgeInsets.symmetric(horizontal: 0.2), itemCount: model.orders == null
child: OrderInfoCard( ? 0
order: model.orders[index], : model.orders.length < 3 ? model.orders.length : 3,
onTap: () { itemBuilder: (BuildContext context, int index) {
Navigator.push( return Padding(
context, padding: EdgeInsets.symmetric(horizontal: 0.2),
MaterialPageRoute( child: OrderInfoCard(
builder: (context) => order: model.orders[index],
InformationPage( onTap: () {
item: model.orders[index], Navigator.push(
))); context,
}), MaterialPageRoute(
)) builder: (context) => InformationPage(
], item: model.orders[index],
)));
},
),
);
},
),
),
), ),
), ],
], ),
), ),
), ),
), ),
@ -537,5 +555,3 @@ class _DashboardScreenState extends State<DashboardScreen> {
} }
} }
} }

@ -1,3 +1,4 @@
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/widgets/order/order_info_card.dart'; import 'package:driverapp/widgets/order/order_info_card.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
@ -27,6 +28,10 @@ class _DeliverdOrdersPageState extends State<DeliverdOrdersPage> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
if (model.state == ViewState.Idle)
model.deliverdOrders.length == 0
? Text("There's No Orders To deliver")
: Text(''),
NetworkBaseView( NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Expanded( child: Expanded(
@ -38,7 +43,7 @@ class _DeliverdOrdersPageState extends State<DeliverdOrdersPage> {
: model.deliverdOrders.length, : model.deliverdOrders.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 12.2), padding: EdgeInsets.symmetric(horizontal: 12.2),
child: OrderInfoCard( child: OrderInfoCard(
order: model.deliverdOrders[index], order: model.deliverdOrders[index],
)); ));

@ -1,3 +1,4 @@
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart'; 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/uitl/translations_delegate_base.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart';
@ -28,6 +29,10 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
if (model.state == ViewState.Idle)
model.orders.length == 0
? Text("There's No Orders To deliver")
: Text(""),
Expanded( Expanded(
child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,

Loading…
Cancel
Save