logins y register responsivos
This commit is contained in:
@@ -6,17 +6,25 @@ import 'package:prosappco/src/components/column_padding.dart';
|
|||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/components/primary_btn.dart';
|
||||||
import 'package:prosappco/src/controllers/otp_controller.dart';
|
import 'package:prosappco/src/controllers/otp_controller.dart';
|
||||||
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
||||||
|
import 'package:responsive_builder/responsive_builder.dart';
|
||||||
|
|
||||||
class CodeValidationScreen extends StatelessWidget {
|
class CodeValidationScreen extends StatelessWidget {
|
||||||
CodeValidationScreen({super.key, this.phoneNumber});
|
CodeValidationScreen({super.key, this.phoneNumber});
|
||||||
String? phoneNumber;
|
String? phoneNumber;
|
||||||
|
var otp;
|
||||||
|
|
||||||
final controller = Get.put(OTPController());
|
final controller = Get.put(OTPController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var otp;
|
return ScreenTypeLayout.builder(
|
||||||
|
mobile: (BuildContext context) => _mobileView(context),
|
||||||
|
tablet: (BuildContext context) => _mobileView(context),
|
||||||
|
desktop: (BuildContext context) => _desktopView(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _mobileView(BuildContext context) {
|
||||||
return BottomSheetExpanded(
|
return BottomSheetExpanded(
|
||||||
horizontalPadding: 10,
|
horizontalPadding: 10,
|
||||||
children: [
|
children: [
|
||||||
@@ -121,4 +129,146 @@ class CodeValidationScreen extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _desktopView(BuildContext context) {
|
||||||
|
double height = MediaQuery.of(context).size.height;
|
||||||
|
double width = MediaQuery.of(context).size.width;
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
|
body: SizedBox(
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: height,
|
||||||
|
child: const Center(
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: width * 0.07),
|
||||||
|
color: Colors.white,
|
||||||
|
height: height,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(width: width * 0.01),
|
||||||
|
const Text(
|
||||||
|
'Validar código',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
ColumnPadding(
|
||||||
|
alineacion: MainAxisAlignment.start,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 25),
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Text(
|
||||||
|
'Numero de celular',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TextField(
|
||||||
|
onChanged: (value) {
|
||||||
|
phoneNumber = value;
|
||||||
|
},
|
||||||
|
controller: TextEditingController(
|
||||||
|
text: phoneNumber ?? ''),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText: '',
|
||||||
|
suffixIcon: Icon(Icons.edit),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: const Text('Reenviar código'),
|
||||||
|
onPressed: () {
|
||||||
|
if (phoneNumber!.isNotEmpty) {
|
||||||
|
PhoneAuthController.instance
|
||||||
|
.phoneAuthentication(
|
||||||
|
phoneNumber!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Text(
|
||||||
|
'Codigo',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
OtpTextField(
|
||||||
|
numberOfFields: 6,
|
||||||
|
focusedBorderColor: Colors.blue,
|
||||||
|
fillColor: Colors.black.withOpacity(0.1),
|
||||||
|
filled: true,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
onSubmit: (code) {
|
||||||
|
otp = code;
|
||||||
|
OTPController.instance.verifyOTP(otp);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 40),
|
||||||
|
PrimaryButtom(
|
||||||
|
onPressed: () {
|
||||||
|
OTPController.instance.verifyOTP(otp);
|
||||||
|
},
|
||||||
|
label: 'Validar código',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+142
-144
@@ -162,165 +162,163 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
double height = MediaQuery.of(context).size.height;
|
double height = MediaQuery.of(context).size.height;
|
||||||
double width = MediaQuery.of(context).size.width;
|
double width = MediaQuery.of(context).size.width;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
body: SizedBox(
|
body: SizedBox(
|
||||||
height: height,
|
height: height,
|
||||||
width: width,
|
width: width,
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: height,
|
height: height,
|
||||||
child: const Center(
|
child: const Center(
|
||||||
child: Image(
|
child: Image(
|
||||||
image: AssetImage('images/logo_prosapp.png'),
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
child: Container(
|
Expanded(
|
||||||
padding: EdgeInsets.symmetric(horizontal: width * 0.1),
|
child: Container(
|
||||||
color: Colors.white,
|
padding: EdgeInsets.symmetric(horizontal: width * 0.1),
|
||||||
height: height,
|
color: Colors.white,
|
||||||
child: Column(
|
height: height,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
const SizedBox(
|
children: [
|
||||||
width: double.infinity,
|
const SizedBox(
|
||||||
child: Text(
|
width: double.infinity,
|
||||||
'Iniciar sesión',
|
child: Text(
|
||||||
style: TextStyle(
|
'Iniciar sesión',
|
||||||
color: Color(0xFF262626),
|
|
||||||
fontSize: 38.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
const SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: Text(
|
|
||||||
'Numero de celular',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.0,
|
|
||||||
color: Color(0xFF65676B),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Form(
|
|
||||||
key: _formKey,
|
|
||||||
child: IntlPhoneField(
|
|
||||||
controller: controller.phoneNo,
|
|
||||||
initialCountryCode: 'CO',
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
onChanged: (phoneNo) {
|
|
||||||
completePhoneNumber = phoneNo.completeNumber;
|
|
||||||
},
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
errorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Color.fromARGB(255, 184, 0, 0)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
fillColor: Color.fromARGB(255, 239, 239, 239),
|
|
||||||
filled: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
'Un código será enviado a este numero de celular.',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13.0,
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: Text(
|
||||||
|
'Numero de celular',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
color: Color(0xFF65676B),
|
color: Color(0xFF65676B),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
PrimaryButtom(
|
Form(
|
||||||
onPressed: () {
|
key: _formKey,
|
||||||
if (_formKey.currentState!.validate()) {
|
child: IntlPhoneField(
|
||||||
PhoneAuthController.instance.phoneAuthentication(
|
controller: controller.phoneNo,
|
||||||
completePhoneNumber.trim(),
|
initialCountryCode: 'CO',
|
||||||
);
|
keyboardType: TextInputType.number,
|
||||||
Get.to(
|
onChanged: (phoneNo) {
|
||||||
() => CodeValidationScreen(
|
completePhoneNumber = phoneNo.completeNumber;
|
||||||
phoneNumber: completePhoneNumber.trim(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
label: 'Enviar código',
|
decoration: const InputDecoration(
|
||||||
),
|
border: OutlineInputBorder(
|
||||||
const SizedBox(height: 20),
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
GestureDetector(
|
borderRadius: BorderRadius.all(
|
||||||
onTap: () {
|
Radius.circular(50),
|
||||||
Navigator.pushNamed(context, '/login');
|
)),
|
||||||
},
|
errorBorder: OutlineInputBorder(
|
||||||
child: const Text(
|
borderSide: BorderSide(
|
||||||
'Entrar con correo electronico',
|
color: Color.fromARGB(255, 184, 0, 0)),
|
||||||
style: TextStyle(
|
borderRadius: BorderRadius.all(
|
||||||
fontSize: 15.0, color: Color(0xFF65676B),
|
Radius.circular(50),
|
||||||
decoration: TextDecoration.underline, // Subrayado
|
)),
|
||||||
),
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
),
|
||||||
RichText(
|
const Text(
|
||||||
text: TextSpan(
|
'Un código será enviado a este numero de celular.',
|
||||||
style: const TextStyle(
|
textAlign: TextAlign.center,
|
||||||
fontSize: 16.0,
|
style: TextStyle(
|
||||||
color: Color(0xFF65676B),
|
fontSize: 13.0,
|
||||||
fontFamily: 'Poppins',
|
color: Color(0xFF65676B),
|
||||||
),
|
),
|
||||||
children: [
|
),
|
||||||
const TextSpan(text: 'No estas registrado? '),
|
const SizedBox(height: 20),
|
||||||
WidgetSpan(
|
PrimaryButtom(
|
||||||
child: GestureDetector(
|
onPressed: () {
|
||||||
onTap: () {
|
if (_formKey.currentState!.validate()) {
|
||||||
Navigator.pushNamed(context, '/register');
|
PhoneAuthController.instance.phoneAuthentication(
|
||||||
},
|
completePhoneNumber.trim(),
|
||||||
child: const Text(
|
);
|
||||||
'Registrarse',
|
Get.to(
|
||||||
style: TextStyle(
|
() => CodeValidationScreen(
|
||||||
fontSize: 16.0,
|
phoneNumber: completePhoneNumber.trim(),
|
||||||
color: Color(0xFF2BA4EC),
|
),
|
||||||
fontWeight: FontWeight.w600,
|
);
|
||||||
),
|
}
|
||||||
|
},
|
||||||
|
label: 'Enviar código',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushNamed(context, '/login');
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Entrar con correo electronico',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15.0, color: Color(0xFF65676B),
|
||||||
|
decoration: TextDecoration.underline, // Subrayado
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(text: 'No estas registrado? '),
|
||||||
|
WidgetSpan(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushNamed(context, '/register');
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Registrarse',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+560
-251
@@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/components/primary_btn.dart';
|
||||||
import 'package:prosappco/src/controllers/login_email_controller.dart';
|
import 'package:prosappco/src/controllers/login_email_controller.dart';
|
||||||
|
import 'package:responsive_builder/responsive_builder.dart';
|
||||||
|
|
||||||
class LoginEmailScreen extends StatefulWidget {
|
class LoginEmailScreen extends StatefulWidget {
|
||||||
const LoginEmailScreen({super.key});
|
const LoginEmailScreen({super.key});
|
||||||
@@ -19,283 +20,591 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return ScreenTypeLayout.builder(
|
||||||
|
mobile: (BuildContext context) => _mobileView(context),
|
||||||
|
tablet: (BuildContext context) => _mobileView(context),
|
||||||
|
desktop: (BuildContext context) => _desktopView(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _mobileView(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
reverse: true,
|
reverse: true,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(top: 130),
|
margin: const EdgeInsets.only(top: 130),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 700,
|
height: 700,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
topRight: Radius.circular(50),
|
topRight: Radius.circular(50),
|
||||||
topLeft: Radius.circular(50))),
|
topLeft: Radius.circular(50))),
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.only(top: 20, left: 30),
|
|
||||||
child: const Image(
|
|
||||||
image: AssetImage('images/logo_prosapp.png'),
|
|
||||||
width: 180,
|
|
||||||
height: 100,
|
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
Container(
|
margin: const EdgeInsets.only(top: 20, left: 30),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
child: const Image(
|
||||||
margin: const EdgeInsets.only(
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
top: 125,
|
width: 180,
|
||||||
left: 25,
|
height: 100,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
Container(
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.arrow_back,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
'Iniciar sesión',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF262626),
|
|
||||||
fontSize: 38.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Form(
|
|
||||||
key: _formKey,
|
|
||||||
child: Container(
|
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||||
margin: const EdgeInsets.only(top: 210, left: 50, right: 50),
|
margin: const EdgeInsets.only(
|
||||||
child: Column(children: [
|
top: 125,
|
||||||
Padding(
|
left: 25,
|
||||||
padding: const EdgeInsets.only(bottom: 20),
|
),
|
||||||
child: ElevatedButton(
|
child: Row(
|
||||||
onPressed: () async {
|
children: <Widget>[
|
||||||
await AuthenticationRepository.instance
|
IconButton(
|
||||||
.signInWithGoogle();
|
icon: const Icon(
|
||||||
},
|
Icons.arrow_back,
|
||||||
style: ElevatedButton.styleFrom(
|
size: 30,
|
||||||
backgroundColor: const Color(0xFF2BA4EC),
|
),
|
||||||
shape: RoundedRectangleBorder(
|
onPressed: () {
|
||||||
borderRadius: BorderRadius.circular(50),
|
Navigator.pop(context);
|
||||||
),
|
},
|
||||||
elevation: 0,
|
|
||||||
minimumSize: const Size(230, 60),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: const [
|
|
||||||
Text(
|
|
||||||
'Entrar con Google ',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 5),
|
|
||||||
FaIcon(FontAwesomeIcons.google),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5),
|
|
||||||
child: Row(
|
|
||||||
children: const [
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: Colors.black38,
|
|
||||||
thickness: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
child: Text("ó"),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: Colors.black38,
|
|
||||||
thickness: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const Text(
|
||||||
const Padding(
|
'Iniciar sesión',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||||
|
margin: const EdgeInsets.only(top: 210, left: 50, right: 50),
|
||||||
|
child: Column(children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await AuthenticationRepository.instance
|
||||||
|
.signInWithGoogle();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
minimumSize: const Size(230, 60),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Text(
|
||||||
|
'Entrar con Google ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
FaIcon(FontAwesomeIcons.google),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||||
|
child: Row(
|
||||||
|
children: const [
|
||||||
|
Expanded(
|
||||||
|
child: Divider(
|
||||||
|
color: Colors.black38,
|
||||||
|
thickness: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Text("ó"),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Divider(
|
||||||
|
color: Colors.black38,
|
||||||
|
thickness: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topLeft,
|
alignment: Alignment.topLeft,
|
||||||
child: Text('Email',
|
child: Text('Email',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18.0, color: Color(0xFF65676B))),
|
fontSize: 18.0, color: Color(0xFF65676B))),
|
||||||
)),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 20),
|
|
||||||
child: TextFormField(
|
|
||||||
controller: controller.email,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Por favor ingrese un email';
|
|
||||||
}
|
|
||||||
final RegExp emailRegExp =
|
|
||||||
RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
|
||||||
if (!emailRegExp.hasMatch(value)) {
|
|
||||||
return 'Por favor ingrese un email válido';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
errorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Color.fromARGB(255, 184, 0, 0)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
hintText: 'Hello@gmail.com',
|
|
||||||
fillColor: Color.fromARGB(255, 239, 239, 239),
|
|
||||||
filled: true,
|
|
||||||
prefixIcon: Icon(Icons.email_outlined),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
const Padding(
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
child: TextFormField(
|
||||||
child: Align(
|
controller: controller.email,
|
||||||
alignment: Alignment.topLeft,
|
validator: (String? value) {
|
||||||
child: Text('Password',
|
if (value == null || value.isEmpty) {
|
||||||
style: TextStyle(
|
return 'Por favor ingrese un email';
|
||||||
fontSize: 18.0, color: Color(0xFF65676B))),
|
}
|
||||||
)),
|
final RegExp emailRegExp =
|
||||||
Padding(
|
RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||||
padding: const EdgeInsets.only(bottom: 50),
|
if (!emailRegExp.hasMatch(value)) {
|
||||||
child: TextFormField(
|
return 'Por favor ingrese un email válido';
|
||||||
controller: controller.password,
|
}
|
||||||
obscureText: _obscureText,
|
return null;
|
||||||
validator: (value) {
|
},
|
||||||
if (value == null || value.isEmpty) {
|
decoration: const InputDecoration(
|
||||||
return 'Por favor ingrese una contraseña';
|
border: OutlineInputBorder(
|
||||||
}
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
return null;
|
borderRadius: BorderRadius.all(
|
||||||
},
|
Radius.circular(50),
|
||||||
decoration: InputDecoration(
|
)),
|
||||||
enabledBorder: const OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
borderRadius: BorderRadius.all(
|
borderRadius: BorderRadius.all(
|
||||||
Radius.circular(50),
|
Radius.circular(50),
|
||||||
)),
|
)),
|
||||||
focusedBorder: const OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
borderRadius: BorderRadius.all(
|
borderRadius: BorderRadius.all(
|
||||||
Radius.circular(50),
|
Radius.circular(50),
|
||||||
)),
|
)),
|
||||||
border: const OutlineInputBorder(
|
errorBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
borderSide: BorderSide(
|
||||||
borderRadius: BorderRadius.all(
|
color: Color.fromARGB(255, 184, 0, 0)),
|
||||||
Radius.circular(50),
|
borderRadius: BorderRadius.all(
|
||||||
)),
|
Radius.circular(50),
|
||||||
errorBorder: const OutlineInputBorder(
|
)),
|
||||||
borderSide: BorderSide(
|
hintText: 'Hello@gmail.com',
|
||||||
color: Color.fromARGB(255, 184, 0, 0)),
|
fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||||
borderRadius: BorderRadius.all(
|
filled: true,
|
||||||
Radius.circular(50),
|
prefixIcon: Icon(Icons.email_outlined),
|
||||||
)),
|
|
||||||
hintText: 'Contraseña',
|
|
||||||
fillColor: const Color.fromARGB(255, 239, 239, 239),
|
|
||||||
filled: true,
|
|
||||||
prefixIcon: const Icon(Icons.lock_outline),
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
_obscureText
|
|
||||||
? Icons.visibility
|
|
||||||
: Icons.visibility_off,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_obscureText = !_obscureText;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const Padding(
|
||||||
Padding(
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
padding: const EdgeInsets.only(bottom: 40),
|
child: Align(
|
||||||
child: Center(
|
alignment: Alignment.topLeft,
|
||||||
child: PrimaryButtom(
|
child: Text('Password',
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
LoginEmailController.instance.loginUser(
|
|
||||||
controller.email.text.trim(),
|
|
||||||
controller.password.text.trim(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
label: 'Iniciar'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Color(0xFF65676B),
|
|
||||||
fontFamily: 'Poppins',
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
const TextSpan(text: 'No estas registrado? '),
|
|
||||||
WidgetSpan(
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pushReplacementNamed(
|
|
||||||
context, '/register');
|
|
||||||
},
|
|
||||||
child: const Text(
|
|
||||||
'Registrarse',
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16.0,
|
fontSize: 18.0, color: Color(0xFF65676B))),
|
||||||
color: Color(0xFF2BA4EC),
|
)),
|
||||||
fontWeight: FontWeight.w600,
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 50),
|
||||||
|
child: TextFormField(
|
||||||
|
controller: controller.password,
|
||||||
|
obscureText: _obscureText,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Por favor ingrese una contraseña';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
errorBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color.fromARGB(255, 184, 0, 0)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
hintText: 'Contraseña',
|
||||||
|
fillColor: const Color.fromARGB(255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
|
prefixIcon: const Icon(Icons.lock_outline),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
_obscureText
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_obscureText = !_obscureText;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 40),
|
||||||
|
child: Center(
|
||||||
|
child: PrimaryButtom(
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
LoginEmailController.instance.loginUser(
|
||||||
|
controller.email.text.trim(),
|
||||||
|
controller.password.text.trim(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label: 'Iniciar'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(text: 'No estas registrado? '),
|
||||||
|
WidgetSpan(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context, '/register');
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Registrarse',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _desktopView(BuildContext context) {
|
||||||
|
double height = MediaQuery.of(context).size.height;
|
||||||
|
double width = MediaQuery.of(context).size.width;
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
|
body: SizedBox(
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: height,
|
||||||
|
child: const Center(
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: height,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: width * 0.07),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(width: width * 0.01),
|
||||||
|
const Text(
|
||||||
|
'Iniciar sesión',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 0, vertical: 20),
|
||||||
|
child: Column(children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await AuthenticationRepository.instance
|
||||||
|
.signInWithGoogle();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
minimumSize: const Size(230, 60),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Text(
|
||||||
|
'Entrar con Google ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
FaIcon(FontAwesomeIcons.google),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 5),
|
||||||
|
child: Row(
|
||||||
|
children: const [
|
||||||
|
Expanded(
|
||||||
|
child: Divider(
|
||||||
|
color: Colors.black38,
|
||||||
|
thickness: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Text("ó"),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Divider(
|
||||||
|
color: Colors.black38,
|
||||||
|
thickness: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Text('Email',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Color(0xFF65676B))),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
|
child: TextFormField(
|
||||||
|
controller: controller.email,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Por favor ingrese un email';
|
||||||
|
}
|
||||||
|
final RegExp emailRegExp = RegExp(
|
||||||
|
r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||||
|
if (!emailRegExp.hasMatch(value)) {
|
||||||
|
return 'Por favor ingrese un email válido';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color:
|
||||||
|
Color.fromARGB(255, 184, 0, 0)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
hintText: 'Hello@gmail.com',
|
||||||
|
fillColor: Color.fromARGB(255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
|
prefixIcon: Icon(Icons.email_outlined),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Text('Password',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Color(0xFF65676B))),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 50),
|
||||||
|
child: TextFormField(
|
||||||
|
controller: controller.password,
|
||||||
|
obscureText: _obscureText,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Por favor ingrese una contraseña';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide:
|
||||||
|
BorderSide(color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
errorBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color:
|
||||||
|
Color.fromARGB(255, 184, 0, 0)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
hintText: 'Contraseña',
|
||||||
|
fillColor:
|
||||||
|
const Color.fromARGB(255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
|
prefixIcon: const Icon(Icons.lock_outline),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
_obscureText
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_obscureText = !_obscureText;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 40),
|
||||||
|
child: Center(
|
||||||
|
child: PrimaryButtom(
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
LoginEmailController.instance.loginUser(
|
||||||
|
controller.email.text.trim(),
|
||||||
|
controller.password.text.trim(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label: 'Iniciar'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(text: 'No estas registrado? '),
|
||||||
|
WidgetSpan(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context, '/register');
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Registrarse',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
)
|
),
|
||||||
]),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+614
-281
@@ -8,6 +8,7 @@ import 'package:prosappco/src/components/primary_btn.dart';
|
|||||||
import 'package:prosappco/src/controllers/register_controller.dart';
|
import 'package:prosappco/src/controllers/register_controller.dart';
|
||||||
import 'package:prosappco/src/screens/login.dart';
|
import 'package:prosappco/src/screens/login.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:responsive_builder/responsive_builder.dart';
|
||||||
|
|
||||||
class RegisterScreen extends StatefulWidget {
|
class RegisterScreen extends StatefulWidget {
|
||||||
const RegisterScreen({super.key});
|
const RegisterScreen({super.key});
|
||||||
@@ -23,302 +24,634 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return ScreenTypeLayout.builder(
|
||||||
|
mobile: (BuildContext context) => _mobileView(context),
|
||||||
|
tablet: (BuildContext context) => _mobileView(context),
|
||||||
|
desktop: (BuildContext context) => _desktopView(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _mobileView(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
reverse: true,
|
reverse: true,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(top: 130),
|
margin: const EdgeInsets.only(top: 130),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 700,
|
height: 700,
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.only(
|
borderRadius: BorderRadius.only(
|
||||||
topRight: Radius.circular(50),
|
topRight: Radius.circular(50),
|
||||||
topLeft: Radius.circular(50))),
|
topLeft: Radius.circular(50))),
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: const EdgeInsets.only(top: 20, left: 30),
|
|
||||||
child: const Image(
|
|
||||||
image: AssetImage('images/logo_prosapp.png'),
|
|
||||||
width: 180,
|
|
||||||
height: 100,
|
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
Container(
|
margin: const EdgeInsets.only(top: 20, left: 30),
|
||||||
padding:
|
child: const Image(
|
||||||
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
margin: const EdgeInsets.only(
|
width: 180,
|
||||||
top: 125,
|
height: 100,
|
||||||
left: 25,
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
Container(
|
||||||
children: <Widget>[
|
padding:
|
||||||
IconButton(
|
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||||
icon: const Icon(
|
margin: const EdgeInsets.only(
|
||||||
Icons.arrow_back,
|
top: 125,
|
||||||
size: 30,
|
left: 25,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
child: Row(
|
||||||
Navigator.pop(context);
|
children: <Widget>[
|
||||||
},
|
IconButton(
|
||||||
),
|
icon: const Icon(
|
||||||
const Text(
|
Icons.arrow_back,
|
||||||
'Registro',
|
size: 30,
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF262626),
|
|
||||||
fontSize: 38.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
|
||||||
margin: const EdgeInsets.only(top: 200, left: 50, right: 50),
|
|
||||||
child: Column(children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 20),
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: () async {
|
|
||||||
await AuthenticationRepository.instance
|
|
||||||
.signInWithGoogle();
|
|
||||||
},
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: const Color(0xFF2BA4EC),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(50),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
minimumSize: const Size(230, 60),
|
|
||||||
),
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
'Registro',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||||
|
margin: const EdgeInsets.only(top: 200, left: 50, right: 50),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await AuthenticationRepository.instance
|
||||||
|
.signInWithGoogle();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
minimumSize: const Size(230, 60),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Text(
|
||||||
|
'Entrar con Google ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
FaIcon(FontAwesomeIcons.google),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: const <Widget>[
|
||||||
children: const [
|
Expanded(
|
||||||
Text(
|
child: Divider(
|
||||||
'Entrar con Google ',
|
color: Colors.black38,
|
||||||
style: TextStyle(
|
thickness: 1,
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 5),
|
Padding(
|
||||||
FaIcon(FontAwesomeIcons.google),
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
],
|
child: Text("ó"),
|
||||||
)),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 0),
|
|
||||||
child: Row(
|
|
||||||
children: const <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: Colors.black38,
|
|
||||||
thickness: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
child: Text("ó"),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: Colors.black38,
|
|
||||||
thickness: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Form(
|
|
||||||
key: _formKey,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
const Padding(
|
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.topLeft,
|
|
||||||
child: Text('Email',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.0,
|
|
||||||
color: Color(0xFF65676B))),
|
|
||||||
)),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 18),
|
|
||||||
child: TextFormField(
|
|
||||||
controller: controller.email,
|
|
||||||
validator: (String? value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Por favor ingrese un email';
|
|
||||||
}
|
|
||||||
final RegExp emailRegExp =
|
|
||||||
RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
|
||||||
if (!emailRegExp.hasMatch(value)) {
|
|
||||||
return 'Por favor ingrese un email válido';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
errorBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color:
|
|
||||||
Color.fromARGB(255, 184, 0, 0)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
hintText: 'Hello@gmail.com',
|
|
||||||
fillColor: Color.fromARGB(255, 239, 239, 239),
|
|
||||||
filled: true,
|
|
||||||
prefixIcon: Icon(Icons.email_outlined)),
|
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
const Padding(
|
child: Divider(
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
color: Colors.black38,
|
||||||
child: Align(
|
thickness: 1,
|
||||||
alignment: Alignment.topLeft,
|
),
|
||||||
child: Text('Password',
|
),
|
||||||
style: TextStyle(
|
],
|
||||||
fontSize: 18.0,
|
),
|
||||||
color: Color(0xFF65676B))),
|
),
|
||||||
)),
|
Form(
|
||||||
Padding(
|
key: _formKey,
|
||||||
padding: const EdgeInsets.only(bottom: 25),
|
child: Column(
|
||||||
child: TextFormField(
|
children: [
|
||||||
controller: controller.password,
|
const Padding(
|
||||||
obscureText: _obscureText,
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
validator: (value) {
|
child: Align(
|
||||||
if (value == null || value.isEmpty) {
|
alignment: Alignment.topLeft,
|
||||||
return 'Por favor ingrese una contraseña';
|
child: Text('Email',
|
||||||
}
|
style: TextStyle(
|
||||||
if (value.length <= 6) {
|
fontSize: 18.0,
|
||||||
return 'Contraseña muy corta';
|
color: Color(0xFF65676B))),
|
||||||
}
|
)),
|
||||||
return null;
|
Padding(
|
||||||
},
|
padding: const EdgeInsets.only(bottom: 18),
|
||||||
decoration: InputDecoration(
|
child: TextFormField(
|
||||||
errorBorder: const OutlineInputBorder(
|
controller: controller.email,
|
||||||
borderSide: BorderSide(
|
validator: (String? value) {
|
||||||
color: Color.fromARGB(255, 184, 0, 0)),
|
if (value == null || value.isEmpty) {
|
||||||
borderRadius: BorderRadius.all(
|
return 'Por favor ingrese un email';
|
||||||
Radius.circular(50),
|
}
|
||||||
)),
|
final RegExp emailRegExp = RegExp(
|
||||||
enabledBorder: const OutlineInputBorder(
|
r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||||
borderSide:
|
if (!emailRegExp.hasMatch(value)) {
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
return 'Por favor ingrese un email válido';
|
||||||
borderRadius: BorderRadius.all(
|
}
|
||||||
Radius.circular(50),
|
return null;
|
||||||
)),
|
|
||||||
border: const OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
focusedBorder: const OutlineInputBorder(
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: Color(0xFFECECEC)),
|
|
||||||
borderRadius: BorderRadius.all(
|
|
||||||
Radius.circular(50),
|
|
||||||
)),
|
|
||||||
hintText: 'Contraseña',
|
|
||||||
fillColor:
|
|
||||||
const Color.fromARGB(255, 239, 239, 239),
|
|
||||||
filled: true,
|
|
||||||
prefixIcon: const Icon(Icons.lock_outline),
|
|
||||||
suffixIcon: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
_obscureText
|
|
||||||
? Icons.visibility
|
|
||||||
: Icons.visibility_off,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_obscureText = !_obscureText;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color.fromARGB(
|
||||||
|
255, 184, 0, 0)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
hintText: 'Hello@gmail.com',
|
||||||
|
fillColor:
|
||||||
|
Color.fromARGB(255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
|
prefixIcon: Icon(Icons.email_outlined)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Text('Password',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Color(0xFF65676B))),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 25),
|
||||||
|
child: TextFormField(
|
||||||
|
controller: controller.password,
|
||||||
|
obscureText: _obscureText,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Por favor ingrese una contraseña';
|
||||||
|
}
|
||||||
|
if (value.length <= 6) {
|
||||||
|
return 'Contraseña muy corta';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
errorBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color:
|
||||||
|
Color.fromARGB(255, 184, 0, 0)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
enabledBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
hintText: 'Contraseña',
|
||||||
|
fillColor: const Color.fromARGB(
|
||||||
|
255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
|
prefixIcon: const Icon(Icons.lock_outline),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
_obscureText
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_obscureText = !_obscureText;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 25),
|
||||||
|
child: Center(
|
||||||
|
child: PrimaryButtom(
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
RegisterController.instance.registerUser(
|
||||||
|
controller.email.text.trim(),
|
||||||
|
controller.password.text.trim(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label: 'Registrarme',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(text: 'Ya estas registrado? '),
|
||||||
|
WidgetSpan(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context, '/login');
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Iniciar Sesión',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
|
||||||
)),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 25),
|
|
||||||
child: Center(
|
|
||||||
child: PrimaryButtom(
|
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
RegisterController.instance.registerUser(
|
|
||||||
controller.email.text.trim(),
|
|
||||||
controller.password.text.trim(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
label: 'Registrarme',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Color(0xFF65676B),
|
|
||||||
fontFamily: 'Poppins',
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
const TextSpan(text: 'Ya estas registrado? '),
|
|
||||||
WidgetSpan(
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pushReplacementNamed(context, '/login');
|
|
||||||
},
|
|
||||||
child: const Text(
|
|
||||||
'Iniciar Sesión',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Color(0xFF2BA4EC),
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
)
|
),
|
||||||
]),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _desktopView(BuildContext context) {
|
||||||
|
double height = MediaQuery.of(context).size.height;
|
||||||
|
double width = MediaQuery.of(context).size.width;
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
|
body: SizedBox(
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: height,
|
||||||
|
child: const Center(
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
height: height,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: width * 0.07),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 0, vertical: 20),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(width: width * 0.01),
|
||||||
|
const Text(
|
||||||
|
'Registro',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 0, vertical: 20),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await AuthenticationRepository.instance
|
||||||
|
.signInWithGoogle();
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
minimumSize: const Size(230, 60),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Text(
|
||||||
|
'Entrar con Google ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
FaIcon(FontAwesomeIcons.google),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 0),
|
||||||
|
child: Row(
|
||||||
|
children: const <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Divider(
|
||||||
|
color: Colors.black38,
|
||||||
|
thickness: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: Text("ó"),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Divider(
|
||||||
|
color: Colors.black38,
|
||||||
|
thickness: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Text('Email',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Color(0xFF65676B))),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(bottom: 18),
|
||||||
|
child: TextFormField(
|
||||||
|
controller: controller.email,
|
||||||
|
validator: (String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Por favor ingrese un email';
|
||||||
|
}
|
||||||
|
final RegExp emailRegExp = RegExp(
|
||||||
|
r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||||
|
if (!emailRegExp.hasMatch(value)) {
|
||||||
|
return 'Por favor ingrese un email válido';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
errorBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color.fromARGB(
|
||||||
|
255, 184, 0, 0)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
hintText: 'Hello@gmail.com',
|
||||||
|
fillColor: Color.fromARGB(
|
||||||
|
255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
|
prefixIcon:
|
||||||
|
Icon(Icons.email_outlined)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Text('Password',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0,
|
||||||
|
color: Color(0xFF65676B))),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(bottom: 25),
|
||||||
|
child: TextFormField(
|
||||||
|
controller: controller.password,
|
||||||
|
obscureText: _obscureText,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Por favor ingrese una contraseña';
|
||||||
|
}
|
||||||
|
if (value.length <= 6) {
|
||||||
|
return 'Contraseña muy corta';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
errorBorder: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color.fromARGB(
|
||||||
|
255, 184, 0, 0)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
enabledBorder:
|
||||||
|
const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
focusedBorder:
|
||||||
|
const OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Color(0xFFECECEC)),
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
)),
|
||||||
|
hintText: 'Contraseña',
|
||||||
|
fillColor: const Color.fromARGB(
|
||||||
|
255, 239, 239, 239),
|
||||||
|
filled: true,
|
||||||
|
prefixIcon:
|
||||||
|
const Icon(Icons.lock_outline),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
_obscureText
|
||||||
|
? Icons.visibility
|
||||||
|
: Icons.visibility_off,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_obscureText = !_obscureText;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 25),
|
||||||
|
child: Center(
|
||||||
|
child: PrimaryButtom(
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
RegisterController.instance.registerUser(
|
||||||
|
controller.email.text.trim(),
|
||||||
|
controller.password.text.trim(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label: 'Registrarme',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
fontFamily: 'Poppins',
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(text: 'Ya estas registrado? '),
|
||||||
|
WidgetSpan(
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pushReplacementNamed(
|
||||||
|
context, '/login');
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Iniciar Sesión',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user