Files
kmobile/lib/features/profile/tpin/change_tpin_otp_screen.dart
2025-11-08 12:25:56 +05:30

53 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:kmobile/widgets/pin_input_field.dart'; // Use the new widget
class ChangeTpinOtpScreen extends StatefulWidget {
final String newTpin;
const ChangeTpinOtpScreen({super.key, required this.newTpin});
@override
State<ChangeTpinOtpScreen> createState() => _ChangeTpinOtpScreenState();
}
class _ChangeTpinOtpScreenState extends State<ChangeTpinOtpScreen> {
final _otpController = TextEditingController();
void _handleVerifyOtp() {
// TODO: Add API call to verify OTP and change TPIN
print('Verifying OTP: ${_otpController.text} for new TPIN: ${widget.newTpin}');
Navigator.of(context).popUntil((route) => route.isFirst);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Verify OTP'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 24),
const Text(
'Enter the OTP sent to your registered mobile number.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 32),
PinInputField(
controller: _otpController,
),
const SizedBox(height: 32),
ElevatedButton(
onPressed: _handleVerifyOtp,
child: const Text('Verify & Change TPIN'),
),
],
),
),
);
}
}