Merge branch 'development' into 'master'

Development

See merge request Cloud_Solution/driver-app!72
logout_function
Mohammad Aljammal 6 years ago
commit 1364cb081c

@ -28,6 +28,10 @@ PODS:
- Flutter - Flutter
- local_auth (0.0.1): - local_auth (0.0.1):
- Flutter - Flutter
- location (0.0.1):
- Flutter
- location_web (0.0.1):
- Flutter
- map_launcher (0.0.1): - map_launcher (0.0.1):
- Flutter - Flutter
- maps_launcher (0.0.1): - maps_launcher (0.0.1):
@ -71,6 +75,8 @@ DEPENDENCIES:
- image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`)
- local_auth (from `.symlinks/plugins/local_auth/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`)
- location (from `.symlinks/plugins/location/ios`)
- location_web (from `.symlinks/plugins/location_web/ios`)
- map_launcher (from `.symlinks/plugins/map_launcher/ios`) - map_launcher (from `.symlinks/plugins/map_launcher/ios`)
- maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
@ -118,6 +124,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker/ios" :path: ".symlinks/plugins/image_picker/ios"
local_auth: local_auth:
:path: ".symlinks/plugins/local_auth/ios" :path: ".symlinks/plugins/local_auth/ios"
location:
:path: ".symlinks/plugins/location/ios"
location_web:
:path: ".symlinks/plugins/location_web/ios"
map_launcher: map_launcher:
:path: ".symlinks/plugins/map_launcher/ios" :path: ".symlinks/plugins/map_launcher/ios"
maps_launcher: maps_launcher:
@ -157,6 +167,8 @@ SPEC CHECKSUMS:
image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
location_web: b94e7433cfe28c0f7c8923c2ee482824b32e55a7
map_launcher: e325db1261d029ff33e08e03baccffe09593ffea map_launcher: e325db1261d029ff33e08e03baccffe09593ffea
maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb

@ -242,6 +242,7 @@
"${BUILT_PRODUCTS_DIR}/image_cropper/image_cropper.framework", "${BUILT_PRODUCTS_DIR}/image_cropper/image_cropper.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework", "${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
"${BUILT_PRODUCTS_DIR}/local_auth/local_auth.framework", "${BUILT_PRODUCTS_DIR}/local_auth/local_auth.framework",
"${BUILT_PRODUCTS_DIR}/location/location.framework",
"${BUILT_PRODUCTS_DIR}/map_launcher/map_launcher.framework", "${BUILT_PRODUCTS_DIR}/map_launcher/map_launcher.framework",
"${BUILT_PRODUCTS_DIR}/maps_launcher/maps_launcher.framework", "${BUILT_PRODUCTS_DIR}/maps_launcher/maps_launcher.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework", "${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
@ -264,6 +265,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_cropper.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_cropper.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/location.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/map_launcher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/map_launcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/maps_launcher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/maps_launcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",

@ -41,5 +41,9 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSLocationAlwaysUsageDescription</key>
<string>Needed to access location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Needed to access location</string>
</dict> </dict>
</plist> </plist>

@ -10,6 +10,8 @@ class PendingOrders {
String lastName; String lastName;
String mobileNumber; String mobileNumber;
int distanceInKilometers; int distanceInKilometers;
String longitude;
String latitude;
PendingOrders({ PendingOrders({
this.driverID, this.driverID,
@ -23,6 +25,8 @@ class PendingOrders {
this.lastName, this.lastName,
this.mobileNumber, this.mobileNumber,
this.distanceInKilometers, this.distanceInKilometers,
this.longitude,
this.latitude,
}); });
PendingOrders.fromJson(Map<String, dynamic> json) { PendingOrders.fromJson(Map<String, dynamic> json) {
@ -48,6 +52,9 @@ class PendingOrders {
data['TokenID'] = this.tokenID; data['TokenID'] = this.tokenID;
data['UserID'] = this.userID; data['UserID'] = this.userID;
data['MobileNo'] = this.mobileNo; data['MobileNo'] = this.mobileNo;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
return data; return data;
} }
} }

@ -23,6 +23,8 @@ class OrdersService extends BaseService {
searchKey: "", searchKey: "",
pageSize: 0, pageSize: 0,
pageIndex: 0, pageIndex: 0,
latitude: "24.640000",
longitude: "46.753000",
); );
DeliverdOrderModel _requestGetDeliverdOrders = DeliverdOrderModel( DeliverdOrderModel _requestGetDeliverdOrders = DeliverdOrderModel(
searchKey: "", searchKey: "",

@ -69,7 +69,10 @@ class AuthenticationViewModel with ChangeNotifier {
isError = true; isError = true;
notifyListeners(); notifyListeners();
} else { } else {
sharedPref.setObject( isLoading = false;
isError = false;
isLogin = true;
await sharedPref.setObject(
USER_PROFILE, _authenticationService.authenticatedUser); USER_PROFILE, _authenticationService.authenticatedUser);
sharedPref.setString(TOKEN, _authenticationService.token); sharedPref.setString(TOKEN, _authenticationService.token);
user = _authenticationService.authenticatedUser; user = _authenticationService.authenticatedUser;

@ -3,7 +3,6 @@ import 'package:get_it/get_it.dart';
import 'core/service/authentication_service.dart'; import 'core/service/authentication_service.dart';
import 'core/service/hospital_service.dart'; import 'core/service/hospital_service.dart';
import 'core/service/orders_service.dart'; import 'core/service/orders_service.dart';
import 'core/viewModels/authentication_view_model.dart';
import 'core/viewModels/hospital_view_model.dart'; import 'core/viewModels/hospital_view_model.dart';
import 'core/viewModels/orders_view_model.dart'; import 'core/viewModels/orders_view_model.dart';
@ -18,6 +17,6 @@ void setupLocator() {
/// View Model /// View Model
locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => AuthenticationViewModel()); // locator.registerFactory(() => AuthenticationViewModel());
locator.registerFactory(() => OrdersViewModel()); locator.registerFactory(() => OrdersViewModel());
} }

@ -2,11 +2,9 @@ import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/core/model/authentication/login_request.dart'; import 'package:driverapp/core/model/authentication/login_request.dart';
import 'package:driverapp/core/viewModels/authentication_view_model.dart'; import 'package:driverapp/core/viewModels/authentication_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart'; import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/pages/dashboard/dashboard_screen.dart';
import 'package:driverapp/uitl/translations_delegate_base.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/buttons/secondary_button.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/data_display/circle-container.dart';
import 'package:driverapp/widgets/input/text_field.dart'; import 'package:driverapp/widgets/input/text_field.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -25,16 +23,27 @@ class LoginPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
authenticationViewModel = Provider.of(context); authenticationViewModel = Provider.of(context);
login() async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
}
}
}
return AnimatedSwitcher( return AnimatedSwitcher(
duration: Duration(microseconds: 350), duration: Duration(microseconds: 350),
child: AppScaffold( child: AppScaffold(
isShowAppBar: false, isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.80, widthFactor: 0.80,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -237,7 +246,7 @@ class LoginPage extends StatelessWidget {
SecondaryButton( SecondaryButton(
label: TranslationBase.of(context).login, label: TranslationBase.of(context).login,
onTap: () { onTap: () {
login(context); login();
}, },
disabled: authenticationViewModel.isLoading, disabled: authenticationViewModel.isLoading,
loading: authenticationViewModel.isLoading, loading: authenticationViewModel.isLoading,
@ -255,17 +264,4 @@ class LoginPage extends StatelessWidget {
); );
} }
login(BuildContext context) async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
} else {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DashboardScreen()));
}
}
}
} }

@ -6,6 +6,7 @@ import 'package:driverapp/core/viewModels/authentication_view_model.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/pages/orders/pending_orders_page.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart';
import 'package:driverapp/pages/setting/setting.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/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/uitl/utils.dart';
@ -90,7 +91,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: SafeArea( child: SafeArea(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
CircleAvatar( InkWell(
child:CircleAvatar(
radius: 25.5, radius: 25.5,
backgroundColor: Color(0xff30B7B9), backgroundColor: Color(0xff30B7B9),
child: CircleAvatar( child: CircleAvatar(
@ -99,8 +101,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Image.asset( child: Image.asset(
'assets/images/driver.png', 'assets/images/driver.png',
fit: BoxFit.contain, fit: BoxFit.contain,
), ),),
), ),
onTap: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SettingPage(driverName:_authenticationViewModel.user.userName, driverID:_authenticationViewModel.user.userID)));
},
), ),
], ],
), ),
@ -588,7 +597,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Text( child: Text(
model.orders[index].distanceInKilometers model.orders[index].distanceInKilometers
.toString() + .toString() +
' K.m\naway', '\nK.m\naway',
style: TextStyle( style: TextStyle(
color: Color(0xff42B6AD), color: Color(0xff42B6AD),
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,

@ -9,6 +9,7 @@ import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:location/location.dart';
import '../../uitl/translations_delegate_base.dart'; import '../../uitl/translations_delegate_base.dart';
import '../../widgets/others/app_scaffold_widget.dart'; import '../../widgets/others/app_scaffold_widget.dart';
@ -23,39 +24,41 @@ class DeliveryConfirmedPage extends StatelessWidget {
return BaseView<OrdersViewModel>( return BaseView<OrdersViewModel>(
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarColor: Theme.of(context).primaryColor, appBarColor: Theme.of(context).primaryColor,
arrowColor: Colors.white, arrowColor: Colors.white,
titleColor: Colors.white, titleColor: Colors.white,
body: SafeArea( body: SafeArea(
child: Container( child: Container(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
Stack( Stack(
children: <Widget>[ children: <Widget>[
Column( Column(
children: <Widget>[ children: <Widget>[
Container( Container(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.7, height: MediaQuery.of(context).size.width * 0.7,
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.12, top: MediaQuery.of(context).size.width * 0.12,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white10, shape: BoxShape.circle), color: Colors.white10,
child: Column( shape: BoxShape.circle),
children: <Widget>[ child: Column(
Icon( children: <Widget>[
Icons.check_circle, Icon(
color: Colors.white, Icons.check_circle,
size: 75, color: Colors.white,
), size: 75,
SizedBox( ),
height: SizedBox(
MediaQuery.of(context).size.width * 0.03, height:
MediaQuery.of(context).size.width *
0.03,
), ),
Text( Text(
TranslationBase.of(context).deliveryInfo, TranslationBase.of(context).deliveryInfo,
@ -131,34 +134,38 @@ class DeliveryConfirmedPage extends StatelessWidget {
), ),
Container( Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: SecondaryButton( child: SecondaryButton(
label: TranslationBase.of(context).nextDelivery, label: TranslationBase
.of(context)
.nextDelivery,
loading: model.state == ViewState.BusyLocal,
onTap: () { onTap: () {
getNextOrder(context, model); getNextOrder(context, model);},
},), ),
), ),
], ],
),
), ),
), ],
], ),
), ),
), Container(
Container( margin: EdgeInsets.only(
margin: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.6, top: MediaQuery.of(context).size.width * 0.6,
),
child: CustomerBriefCard(
itemId: item.orderID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber,
totalPayment: item.amount,
showDistance: false,
deliveryTime: item.orderCreatedOn),
), ),
child: CustomerBriefCard( ],
itemId: item.orderID, ),
customerFirstName: item.firstName, ],
customerLastName: item.lastName, ),
mobileNo: item.mobileNumber,
totalPayment: item.amount,
showDistance: false,
deliveryTime: item.orderCreatedOn),
),
],
),
],),
), ),
), ),
), ),
@ -166,11 +173,15 @@ class DeliveryConfirmedPage extends StatelessWidget {
} }
getNextOrder(BuildContext context, OrdersViewModel model) async { getNextOrder(BuildContext context, OrdersViewModel model) async {
model.setState(ViewState.BusyLocal);
LocationData loc = await Utils.getLocation();
NextOrderRequestModel nextOrderRequestModel = NextOrderRequestModel( NextOrderRequestModel nextOrderRequestModel = NextOrderRequestModel(
pageIndex: 0, pageIndex: 0,
pageSize: 0, pageSize: 0,
latitude: "46.621730", latitude: loc.latitude.toString(),
longitude: "24.797682", //"46.621730",
longitude: loc.longitude.toString(),
//"24.797682",
searchKey: ""); searchKey: "");
await model.nextOrder(nextOrderRequestModel); await model.nextOrder(nextOrderRequestModel);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {

File diff suppressed because one or more lines are too long

@ -115,7 +115,7 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
child: Text( child: Text(
model.orders[index].distanceInKilometers model.orders[index].distanceInKilometers
.toString() + .toString() +
' K.m\naway', '\nK.m\naway',
style: TextStyle( style: TextStyle(
color: Color(0xff42B6AD), color: Color(0xff42B6AD),
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,

@ -0,0 +1,163 @@
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SettingPage extends StatelessWidget {
final String driverName;//_authenticationViewModel.user.userName
final int driverID;
SettingPage({this.driverName, this.driverID});
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarColor: Color(0xff30B7B9),
arrowColor: Colors.white,
titleColor: Colors.white,
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
width: double.infinity,
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.7,
child: CircleAvatar(
radius: 25.5,
backgroundColor: Theme.of(context).primaryColor,
child: CircleAvatar(
backgroundColor: Theme.of(context).primaryColor,
maxRadius: 200.0,
child: Image.asset(
'assets/images/driver.png',
height: MediaQuery.of(context).size.width * 1 ,
width: MediaQuery.of(context).size.width * 1,
fit: BoxFit.contain,
),
),
),
),
SizedBox(height: MediaQuery.of(context).size.width *0.05,),
Container(
child: Text(
driverName,
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.w600,
color: Colors.white
),
),
),
SizedBox(height: MediaQuery.of(context).size.width *0.05,),
Container(
child: Text(
'ID: ${driverID.toString()}',
style: TextStyle(
fontSize: 20,
color: Colors.white
),
),
),
],
),
),
SizedBox(height: MediaQuery.of(context).size.width *0.1,),
Container(
margin: EdgeInsets.only(left: 35),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Icon(
Icons.input,
size: 40,
color: Colors.white,
),
SizedBox(width: MediaQuery.of(context).size.width *0.05,),
Text(
TranslationBase.of(context).logout,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18
),
),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.width *0.05,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
],
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Icon(
Icons.settings,
size: 40,
color: Colors.white,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.05,
),
Text(
TranslationBase.of(context).settings,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18
),
),
],
),
),
SizedBox(
height: 10.0,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
],
),
),
],
),
),
],
),
),
);
}
}

@ -1,5 +1,6 @@
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:location/location.dart';
import 'app_shared_preferences.dart'; import 'app_shared_preferences.dart';
import 'app_toast.dart'; import 'app_toast.dart';
@ -42,4 +43,10 @@ class Utils {
static hideKeyboard(BuildContext context) { static hideKeyboard(BuildContext context) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
} }
static getLocation() async {
Location location = new Location();
LocationData currentLocation = await location.getLocation();
return currentLocation;
}
} }

@ -26,8 +26,8 @@ class CircleContainer extends StatelessWidget {
color: color, color: color,
border: Border.all( border: Border.all(
color: borderColor ?? Hexcolor("#707070"), width: borderWidth)), color: borderColor ?? Hexcolor("#707070"), width: borderWidth)),
height: 60, height: 80,
width: 60, width: 80,
), ),
); );
} }

@ -1,3 +1,4 @@
import 'package:driverapp/widgets/data_display/circle-container.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../uitl/date_uitl.dart'; import '../../uitl/date_uitl.dart';
@ -16,25 +17,27 @@ class CustomerBriefCard extends StatelessWidget {
final double latitude; final double latitude;
final bool showDistance; final bool showDistance;
CustomerBriefCard( CustomerBriefCard({
{this.itemId, this.itemId,
this.time, this.time,
this.customerFirstName, this.customerFirstName,
this.customerLastName, this.customerLastName,
this.mobileNo, this.mobileNo,
this.direction, this.direction,
this.totalPayment, this.totalPayment,
this.deliveryTime, this.deliveryTime,
this.longitude, this.longitude,
this.latitude, this.latitude,
this.showDistance = true, this.showDistance = true,
}); });
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Center(
child: Container( child: Container(
width: 350, width: MediaQuery.of(context).orientation == Orientation.landscape
? 580
: 370,
height: 270, height: 270,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -63,46 +66,45 @@ class CustomerBriefCard extends StatelessWidget {
flex: 3, flex: 3,
child: Text( child: Text(
'ID: ${itemId}', 'ID: ${itemId}',
style: TextStyle(color: Color(0xFFADACAD)), style: TextStyle(
color: Color(0xFFADACAD),
fontWeight: FontWeight.w800,
fontSize: 17.5),
), ),
), ),
Visibility( Expanded(
visible: showDistance, child: Padding(
child: Expanded( padding: EdgeInsets.all(8.0),
child: CircleAvatar( child: CircleContainer(
backgroundColor: Colors.black45, borderWidth: 0.9,
radius: 28.0, child: Text(
child: CircleAvatar( '0 K.m\naway',
backgroundColor: Colors.white, style: TextStyle(
maxRadius: 26.1, color: Color(0xff42B6AD),
child: Padding( fontWeight: FontWeight.w800,
padding: const EdgeInsets.only(left: 3), fontStyle: FontStyle.normal),
child: Text(
'3 K.m \n away',
style: TextStyle(
color: Color(0xff30B7B9),
fontSize: 12.5,
fontWeight: FontWeight.w600),
),
),
), ),
), ),
), ),
), ),
], ],
), ),
SizedBox(height: MediaQuery.of(context).size.width * 0.02,), SizedBox(
height: MediaQuery.of(context).size.width * 0.02,
),
Text( Text(
'${customerFirstName} ${customerLastName}', '${customerFirstName} ${customerLastName}',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w900), style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.019,
), ),
SizedBox(height: MediaQuery.of(context).size.width * 0.019,),
Text( Text(
mobileNo, mobileNo,
style: TextStyle(color: Color(0xFF50BDC5)), style: TextStyle(color: Color(0xFF50BDC5)),
), ),
SizedBox( SizedBox(
height:MediaQuery.of(context).size.width*0.005, height: MediaQuery.of(context).size.width * 0.005,
), ),
// Text( // Text(
// 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277', // 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277',
@ -143,13 +145,13 @@ class CustomerBriefCard extends StatelessWidget {
child: Text( child: Text(
totalPayment.toString(), totalPayment.toString(),
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle(fontWeight: FontWeight.w600), style: TextStyle(fontWeight: FontWeight.w400),
), ),
), ),
], ],
), ),
SizedBox( SizedBox(
height: MediaQuery.of(context).size.width*0.03, height: MediaQuery.of(context).size.width * 0.03,
), ),
Row( Row(
children: <Widget>[ children: <Widget>[
@ -164,7 +166,7 @@ class CustomerBriefCard extends StatelessWidget {
child: Text( child: Text(
'${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(deliveryTime))} ${(DateUtil.convertStringToHours(deliveryTime))}', '${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(deliveryTime))} ${(DateUtil.convertStringToHours(deliveryTime))}',
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle(fontWeight: FontWeight.w600)), style: TextStyle(fontWeight: FontWeight.w400)),
), ),
], ],
) )

@ -12,25 +12,19 @@ class DeliveryInfoButton extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
print(btnColor); print(btnColor);
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: MediaQuery.of(context).orientation == Orientation.portrait
? EdgeInsets.all(4.0)
: EdgeInsets.all(7.0),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
height: MediaQuery height: MediaQuery.of(context).size.width * 0.14,
.of(context) width: MediaQuery.of(context).size.width * 0.165, // specific value
.size child: InkWell(
.width * 0.14, child: btnIcon,
width: MediaQuery
.of(context)
.size
.width * 0.165, // specific value
child:
InkWell(
child: btnIcon,
onTap: btnFunction, onTap: btnFunction,
), ),
), ),
Text( Text(
btnName, btnName,
style: TextStyle( style: TextStyle(

@ -67,9 +67,14 @@ dependencies:
# Qr code Scanner # Qr code Scanner
barcode_scan: ^3.0.1 barcode_scan: ^3.0.1
#mape # map
map_launcher: ^0.12.0 map_launcher: ^0.12.0
# location
location: ^3.0.2

Loading…
Cancel
Save