From 36f11f1474b2389c2f6eb3a89572f4b9fe8ec83a Mon Sep 17 00:00:00 2001 From: enadhilal Date: Mon, 7 Sep 2020 14:29:35 +0300 Subject: [PATCH 1/4] Merge branch 'master' of gitlab.com:Cloud_Solution/driver-app into delivery_confirmed # Conflicts: # lib/pages/delivery/delivery_confirmed_page.dart # lib/pages/delivery/information_page.dart --- lib/pages/dashboard/dashboard_screen.dart | 24 ++++++++++----- lib/pages/setting/setting.dart | 36 +++++++++++++++++++++++ 2 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 lib/pages/setting/setting.dart diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index d62ab89..afea5de 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -4,6 +4,7 @@ import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_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/translations_delegate_base.dart'; import 'package:driverapp/uitl/utils.dart'; @@ -74,17 +75,26 @@ class _DashboardScreenState extends State { child: SafeArea( child: Column( children: [ - CircleAvatar( - radius: 25.5, - backgroundColor: Color(0xff30B7B9), + InkWell( child: CircleAvatar( + radius: 25.5, backgroundColor: Color(0xff30B7B9), - maxRadius: 26.0, - child: Image.asset( - 'assets/images/driver.png', - fit: BoxFit.contain, + child: CircleAvatar( + backgroundColor: Color(0xff30B7B9), + maxRadius: 26.0, + child: Image.asset( + 'assets/images/driver.png', + fit: BoxFit.contain, + ), ), ), + onTap: (){ + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SettingPage())); + }, ), ], ), diff --git a/lib/pages/setting/setting.dart b/lib/pages/setting/setting.dart new file mode 100644 index 0000000..a86ce95 --- /dev/null +++ b/lib/pages/setting/setting.dart @@ -0,0 +1,36 @@ +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 { + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: true, + appBarColor: Theme.of(context).primaryColor, + arrowColor: Colors.white, + titleColor: Colors.white, + body: Container( + 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, + ), + ), + ), + ], + ), + ), + ); + } +} \ No newline at end of file From 9bc404fa2a5a2a180580da56d5f5736e16a484b6 Mon Sep 17 00:00:00 2001 From: enadhilal Date: Tue, 8 Sep 2020 09:07:43 +0300 Subject: [PATCH 2/4] add scroll for landscape --- lib/pages/setting/setting.dart | 184 +++++++++++++++++---------------- 1 file changed, 93 insertions(+), 91 deletions(-) diff --git a/lib/pages/setting/setting.dart b/lib/pages/setting/setting.dart index 7ea5f37..7464459 100644 --- a/lib/pages/setting/setting.dart +++ b/lib/pages/setting/setting.dart @@ -13,114 +13,116 @@ class SettingPage extends StatelessWidget { appBarColor: Color(0xff30B7B9), arrowColor: Colors.white, titleColor: Colors.white, - body: Column( - children: [ - Container( - width: double.infinity, - child: Column( - children: [ - 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, + body: SingleChildScrollView( + child: Column( + children: [ + Container( + width: double.infinity, + child: Column( + children: [ + 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, - maxRadius: 200.0, - child: Image.asset( - 'assets/images/driver.png', - height: 280, - width: 280, - fit: BoxFit.contain, + child: CircleAvatar( + backgroundColor: Theme.of(context).primaryColor, + maxRadius: 200.0, + child: Image.asset( + 'assets/images/driver.png', + height: 280, + width: 280, + fit: BoxFit.contain, + ), ), ), ), - ), - SizedBox(height: 10,), - Container( - child: Text('Driver Name', style: TextStyle(fontSize: 40, fontWeight: FontWeight.w600, color: Colors.white),), - ), - SizedBox(height: 10,), - Container( - child: Text('ID: 123456789', style: TextStyle(fontSize: 20, color: Colors.white),), - ), - ], + SizedBox(height: 10,), + Container( + child: Text('Driver Name', style: TextStyle(fontSize: 40, fontWeight: FontWeight.w600, color: Colors.white),), + ), + SizedBox(height: 10,), + Container( + child: Text('ID: 123456789', style: TextStyle(fontSize: 20, color: Colors.white),), + ), + ], + ), ), - ), - SizedBox(height: 50,), - Container( - margin: EdgeInsets.only(left: 35), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - InkWell( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 15), - child: Row( - children: [ - Icon( - Icons.input, - size: 40, + SizedBox(height: 50,), + Container( + margin: EdgeInsets.only(left: 35), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + InkWell( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 15), + child: Row( + children: [ + Icon( + Icons.input, + size: 40, + color: Colors.white, + ), + SizedBox(width: 20,), + Text('Log out', 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(width: 20,), - Text('Log out', 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: 8,), - InkWell( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 15), - child: Row( - children: [ - Icon( - Icons.settings, - size: 40, + SizedBox(height: 8,), + InkWell( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 15), + child: Row( + children: [ + Icon( + Icons.settings, + size: 40, + color: Colors.white, + ), + SizedBox(width: 20,), + Text('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(width: 20,), - Text('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, ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), ); } From be8dd59c6d4c46d39be7dd1d53192fe18ef3e7ca Mon Sep 17 00:00:00 2001 From: enadhilal Date: Tue, 8 Sep 2020 11:31:26 +0300 Subject: [PATCH 3/4] make driver name and ID dynamic, add translate to logout and settings label. --- lib/pages/dashboard/dashboard_screen.dart | 2 +- lib/pages/setting/setting.dart | 31 +++++++++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index 460bce7..8b7b411 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -109,7 +109,7 @@ class _DashboardScreenState extends State { context, MaterialPageRoute( builder: (context) => - SettingPage())); + SettingPage(driverName:_authenticationViewModel.user.userName, driverID:_authenticationViewModel.user.userID))); }, ), ], diff --git a/lib/pages/setting/setting.dart b/lib/pages/setting/setting.dart index 7464459..0de7d9a 100644 --- a/lib/pages/setting/setting.dart +++ b/lib/pages/setting/setting.dart @@ -5,6 +5,10 @@ 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) { @@ -31,25 +35,25 @@ class SettingPage extends StatelessWidget { maxRadius: 200.0, child: Image.asset( 'assets/images/driver.png', - height: 280, - width: 280, + height: MediaQuery.of(context).size.width * 1 , + width: MediaQuery.of(context).size.width * 1, fit: BoxFit.contain, ), ), ), ), - SizedBox(height: 10,), + SizedBox(height: MediaQuery.of(context).size.width *0.05,), Container( - child: Text('Driver Name', style: TextStyle(fontSize: 40, fontWeight: FontWeight.w600, color: Colors.white),), + child: Text(driverName, style: TextStyle(fontSize: 40, fontWeight: FontWeight.w600, color: Colors.white),), ), - SizedBox(height: 10,), + SizedBox(height: MediaQuery.of(context).size.width *0.05,), Container( - child: Text('ID: 123456789', style: TextStyle(fontSize: 20, color: Colors.white),), + child: Text('ID: ${driverID.toString()}', style: TextStyle(fontSize: 20, color: Colors.white),), ), ], ), ), - SizedBox(height: 50,), + SizedBox(height: MediaQuery.of(context).size.width *0.1,), Container( margin: EdgeInsets.only(left: 35), child: Column( @@ -68,13 +72,13 @@ class SettingPage extends StatelessWidget { size: 40, color: Colors.white, ), - SizedBox(width: 20,), - Text('Log out', style: TextStyle(fontWeight: FontWeight.w500, color: Colors.white, fontSize: 18),), + 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: 10.0, + height: MediaQuery.of(context).size.width *0.05, child: Center( child: Container( margin: EdgeInsetsDirectional.only(start: 0, end: 30), @@ -86,7 +90,7 @@ class SettingPage extends StatelessWidget { ], ), ), - SizedBox(height: 8,), + SizedBox(height: MediaQuery.of(context).size.width*0.05,), InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -100,8 +104,8 @@ class SettingPage extends StatelessWidget { size: 40, color: Colors.white, ), - SizedBox(width: 20,), - Text('Settings', style: TextStyle(fontWeight: FontWeight.w500, color: Colors.white, fontSize: 18),), + SizedBox(width: MediaQuery.of(context).size.width * 0.05,), + Text(TranslationBase.of(context).settings, style: TextStyle(fontWeight: FontWeight.w500, color: Colors.white, fontSize: 18),), ], ), ), @@ -115,6 +119,7 @@ class SettingPage extends StatelessWidget { ), ), ), + SizedBox(height: MediaQuery.of(context).size.width*0.05,), ], ), ), From 99a2233733a5d94c61a0017e3365d1bd325ce131 Mon Sep 17 00:00:00 2001 From: enadhilal Date: Tue, 8 Sep 2020 11:33:33 +0300 Subject: [PATCH 4/4] make driver name and ID dynamic, add translate to logout and settings label. --- lib/pages/setting/setting.dart | 39 +++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/lib/pages/setting/setting.dart b/lib/pages/setting/setting.dart index 0de7d9a..c084d7f 100644 --- a/lib/pages/setting/setting.dart +++ b/lib/pages/setting/setting.dart @@ -44,11 +44,24 @@ class SettingPage extends StatelessWidget { ), SizedBox(height: MediaQuery.of(context).size.width *0.05,), Container( - child: Text(driverName, style: TextStyle(fontSize: 40, fontWeight: FontWeight.w600, color: Colors.white),), + 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),), + child: Text( + 'ID: ${driverID.toString()}', + style: TextStyle( + fontSize: 20, + color: Colors.white + ), + ), ), ], ), @@ -73,7 +86,14 @@ class SettingPage extends StatelessWidget { 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),), + Text( + TranslationBase.of(context).logout, + style: TextStyle( + fontWeight: FontWeight.w500, + color: Colors.white, + fontSize: 18 + ), + ), ], ), ), @@ -104,8 +124,17 @@ class SettingPage extends StatelessWidget { 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( + width: MediaQuery.of(context).size.width * 0.05, + ), + Text( + TranslationBase.of(context).settings, + style: TextStyle( + fontWeight: FontWeight.w500, + color: Colors.white, + fontSize: 18 + ), + ), ], ), ),