|
|
|
|
@ -8,11 +8,14 @@ import 'package:tangheem/app_state/app_state.dart';
|
|
|
|
|
import 'package:tangheem/classes/colors.dart';
|
|
|
|
|
import 'package:tangheem/classes/consts.dart';
|
|
|
|
|
import 'package:tangheem/classes/utils.dart';
|
|
|
|
|
import 'package:tangheem/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:tangheem/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:tangheem/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:tangheem/models/authentication_user_model.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/contact_us_screen.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/forgot_password_screen.dart';
|
|
|
|
|
import 'package:tangheem/ui/screens/registration_screen.dart';
|
|
|
|
|
import 'package:tangheem/widgets/common_textfield_widget.dart';
|
|
|
|
|
import 'package:tangheem/widgets/login_textfield_widget.dart';
|
|
|
|
|
|
|
|
|
|
class LoginScreen extends StatefulWidget {
|
|
|
|
|
static const String routeName = "/login";
|
|
|
|
|
@ -82,133 +85,117 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
backgroundColor: ColorConsts.secondaryWhite,
|
|
|
|
|
backgroundColor: ColorConsts.darkText,
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: Directionality(
|
|
|
|
|
textDirection: TextDirection.rtl,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
padding: EdgeInsets.all(21.0),
|
|
|
|
|
padding: EdgeInsets.only(top: 140, bottom: 50, left: 40, right: 40),
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8.0), color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 24, bottom: 24),
|
|
|
|
|
child: SvgPicture.asset("assets/logos/tangheem_logo.svg", width: 100, height: 100),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"تسجيل الدخول",
|
|
|
|
|
style: TextStyle(fontSize: 22, color: ColorConsts.primaryBlue),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 16),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.all(32.0),
|
|
|
|
|
color: ColorConsts.primaryBlue,
|
|
|
|
|
child: Column(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset("assets/icons/new/Tangeem-logo-W.png", width: 136, height: 74),
|
|
|
|
|
50.height,
|
|
|
|
|
"تسجيل الدخول".toText(18),
|
|
|
|
|
32.height,
|
|
|
|
|
LoginTextFieldWidget(hint: "البريد الإلكتروني", controller: _emailController, iconData: Icons.email_rounded),
|
|
|
|
|
20.height,
|
|
|
|
|
LoginTextFieldWidget(hint: "كلمة المرور", controller: _passwordController, iconData: Icons.lock_rounded, isPassword: true),
|
|
|
|
|
20.height,
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
CommonTextFieldWidget(hint: "البريد الإلكتروني", controller: _emailController, prefixIcon: "assets/icons/email.svg"),
|
|
|
|
|
SizedBox(height: 16),
|
|
|
|
|
CommonTextFieldWidget(hint: "كلمة المرور", controller: _passwordController, isPassword: true, prefixIcon: "assets/icons/password.svg"),
|
|
|
|
|
SizedBox(height: 16),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 50,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (_emailController.text.length < 1) {
|
|
|
|
|
Utils.showToast("يرجى إدخال البريد الإلكتروني");
|
|
|
|
|
return;
|
|
|
|
|
} else if (!_emailController.text.isValidEmail()) {
|
|
|
|
|
Utils.showToast("صيغة البريد الإلكتروني خاطئة");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (_passwordController.text.length < 1) {
|
|
|
|
|
Utils.showToast("يرجى إدخال كلمة المرور");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
performLogin(_emailController.text, _passwordController.text);
|
|
|
|
|
},
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
primary: Colors.white,
|
|
|
|
|
backgroundColor: ColorConsts.secondaryPink,
|
|
|
|
|
textStyle: TextStyle(fontSize: 16, fontFamily: "DroidKufi"),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(6.0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Text("تسجيل الدخول"),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"تذكرني",
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 8),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isRemember = !_isRemember;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: SvgPicture.asset(_isRemember ? "assets/icons/checkOn.svg" : "assets/icons/checkOff.svg", width: 16, height: 16))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pushNamed(context, ForgotPasswordScreen.routeName);
|
|
|
|
|
},
|
|
|
|
|
child: Text(
|
|
|
|
|
"نسيت كلمة المرور؟",
|
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isRemember = !_isRemember;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Icon(_isRemember ? Icons.check_box_rounded : Icons.check_box_outline_blank_rounded, color: ColorConsts.borderDark2Text, size: 17),
|
|
|
|
|
//child: SvgPicture.asset(_isAccept ? "assets/icons/checkOn.svg" : "assets/icons/checkOff.svg", width: 16, height: 16,color: ColorConsts.borderDarkText),
|
|
|
|
|
),
|
|
|
|
|
10.width,
|
|
|
|
|
"تذكرني".toText(14),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
"هل نسيت كلمة المرور؟".toText(14).onPress(() {
|
|
|
|
|
Navigator.pushNamed(context, ForgotPasswordScreen.routeName);
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
20.height,
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 50,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (_emailController.text.length < 1) {
|
|
|
|
|
Utils.showToast("يرجى إدخال البريد الإلكتروني");
|
|
|
|
|
return;
|
|
|
|
|
} else if (!_emailController.text.isValidEmail()) {
|
|
|
|
|
Utils.showToast("صيغة البريد الإلكتروني خاطئة");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (_passwordController.text.length < 1) {
|
|
|
|
|
Utils.showToast("يرجى إدخال كلمة المرور");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
performLogin(_emailController.text, _passwordController.text);
|
|
|
|
|
},
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
backgroundColor: ColorConsts.brownLightColor,
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
textStyle: TextStyle(fontSize: 18),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Text("تسجيل الدخول"),
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
),
|
|
|
|
|
20.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Divider(height: 1, color: Colors.white).expanded,
|
|
|
|
|
"ليس لديك حساب؟".toText(14).paddingOnly(left: 24, right: 24),
|
|
|
|
|
Divider(height: 1, color: Colors.white).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
20.height,
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 48,
|
|
|
|
|
child: TextButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pushNamed(context, RegistrationScreen.routeName);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 50,
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: ColorConsts.tertiaryPurple,
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
bottomLeft: Radius.circular(8),
|
|
|
|
|
bottomRight: Radius.circular(8),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
" حساب جديد",
|
|
|
|
|
style: TextStyle(fontSize: 14, color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
Icon(Icons.arrow_forward_ios, color: Colors.white, size: 12),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
|
textStyle: TextStyle(fontSize: 18),
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.white, width: 1)),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Text("إنشاء حساب جديد"),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
46.height,
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SvgPicture.asset("assets/icons/new/contact_us.svg", width: 26, height: 24, color: ColorConsts.greyC4Color),
|
|
|
|
|
8.height,
|
|
|
|
|
"اتصل بنا".toText(14, color: ColorConsts.greyC4Color),
|
|
|
|
|
],
|
|
|
|
|
).onPress(() {
|
|
|
|
|
Navigator.pushNamed(context, ContactUsScreen.routeName);
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|