From 3f6e3f142373d346747f161de878503c3d49bb89 Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Tue, 16 Aug 2022 14:23:57 +0300 Subject: [PATCH] New UI Implemented Fix 1.0 --- lib/pages/dashboard/dashboard_page.dart | 12 +--- .../settings/branch/branch_detail_page.dart | 62 ++++++++++--------- lib/pages/user/change_email_page.dart | 40 +++--------- lib/pages/user/change_mobile_page.dart | 43 ++++--------- lib/pages/user/change_password_page.dart | 30 ++------- .../user/forget_password_method_page.dart | 15 ++--- lib/pages/user/login_with_password_page.dart | 2 +- 7 files changed, 64 insertions(+), 140 deletions(-) diff --git a/lib/pages/dashboard/dashboard_page.dart b/lib/pages/dashboard/dashboard_page.dart index db80564..fbca3e4 100644 --- a/lib/pages/dashboard/dashboard_page.dart +++ b/lib/pages/dashboard/dashboard_page.dart @@ -149,16 +149,6 @@ class _DashboardPageState extends State { ), ) ]), - // Container( - // width: double.infinity, - // height: 200, - // color: accentColor.withOpacity(0.3), - // child: Icon( - // Icons.person, - // size: 80, - // color: accentColor.withOpacity(0.3), - // ), - // ), Container( width: double.infinity, color: MyColors.darkPrimaryColor.withOpacity(0.1), @@ -252,7 +242,7 @@ class _DashboardPageState extends State { final pref = await SharedPreferences.getInstance(); await pref.clear(); pop(context); - pop(context); + navigateReplaceWithName(context, AppRoutes.registerSelection); }, ), ], diff --git a/lib/pages/settings/branch/branch_detail_page.dart b/lib/pages/settings/branch/branch_detail_page.dart index 267faa1..87bce99 100644 --- a/lib/pages/settings/branch/branch_detail_page.dart +++ b/lib/pages/settings/branch/branch_detail_page.dart @@ -102,37 +102,39 @@ class _BranchDetailPageState extends State { color: Colors.grey, margin: EdgeInsets.symmetric(vertical: 12), ), - ListView.builder( - itemBuilder: (context, pIndex) { - return Container( - width: double.infinity, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - categories[pIndex].categoryName.toString().toText16(isBold: true), - ListView.builder( - itemBuilder: (context, index) { - return Container( - child: ("- " + - (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA" - ? categories[pIndex].services![index].serviceNameN.toString() - : categories[pIndex].services![index].serviceName.toString())) - .toText14(), - ); - }, - itemCount: categories[pIndex].services?.length, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - ) - ], + categories.length == 0 + ? LocaleKeys.no_branch.tr().toText12() + : ListView.builder( + itemBuilder: (context, pIndex) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + categories[pIndex].categoryName.toString().toText16(isBold: true), + ListView.builder( + itemBuilder: (context, index) { + return Container( + child: ("- " + + (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA" + ? categories[pIndex].services![index].serviceNameN.toString() + : categories[pIndex].services![index].serviceName.toString())) + .toText14(), + ); + }, + itemCount: categories[pIndex].services?.length, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + ) + ], + ), + ); + }, + itemCount: categories.length, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, ), - ); - }, - itemCount: categories.length, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - ), ], ), ), diff --git a/lib/pages/user/change_email_page.dart b/lib/pages/user/change_email_page.dart index 6d81d97..d1fddbf 100644 --- a/lib/pages/user/change_email_page.dart +++ b/lib/pages/user/change_email_page.dart @@ -1,4 +1,3 @@ - import 'package:car_provider_app/api/client/user_api_client.dart'; import 'package:car_provider_app/classes/utils.dart'; import 'package:car_provider_app/config/routes.dart'; @@ -13,6 +12,7 @@ import 'package:car_provider_app/widgets/dialog/dialogs.dart'; import 'package:car_provider_app/widgets/dialog/message_dialog.dart'; import 'package:car_provider_app/widgets/dialog/otp_dialog.dart'; import 'package:car_provider_app/widgets/button/show_fill_button.dart'; +import 'package:car_provider_app/widgets/txt_field.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; @@ -20,7 +20,6 @@ import 'dart:convert'; import 'package:http/http.dart'; class ChangeEmailPage extends StatefulWidget { - @override State createState() => _ChangeEmailPageState(); } @@ -32,46 +31,22 @@ class _ChangeEmailPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: appBar(context,title: "Change Email"), + appBar: appBar(context, title: LocaleKeys.changeEmail.tr()), body: SingleChildScrollView( child: Container( // width: double.infinity, // height: double.infinity, - padding: EdgeInsets.all(40), + padding: EdgeInsets.all(20), child: Column( children: [ - "Enter Email".toText24(), + LocaleKeys.enterEmail.tr().toText24(), 12.height, - TextFormField( - decoration: InputDecoration( - hintText: "Enter New Email", - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), - ), - ), - ), - obscureText: false, - onChanged: (v) => email = v, - ), + TxtField(hint: LocaleKeys.enterNewEmail.tr(), onChanged: (v) => email = v,), 12.height, - TextFormField( - decoration: InputDecoration( - hintText: "Enter Current Password", - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), - ), - ), - ), - obscureText: true, - onChanged: (v) => password = v, - ), + TxtField(hint: LocaleKeys.enterCurrentPassword.tr(), onChanged: (v) => password = v,), 40.height, ShowFillButton( - title: "Confirm", + title: LocaleKeys.confirm.tr(), maxWidth: double.infinity, onPressed: () { changeEmail(context); @@ -114,5 +89,4 @@ class _ChangeEmailPageState extends State { Utils.showToast(otpRequest.message ?? ""); } } - } diff --git a/lib/pages/user/change_mobile_page.dart b/lib/pages/user/change_mobile_page.dart index e30fa4f..ac69288 100644 --- a/lib/pages/user/change_mobile_page.dart +++ b/lib/pages/user/change_mobile_page.dart @@ -1,4 +1,3 @@ - import 'package:car_provider_app/api/client/user_api_client.dart'; import 'package:car_provider_app/classes/utils.dart'; import 'package:car_provider_app/config/routes.dart'; @@ -13,6 +12,7 @@ import 'package:car_provider_app/widgets/dialog/dialogs.dart'; import 'package:car_provider_app/widgets/dialog/message_dialog.dart'; import 'package:car_provider_app/widgets/dialog/otp_dialog.dart'; import 'package:car_provider_app/widgets/button/show_fill_button.dart'; +import 'package:car_provider_app/widgets/txt_field.dart'; import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; @@ -20,57 +20,39 @@ import 'dart:convert'; import 'package:http/http.dart'; class ChangeMobilePage extends StatefulWidget { - @override State createState() => _ChangeMobilePageState(); } class _ChangeMobilePageState extends State { - int countryID=1 ; + int countryID = 1; + String mobileNo = ''; String password = ''; @override Widget build(BuildContext context) { return Scaffold( - appBar: appBar(context,title: LocaleKeys.changeMobile.tr()), + appBar: appBar(context, title: LocaleKeys.changeMobile.tr()), body: SingleChildScrollView( child: Container( // width: double.infinity, // height: double.infinity, - padding: EdgeInsets.all(40), + padding: EdgeInsets.all(20), child: Column( children: [ LocaleKeys.enterNewPhoneNumber.tr().toText24(), 12.height, - TextFormField( - decoration: InputDecoration( - hintText: LocaleKeys.enterNewPhoneNumber.tr(), - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), - ), - ), - ), - obscureText: false, + TxtField( + hint: LocaleKeys.enterNewPhoneNumber.tr(), onChanged: (v) => mobileNo = v, ), 12.height, - TextFormField( - decoration: InputDecoration( - hintText: LocaleKeys.enterCurrentPassword.tr(), - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), - ), - ), - ), - obscureText: true, + TxtField( + hint: LocaleKeys.enterCurrentPassword.tr(), onChanged: (v) => password = v, ), - 40.height, + 20.height, ShowFillButton( title: LocaleKeys.confirm.tr(), maxWidth: double.infinity, @@ -100,7 +82,7 @@ class _ChangeMobilePageState extends State { showMDialog( context, child: MessageDialog( - title:LocaleKeys.phoneNumberVerified.tr(), + title: LocaleKeys.phoneNumberVerified.tr(), onClick: () { Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.loginWithPassword, (Route route) => false); }, @@ -115,7 +97,4 @@ class _ChangeMobilePageState extends State { Utils.showToast(otpRequest.message ?? ""); } } - - - } diff --git a/lib/pages/user/change_password_page.dart b/lib/pages/user/change_password_page.dart index ba4aead..e050968 100644 --- a/lib/pages/user/change_password_page.dart +++ b/lib/pages/user/change_password_page.dart @@ -36,7 +36,7 @@ class _ChangePasswordPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: appBar(context,title: LocaleKeys.changePassword.tr()), + appBar: appBar(context, title: LocaleKeys.changePassword.tr()), body: SingleChildScrollView( child: Container( // width: double.infinity, @@ -46,34 +46,16 @@ class _ChangePasswordPageState extends State { children: [ LocaleKeys.enterNewPassword.tr().toText24(), 12.height, - TextFormField( - decoration: InputDecoration( - hintText: LocaleKeys.enterOldPassword.tr(), - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), - ), - ), - ), - obscureText: true, + TxtField( + hint: LocaleKeys.enterOldPassword.tr(), onChanged: (v) => currentPasswor = v, ), 12.height, - TextFormField( - decoration: InputDecoration( - hintText: LocaleKeys.enterNewPassword.tr(), - hintStyle: TextStyle(color: Colors.grey), - border: OutlineInputBorder( - borderRadius: const BorderRadius.all( - const Radius.circular(5.0), - ), - ), - ), - obscureText: true, + TxtField( + hint: LocaleKeys.enterNewPassword.tr(), onChanged: (v) => newPassword = v, ), - 40.height, + 20.height, ShowFillButton( title: LocaleKeys.confirm.tr(), maxWidth: double.infinity, diff --git a/lib/pages/user/forget_password_method_page.dart b/lib/pages/user/forget_password_method_page.dart index c5c3a16..fd79a08 100644 --- a/lib/pages/user/forget_password_method_page.dart +++ b/lib/pages/user/forget_password_method_page.dart @@ -1,6 +1,3 @@ - - - import 'dart:convert'; import 'package:car_provider_app/api/client/user_api_client.dart'; import 'package:car_provider_app/classes/utils.dart'; @@ -36,7 +33,7 @@ class _ForgetPasswordMethodPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: appBar(context,title: LocaleKeys.forgetPassword.tr()), + appBar: appBar(context, title: LocaleKeys.forgetPassword.tr()), body: Container( width: double.infinity, height: double.infinity, @@ -53,8 +50,8 @@ class _ForgetPasswordMethodPageState extends State { otpType = 1; forgetPasswordOTPMethod(context); }, - title: 'With SMS', - icon: icons + "ic_sms.png", + title: LocaleKeys.SMS.tr(), + icon: icons + "ic_sms.svg", ), ), 20.width, @@ -64,8 +61,8 @@ class _ForgetPasswordMethodPageState extends State { otpType = 1; forgetPasswordOTPMethod(context); }, - title: 'With Whatsapp', - icon: icons + "ic_whatsapp.png", + title: LocaleKeys.whatsapp.tr(), + icon: icons + "ic_whatsapp.svg", ), ), ], @@ -82,7 +79,7 @@ class _ForgetPasswordMethodPageState extends State { onClick: (String code) async { pop(context); Utils.showLoading(context); - Response res = await UserApiClent().ForgetPasswordOTPCompare(widget.userToken?? "", code); + Response res = await UserApiClent().ForgetPasswordOTPCompare(widget.userToken ?? "", code); Utils.hideLoading(context); PasswordOTPCompare otpCompare = PasswordOTPCompare.fromJson(jsonDecode(res.body)); if (otpCompare.messageStatus == 1) { diff --git a/lib/pages/user/login_with_password_page.dart b/lib/pages/user/login_with_password_page.dart index 5fb56fa..bc4fbba 100644 --- a/lib/pages/user/login_with_password_page.dart +++ b/lib/pages/user/login_with_password_page.dart @@ -114,7 +114,7 @@ class _LoginWithPasswordState extends State { isFlatButton: true, isBold: false, fontSize: 14, - txtColor: Colors.blue, + txtColor: MyColors.darkPrimaryColor, onPressed: () { navigateWithName(context, AppRoutes.forgetPassword); },