auth phone and re auth phone
This commit is contained in:
@@ -11,8 +11,9 @@ import 'package:prosappco/blocs/profile_bloc/profile_bloc.dart';
|
||||
import 'package:prosappco/components/birthday_picker.dart';
|
||||
import 'package:prosappco/components/gender_dropdown.dart';
|
||||
import 'package:prosappco/screens/profile/components/profile_item.dart';
|
||||
import 'package:prosappco/screens/profile/profile_email_screen.dart';
|
||||
import 'package:prosappco/screens/profile/profile_phone_screen.dart';
|
||||
import 'package:prosappco/screens/profile/profile_register_email_screen.dart';
|
||||
import 'package:prosappco/screens/profile/profile_register_phone_screen.dart';
|
||||
import 'package:prosappco/screens/profile/profile_update_password_screen.dart';
|
||||
|
||||
class ProfileScreen extends StatefulWidget {
|
||||
const ProfileScreen({super.key});
|
||||
@@ -149,42 +150,54 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 20),
|
||||
ProfileItem(
|
||||
title: 'Iniciar sesión con correo',
|
||||
title: 'Configurar inicio de sesión con correo',
|
||||
subtitle: _emailController.text,
|
||||
leading: Icons.email_rounded,
|
||||
onTap: () {
|
||||
if (state.user!.name == null ||
|
||||
state.user!.name == '') {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(
|
||||
content: Text('Por favor, ingrese su nombre'),
|
||||
));
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Por favor, ingrese su nombre')));
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
const ProfileEmailScreen(),
|
||||
),
|
||||
builder: (context) =>
|
||||
_emailController.text.isEmpty
|
||||
? ProfileRegisterEmailScreen()
|
||||
: ProfileUpdatePasswordScreen(
|
||||
email: _emailController.text)),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
ProfileItem(
|
||||
title: 'Iniciar sesión con teléfono',
|
||||
title: 'Configurar inicio de sesión con celular',
|
||||
subtitle: _phoneController.text,
|
||||
leading: Icons.phone_iphone_rounded,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
const ProfilePhoneScreen(),
|
||||
),
|
||||
);
|
||||
if (state.user!.name == null ||
|
||||
state.user!.name == '') {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Por favor, ingrese su nombre')));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_phoneController.text.isEmpty) {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
const ProfileRegisterPhoneScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 60.0),
|
||||
@@ -210,42 +223,30 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (enableLoginWithEmail) {
|
||||
// if (_newEmailController.text.isEmpty) {
|
||||
// return;
|
||||
// }
|
||||
if (_nameController.text.isEmpty) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
|
||||
// if (_passwordController.text.isEmpty) {
|
||||
// return;
|
||||
// }
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Por favor, ingrese su nombre')),
|
||||
);
|
||||
|
||||
// context.read<AuthBloc>().add(
|
||||
// AuthEventAddEmailAndPassword(
|
||||
// email: _newEmailController.text,
|
||||
// password: _passwordController.text,
|
||||
// ),
|
||||
// );
|
||||
|
||||
// _emailController.text = _newEmailController.text;
|
||||
// }
|
||||
return;
|
||||
}
|
||||
|
||||
final myUser = state.user!.copyWith(
|
||||
name: _nameController.text,
|
||||
nickname: _nameController.text.trim().toLowerCase(),
|
||||
email: _emailController.text,
|
||||
phone: _phoneController.text,
|
||||
birthday: _birthdayController.text,
|
||||
gender: _genderController.text,
|
||||
nickname: _nameController.text.trim().toLowerCase(),
|
||||
);
|
||||
|
||||
context.read<ProfileBloc>().add(
|
||||
UpdateUserInfo(
|
||||
myUser: myUser,
|
||||
filePicture: _imageFile?.path,
|
||||
),
|
||||
);
|
||||
context
|
||||
.read<ProfileBloc>()
|
||||
.add(UpdateUserInfo(myUser: myUser, filePicture: _imageFile?.path));
|
||||
|
||||
// Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue,
|
||||
|
||||
Reference in New Issue
Block a user