comp
This commit is contained in:
@@ -24,6 +24,7 @@ class _SignInScreenState extends State<SignInScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
return BlocListener<SignInBloc, SignInState>(
|
||||
listener: (context, state) {
|
||||
if (state is SignInSuccess) {
|
||||
@@ -41,103 +42,133 @@ class _SignInScreenState extends State<SignInScreen> {
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: emailController,
|
||||
hintText: 'Email',
|
||||
obscureText: false,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
prefixIcon: Icon(
|
||||
CupertinoIcons.mail_solid,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: const Icon(
|
||||
CupertinoIcons.arrow_left,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Iniciar sesión',
|
||||
style: TextStyle(
|
||||
// fontSize: 30,
|
||||
fontSize: width * 0.08,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: emailController,
|
||||
hintText: 'Email',
|
||||
obscureText: false,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
prefixIcon: Icon(
|
||||
CupertinoIcons.mail_solid,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
errorMsg: _errorMsg,
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (!emailRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid email';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: passwordController,
|
||||
hintText: 'Password',
|
||||
obscureText: obscurePassword,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
prefixIcon:
|
||||
Icon(CupertinoIcons.lock_fill, color: Colors.grey[600]),
|
||||
errorMsg: _errorMsg,
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (!emailRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid email';
|
||||
} else if (!passwordRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid password';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: passwordController,
|
||||
hintText: 'Password',
|
||||
obscureText: obscurePassword,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
prefixIcon:
|
||||
Icon(CupertinoIcons.lock_fill, color: Colors.grey[600]),
|
||||
errorMsg: _errorMsg,
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (!passwordRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid password';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
obscurePassword = !obscurePassword;
|
||||
if (obscurePassword) {
|
||||
iconPassword = CupertinoIcons.eye_fill;
|
||||
} else {
|
||||
iconPassword = CupertinoIcons.eye_slash_fill;
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: Icon(iconPassword, color: Colors.grey[600]),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
obscurePassword = !obscurePassword;
|
||||
if (obscurePassword) {
|
||||
iconPassword = CupertinoIcons.eye_fill;
|
||||
} else {
|
||||
iconPassword = CupertinoIcons.eye_slash_fill;
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: Icon(iconPassword, color: Colors.grey[600]),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
!signInRequired
|
||||
? SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: 50,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
context.read<SignInBloc>().add(SignInRequired(
|
||||
emailController.text, passwordController.text));
|
||||
}
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
elevation: 3.0,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(60))),
|
||||
child: const Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 25, vertical: 5),
|
||||
child: Text(
|
||||
'Iniciar Sesión',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
const SizedBox(height: 20),
|
||||
!signInRequired
|
||||
? SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: 50,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
context.read<SignInBloc>().add(SignInRequired(
|
||||
emailController.text,
|
||||
passwordController.text));
|
||||
}
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
elevation: 3.0,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(60))),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 25, vertical: 5),
|
||||
child: Text(
|
||||
'Iniciar Sesión',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const CircularProgressIndicator()
|
||||
],
|
||||
)),
|
||||
)
|
||||
: const CircularProgressIndicator()
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,89 +32,116 @@ class _SignScreenState extends State<SignScreen> with TickerProviderStateMixin {
|
||||
Widget build(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
return BlocListener<AuthenticationBloc, AuthenticationState>(
|
||||
listener: (context, state) {
|
||||
if (state.status == AuthenticationStatus.authenticated) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
listener: (context, state) {
|
||||
if (state.status == AuthenticationStatus.authenticated) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.tertiary,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
// Text('${context.read<SignInBloc>().state}'),
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
color: Theme.of(context).colorScheme.tertiary,
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Center(
|
||||
child: Image(
|
||||
width: width * 0.7,
|
||||
image: const AssetImage('images/logo_prosapp.png'),
|
||||
),
|
||||
),
|
||||
),
|
||||
// TabBar(
|
||||
// controller: tabController,
|
||||
// unselectedLabelColor:
|
||||
// Theme.of(context).colorScheme.onBackground,
|
||||
// labelColor: Theme.of(context).colorScheme.onBackground,
|
||||
// tabs: const [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.all(12.0),
|
||||
// child: Text(
|
||||
// 'Inicia sesión',
|
||||
// style: TextStyle(
|
||||
// fontSize: 18,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: EdgeInsets.all(12.0),
|
||||
// child: Text(
|
||||
// 'Registrate',
|
||||
// style: TextStyle(
|
||||
// fontSize: 18,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBarView(controller: tabController, children: [
|
||||
BlocProvider<SignInBloc>(
|
||||
create: (context) =>
|
||||
Injector.appInstance.get<SignInBloc>(),
|
||||
child: SignInScreen(),
|
||||
),
|
||||
BlocProvider<SignUpBloc>(
|
||||
create: (context) =>
|
||||
Injector.appInstance.get<SignUpBloc>(),
|
||||
child: SignUpScreen(),
|
||||
),
|
||||
]),
|
||||
)
|
||||
],
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||
child: Center(
|
||||
child: Image(
|
||||
width: width * 0.7,
|
||||
image: const AssetImage('images/logo_prosapp.png'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(60),
|
||||
topRight: Radius.circular(60),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 30, vertical: 15),
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height - 200,
|
||||
child: TabBarView(
|
||||
controller: tabController,
|
||||
children: [
|
||||
BlocProvider<SignInBloc>(
|
||||
create: (context) =>
|
||||
Injector.appInstance.get<SignInBloc>(),
|
||||
child: SignInScreen(),
|
||||
),
|
||||
BlocProvider<SignUpBloc>(
|
||||
create: (context) =>
|
||||
Injector.appInstance.get<SignUpBloc>(),
|
||||
child: SignUpScreen(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
// Scaffold(
|
||||
// // appBar: AppBar(
|
||||
// // backgroundColor: Theme.of(context).colorScheme.tertiary,
|
||||
// // ),
|
||||
// body: Column(
|
||||
// children: [
|
||||
// // Text('${context.read<SignInBloc>().state}'),
|
||||
// Container(
|
||||
// color: Theme.of(context).colorScheme.tertiary,
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Container(
|
||||
// color: Theme.of(context).colorScheme.tertiary,
|
||||
// padding: const EdgeInsets.only(bottom: 20.0),
|
||||
// child: Center(
|
||||
// child: Image(
|
||||
// width: width * 0.7,
|
||||
// image: const AssetImage('images/logo_prosapp.png'),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: SingleChildScrollView(
|
||||
// child: SizedBox(
|
||||
// height: MediaQuery.of(context).size.height,
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: TabBarView(controller: tabController, children: [
|
||||
// BlocProvider<SignInBloc>(
|
||||
// create: (context) =>
|
||||
// Injector.appInstance.get<SignInBloc>(),
|
||||
// child: SignInScreen(),
|
||||
// ),
|
||||
// BlocProvider<SignUpBloc>(
|
||||
// create: (context) =>
|
||||
// Injector.appInstance.get<SignUpBloc>(),
|
||||
// child: SignUpScreen(),
|
||||
// ),
|
||||
// ]),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:prosappco/components/general_primary_button.dart';
|
||||
import 'package:user_repository/user_repository.dart';
|
||||
|
||||
import '../../blocs/sign_up_bloc/sign_up_bloc.dart';
|
||||
@@ -31,6 +32,8 @@ class _SignUpScreenState extends State<SignUpScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
|
||||
return BlocListener<SignUpBloc, SignUpState>(
|
||||
listener: (context, state) {
|
||||
if (state is SignUpSuccess) {
|
||||
@@ -45,178 +48,212 @@ class _SignUpScreenState extends State<SignUpScreen> {
|
||||
return;
|
||||
}
|
||||
},
|
||||
child: Scaffold(
|
||||
body: Form(
|
||||
key: _formKey,
|
||||
child: Center(
|
||||
child: Column(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: emailController,
|
||||
hintText: 'Email',
|
||||
obscureText: false,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
prefixIcon: const Icon(CupertinoIcons.mail_solid),
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (!emailRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid email';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: const Icon(
|
||||
CupertinoIcons.arrow_left,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: passwordController,
|
||||
hintText: 'Password',
|
||||
obscureText: obscurePassword,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
prefixIcon: const Icon(CupertinoIcons.lock_fill),
|
||||
onChanged: (val) {
|
||||
if (val!.contains(RegExp(r'[A-Z]'))) {
|
||||
setState(() {
|
||||
containsUpperCase = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsUpperCase = false;
|
||||
});
|
||||
}
|
||||
if (val.contains(RegExp(r'[a-z]'))) {
|
||||
setState(() {
|
||||
containsLowerCase = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsLowerCase = false;
|
||||
});
|
||||
}
|
||||
if (val.contains(RegExp(r'[0-9]'))) {
|
||||
setState(() {
|
||||
containsNumber = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsNumber = false;
|
||||
});
|
||||
}
|
||||
if (val.contains(specialCharRexExp)) {
|
||||
setState(() {
|
||||
containsSpecialChar = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsSpecialChar = false;
|
||||
});
|
||||
}
|
||||
if (val.length >= 8) {
|
||||
setState(() {
|
||||
contains8Length = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
contains8Length = false;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
},
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
obscurePassword = !obscurePassword;
|
||||
if (obscurePassword) {
|
||||
iconPassword = CupertinoIcons.eye_fill;
|
||||
} else {
|
||||
iconPassword = CupertinoIcons.eye_slash_fill;
|
||||
}
|
||||
});
|
||||
Text(
|
||||
'Registrate',
|
||||
style: TextStyle(
|
||||
// fontSize: 30,
|
||||
fontSize: width * 0.08,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Form(
|
||||
key: _formKey,
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: emailController,
|
||||
hintText: 'Email',
|
||||
obscureText: false,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
prefixIcon: const Icon(CupertinoIcons.mail_solid),
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (!emailRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid email';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
controller: passwordController,
|
||||
hintText: 'Password',
|
||||
obscureText: obscurePassword,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
prefixIcon: const Icon(CupertinoIcons.lock_fill),
|
||||
onChanged: (val) {
|
||||
if (val!.contains(RegExp(r'[A-Z]'))) {
|
||||
setState(() {
|
||||
containsUpperCase = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsUpperCase = false;
|
||||
});
|
||||
}
|
||||
if (val.contains(RegExp(r'[a-z]'))) {
|
||||
setState(() {
|
||||
containsLowerCase = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsLowerCase = false;
|
||||
});
|
||||
}
|
||||
if (val.contains(RegExp(r'[0-9]'))) {
|
||||
setState(() {
|
||||
containsNumber = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsNumber = false;
|
||||
});
|
||||
}
|
||||
if (val.contains(specialCharRexExp)) {
|
||||
setState(() {
|
||||
containsSpecialChar = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
containsSpecialChar = false;
|
||||
});
|
||||
}
|
||||
if (val.length >= 8) {
|
||||
setState(() {
|
||||
contains8Length = true;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
contains8Length = false;
|
||||
});
|
||||
}
|
||||
return null;
|
||||
},
|
||||
icon: Icon(iconPassword),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
obscurePassword = !obscurePassword;
|
||||
if (obscurePassword) {
|
||||
iconPassword = CupertinoIcons.eye_fill;
|
||||
} else {
|
||||
iconPassword = CupertinoIcons.eye_slash_fill;
|
||||
}
|
||||
});
|
||||
},
|
||||
icon: Icon(iconPassword),
|
||||
),
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (!passwordRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid password';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"⚈ 1 uppercase",
|
||||
style: TextStyle(
|
||||
color: containsUpperCase
|
||||
? Colors.green
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onBackground),
|
||||
),
|
||||
Text(
|
||||
"⚈ 1 lowercase",
|
||||
style: TextStyle(
|
||||
color: containsLowerCase
|
||||
? Colors.green
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onBackground),
|
||||
),
|
||||
],
|
||||
),
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (!passwordRexExp.hasMatch(val)) {
|
||||
return 'Please enter a valid password';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"⚈ 1 uppercase",
|
||||
style: TextStyle(
|
||||
color: containsUpperCase
|
||||
? Colors.green
|
||||
: Theme.of(context).colorScheme.onBackground),
|
||||
),
|
||||
Text(
|
||||
"⚈ 1 lowercase",
|
||||
style: TextStyle(
|
||||
color: containsLowerCase
|
||||
? Colors.green
|
||||
: Theme.of(context).colorScheme.onBackground),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"⚈ 8 minimum character",
|
||||
style: TextStyle(
|
||||
color: contains8Length
|
||||
? Colors.green
|
||||
: Theme.of(context).colorScheme.onBackground),
|
||||
),
|
||||
Text(
|
||||
"⚈ 1 number",
|
||||
style: TextStyle(
|
||||
color: containsNumber
|
||||
? Colors.green
|
||||
: Theme.of(context).colorScheme.onBackground),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
labelText: 'Nombre',
|
||||
controller: nameController,
|
||||
hintText: 'Ingresa tu nombre',
|
||||
obscureText: false,
|
||||
keyboardType: TextInputType.name,
|
||||
prefixIcon: const Icon(CupertinoIcons.person_fill),
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (val.length > 30) {
|
||||
return 'Name too long';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
!signUpRequired
|
||||
? SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.5,
|
||||
child: TextButton(
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"⚈ 8 minimum character",
|
||||
style: TextStyle(
|
||||
color: contains8Length
|
||||
? Colors.green
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onBackground),
|
||||
),
|
||||
Text(
|
||||
"⚈ 1 number",
|
||||
style: TextStyle(
|
||||
color: containsNumber
|
||||
? Colors.green
|
||||
: Theme.of(context)
|
||||
.colorScheme
|
||||
.onBackground),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
child: MyTextField(
|
||||
labelText: 'Nombre',
|
||||
controller: nameController,
|
||||
hintText: 'Ingresa tu nombre',
|
||||
obscureText: false,
|
||||
keyboardType: TextInputType.name,
|
||||
prefixIcon: const Icon(CupertinoIcons.person_fill),
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Please fill in this field';
|
||||
} else if (val.length > 30) {
|
||||
return 'Name too long';
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
|
||||
!signUpRequired
|
||||
? SizedBox(
|
||||
width: MediaQuery.of(context).size.width * 0.5,
|
||||
child: GeneralPrimaryButton(
|
||||
label: 'Registrarme',
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
MyUser myUser = MyUser.empty;
|
||||
@@ -231,31 +268,14 @@ class _SignUpScreenState extends State<SignUpScreen> {
|
||||
});
|
||||
}
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
elevation: 3.0,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(60))),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 25, vertical: 5),
|
||||
child: Text(
|
||||
'Sign Up',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
)),
|
||||
)
|
||||
: const CircularProgressIndicator(),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const CircularProgressIndicator(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl_phone_field/intl_phone_field.dart';
|
||||
import 'package:prosappco/components/general_input_decoration.dart';
|
||||
import 'package:prosappco/components/general_primary_button.dart';
|
||||
import 'package:prosappco/screens/authentication/otp_auth_screen.dart';
|
||||
import 'package:prosappco/screens/authentication/sign_screen.dart';
|
||||
|
||||
@@ -100,7 +101,7 @@ class WelcomeScreen extends StatelessWidget {
|
||||
color: Theme.of(context).colorScheme.onBackground,
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
GeneralPrimaryButton(
|
||||
onPressed: () {
|
||||
final phoneNumber = _phoneNumber;
|
||||
|
||||
@@ -112,10 +113,26 @@ class WelcomeScreen extends StatelessWidget {
|
||||
OtpAuthScreen(phoneNumber: phoneNumber),
|
||||
),
|
||||
);
|
||||
} else {}
|
||||
}
|
||||
},
|
||||
child: const Text('Enviar código'),
|
||||
label: 'Enviar código',
|
||||
),
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
// final phoneNumber = _phoneNumber;
|
||||
|
||||
// if (phoneNumber != null && phoneNumber.isNotEmpty) {
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// CupertinoPageRoute(
|
||||
// builder: (context) =>
|
||||
// OtpAuthScreen(phoneNumber: phoneNumber),
|
||||
// ),
|
||||
// );
|
||||
// } else {}
|
||||
// },
|
||||
// child: const Text('Enviar código'),
|
||||
// ),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
|
||||
Reference in New Issue
Block a user