update
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:animate_do/animate_do.dart';
|
||||||
|
|
||||||
class BottomSheetExpanded extends StatelessWidget {
|
class BottomSheetExpanded extends StatelessWidget {
|
||||||
final List<Widget> children;
|
final List<Widget> children;
|
||||||
@@ -12,6 +13,56 @@ class BottomSheetExpanded extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
colors: [
|
||||||
|
Color.fromARGB(255, 87, 210, 255),
|
||||||
|
Color.fromARGB(255, 137, 224, 255),
|
||||||
|
Color(0xFFD6F4FF),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
const SizedBox(height: 50),
|
||||||
|
Center(
|
||||||
|
child: FadeInLeft(
|
||||||
|
duration: const Duration(milliseconds: 1000),
|
||||||
|
child: const Image(
|
||||||
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Expanded(
|
||||||
|
child: FadeInUpBig(
|
||||||
|
duration: const Duration(milliseconds: 1000),
|
||||||
|
child: Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(60),
|
||||||
|
topRight: Radius.circular(60))),
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: horizontalPadding,
|
||||||
|
vertical: 15,
|
||||||
|
),
|
||||||
|
child: Column(children: children),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
backgroundColor: const Color(0xFFD6F4FF),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl_phone_field/intl_phone_field.dart';
|
import 'package:intl_phone_field/intl_phone_field.dart';
|
||||||
import 'package:prosappco/src/components/bottom_sheet.dart';
|
import 'package:prosappco/src/components/bottom_sheet.dart';
|
||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
import 'package:prosappco/src/presentation/widgets/shared/primary_button.dart';
|
||||||
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
import 'package:prosappco/src/controllers/phone_auth_controller.dart';
|
||||||
import 'package:prosappco/src/models/setting_model.dart';
|
import 'package:prosappco/src/models/setting_model.dart';
|
||||||
import 'package:prosappco/src/providers/user_provider.dart';
|
import 'package:prosappco/src/providers/user_provider.dart';
|
||||||
@@ -180,7 +180,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PrimaryButtom(
|
PrimaryButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
PhoneAuthController.instance.phoneAuthentication(
|
PhoneAuthController.instance.phoneAuthentication(
|
||||||
@@ -196,8 +196,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
.initUserProvider();
|
.initUserProvider();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
text: 'Enviar código',
|
||||||
isEnabled: _isChecked,
|
isEnabled: _isChecked,
|
||||||
label: 'Enviar código',
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
GestureBottom(clearPhoneNumber: _clearPhoneNumber),
|
GestureBottom(clearPhoneNumber: _clearPhoneNumber),
|
||||||
@@ -353,7 +353,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PrimaryButtom(
|
PrimaryButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
PhoneAuthController.instance.phoneAuthentication(
|
PhoneAuthController.instance.phoneAuthentication(
|
||||||
@@ -369,8 +369,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|||||||
.initUserProvider();
|
.initUserProvider();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
text: 'Enviar código',
|
||||||
isEnabled: _isChecked,
|
isEnabled: _isChecked,
|
||||||
label: 'Enviar código',
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
GestureBottom(clearPhoneNumber: _clearPhoneNumber),
|
GestureBottom(clearPhoneNumber: _clearPhoneNumber),
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
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/bottom_sheet.dart';
|
||||||
|
import 'package:prosappco/src/presentation/widgets/shared/primary_button.dart';
|
||||||
import 'package:prosappco/src/controllers/login_email_controller.dart';
|
import 'package:prosappco/src/controllers/login_email_controller.dart';
|
||||||
import 'package:prosappco/src/models/setting_model.dart';
|
import 'package:prosappco/src/models/setting_model.dart';
|
||||||
import 'package:prosappco/src/providers/user_provider.dart';
|
import 'package:prosappco/src/providers/user_provider.dart';
|
||||||
@@ -47,230 +48,197 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
|||||||
Widget _mobileView(BuildContext context) {
|
Widget _mobileView(BuildContext context) {
|
||||||
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
|
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
|
||||||
|
|
||||||
return SafeArea(
|
return BottomSheetExpanded(
|
||||||
child: Scaffold(
|
horizontalPadding: 10,
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
children: [
|
||||||
body: SingleChildScrollView(
|
Row(
|
||||||
reverse: true,
|
children: <Widget>[
|
||||||
child: Stack(
|
IconButton(
|
||||||
children: [
|
icon: const Icon(
|
||||||
Container(
|
Icons.arrow_back,
|
||||||
margin: const EdgeInsets.only(top: 130),
|
size: 30,
|
||||||
width: double.infinity,
|
|
||||||
height: 700,
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topRight: Radius.circular(50),
|
|
||||||
topLeft: Radius.circular(50))),
|
|
||||||
),
|
),
|
||||||
Container(
|
onPressed: () {
|
||||||
margin: const EdgeInsets.only(top: 20, left: 30),
|
Navigator.pop(context);
|
||||||
child: const Image(
|
},
|
||||||
image: AssetImage('images/logo_prosapp.png'),
|
),
|
||||||
width: 180,
|
const Text(
|
||||||
height: 100,
|
'Iniciar sesión',
|
||||||
),
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
Container(
|
textAlign: TextAlign.right,
|
||||||
padding:
|
),
|
||||||
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
],
|
||||||
margin: const EdgeInsets.only(
|
),
|
||||||
top: 125,
|
Padding(
|
||||||
left: 25,
|
padding: const EdgeInsets.symmetric(horizontal: 25),
|
||||||
),
|
child: Form(
|
||||||
child: Row(
|
key: _formKey,
|
||||||
children: <Widget>[
|
child: Container(
|
||||||
IconButton(
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||||
icon: const Icon(
|
child: Column(
|
||||||
Icons.arrow_back,
|
children: [
|
||||||
size: 30,
|
!isIOS && !kIsWeb && settings?.google == true
|
||||||
),
|
? Padding(
|
||||||
onPressed: () {
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
Navigator.pop(context);
|
child: ElevatedButton(
|
||||||
},
|
onPressed: () async {
|
||||||
),
|
await AuthenticationRepository.instance
|
||||||
const Text(
|
.signInWithGoogle()
|
||||||
'Iniciar sesión',
|
.then((value) => {
|
||||||
style: TextStyle(
|
Provider.of<UserProvider>(context,
|
||||||
color: Color(0xFF262626),
|
listen: false)
|
||||||
fontSize: 38.0,
|
.initUserProvider()
|
||||||
fontWeight: FontWeight.bold,
|
});
|
||||||
),
|
},
|
||||||
textAlign: TextAlign.right,
|
style: ElevatedButton.styleFrom(
|
||||||
),
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
],
|
shape: RoundedRectangleBorder(
|
||||||
),
|
borderRadius: BorderRadius.circular(50),
|
||||||
),
|
),
|
||||||
Form(
|
elevation: 0,
|
||||||
key: _formKey,
|
minimumSize: const Size(230, 60),
|
||||||
child: Container(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
|
||||||
margin: const EdgeInsets.only(top: 210, left: 50, right: 50),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
!isIOS && !kIsWeb && settings?.google == true
|
|
||||||
? Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 20),
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: () async {
|
|
||||||
await AuthenticationRepository.instance
|
|
||||||
.signInWithGoogle()
|
|
||||||
.then((value) => {
|
|
||||||
Provider.of<UserProvider>(context,
|
|
||||||
listen: false)
|
|
||||||
.initUserProvider()
|
|
||||||
});
|
|
||||||
},
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: const Color(0xFF2BA4EC),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(50),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
minimumSize: const Size(230, 60),
|
|
||||||
),
|
|
||||||
child: const Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Entra con Google ',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 5),
|
|
||||||
FaIcon(FontAwesomeIcons.google),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
!isIOS && !kIsWeb && settings?.google == true
|
|
||||||
? const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 5),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: Colors.black38,
|
|
||||||
thickness: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
child: Text("ó"),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Divider(
|
|
||||||
color: Colors.black38,
|
|
||||||
thickness: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
child: const Row(
|
||||||
: const SizedBox(),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
const Padding(
|
children: [
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
Text(
|
||||||
child: Align(
|
'Entra con Google ',
|
||||||
alignment: Alignment.topLeft,
|
style: TextStyle(
|
||||||
child: Text('Email',
|
color: Colors.white,
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 18.0, color: Color(0xFF65676B))),
|
fontSize: 18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
FormEmail(controller: controller),
|
SizedBox(width: 5),
|
||||||
const Padding(
|
FaIcon(FontAwesomeIcons.google),
|
||||||
padding: EdgeInsets.only(bottom: 5),
|
],
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.topLeft,
|
|
||||||
child: Text('Password',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.0, color: Color(0xFF65676B))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
controller: controller.password,
|
|
||||||
obscureText: _obscureText,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Por favor, ingresa 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)),
|
: const SizedBox(),
|
||||||
borderRadius: BorderRadius.all(
|
!isIOS && !kIsWeb && settings?.google == true
|
||||||
Radius.circular(50),
|
? const Padding(
|
||||||
)),
|
padding: EdgeInsets.symmetric(vertical: 5),
|
||||||
border: const OutlineInputBorder(
|
child: Row(
|
||||||
borderSide: BorderSide(color: Color(0xFFECECEC)),
|
children: [
|
||||||
borderRadius: BorderRadius.all(
|
Expanded(
|
||||||
Radius.circular(50),
|
child: Divider(
|
||||||
)),
|
color: Colors.black38,
|
||||||
errorBorder: const OutlineInputBorder(
|
thickness: 1,
|
||||||
borderSide: BorderSide(
|
),
|
||||||
color: Color.fromARGB(255, 184, 0, 0)),
|
),
|
||||||
borderRadius: BorderRadius.all(
|
Padding(
|
||||||
Radius.circular(50),
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
)),
|
child: Text("ó"),
|
||||||
hintText: 'Contraseña',
|
),
|
||||||
fillColor: const Color.fromARGB(255, 239, 239, 239),
|
Expanded(
|
||||||
filled: true,
|
child: Divider(
|
||||||
prefixIcon: const Icon(Icons.lock_outline),
|
color: Colors.black38,
|
||||||
suffixIcon: IconButton(
|
thickness: 1,
|
||||||
icon: Icon(
|
),
|
||||||
_obscureText
|
),
|
||||||
? Icons.visibility
|
],
|
||||||
: Icons.visibility_off,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_obscureText = !_obscureText;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
hintStyle: const TextStyle(
|
)
|
||||||
color: Colors.grey,
|
: const SizedBox(),
|
||||||
),
|
const Padding(
|
||||||
),
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
),
|
child: Align(
|
||||||
Padding(
|
alignment: Alignment.topLeft,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
child: Text('Email',
|
||||||
child: TextButton(
|
style: TextStyle(
|
||||||
onPressed: () {
|
fontSize: 18.0, color: Color(0xFF65676B))),
|
||||||
Navigator.pushNamed(context, '/resetpassword');
|
),
|
||||||
},
|
|
||||||
child: const Text(
|
|
||||||
'Olvidé la contraseña',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.blue,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
PaddingButtomBottom(
|
|
||||||
formKey: _formKey, controller: controller),
|
|
||||||
const RichTxtBottom()
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
FormEmail(controller: controller),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 5),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: Text('Password',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.0, color: Color(0xFF65676B))),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: controller.password,
|
||||||
|
obscureText: _obscureText,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return 'Por favor, ingresa 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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
hintStyle: const TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pushNamed(context, '/resetpassword');
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Olvidé la contraseña',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PaddingButtomBottom(
|
||||||
|
formKey: _formKey, controller: controller),
|
||||||
|
const RichTxtBottom()
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,22 +487,23 @@ class PaddingButtomBottom extends StatelessWidget {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 40),
|
padding: const EdgeInsets.only(bottom: 40),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: PrimaryButtom(
|
child: PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
LoginEmailController.instance
|
LoginEmailController.instance
|
||||||
.loginUser(
|
.loginUser(
|
||||||
controller.email.text.trim(),
|
controller.email.text.trim(),
|
||||||
controller.password.text.trim(),
|
controller.password.text.trim(),
|
||||||
)
|
)
|
||||||
.then((value) {
|
.then((value) {
|
||||||
Provider.of<UserProvider>(context, listen: false)
|
Provider.of<UserProvider>(context, listen: false)
|
||||||
.initUserProvider();
|
.initUserProvider();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
label: 'Iniciar',
|
text: 'Iniciar',
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:prosappco/main.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/bottom_sheet.dart';
|
||||||
|
import 'package:prosappco/src/components/column_padding.dart';
|
||||||
|
import 'package:prosappco/src/presentation/widgets/shared/primary_button.dart';
|
||||||
import 'package:prosappco/src/controllers/register_controller.dart';
|
import 'package:prosappco/src/controllers/register_controller.dart';
|
||||||
import 'package:prosappco/src/models/setting_model.dart';
|
import 'package:prosappco/src/models/setting_model.dart';
|
||||||
import 'package:prosappco/src/providers/user_provider.dart';
|
import 'package:prosappco/src/providers/user_provider.dart';
|
||||||
import 'package:prosappco/src/presentation/screens/login/login.dart';
|
|
||||||
import 'package:prosappco/src/presentation/screens/web_view.dart';
|
import 'package:prosappco/src/presentation/screens/web_view.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:responsive_builder/responsive_builder.dart';
|
import 'package:responsive_builder/responsive_builder.dart';
|
||||||
@@ -62,371 +61,316 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
Widget _mobileView(BuildContext context) {
|
Widget _mobileView(BuildContext context) {
|
||||||
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
|
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
|
||||||
|
|
||||||
return SafeArea(
|
return BottomSheetExpanded(
|
||||||
child: Scaffold(
|
horizontalPadding: 10,
|
||||||
backgroundColor: const Color(0xFFD6F4FF),
|
children: [
|
||||||
body: GestureDetector(
|
Row(
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
children: <Widget>[
|
||||||
child: SingleChildScrollView(
|
IconButton(
|
||||||
reverse: true,
|
icon: const Icon(
|
||||||
child: Stack(
|
Icons.arrow_back,
|
||||||
children: [
|
size: 30,
|
||||||
Container(
|
),
|
||||||
margin: const EdgeInsets.only(top: 130),
|
onPressed: () {
|
||||||
width: double.infinity,
|
Navigator.pop(context);
|
||||||
height: 700,
|
},
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
topRight: 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(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
|
||||||
margin: const EdgeInsets.only(
|
|
||||||
top: 125,
|
|
||||||
left: 25,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.arrow_back,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
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: [
|
|
||||||
!isIOS && !kIsWeb && settings?.google == true
|
|
||||||
? 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: const Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'Entrar con Google ',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 18,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 5),
|
|
||||||
FaIcon(FontAwesomeIcons.google),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
!isIOS && !kIsWeb && settings?.google == true
|
|
||||||
? const Padding(
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 0),
|
|
||||||
child: Row(
|
|
||||||
children: <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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: const SizedBox(),
|
|
||||||
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 ingresa un email';
|
|
||||||
}
|
|
||||||
final RegExp emailRegExp = RegExp(
|
|
||||||
r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
|
||||||
if (!emailRegExp.hasMatch(value)) {
|
|
||||||
return 'Por favor ingresa 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),
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
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 ingresa 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',
|
|
||||||
hintStyle: const TextStyle(
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
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: 20),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment
|
|
||||||
.center, // Centra horizontalmente
|
|
||||||
children: <Widget>[
|
|
||||||
Checkbox(
|
|
||||||
value: _isChecked,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
_isChecked = value!;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
if (kIsWeb) {
|
|
||||||
_launchURL(
|
|
||||||
settings?.terminosCondiciones ?? '');
|
|
||||||
} else {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
CupertinoPageRoute(
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return WebViewScreen(
|
|
||||||
label: 'Políticas de privacidad',
|
|
||||||
link: settings?.terminosCondiciones ??
|
|
||||||
'',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: const Text(
|
|
||||||
'Acepto los términos y condiciones.',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color(0xFF65676B),
|
|
||||||
decoration: TextDecoration.underline,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
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(),
|
|
||||||
)
|
|
||||||
.then((value) => Provider.of<UserProvider>(
|
|
||||||
context,
|
|
||||||
listen: false)
|
|
||||||
.initUserProvider());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
label: 'Registrarme',
|
|
||||||
isEnabled: _isChecked,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const Text(
|
||||||
|
'Registro',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
ColumnPadding(
|
||||||
|
alineacion: MainAxisAlignment.start,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 25, vertical: 20),
|
||||||
|
children: [
|
||||||
|
!isIOS && !kIsWeb && settings?.google == true
|
||||||
|
? 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: const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Entrar con Google ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
FaIcon(FontAwesomeIcons.google),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
!isIOS && !kIsWeb && settings?.google == true
|
||||||
|
? const Padding(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 0),
|
||||||
|
child: Row(
|
||||||
|
children: <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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox(),
|
||||||
|
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 ingresa un email';
|
||||||
|
}
|
||||||
|
final RegExp emailRegExp =
|
||||||
|
RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||||
|
if (!emailRegExp.hasMatch(value)) {
|
||||||
|
return 'Por favor ingresa 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),
|
||||||
|
hintStyle: TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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 ingresa 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',
|
||||||
|
hintStyle: const TextStyle(
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
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: 20),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center, // Centra horizontalmente
|
||||||
|
children: <Widget>[
|
||||||
|
Checkbox(
|
||||||
|
value: _isChecked,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_isChecked = value!;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
if (kIsWeb) {
|
||||||
|
_launchURL(settings?.terminosCondiciones ?? '');
|
||||||
|
} else {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return WebViewScreen(
|
||||||
|
label: 'Políticas de privacidad',
|
||||||
|
link: settings?.terminosCondiciones ?? '',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Acepto los términos y condiciones.',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF65676B),
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 25),
|
||||||
|
child: Center(
|
||||||
|
child: PrimaryButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (_formKey.currentState!.validate()) {
|
||||||
|
RegisterController.instance
|
||||||
|
.registerUser(
|
||||||
|
controller.email.text.trim(),
|
||||||
|
controller.password.text.trim(),
|
||||||
|
)
|
||||||
|
.then((value) =>
|
||||||
|
Provider.of<UserProvider>(context, listen: false)
|
||||||
|
.initUserProvider());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
text: 'Registrarme',
|
||||||
|
isEnabled: _isChecked,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,24 +628,23 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 25),
|
padding: const EdgeInsets.only(bottom: 25),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: PrimaryButtom(
|
child: PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
RegisterController.instance
|
RegisterController.instance
|
||||||
.registerUser(
|
.registerUser(
|
||||||
controller.email.text.trim(),
|
controller.email.text.trim(),
|
||||||
controller.password.text.trim(),
|
controller.password.text.trim(),
|
||||||
)
|
)
|
||||||
.then((value) =>
|
.then((value) =>
|
||||||
Provider.of<UserProvider>(context,
|
Provider.of<UserProvider>(context,
|
||||||
listen: false)
|
listen: false)
|
||||||
.initUserProvider());
|
.initUserProvider());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isEnabled: _isChecked,
|
text: 'Registrarme',
|
||||||
label: 'Registrarme',
|
isEnabled: _isChecked,
|
||||||
),
|
)),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
|
|||||||
@@ -5,33 +5,37 @@ class PrimaryButton extends StatelessWidget {
|
|||||||
final String text;
|
final String text;
|
||||||
final double? minWidth;
|
final double? minWidth;
|
||||||
final double? minHeight;
|
final double? minHeight;
|
||||||
|
final bool isEnabled;
|
||||||
|
|
||||||
const PrimaryButton(
|
const PrimaryButton({
|
||||||
{super.key,
|
super.key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
required this.text,
|
required this.text,
|
||||||
this.minWidth = 200,
|
this.minWidth = 200,
|
||||||
this.minHeight = 50});
|
this.minHeight = 50,
|
||||||
|
this.isEnabled = true,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
onPressed: onPressed,
|
onPressed: isEnabled ? onPressed : null,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: const Color(0xFF2BA4EC),
|
backgroundColor: isEnabled ? const Color(0xFF2BA4EC) : Colors.grey,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(50),
|
borderRadius: BorderRadius.circular(50),
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
minimumSize: Size(minWidth!, minHeight!),
|
|
||||||
),
|
),
|
||||||
child: Text(
|
elevation: 0,
|
||||||
text,
|
minimumSize: Size(minWidth!, minHeight!),
|
||||||
style: const TextStyle(
|
),
|
||||||
color: Colors.white,
|
child: Text(
|
||||||
fontWeight: FontWeight.bold,
|
text,
|
||||||
fontSize: 17,
|
style: TextStyle(
|
||||||
),
|
color: isEnabled ? Colors.white : Colors.black,
|
||||||
));
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.13.0"
|
version: "5.13.0"
|
||||||
|
animate_do:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: animate_do
|
||||||
|
sha256: "9aeacc1a7238f971c039bdf45d13c628be554a242e0251c4ddda09d19a1a923f"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.2"
|
||||||
animated_splash_screen:
|
animated_splash_screen:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ dependencies:
|
|||||||
universal_html: ^2.2.3
|
universal_html: ^2.2.3
|
||||||
firebase_messaging: ^14.6.3
|
firebase_messaging: ^14.6.3
|
||||||
animated_splash_screen: ^1.3.0
|
animated_splash_screen: ^1.3.0
|
||||||
|
animate_do: ^3.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user