diff --git a/lib/app-icons/config.json b/lib/app-icons/config.json index dd751e6..d406a1c 100644 --- a/lib/app-icons/config.json +++ b/lib/app-icons/config.json @@ -161,17 +161,59 @@ ] }, { - "uid": "3a5cc972b7f3f2ab8a20e22287b5598b", - "css": "group-169", - "code": 59412, + "uid": "f454f0b074a5a3194dbf7409c724a0e9", + "css": "call", + "code": 59408, "src": "custom_icons", - "selected": false, + "selected": true, + "svg": { + "path": "M1185.4 990.2H156.1C78 990.2 9.8 926.8 9.8 843.9V156.1C9.8 78 73.2 9.8 156.1 9.8H1185.4C1263.4 9.8 1331.7 73.2 1331.7 156.1V848.8C1331.7 926.8 1268.3 990.2 1185.4 990.2ZM902.4 619.5L824.4 541.5C804.9 522 780.5 522 761 541.5 761 541.5 761 541.5 761 541.5L717.1 585.4C712.2 590.2 707.3 590.2 702.4 585.4 678 570.7 653.7 551.2 634.1 526.8 614.6 507.3 600 487.8 580.5 468.3 575.6 463.4 580.5 458.5 580.5 453.7L634.1 409.8C653.7 390.2 653.7 365.9 634.1 346.3L556.1 268.3C536.6 253.7 512.2 253.7 492.7 268.3L468.3 297.6C429.3 331.7 419.5 390.2 434.1 439 443.9 473.2 463.4 507.3 482.9 541.5 502.4 570.7 522 595.1 546.3 619.5 570.7 648.8 604.9 668.3 634.1 692.7 668.3 717.1 707.3 731.7 746.3 741.5 756.1 746.3 765.9 746.3 780.5 746.3 819.5 746.3 853.7 731.7 878 707.3L897.6 687.8C922 663.4 922 634.1 902.4 619.5Z", + "width": 1337 + }, + "search": [ + "call" + ] + }, + { + "uid": "ecb856dd748af0bc0fca50e5c00802b2", + "css": "whatsapp", + "code": 59407, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1180.5 990.2H151.2C73.2 990.2 4.9 926.8 4.9 843.9V151.2C4.9 73.2 68.3 4.9 151.2 4.9H1180.5C1258.5 4.9 1326.8 68.3 1326.8 151.2V843.9C1326.8 926.8 1263.4 990.2 1180.5 990.2ZM448.8 722L478 609.8C458.5 575.6 448.8 536.6 448.8 502.4 448.8 380.5 546.3 282.9 668.3 282.9 726.8 282.9 780.5 307.3 824.4 346.3 863.4 385.4 887.8 443.9 887.8 502.4 887.8 624.4 790.2 722 668.3 722 668.3 722 668.3 722 668.3 722H668.3C629.3 722 595.1 712.2 565.9 697.6L448.8 722ZM570.7 648.8L575.6 653.7C604.9 668.3 634.1 678 668.3 678H668.3C770.7 678 848.8 595.1 848.8 497.6 848.8 448.8 829.3 404.9 795.1 370.7 761 336.6 717.1 317.1 668.3 317.1 565.9 317.1 487.8 400 487.8 497.6 487.8 531.7 497.6 565.9 517.1 595.1L522 600 502.4 668.3 570.7 648.8ZM448.8 722L478 609.8C458.5 575.6 448.8 536.6 448.8 502.4 448.8 380.5 546.3 282.9 668.3 282.9 726.8 282.9 780.5 307.3 824.4 346.3 863.4 385.4 887.8 443.9 887.8 502.4 887.8 624.4 790.2 722 668.3 722 668.3 722 668.3 722 668.3 722H668.3C629.3 722 595.1 712.2 565.9 697.6L448.8 722ZM570.7 648.8L575.6 653.7C604.9 668.3 634.1 678 668.3 678H668.3C770.7 678 848.8 595.1 848.8 497.6 848.8 448.8 829.3 404.9 795.1 370.7 761 336.6 717.1 317.1 668.3 317.1 565.9 317.1 487.8 400 487.8 497.6 487.8 531.7 497.6 565.9 517.1 595.1L522 600 502.4 668.3 570.7 648.8ZM614.6 404.9C609.8 395.1 604.9 395.1 600 395.1 595.1 395.1 595.1 395.1 590.2 395.1 585.4 395.1 580.5 395.1 575.6 400 570.7 404.9 556.1 419.5 556.1 443.9 556.1 473.2 575.6 497.6 580.5 502.4 585.4 507.3 619.5 561 673.2 585.4 717.1 604.9 726.8 600 736.6 600 746.3 600 770.7 585.4 775.6 575.6 780.5 561 780.5 551.2 780.5 551.2 780.5 551.2 775.6 546.3 770.7 546.3 765.9 541.5 736.6 531.7 731.7 526.8 726.8 526.8 722 522 717.1 531.7 712.2 536.6 702.4 551.2 697.6 551.2 692.7 556.1 692.7 556.1 687.8 551.2 682.9 546.3 663.4 541.5 643.9 522 629.3 507.3 614.6 487.8 614.6 482.9 609.8 478 614.6 473.2 614.6 473.2 619.5 468.3 624.4 458.5 629.3 453.7 629.3 448.8 629.3 448.8 629.3 443.9 629.3 443.9 619.5 419.5 614.6 404.9Z", + "width": 1337 + }, + "search": [ + "whatsapp" + ] + }, + { + "uid": "79e200375e576071502c28bb9054ee19", + "css": "message", + "code": 59406, + "src": "custom_icons", + "selected": true, "svg": { - "path": "", - "width": 663 + "path": "M1180.5 990.2H151.2C73.2 990.2 4.9 926.8 4.9 843.9V151.2C4.9 73.2 68.3 4.9 151.2 4.9H1180.5C1258.5 4.9 1326.8 68.3 1326.8 151.2V843.9C1326.8 926.8 1263.4 990.2 1180.5 990.2ZM873.2 273.2H463.4C434.1 273.2 409.8 297.6 409.8 326.8V595.1C409.8 624.4 434.1 648.8 463.4 648.8H595.1C595.1 648.8 600 648.8 600 648.8L648.8 712.2C653.7 717.1 658.5 722 668.3 722H668.3C678 722 682.9 717.1 687.8 712.2L736.6 648.8C736.6 648.8 741.5 648.8 741.5 648.8H873.2C902.4 648.8 926.8 624.4 926.8 595.1V326.8C926.8 297.6 902.4 273.2 873.2 273.2L873.2 273.2ZM897.6 595.1C897.6 595.1 897.6 600 897.6 600L741.5 463.4 897.6 331.7 897.6 595.1ZM873.2 302.4C878 302.4 882.9 302.4 887.8 307.3L682.9 473.2C673.2 482.9 658.5 482.9 648.8 473.2L448.8 307.3C453.7 307.3 458.5 302.4 463.4 302.4L873.2 302.4ZM439 600C439 600 439 595.1 439 595.1V336.6L595.1 468.3 439 600ZM712.2 634.1L668.3 692.7 624.4 634.1C619.5 624.4 604.9 619.5 595.1 619.5H463.4L619.5 482.9 634.1 492.7C643.9 502.4 658.5 507.3 668.3 507.3 682.9 507.3 692.7 502.4 702.4 492.7L717.1 482.9 873.2 619.5H741.5C731.7 619.5 717.1 624.4 712.2 634.1L712.2 634.1Z", + "width": 1337 }, "search": [ - "group-169" + "message" + ] + }, + { + "uid": "5c38c3d86ba300ea6939a53b5e4467fa", + "css": "location-1", + "code": 59392, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1180.5 990.2H151.2C73.2 990.2 4.9 926.8 4.9 843.9V151.2C4.9 73.2 68.3 4.9 151.2 4.9H1180.5C1258.5 4.9 1326.8 68.3 1326.8 151.2V843.9C1326.8 926.8 1263.4 990.2 1180.5 990.2ZM863.4 443.9L487.8 287.8C478 282.9 468.3 287.8 463.4 292.7 458.5 297.6 453.7 307.3 458.5 317.1L600 697.6C604.9 707.3 609.8 712.2 619.5 712.2 629.3 712.2 639 707.3 639 697.6L702.4 551.2C707.3 546.3 707.3 541.5 717.1 541.5L863.4 482.9C873.2 482.9 878 473.2 878 463.4 878 458.5 873.2 448.8 863.4 443.9Z", + "width": 1337 + }, + "search": [ + "location" ] } ] diff --git a/lib/app-icons/driver_app_icons.dart b/lib/app-icons/driver_app_icons.dart index b8b3326..b55144c 100644 --- a/lib/app-icons/driver_app_icons.dart +++ b/lib/app-icons/driver_app_icons.dart @@ -21,26 +21,19 @@ class DriverApp { static const _kFontFam = 'DriverApp'; static const _kFontPkg = null; - static const IconData logo = - IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData closed_box = - IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData location = - IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData open_box = - IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData phone_call = - IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr = - IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData not_available = - IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData rejected_icon = - IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData not_reachable_icon = - IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData group_74 = - IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData deliverd_icon = - IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData location_1 = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData logo = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData closed_box = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData location = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData open_box = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData phone_call = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData not_available = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData rejected_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData not_reachable_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData group_74 = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData whatsapp = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData call = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData deliverd_icon = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/app-icons/fonts/DriverApp.ttf b/lib/app-icons/fonts/DriverApp.ttf index b00b39f..7ee3e16 100644 Binary files a/lib/app-icons/fonts/DriverApp.ttf and b/lib/app-icons/fonts/DriverApp.ttf differ diff --git a/lib/config/config.dart b/lib/config/config.dart index b3c0d02..0c92975 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,6 +15,7 @@ const GET_ALL_DELIVERD_ORDER = /// Body Constant const CHANNEL = 9; +const VERSION_ID = 8.3; /// design constant const MAX_SMALL_SCREEN = 660; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 9b5834a..8c3602b 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -33,9 +33,9 @@ class BaseAppClient { body['UserID'] = '${doctorProfile?.userID}'; body['TokenID'] = token; body['MobileNo'] = doctorProfile?.mobileNumber; - body['Channel'] = CHANNEL; } - + body['Channel'] = CHANNEL; + body['VersionID'] = VERSION_ID; print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/core/service/orders_service.dart b/lib/core/service/orders_service.dart index 42bc118..d1f4f22 100644 --- a/lib/core/service/orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -1,5 +1,4 @@ import 'package:driverapp/config/config.dart'; -import 'package:driverapp/core/model/orders/deliverd_order_req_model.dart'; import 'package:driverapp/core/model/orders/next_order_request_model.dart'; import 'package:driverapp/core/model/orders/pending_orders_req_model.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; @@ -10,12 +9,9 @@ import 'package:driverapp/core/service/base_service.dart'; class OrdersService extends BaseService { List _orders = List(); List _nextOrdersList = List(); - List _deliverdOrderList = List(); List get orders => _orders; - List get deliverdOrderList => _deliverdOrderList; - List get nextOrdersList => _nextOrdersList; bool isOrderInserted; bool isOrderStatusUpdated; @@ -26,14 +22,6 @@ class OrdersService extends BaseService { pageIndex: 0, ); - DeliverdOrderModel _requestGetDeliverdOrders = DeliverdOrderModel( - searchKey: "", - pageSize: 0, - pageIndex: 0, - latitude: "24.640000", - longitude: "46.753000", - ); - Future getPendingOrders() async { hasError = false; try { @@ -108,25 +96,4 @@ class OrdersService extends BaseService { throw e; } } - - Future getDeliverdList() async { - hasError = false; - try { - await baseAppClient.post(GET_ALL_DELIVERD_ORDER, - onSuccess: (dynamic response, int statusCode) { - _deliverdOrderList.clear(); - response['PatientER_Delivery_GetAllDeliverdOrderList'].forEach((order) { - _deliverdOrderList.add(DeliverdOrderModel.fromJson(order)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _requestGetPendingOrders.toJson()); - } catch (e) { - hasError = true; - super.error = error; - - throw e; - } - } } diff --git a/lib/core/viewModels/authentication_view_model.dart b/lib/core/viewModels/authentication_view_model.dart index b64f49c..96f3dc0 100644 --- a/lib/core/viewModels/authentication_view_model.dart +++ b/lib/core/viewModels/authentication_view_model.dart @@ -1,22 +1,57 @@ import 'package:driverapp/config/shared_pref_kay.dart'; -import 'package:driverapp/core/enum/viewstate.dart'; +import 'package:driverapp/core/model/authentication/authenticated_user.dart'; import 'package:driverapp/core/model/authentication/login_request.dart'; import 'package:driverapp/core/service/authentication_service.dart'; import 'package:driverapp/core/service/client/base_app_client.dart'; -import 'package:driverapp/core/viewModels/base_view_model.dart'; +import 'package:flutter/cupertino.dart'; import '../../locator.dart'; enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } -class AuthenticationViewModel extends BaseViewModel { - AuthenticationService _authenticationService = locator(); +class AuthenticationViewModel with ChangeNotifier { + AuthenticationService _authenticationService = + locator(); + AuthenticatedUser user; + bool isLogin = false; + bool isLoading = false; + bool isError = false; + String error; + + AuthenticationViewModel() { + getUser(); + } + + getUser() async { + if (user == null) { + isLoading = true; + notifyListeners(); + var userProfile = await sharedPref.getObject(USER_PROFILE); + if (userProfile != null) { + user = AuthenticatedUser.fromJson( + await sharedPref.getObject(USER_PROFILE)); + isLogin = true; + isLoading = false; + notifyListeners(); + } else { + isLogin = false; + isLoading = false; + notifyListeners(); + } + } +// else +// { +// isLogin = true; +// isLoading = false; +// notifyListeners(); +// } + } APP_STATUS get status { - if (state == ViewState.Busy || state == ViewState.BusyLocal) { + if (isLoading) { return APP_STATUS.LOADING; } else { - if ( user != null) { + if (isLogin) { return APP_STATUS.AUTHENTICATED; } else { return APP_STATUS.UNAUTHENTICATED; @@ -25,16 +60,20 @@ class AuthenticationViewModel extends BaseViewModel { } login(LoginRequest loginRequest) async { - setState(ViewState.BusyLocal); + isLoading = true; + notifyListeners(); await _authenticationService.login(loginRequest); if (_authenticationService.hasError) { error = _authenticationService.error; - setState(ViewState.ErrorLocal); + isLoading = false; + isError = true; + notifyListeners(); } else { sharedPref.setObject( USER_PROFILE, _authenticationService.authenticatedUser); sharedPref.setString(TOKEN, _authenticationService.token); - setState(ViewState.Idle); + user = _authenticationService.authenticatedUser; + notifyListeners(); } } } diff --git a/lib/main.dart b/lib/main.dart index d181377..2036786 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,6 +5,7 @@ import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:provider/provider.dart'; import 'config/size_config.dart'; +import 'core/viewModels/authentication_view_model.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; @@ -25,7 +26,10 @@ class MyApp extends StatelessWidget { providers: [ ChangeNotifierProvider( create: (context) => ProjectViewModel(), - ) + ), + ChangeNotifierProvider( + create: (context) => AuthenticationViewModel(), + ), ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( diff --git a/lib/pages/authentication/login_page.dart b/lib/pages/authentication/login_page.dart index c1ec051..5d45d5c 100644 --- a/lib/pages/authentication/login_page.dart +++ b/lib/pages/authentication/login_page.dart @@ -1,9 +1,7 @@ import 'package:driverapp/app-icons/driver_app_icons.dart'; -import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/authentication/login_request.dart'; import 'package:driverapp/core/viewModels/authentication_view_model.dart'; import 'package:driverapp/core/viewModels/project_view_model.dart'; -import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/dashboard/dashboard_screen.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:driverapp/uitl/utils.dart'; @@ -21,14 +19,15 @@ class LoginPage extends StatelessWidget { LoginRequest loginRequest = LoginRequest(); final loginFormKey = GlobalKey(); ProjectViewModel projectViewModel; + AuthenticationViewModel authenticationViewModel; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); + authenticationViewModel = Provider.of(context); return AnimatedSwitcher( duration: Duration(microseconds: 350), - child: BaseView( - builder: (_, model, widget) => AppScaffold( + child: AppScaffold( isShowAppBar: false, body: SingleChildScrollView( child: Center( @@ -229,26 +228,26 @@ class LoginPage extends StatelessWidget { SizedBox( height: 10, ), - Container( - margin: EdgeInsets.all(10), - height: MediaQuery.of(context).size.height * 0.22, - child: Column( - children: [ - SecondaryButton( - label: TranslationBase.of(context).login, - onTap: () { - login(model, context); - }, - disabled: model.state == ViewState.BusyLocal, - loading: model.state == ViewState.BusyLocal, - ), - SizedBox( - height: 30, - ), - ], - )) - ], - ), + + Container( + margin: EdgeInsets.all(10), + height: MediaQuery.of(context).size.height * 0.22, + child: Column( + children: [ + SecondaryButton( + label: TranslationBase.of(context).login, + onTap: () { + login(context); + }, + disabled: authenticationViewModel.isLoading, + loading: authenticationViewModel.isLoading, + ), + SizedBox( + height: 30, + ), + ], + )) + ], ), ), ), @@ -256,14 +255,15 @@ class LoginPage extends StatelessWidget { ); } - login(AuthenticationViewModel model, BuildContext context) async { + login(BuildContext context) async { if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); - await model.login(loginRequest); - if (model.state == ViewState.ErrorLocal) { - Utils.showErrorToast(model.error); + await authenticationViewModel.login(loginRequest); + if (authenticationViewModel.isError) { + Utils.showErrorToast(authenticationViewModel.error); } else { - Navigator.push(context, + Navigator.push( + context, MaterialPageRoute(builder: (context) => DashboardScreen())); } } diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index a8f9f8b..c7068d8 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -2,9 +2,9 @@ import 'package:barcode_scan/platform_wrapper.dart'; import 'package:driverapp/config/size_config.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; +import 'package:driverapp/core/viewModels/authentication_view_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; -import 'package:driverapp/pages/orders/deliverd_orders_page.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart'; import 'package:driverapp/uitl/app_toast.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; @@ -16,6 +16,7 @@ import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; import '../base/base_view.dart'; @@ -25,6 +26,19 @@ class DashboardScreen extends StatefulWidget { } class _DashboardScreenState extends State { + bool _isInit = false; + AuthenticationViewModel _authenticationViewModel; + + @override + void didChangeDependencies() { + if (!_isInit) { + _authenticationViewModel = Provider.of(context); + _isInit = true; + } + + super.didChangeDependencies(); + } + @override Widget build(BuildContext context) { int orderId; @@ -35,572 +49,564 @@ class _DashboardScreenState extends State { body: Container( height: MediaQuery.of(context).size.height * .95, child: ListView( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: EdgeInsets.all(16.0), - child: Column( - children: [ - SafeArea( + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + SafeArea( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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( + fontWeight: FontWeight.w400, + fontSize: 25.0), + ), + ), + ], + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(16.0), + child: SafeArea( child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, children: [ - 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), + CircleAvatar( + radius: 25.5, + backgroundColor: Color(0xff30B7B9), + child: CircleAvatar( + backgroundColor: Color(0xff30B7B9), + maxRadius: 26.0, + child: Image.asset( + 'assets/images/driver.png', + fit: BoxFit.contain, + ), ), ), ], ), ), - ], - ), - ), - Padding( - padding: EdgeInsets.all(16.0), - child: SafeArea( - child: Column( - children: [ - CircleAvatar( - radius: 25.5, - backgroundColor: Color(0xff30B7B9), - child: CircleAvatar( - backgroundColor: Color(0xff30B7B9), - maxRadius: 26.0, - child: Image.asset( - 'assets/images/driver.png', - fit: BoxFit.contain, - ), - ), - ), - ], ), - ), + ], ), - ], - ), - Row( - children: [ - Expanded( - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), - child: Container( - height: MediaQuery.of(context).orientation == + Row( + children: [ + Expanded( + child: Column( + children: [ + 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: LinearGradient(colors: [ - Color(0xff17AFB8), - Color(0xff49C1BC) - ]), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.all(2.0), - child: Column( - mainAxisAlignment: + ? 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: LinearGradient(colors: [ + Color(0xff17AFB8), + Color(0xff49C1BC) + ]), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(2.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - TranslationBase.of(context).youHave, - style: TextStyle( - color: Colors.white, - fontSize: MediaQuery.of(context) - .orientation == + children: [ + Text( + TranslationBase.of(context).youHave, + style: TextStyle( + color: Colors.white, + fontSize: MediaQuery.of(context) + .orientation == Orientation.landscape - ? SizeConfig.textMultiplier * + ? SizeConfig.textMultiplier * 2.2 - : SizeConfig.textMultiplier * + : SizeConfig.textMultiplier * 1.3, - ), - ), - Text( - '5', - style: TextStyle( - color: Colors.white, - fontSize: + ), + ), + 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 == + ), + Text( + TranslationBase.of(context) + .undeliveredPackages, + style: TextStyle( + color: Colors.white, + fontSize: MediaQuery.of(context) + .orientation == Orientation.landscape - ? SizeConfig.textMultiplier * + ? SizeConfig.textMultiplier * 2.2 - : SizeConfig.textMultiplier * + : SizeConfig.textMultiplier * 1.3, - ), - ) - ], + ), + ) + ], + ), + ), ), - ), - ), - Padding( - padding: EdgeInsets.only(right: 9.5), - child: Container( - width: 100, - height: 100, - decoration: BoxDecoration( - color: Colors.white10, - shape: BoxShape.circle), - child: Column( - mainAxisAlignment: + Padding( + padding: EdgeInsets.only(right: 9.5), + child: Container( + width: 100, + height: 100, + decoration: BoxDecoration( + color: Colors.white10, + shape: BoxShape.circle), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/closed_box.png', - height: MediaQuery.of(context) - .orientation == + children: [ + Image.asset( + 'assets/images/closed_box.png', + height: MediaQuery.of(context) + .orientation == Orientation.portrait - ? MediaQuery.of(context) - .size - .height * + ? MediaQuery.of(context) + .size + .height * 0.09 - : MediaQuery.of(context) - .size - .height * + : MediaQuery.of(context) + .size + .height * 0.20, - width: MediaQuery.of(context) + width: MediaQuery.of(context) .size .width * - 0.20, - scale: 0.9, - fit: BoxFit.contain, + 0.20, + scale: 0.9, + fit: BoxFit.contain, + ), + ], ), - ], + ), ), - ), + ], ), - ], - ), - ), - ) - ], - ), - ), - Expanded( - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), - child: Container( - height: MediaQuery.of(context).orientation == + ), + ) + ], + ), + ), + Expanded( + child: Column( + children: [ + 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.45, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.0), - gradient: LinearGradient(colors: [ - Color(0xff17AFB8), - Color(0xff49C1BC) - ]), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.all(2.0), - child: InkWell( - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - DeliverdOrdersPage()), - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - 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( + ? MediaQuery.of(context).size.height * 0.16 + : MediaQuery.of(context).size.height * 0.30, + width: MediaQuery.of(context).size.width * 0.45, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + gradient: LinearGradient(colors: [ + Color(0xff17AFB8), + Color(0xff49C1BC) + ]), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(2.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Text( + TranslationBase.of(context).youHave, + 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, + 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: EdgeInsets.only(right: 9.5), - child: Container( - width: 100, - height: 100, - decoration: BoxDecoration( - color: Colors.white10, - shape: BoxShape.circle), - child: Column( - mainAxisAlignment: + Padding( + padding: EdgeInsets.only(right: 9.5), + child: Container( + width: 100, + height: 100, + decoration: BoxDecoration( + color: Colors.white10, + shape: BoxShape.circle), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/opend_box.png', - height: MediaQuery.of(context) - .orientation == + children: [ + Image.asset( + 'assets/images/opend_box.png', + height: MediaQuery.of(context) + .orientation == Orientation.portrait - ? MediaQuery.of(context) - .size - .height * + ? MediaQuery.of(context) + .size + .height * 0.09 - : MediaQuery.of(context) - .size - .height * + : MediaQuery.of(context) + .size + .height * 0.20, - width: MediaQuery.of(context) + width: MediaQuery.of(context) .size .width * - 0.20, - scale: 0.9, - fit: BoxFit.contain, + 0.20, + scale: 0.9, + fit: BoxFit.contain, + ), + ], ), - ], + ), ), - ), + ], ), - ], - ), - ), - ) - ], - ), + ), + ) + ], + ), + ), + ], ), - ], - ), - Padding( - padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0), - child: Row( - children: [ - Expanded( - child: InkWell( - child: Container( - height: MediaQuery.of(context).orientation == + Padding( + padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0), + child: Row( + children: [ + Expanded( + child: InkWell( + child: Container( + height: MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.18 - : MediaQuery.of(context).size.height * 0.30, - width: MediaQuery.of(context).size.width * 0.50, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.0), - gradient: LinearGradient( - colors: [ - Hexcolor("#45B7AE"), - Hexcolor("#119FA9") - ], - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, + ? MediaQuery.of(context).size.height * 0.18 + : MediaQuery.of(context).size.height * 0.30, + width: MediaQuery.of(context).size.width * 0.50, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + gradient: LinearGradient( + colors: [ + Hexcolor("#45B7AE"), + Hexcolor("#119FA9") + ], + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Image.asset( - 'assets/images/qr_code.png', - width: MediaQuery.of(context).size.width * - 0.26, - height: MediaQuery.of(context) - .orientation == + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + 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 * + ? MediaQuery.of(context).size.height * 0.14 - : MediaQuery.of(context).size.height * + : MediaQuery.of(context).size.height * 0.28, - fit: BoxFit.contain, - ) - ], - ), - Column( - mainAxisAlignment: + fit: BoxFit.contain, + ) + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InkWell( - onTap: () { - _scanQrAndGetPatient(context, model); - }, - child: Padding( - padding: EdgeInsets.only(top: 8.0), - child: Text( - TranslationBase.of(context).scan, - style: TextStyle( - fontSize: MediaQuery.of(context) - .orientation == + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + InkWell( + onTap: () { + _scanQrAndGetPatient(context, model); + }, + child: 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, + ? 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 == + 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, + ? SizeConfig.textMultiplier * 3.0 + : SizeConfig.textMultiplier * 2.0, + color: Colors.white, + letterSpacing: 0.2, + wordSpacing: 0.5, + ), + ), ), - ), - ), + ], + ) ], - ) - ], + ), + ), ), - ), - ), - ) - ], - ), - ), - NetworkBaseView( - baseViewModel: model, - child: Padding( - padding: + ) + ], + ), + ), + NetworkBaseView( + baseViewModel: model, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - TranslationBase.of(context).nearestDropOffs, - style: TextStyle( - fontSize: 21.0, - fontWeight: FontWeight.w400, - ), + Column( + children: [ + Text( + TranslationBase.of(context).nearestDropOffs, + style: TextStyle( + fontSize: 21.0, + fontWeight: FontWeight.w400, + ), + ), + ], ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - child: Row( - children: [ - Text( - TranslationBase.of(context).seeAll, - style: TextStyle( - fontSize: 14.5, color: Color(0xff42B6AD)), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + child: Row( + children: [ + Text( + TranslationBase.of(context).seeAll, + style: TextStyle( + fontSize: 14.5, color: Color(0xff42B6AD)), + ), + Icon( + Icons.arrow_forward_ios, + size: 15.0, + color: Color(0xff42B6AD), + ), + ], ), - Icon( - Icons.arrow_forward_ios, - size: 15.0, - color: Color(0xff42B6AD), + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), ), - ], - ), - 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 == + NetworkBaseView( + baseViewModel: model, + child: Expanded( + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: model.orders == null + ? 0 + : model.orders.length < 3 ? 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.120 - : MediaQuery.of(context).size.height * 0.209, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: + ? MediaQuery.of(context).size.height * 0.120 + : MediaQuery.of(context).size.height * 0.209, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - left: 15.0, top: 14.0), - child: Image.asset( - 'assets/images/location.png', - height: MediaQuery.of(context) - .orientation == + children: [ + Padding( + 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 * + ? MediaQuery.of(context) + .size + .height * 0.06 - : MediaQuery.of(context) - .size - .height * + : MediaQuery.of(context) + .size + .height * 0.11, - width: MediaQuery.of(context) - .orientation == + width: MediaQuery.of(context) + .orientation == Orientation.portrait - ? MediaQuery.of(context) - .size - .width * + ? MediaQuery.of(context) + .size + .width * 0.05 - : MediaQuery.of(context) - .size - .width * + : MediaQuery.of(context) + .size + .width * 0.09, - ), - ) - ], - ), - ), - if (model.orders.length != 0) - Expanded( - flex: 5, - child: Column( - crossAxisAlignment: + ), + ) + ], + ), + ), + if (model.orders.length != 0) + Expanded( + flex: 5, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 20.0), - child: Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), - ), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0, - ), - ), - Expanded( - child: Text( - model.orders[index].orderID - .toString(), - style: TextStyle( + children: [ + Padding( + padding: EdgeInsets.only(top: 20.0), + child: Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 18.0), + ), + ), + Text( + model.orders[index].mobileNumber, + style: TextStyle( + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, fontSize: 15.0, - fontWeight: FontWeight.w400, - letterSpacing: 8.0), - ), + ), + ), + Expanded( + child: Text( + model.orders[index].orderID + .toString(), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.w400, + letterSpacing: 8.0), + ), + ), + ], ), - ], - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: CircleContainer( - borderWidth: 0.9, - child: Text( - model.orders[index].distanceInKilometers + ), + Padding( + padding: EdgeInsets.all(8.0), + child: CircleContainer( + borderWidth: 0.9, + child: Text( + model.orders[index].distanceInKilometers .toString() + - ' K.m\naway', - style: TextStyle( - color: Color(0xff42B6AD), - fontWeight: FontWeight.w800, - fontStyle: FontStyle.normal), + ' K.m\naway', + style: TextStyle( + color: Color(0xff42B6AD), + fontWeight: FontWeight.w800, + 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]))); - }, - ), - ); - }, + ); + }, + ), + ), ), - ), + ], ), - ], + ), ), - ), - ), ); } diff --git a/lib/pages/delivery/delivery_confirmed_page.dart b/lib/pages/delivery/delivery_confirmed_page.dart index 35de795..2a4a57d 100644 --- a/lib/pages/delivery/delivery_confirmed_page.dart +++ b/lib/pages/delivery/delivery_confirmed_page.dart @@ -22,46 +22,40 @@ class DeliveryConfirmedPage extends StatelessWidget { Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( - body: SafeArea( - child: Container( - color: Theme.of(context).primaryColor, - child: ListView( - children: [ - Column( + isShowAppBar: true, + appBarColor: Theme.of(context).primaryColor, + arrowColor: Colors.white, + titleColor: Colors.white, + body: SafeArea( + child: Container( + color: Theme.of(context).primaryColor, + child: ListView( + children: [ + Stack( children: [ Column( children: [ Container( - child: Container( - alignment: Alignment.topLeft, - child: IconButton( - color: Colors.white, - iconSize: 40, - icon: Icon(Icons.arrow_back), - onPressed: () { - Navigator.pop(context); - }, - ), - ), - ), - Container( - child: Column( - children: [ - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width * 0.7, - padding: EdgeInsets.only( - top: MediaQuery.of(context).size.width * 0.2, - ), - decoration: BoxDecoration( - color: Colors.white10, - shape: BoxShape.circle), - child: Column( - children: [ - Icon( - Icons.check_circle, - color: Colors.white, - size: 60, + child: Column( + children: [ + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width * 0.7, + padding: EdgeInsets.only( + top: MediaQuery.of(context).size.width * 0.12, + ), + decoration: BoxDecoration( + color: Colors.white10, shape: BoxShape.circle), + child: Column( + children: [ + Icon( + Icons.check_circle, + color: Colors.white, + size: 75, + ), + SizedBox( + height: + MediaQuery.of(context).size.width * 0.03, ), Text( TranslationBase.of(context).deliveryInfo, @@ -70,102 +64,101 @@ class DeliveryConfirmedPage extends StatelessWidget { fontSize: 20, fontWeight: FontWeight.bold), ), - Text( - TranslationBase.of(context) - .confirmationSent, - style: TextStyle( - color: Colors.white, - fontSize: 13, - ), + SizedBox( + height: + MediaQuery.of(context).size.width * 0.03, + ), + Text( + TranslationBase.of(context).confirmationSent, + style: TextStyle( + color: Colors.white, + fontSize: 13, ), - ], - ), + ), + ], ), - ], - ), + ), + ], ), - ], + ), + ], + ), + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width, + ), + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width * 1.0, + margin: EdgeInsets.only( + top: MediaQuery.of(context).size.width * 0.75, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(80), + topRight: Radius.circular(80)), ), - Stack( + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width, - ), - Container( - width: MediaQuery.of(context).size.width, - //800, - height: MediaQuery.of(context).size.width * 1.2, - //440, - margin: EdgeInsets.only(top: 60), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(80), - topRight: Radius.circular(80)), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).size.width * 0.09, ), child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Container( - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).size.width * - 0.15, //50 + FlatButton.icon( + padding: EdgeInsets.all(8), + color: Colors.orangeAccent, + shape: RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0), ), - child: Column( - children: [ - FlatButton.icon( - padding: EdgeInsets.all(8), - color: Colors.orangeAccent, - shape: RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(10.0), - ), - label: Text( - TranslationBase.of(context).addNoteBtn, - style: TextStyle(color: Colors.white), - ), - icon: Icon( - Icons.mode_edit, - color: Colors.white, - ), - onPressed: () {}, - ), - SizedBox( - height: - MediaQuery.of(context).size.width * - 0.1, //20, - ), - Container( - margin: EdgeInsets.all(10), - child: SecondaryButton( - label: TranslationBase.of(context) - .nextDelivery, - onTap: () { - getNextOrder(context, model); - }, - ), - ), - ], + label: Text( + TranslationBase.of(context).addNoteBtn, + style: TextStyle(color: Colors.white), + ), + icon: Icon( + Icons.mode_edit, + color: Colors.white, ), + onPressed: () {}, + ), + SizedBox( + height: + MediaQuery.of(context).size.width * 0.02, //20, + ), + Container( + margin: EdgeInsets.all(10), + child: SecondaryButton( + label: TranslationBase.of(context).nextDelivery, + onTap: () { + getNextOrder(context, model); + },), ), ], ), ), - CustomerBriefCard( - itemId: item.orderID, - customerFirstName: item.firstName, - customerLastName: item.lastName, - mobileNo: item.mobileNumber, - totalPayment: item.amount, - deliveryTime: item.orderCreatedOn), ], ), - ], - ), - ], - ), + ), + Container( + margin: EdgeInsets.only( + 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), + ), + ], + ), + ],), ), ), ), diff --git a/lib/pages/delivery/information_page.dart b/lib/pages/delivery/information_page.dart index ff2de68..685d5bd 100644 --- a/lib/pages/delivery/information_page.dart +++ b/lib/pages/delivery/information_page.dart @@ -1 +1 @@ -import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; import 'package:driverapp/widgets/bottom_sheet/custom_bottom_sheet.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/data_display/dialog/custom_dialog.dart'; import 'package:driverapp/widgets/data_display/text.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:driverapp/widgets/delivery/delivery_action_button.dart'; import 'package:driverapp/widgets/delivery/package_content.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../uitl/translations_delegate_base.dart'; import '../../widgets/others/app_scaffold_widget.dart'; class InformationPage extends StatelessWidget { final PendingOrdersRes item; int orderStatus; InformationPage(this.item); @override Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarColor: Theme.of(context).primaryColor, arrowColor: Colors.white, titleColor: Colors.white, appBarTitle: TranslationBase.of(context).deliveryInfo, body: Container( color: Theme.of(context).primaryColor, child: Container( color: Theme.of(context).primaryColor, child: ListView( children: [ Column( children: [ Stack( children: [ Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.width, ), Container( width: MediaQuery.of(context).size.width * 1, height: MediaQuery.of(context).size.width * 1.5, margin: EdgeInsets.only( top: MediaQuery.of(context).size.width * 0.23, ), decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(45), topRight: Radius.circular(45)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: MediaQuery.of(context).size.width * 0.53, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Color(0xffED1C24), btnIcon: Icon( Icons.near_me, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); },), DeliveryInfoButton( btnColor: Color(0xFF61B260), btnIcon: Icon( Icons.whatshot, size: 30, color: Colors.white, ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Color(0xFFFCB657), btnIcon: Icon( Icons.mail_outline, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Theme.of(context).primaryColor, btnIcon: Icon( Icons.phone, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).call, btnFunction: () => launch("tel://" + item.mobileNumber), ), ], ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( margin: EdgeInsets.only( left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Text( TranslationBase.of(context) .packageContent, style: TextStyle( fontWeight: FontWeight.w900, fontSize: 20), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.05, ), Padding( padding: const EdgeInsets.only(left: 10), child: Column( children: List.generate( item.itemsQuantitiesList != null ? item .itemsQuantitiesList.length : 0, (index) { return packageContent( packageName: item .itemsQuantitiesList[index] .itemName .toString(), packageCount: item .itemsQuantitiesList[index] .quantity .toString(), ); }), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.01, ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( margin: EdgeInsets.all(10), child: SecondaryButton( label: TranslationBase.of(context).clientReached, onTap: () { model.showBottomSheet(); }, ), ), ], ), ), CustomerBriefCard( itemId: item.orderID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, deliveryTime: item.orderCreatedOn, longitude: item.longitude, latitude: item.latitude, ),], ), ], ), ], ), ), ), bottomSheet: !model.isBottomSheetAppear ? Container( width: 0, height: 0, ) : CustomBottomSheet(children: [ SizedBox( height: 10, ), Center( child: Texts( TranslationBase.of(context).selectAction, color: Colors.black, fontSize: 22, ), ), SizedBox( height: 10, ), FractionallySizedBox( widthFactor: MediaQuery.of(context).orientation == Orientation.portrait ? 0.9 : 0.98, child: Container( height: MediaQuery.of(context).size.height * 0.43, width: double.infinity, child: ListView( children: [ Column( children: [ SizedBox( height: 3, child: Container( color: Hexcolor("#D5D5D5"), ), ), SizedBox( height: 15, ), ActionSheetButton( label: TranslationBase.of(context).delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context).canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox(height: 15), ], ), ], ), )), ]), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase .of(context) .delivered; break; case 4: orderStatusText = TranslationBase .of(context) .deliveredAccepted; break; case 5: orderStatusText = TranslationBase .of(context) .deliveredRejected; break; case 6: orderStatusText = TranslationBase .of(context) .canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model,); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel(deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file +import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; import 'package:driverapp/widgets/bottom_sheet/custom_bottom_sheet.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/data_display/dialog/custom_dialog.dart'; import 'package:driverapp/widgets/data_display/text.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:driverapp/widgets/delivery/delivery_action_button.dart'; import 'package:driverapp/widgets/delivery/package_content.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../uitl/translations_delegate_base.dart'; import '../../widgets/others/app_scaffold_widget.dart'; class InformationPage extends StatelessWidget { final PendingOrdersRes item; int orderStatus; InformationPage(this.item); @override Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarColor: Theme.of(context).primaryColor, arrowColor: Colors.white, titleColor: Colors.white, appBarTitle: TranslationBase.of(context).deliveryInfo, body: Container( color: Theme.of(context).primaryColor, child: Container( color: Theme.of(context).primaryColor, child: ListView( children: [ Column( children: [ Stack( children: [ // Container( // width: MediaQuery.of(context).size.width, // height: MediaQuery.of(context).size.width, // ), Container( width: MediaQuery.of(context).size.width * 1, height: MediaQuery.of(context).size.width * 1.5, margin: EdgeInsets.only( top: MediaQuery.of(context).size.width * 0.23, ), decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(45), topRight: Radius.circular(45)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: MediaQuery.of(context).size.width * 0.23, //MediaQuery.of(context).size.width * 0.005, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Colors.white,//Color(0xffED1C24), btnIcon: Icon( DriverApp.location_1, size: 40, color: Color(0xffED1C24) ), btnName: TranslationBase.of(context).location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); },), DeliveryInfoButton( btnColor: Colors.white,//Color(0xFF61B260), btnIcon: Icon( DriverApp.whatsapp, size: 40, color: Color(0xFF61B260), ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white,//Color(0xFFFCB657), btnIcon: Icon( DriverApp.message, size: 40, color: Color(0xFFFCB657), ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white,//Theme.of(context).primaryColor, btnIcon: Icon( DriverApp.call, size: 40, color: Theme.of(context).primaryColor, ), btnName: TranslationBase.of(context).call, btnFunction: () => launch("tel://" + item.mobileNumber), ), ], ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( margin: EdgeInsets.only( left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Text( TranslationBase.of(context) .packageContent, style: TextStyle( fontWeight: FontWeight.w900, fontSize: 20), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.05, ), Padding( padding: const EdgeInsets.only(left: 10), child: Column( children: List.generate( item.itemsQuantitiesList != null ? item .itemsQuantitiesList.length : 0, (index) { return packageContent( packageName: item .itemsQuantitiesList[index] .itemName .toString(), packageCount: item .itemsQuantitiesList[index] .quantity .toString(), ); }), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.01, ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( margin: EdgeInsets.all(10), child: SecondaryButton( label: TranslationBase .of(context) .clientReached, onTap: () { model.showBottomSheet(); }, ), ), ], ), ), CustomerBriefCard( itemId: item.orderID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, deliveryTime: item.orderCreatedOn, longitude: item.longitude, latitude: item.latitude, ), ], ), ], ), ], ), ), ), bottomSheet: !model.isBottomSheetAppear ? Container( width: 0, height: 0, ) : CustomBottomSheet(children: [ SizedBox( height: 10, ), Center( child: Texts( TranslationBase.of(context).selectAction, color: Colors.black, fontSize: 22, ), ), SizedBox( height: 10, ), FractionallySizedBox( widthFactor: MediaQuery.of(context).orientation == Orientation.portrait ? 0.9 : 0.98, child: Container( height: MediaQuery.of(context).size.height * 0.43, width: double.infinity, child: ListView( children: [ Column( children: [ SizedBox( height: 3, child: Container( color: Hexcolor("#D5D5D5"), ), ), SizedBox( height: 15, ), ActionSheetButton( label: TranslationBase.of(context).delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context).canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox(height: 15), ], ), ], ), )), ]), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase .of(context) .delivered; break; case 4: orderStatusText = TranslationBase .of(context) .deliveredAccepted; break; case 5: orderStatusText = TranslationBase .of(context) .deliveredRejected; break; case 6: orderStatusText = TranslationBase .of(context) .canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model,); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel(deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file diff --git a/lib/root_page.dart b/lib/root_page.dart index 48994a9..329d0f6 100644 --- a/lib/root_page.dart +++ b/lib/root_page.dart @@ -1,17 +1,18 @@ import 'package:driverapp/pages/authentication/login_page.dart'; -import 'package:driverapp/pages/base/base_view.dart'; -import 'package:driverapp/pages/landing/landing_page.dart'; -import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; +import 'package:driverapp/pages/dashboard/dashboard_screen.dart'; +import 'package:driverapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:driverapp/pages/dashboard/dashboard_screen.dart'; +import 'package:provider/provider.dart'; import 'core/viewModels/authentication_view_model.dart'; class RootPage extends StatelessWidget { @override Widget build(BuildContext context) { - Widget buildRoot(APP_STATUS status) { + AuthenticationViewModel authenticationViewModel = Provider.of(context); + APP_STATUS status = authenticationViewModel.status; + Widget buildRoot() { switch (status) { case APP_STATUS.UNAUTHENTICATED: return LoginPage(); @@ -19,16 +20,16 @@ class RootPage extends StatelessWidget { case APP_STATUS.AUTHENTICATED: return DashboardScreen(); break; + case APP_STATUS.LOADING: + return Center(child: AppCircularProgressIndicator()); + break; } } return AnimatedSwitcher( duration: Duration(microseconds: 350), - child: BaseView( - builder: (_, model, widget) => AppScaffold( - baseViewModel: model, - body: buildRoot((model.status)), - ), + child: Scaffold( + body: buildRoot(), ), ); } diff --git a/lib/widgets/delivery/customer_brief_card.dart b/lib/widgets/delivery/customer_brief_card.dart index 7af12c1..7a6899d 100644 --- a/lib/widgets/delivery/customer_brief_card.dart +++ b/lib/widgets/delivery/customer_brief_card.dart @@ -14,6 +14,7 @@ class CustomerBriefCard extends StatelessWidget { final String deliveryTime; final double longitude; final double latitude; + final bool showDistance; CustomerBriefCard( {this.itemId, @@ -25,7 +26,9 @@ class CustomerBriefCard extends StatelessWidget { this.totalPayment, this.deliveryTime, this.longitude, - this.latitude}); + this.latitude, + this.showDistance = true, + }); @override Widget build(BuildContext context) { @@ -63,21 +66,24 @@ class CustomerBriefCard extends StatelessWidget { style: TextStyle(color: Color(0xFFADACAD)), ), ), - Expanded( - child: CircleAvatar( - backgroundColor: Colors.black45, - radius: 28.0, + Visibility( + visible: showDistance, + child: Expanded( child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 25.1, - child: Padding( - padding: const EdgeInsets.only(left: 3), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 12.5, - fontWeight: FontWeight.w600), + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 26.1, + child: Padding( + padding: const EdgeInsets.only(left: 3), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: FontWeight.w600), + ), ), ), ), @@ -85,22 +91,24 @@ class CustomerBriefCard extends StatelessWidget { ), ], ), + SizedBox(height: MediaQuery.of(context).size.width * 0.02,), Text( '${customerFirstName} ${customerLastName}', style: TextStyle(fontSize: 20, fontWeight: FontWeight.w900), ), + SizedBox(height: MediaQuery.of(context).size.width * 0.019,), Text( mobileNo, style: TextStyle(color: Color(0xFF50BDC5)), ), SizedBox( - height: 10, - ), - Text( - 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277', - style: TextStyle( - color: Color(0xFF464748), fontWeight: FontWeight.w600), + height:MediaQuery.of(context).size.width*0.005, ), +// Text( +// 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277', +// style: TextStyle( +// color: Color(0xFF464748), fontWeight: FontWeight.w600), +// ), SizedBox( height: 10, ), @@ -141,7 +149,7 @@ class CustomerBriefCard extends StatelessWidget { ], ), SizedBox( - height: 20, + height: MediaQuery.of(context).size.width*0.03, ), Row( children: [ diff --git a/lib/widgets/delivery/delivery_action_button.dart b/lib/widgets/delivery/delivery_action_button.dart index 3571218..00ea320 100644 --- a/lib/widgets/delivery/delivery_action_button.dart +++ b/lib/widgets/delivery/delivery_action_button.dart @@ -24,22 +24,13 @@ class DeliveryInfoButton extends StatelessWidget { .of(context) .size .width * 0.165, // specific value - child: RaisedButton( - padding: EdgeInsets.only(left: 2), - color: btnColor, - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(8.0), - ), - child: btnIcon, - onPressed: btnFunction, + child: + InkWell( + child: btnIcon, + onTap: btnFunction, ), ), - SizedBox( - height: MediaQuery - .of(context) - .size - .width * 0.05, - ), + Text( btnName, style: TextStyle(