bharat_erp/lib/modules/auth/presentation/screens/verify_otp_screen.dart
SurendarSuri30 8f852ac4f6 Initial commit: Bharat ERP Flutter application.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-19 15:04:06 +05:30

68 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import '../../../../core/constants/route_constants.dart';
import '../../../../core/utils/validators.dart';
import '../../../../shared/widgets/app_button.dart';
import '../../../../shared/widgets/app_text_field.dart';
class VerifyOtpScreen extends StatefulWidget {
const VerifyOtpScreen({super.key, required this.email});
final String email;
@override
State<VerifyOtpScreen> createState() => _VerifyOtpScreenState();
}
class _VerifyOtpScreenState extends State<VerifyOtpScreen> {
final _formKey = GlobalKey<FormState>();
final _otpController = TextEditingController();
@override
void dispose() {
_otpController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Verify OTP')),
body: Center(
child: SingleChildScrollView(
padding: const EdgeInsets.all(24),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 420),
child: Form(
key: _formKey,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Enter the OTP sent to ${widget.email}'),
const SizedBox(height: 24),
AppTextField(
controller: _otpController,
label: 'OTP',
keyboardType: TextInputType.number,
validator: (v) => Validators.minLength(v, 6, fieldName: 'OTP'),
),
const SizedBox(height: 24),
AppButton(
label: 'Verify',
onPressed: () {
if (_formKey.currentState!.validate()) {
context.go(RouteConstants.dashboard);
}
},
),
],
),
),
),
),
),
);
}
}