auth phone and re auth phone
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_otp_text_field/flutter_otp_text_field.dart';
|
||||
@@ -16,6 +17,7 @@ class OtpAuthScreen extends StatefulWidget {
|
||||
|
||||
class _OtpAuthScreenState extends State<OtpAuthScreen> {
|
||||
late final AuthBloc authBloc;
|
||||
late String verificationCode = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -47,7 +49,7 @@ class _OtpAuthScreenState extends State<OtpAuthScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.1),
|
||||
const Text('Te enviaremos un Código de verificación a'),
|
||||
const Text('Te enviaremos un código de verificación a'),
|
||||
Text(
|
||||
widget.phoneNumber,
|
||||
style: const TextStyle(
|
||||
@@ -60,14 +62,18 @@ class _OtpAuthScreenState extends State<OtpAuthScreen> {
|
||||
numberOfFields: 6,
|
||||
borderColor: const Color(0xFF512DA8),
|
||||
showFieldAsBox: true,
|
||||
onCodeChanged: (String code) {},
|
||||
onCodeChanged: (String code) {
|
||||
verificationCode = code;
|
||||
},
|
||||
onSubmit: (String verificationCode) {
|
||||
authBloc.add(AuthEventVerifyOAuth(code: verificationCode));
|
||||
},
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
GeneralPrimaryButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
authBloc.add(AuthEventVerifyOAuth(code: verificationCode));
|
||||
},
|
||||
label: 'Continuar',
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
@@ -85,32 +85,25 @@ class WelcomeScreen extends StatelessWidget {
|
||||
onChanged: (phone) {
|
||||
_phoneNumber = phone.completeNumber;
|
||||
},
|
||||
decoration:
|
||||
GeneralInputDecoration.getCustomDecoration(
|
||||
decoration: GeneralInputDecoration.getCustomDecoration(
|
||||
context: context,
|
||||
hintText: 'Ingresa tu numero',
|
||||
errorMsg: _errorMsg,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Un código será enviado a este numero de celular.',
|
||||
Text('Un código será enviado a este numero de celular.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13.0,
|
||||
color: Theme.of(context).colorScheme.onBackground,
|
||||
),
|
||||
style: TextStyle(fontSize: 13.0,color: Theme.of(context).colorScheme.onBackground),
|
||||
),
|
||||
GeneralPrimaryButton(
|
||||
onPressed: () {
|
||||
final phoneNumber = _phoneNumber;
|
||||
|
||||
if (phoneNumber != null && phoneNumber.isNotEmpty) {
|
||||
Navigator.push(
|
||||
context,
|
||||
Navigator.push(context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
OtpAuthScreen(phoneNumber: phoneNumber),
|
||||
builder: (context) => OtpAuthScreen(phoneNumber: phoneNumber),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user