Mobile Number Implemented in OTP
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:kmobile/features/auth/controllers/auth_cubit.dart';
|
||||
import 'package:kmobile/features/auth/controllers/auth_state.dart';
|
||||
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:kmobile/features/fund_transfer/screens/tpin_otp_screen.dart';
|
||||
@@ -12,7 +16,7 @@ class TpinSetupPromptScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _TpinSetupPromptScreenState extends State<TpinSetupPromptScreen> {
|
||||
// 3. Add state variables
|
||||
int selectedAccountIndex = 0;
|
||||
bool _isLoading = false;
|
||||
final ChangePasswordService _changePasswordService = getIt<ChangePasswordService>();
|
||||
Future<void> _getOtp() async {
|
||||
@@ -21,11 +25,18 @@ class TpinSetupPromptScreen extends StatefulWidget {
|
||||
});
|
||||
|
||||
try {
|
||||
await _changePasswordService.getOtp(mobileNumber: '8981274001');
|
||||
final authState = context.read<AuthCubit>().state;
|
||||
String mobileNumberToPass = '';
|
||||
if (authState is Authenticated) {
|
||||
if (selectedAccountIndex >= 0 && selectedAccountIndex < authState.users.length) {
|
||||
mobileNumberToPass = authState.users[selectedAccountIndex].mobileNo ?? '';
|
||||
}
|
||||
}
|
||||
await _changePasswordService.getOtp(mobileNumber: mobileNumberToPass);
|
||||
if (mounted) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const TpinOtpScreen()),
|
||||
MaterialPageRoute(builder: (_) => TpinOtpScreen(mobileNumber: mobileNumberToPass,)),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user