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 createState() => _VerifyOtpScreenState(); } class _VerifyOtpScreenState extends State { final _formKey = GlobalKey(); 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); } }, ), ], ), ), ), ), ), ); } }