Files
sf-app-platform/lib/payments/view/screens/phone_code_screen.dart
2025-11-03 09:23:17 +01:00

55 lines
1.9 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:sf_app_platform/payments/view/screens/dashboard_screen.dart';
class PhoneCodeScreen extends StatefulWidget {
final String phone;
const PhoneCodeScreen({super.key, required this.phone});
@override
State<PhoneCodeScreen> createState() => PhoneCodeScreenState();
}
class PhoneCodeScreenState extends State<PhoneCodeScreen> {
final focusNodes = List<FocusNode>.generate(6, (int i){
return FocusNode();
});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Expanded(child: Center(
child: Column(
spacing: 15,
children: [
Text("Conéctate", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30)),
Text.rich(TextSpan(text: "Hemos enviado el código al ",
children: [TextSpan(
text: widget.phone, style: TextStyle(fontWeight: FontWeight.bold))]
)),
Text("Introduce el código aquí"),
Row(
children: List<Widget>.generate(6, (int i){
return Expanded(child: TextField(
focusNode: focusNodes[i],
keyboardType: TextInputType.number,
decoration: InputDecoration(hintText: "0"),
maxLength: 1,
onChanged: (String value)=>{value!="" ? focusNodes[i+1].requestFocus() : focusNodes[i-1].requestFocus()},
));
}),
),
FilledButton(onPressed: ()=>{Navigator.pushReplacement(context, MaterialPageRoute(builder: (_)=>DashboardScreen()))}, child: Text("Entrar")),
Text("¿No lo has recibido?"),
TextButton(onPressed: ()=>{},
child: Text("Volver a intentarlo", style: TextStyle(fontWeight: FontWeight.bold))
)
]
),
)),
);
}
}