diff --git a/lib/core/viewModels/authentication_view_model.dart b/lib/core/viewModels/authentication_view_model.dart index f1a2be6..158e428 100644 --- a/lib/core/viewModels/authentication_view_model.dart +++ b/lib/core/viewModels/authentication_view_model.dart @@ -80,10 +80,7 @@ class AuthenticationViewModel with ChangeNotifier { } } - logout() async{ + logout() async { await sharedPref.clear(); - isLogin = false; - isLoading = false; - notifyListeners(); } } diff --git a/lib/pages/setting/setting.dart b/lib/pages/setting/setting.dart index 4cc26b3..63c8830 100644 --- a/lib/pages/setting/setting.dart +++ b/lib/pages/setting/setting.dart @@ -1,5 +1,5 @@ import 'package:driverapp/core/viewModels/authentication_view_model.dart'; -import 'package:driverapp/root_page.dart'; +import 'package:driverapp/pages/authentication/login_page.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -9,14 +9,13 @@ import 'package:provider/provider.dart'; class SettingPage extends StatelessWidget { final String driverName; //_authenticationViewModel.user.userName final int driverID; + AuthenticationViewModel _authenticationViewModel; SettingPage({this.driverName, this.driverID}); - AuthenticationViewModel authenticationViewModel; - @override Widget build(BuildContext context) { - authenticationViewModel = Provider.of(context); + _authenticationViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, appBarColor: Color(0xff30B7B9), @@ -40,46 +39,53 @@ class SettingPage extends StatelessWidget { maxRadius: 200.0, child: Image.asset( 'assets/images/driver.png', - height: MediaQuery.of(context).size.width * 1, + 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, - ), + SizedBox(height: MediaQuery.of(context).size.width *0.05,), Container( child: Text( driverName, style: TextStyle( fontSize: 40, fontWeight: FontWeight.w600, - color: Colors.white), + color: Colors.white + ), ), ), - SizedBox( - height: MediaQuery.of(context).size.width * 0.05, - ), + SizedBox(height: MediaQuery.of(context).size.width *0.05,), Container( child: Text( 'ID: ${driverID.toString()}', - style: TextStyle(fontSize: 20, color: Colors.white), + style: TextStyle( + fontSize: 20, + color: Colors.white + ), ), ), ], ), ), - SizedBox( - height: MediaQuery.of(context).size.width * 0.1, - ), + SizedBox(height: MediaQuery.of(context).size.width *0.1,), Container( margin: EdgeInsets.only(left: 35), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ InkWell( + onTap: () async { + await _authenticationViewModel.logout(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LoginPage() + ), + ); + }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -92,25 +98,23 @@ class SettingPage extends StatelessWidget { size: 40, color: Colors.white, ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.05, - ), + SizedBox(width: MediaQuery.of(context).size.width *0.05,), Text( TranslationBase.of(context).logout, style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, - fontSize: 18), + fontSize: 18 + ), ), ], ), ), SizedBox( - height: MediaQuery.of(context).size.width * 0.05, + height: MediaQuery.of(context).size.width *0.05, child: Center( child: Container( - margin: - EdgeInsetsDirectional.only(start: 0, end: 30), + margin: EdgeInsetsDirectional.only(start: 0, end: 30), height: 1.0, color: Colors.white, ), @@ -118,21 +122,8 @@ class SettingPage extends StatelessWidget { ), ], ), - onTap: () async { -// await authenticationViewModel.logout(); -// Navigator.pushReplacement( -// context, -// MaterialPageRoute( -// builder: (context) => RootPage(), -// ), -// ); -// Navigator.of(context).pushNamedAndRemoveUntil( -// '/', ModalRoute.withName('/')); - }, - ), - SizedBox( - height: MediaQuery.of(context).size.width * 0.05, ), + SizedBox(height: MediaQuery.of(context).size.width*0.05,), InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -154,7 +145,8 @@ class SettingPage extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, - fontSize: 18), + fontSize: 18 + ), ), ], ), @@ -163,19 +155,15 @@ class SettingPage extends StatelessWidget { height: 10.0, child: Center( child: Container( - margin: - EdgeInsetsDirectional.only(start: 0, end: 30), + margin: EdgeInsetsDirectional.only(start: 0, end: 30), height: 1.0, color: Colors.white, ), ), ), - SizedBox( - height: MediaQuery.of(context).size.width * 0.05, - ), + SizedBox(height: MediaQuery.of(context).size.width*0.05,), ], ), - onTap: () {}, ), ], ), @@ -185,4 +173,4 @@ class SettingPage extends StatelessWidget { ), ); } -} +} \ No newline at end of file diff --git a/lib/pages/splash_screen_page.dart b/lib/pages/splash_screen_page.dart index 038b982..a18f077 100644 --- a/lib/pages/splash_screen_page.dart +++ b/lib/pages/splash_screen_page.dart @@ -34,7 +34,7 @@ class _SplashScreenPageState extends State { body: SingleChildScrollView( child: Center( child: Column( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ FractionallySizedBox( widthFactor: 0.80, @@ -49,16 +49,16 @@ class _SplashScreenPageState extends State { Container( child: Icon( DriverApp.logo, - size: 110, + size: 120, color: Colors.white, ), margin: EdgeInsets.only( right: projectViewModel.isArabic ? 0 - : MediaQuery.of(context).size.width * 0.15, + : MediaQuery.of(context).size.width * 0.20, left: !projectViewModel.isArabic ? 0 - : MediaQuery.of(context).size.width * 0.15), + : MediaQuery.of(context).size.width * 0.10), ), ], ), @@ -92,7 +92,7 @@ class _SplashScreenPageState extends State { ], ), SizedBox( - height: 280, + height: 100, ) ], ),